Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
import org.apache.hadoop.hbase.shaded.protobuf.generated.FSProtos;
import org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos;

@InterfaceAudience.Private
@InterfaceAudience.LimitedPrivate(HBaseInterfaceAudience.COPROC)
public final class ClusterMetricsBuilder {

public static ClusterStatusProtos.ClusterStatus toClusterStatus(ClusterMetrics metrics) {
Expand Down Expand Up @@ -105,7 +105,7 @@ public static ClusterMetrics toClusterMetrics(ClusterStatusProtos.ClusterStatus
.collect(Collectors.toList()))
.setUnknownServerNames(proto.getUnknownServersList().stream().map(ProtobufUtil::toServerName)
.collect(Collectors.toList()))
.setBackerMasterNames(proto.getBackupMastersList().stream().map(ProtobufUtil::toServerName)
.setBackupMasterNames(proto.getBackupMastersList().stream().map(ProtobufUtil::toServerName)
.collect(Collectors.toList()))
.setRegionsInTransition(proto.getRegionsInTransitionList().stream()
.map(ClusterStatusProtos.RegionInTransition::getRegionState).map(RegionState::convert)
Expand Down Expand Up @@ -256,7 +256,7 @@ public static ClusterMetricsBuilder newBuilder() {
private String hbaseVersion;
private List<ServerName> deadServerNames = Collections.emptyList();
private List<ServerName> unknownServerNames = Collections.emptyList();
private Map<ServerName, ServerMetrics> liveServerMetrics = new TreeMap<>();
private Map<ServerName, ServerMetrics> liveServerMetrics = Collections.emptyMap();
@Nullable
private ServerName masterName;
private List<ServerName> backupMasterNames = Collections.emptyList();
Expand Down Expand Up @@ -292,7 +292,7 @@ public ClusterMetricsBuilder setUnknownServerNames(List<ServerName> value) {
}

public ClusterMetricsBuilder setLiveServerMetrics(Map<ServerName, ServerMetrics> value) {
liveServerMetrics.putAll(value);
this.liveServerMetrics = new TreeMap<>(value);
return this;
}

Expand All @@ -301,7 +301,7 @@ public ClusterMetricsBuilder setMasterName(ServerName value) {
return this;
}

public ClusterMetricsBuilder setBackerMasterNames(List<ServerName> value) {
public ClusterMetricsBuilder setBackupMasterNames(List<ServerName> value) {
this.backupMasterNames = value;
return this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import org.apache.hadoop.hbase.client.ConnectionUtils;
import org.apache.hadoop.hbase.conf.ConfigurationObserver;
import org.apache.hadoop.hbase.coprocessor.ClientMetaCoprocessorHost;
import org.apache.hadoop.hbase.coprocessor.CoprocessorHost;
import org.apache.hadoop.hbase.io.ByteBuffAllocator;
import org.apache.hadoop.hbase.ipc.HBaseRPCErrorHandler;
import org.apache.hadoop.hbase.ipc.PriorityFunction;
Expand All @@ -53,6 +54,7 @@
import org.apache.hadoop.hbase.security.access.NoopAccessChecker;
import org.apache.hadoop.hbase.security.access.Permission;
import org.apache.hadoop.hbase.security.access.ZKPermissionWatcher;
import org.apache.hadoop.hbase.util.CoprocessorConfigurationUtil;
import org.apache.hadoop.hbase.util.DNS;
import org.apache.hadoop.hbase.util.OOMEChecker;
import org.apache.hadoop.hbase.util.ReservoirSample;
Expand Down Expand Up @@ -389,7 +391,13 @@ public UpdateConfigurationResponse updateConfiguration(RpcController controller,
requirePermission("updateConfiguration", Permission.Action.ADMIN);
this.server.updateConfiguration();

clientMetaCoprocessorHost = new ClientMetaCoprocessorHost(getConfiguration());
if (
CoprocessorConfigurationUtil.checkConfigurationChange(clientMetaCoprocessorHost,
getConfiguration(), CoprocessorHost.CLIENT_META_COPROCESSOR_CONF_KEY)
) {
LOG.info("Updating client meta coprocessors, because the configuration has changed.");
clientMetaCoprocessorHost = new ClientMetaCoprocessorHost(getConfiguration());
}
} catch (Exception e) {
throw new ServiceException(e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import java.util.Set;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.ClusterMetrics;
import org.apache.hadoop.hbase.ClusterMetricsBuilder;
import org.apache.hadoop.hbase.HBaseInterfaceAudience;
import org.apache.hadoop.hbase.MetaMutationAnnotation;
import org.apache.hadoop.hbase.NamespaceDescriptor;
Expand Down Expand Up @@ -1672,7 +1673,15 @@ default void preGetClusterMetrics(ObserverContext<MasterCoprocessorEnvironment>
* Called after get cluster status.
*/
default void postGetClusterMetrics(ObserverContext<MasterCoprocessorEnvironment> ctx,
ClusterMetrics status) throws IOException {
ClusterMetrics metrics) throws IOException {
}

/**
* Called after get cluster status.
*/
default void postGetClusterMetrics(ObserverContext<MasterCoprocessorEnvironment> ctx,
ClusterMetricsBuilder metricsBuilder) throws IOException {
postGetClusterMetrics(ctx, metricsBuilder.build());
}

/**
Expand Down
Loading
Loading