HBASE-15068 Add metrics for region normalization plans
This commit is contained in:
parent
53983f5b2e
commit
e7d935cbed
|
@ -57,6 +57,8 @@ public interface MetricsMasterSource extends BaseSource {
|
||||||
String SERVER_NAME_NAME = "serverName";
|
String SERVER_NAME_NAME = "serverName";
|
||||||
String CLUSTER_ID_NAME = "clusterId";
|
String CLUSTER_ID_NAME = "clusterId";
|
||||||
String IS_ACTIVE_MASTER_NAME = "isActiveMaster";
|
String IS_ACTIVE_MASTER_NAME = "isActiveMaster";
|
||||||
|
String SPLIT_PLAN_COUNT_NAME = "splitPlanCount";
|
||||||
|
String MERGE_PLAN_COUNT_NAME = "mergePlanCount";
|
||||||
|
|
||||||
String CLUSTER_REQUESTS_NAME = "clusterRequests";
|
String CLUSTER_REQUESTS_NAME = "clusterRequests";
|
||||||
String MASTER_ACTIVE_TIME_DESC = "Master Active Time";
|
String MASTER_ACTIVE_TIME_DESC = "Master Active Time";
|
||||||
|
@ -70,7 +72,8 @@ public interface MetricsMasterSource extends BaseSource {
|
||||||
String SERVER_NAME_DESC = "Server Name";
|
String SERVER_NAME_DESC = "Server Name";
|
||||||
String CLUSTER_ID_DESC = "Cluster Id";
|
String CLUSTER_ID_DESC = "Cluster Id";
|
||||||
String IS_ACTIVE_MASTER_DESC = "Is Active Master";
|
String IS_ACTIVE_MASTER_DESC = "Is Active Master";
|
||||||
|
String SPLIT_PLAN_COUNT_DESC = "Number of Region Split Plans executed";
|
||||||
|
String MERGE_PLAN_COUNT_DESC = "Number of Region Merge Plans executed";
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -112,4 +112,13 @@ public interface MetricsMasterWrapper {
|
||||||
*/
|
*/
|
||||||
long getNumWALFiles();
|
long getNumWALFiles();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the number of region split plans executed.
|
||||||
|
*/
|
||||||
|
long getSplitPlanCount();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the number of region merge plans executed.
|
||||||
|
*/
|
||||||
|
long getMergePlanCount();
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,6 +74,10 @@ public class MetricsMasterSourceImpl
|
||||||
// masterWrapper can be null because this function is called inside of init.
|
// masterWrapper can be null because this function is called inside of init.
|
||||||
if (masterWrapper != null) {
|
if (masterWrapper != null) {
|
||||||
metricsRecordBuilder
|
metricsRecordBuilder
|
||||||
|
.addGauge(Interns.info(MERGE_PLAN_COUNT_NAME, MERGE_PLAN_COUNT_DESC),
|
||||||
|
masterWrapper.getMergePlanCount())
|
||||||
|
.addGauge(Interns.info(SPLIT_PLAN_COUNT_NAME, SPLIT_PLAN_COUNT_DESC),
|
||||||
|
masterWrapper.getSplitPlanCount())
|
||||||
.addGauge(Interns.info(MASTER_ACTIVE_TIME_NAME,
|
.addGauge(Interns.info(MASTER_ACTIVE_TIME_NAME,
|
||||||
MASTER_ACTIVE_TIME_DESC), masterWrapper.getActiveTime())
|
MASTER_ACTIVE_TIME_DESC), masterWrapper.getActiveTime())
|
||||||
.addGauge(Interns.info(MASTER_START_TIME_NAME,
|
.addGauge(Interns.info(MASTER_START_TIME_NAME,
|
||||||
|
|
|
@ -116,6 +116,7 @@ import org.apache.hadoop.hbase.master.snapshot.SnapshotManager;
|
||||||
import org.apache.hadoop.hbase.monitoring.MemoryBoundedLogMessageBuffer;
|
import org.apache.hadoop.hbase.monitoring.MemoryBoundedLogMessageBuffer;
|
||||||
import org.apache.hadoop.hbase.monitoring.MonitoredTask;
|
import org.apache.hadoop.hbase.monitoring.MonitoredTask;
|
||||||
import org.apache.hadoop.hbase.monitoring.TaskMonitor;
|
import org.apache.hadoop.hbase.monitoring.TaskMonitor;
|
||||||
|
import org.apache.hadoop.hbase.normalizer.NormalizationPlan;
|
||||||
import org.apache.hadoop.hbase.normalizer.NormalizationPlan.PlanType;
|
import org.apache.hadoop.hbase.normalizer.NormalizationPlan.PlanType;
|
||||||
import org.apache.hadoop.hbase.procedure.MasterProcedureManagerHost;
|
import org.apache.hadoop.hbase.procedure.MasterProcedureManagerHost;
|
||||||
import org.apache.hadoop.hbase.procedure.flush.MasterFlushTableProcedureManager;
|
import org.apache.hadoop.hbase.procedure.flush.MasterFlushTableProcedureManager;
|
||||||
|
@ -325,6 +326,9 @@ public class HMaster extends HRegionServer implements MasterServices, Server {
|
||||||
private ProcedureExecutor<MasterProcedureEnv> procedureExecutor;
|
private ProcedureExecutor<MasterProcedureEnv> procedureExecutor;
|
||||||
private WALProcedureStore procedureStore;
|
private WALProcedureStore procedureStore;
|
||||||
|
|
||||||
|
private long splitPlanCount;
|
||||||
|
private long mergePlanCount;
|
||||||
|
|
||||||
/** flag used in test cases in order to simulate RS failures during master initialization */
|
/** flag used in test cases in order to simulate RS failures during master initialization */
|
||||||
private volatile boolean initializationBeforeMetaAssignment = false;
|
private volatile boolean initializationBeforeMetaAssignment = false;
|
||||||
|
|
||||||
|
@ -1370,7 +1374,13 @@ public class HMaster extends HRegionServer implements MasterServices, Server {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.normalizer.computePlanForTable(table, types).execute(clusterConnection.getAdmin());
|
NormalizationPlan plan = this.normalizer.computePlanForTable(table, types);
|
||||||
|
plan.execute(clusterConnection.getAdmin());
|
||||||
|
if (plan.getType() == PlanType.SPLIT) {
|
||||||
|
splitPlanCount++;
|
||||||
|
} else if (plan.getType() == PlanType.MERGE) {
|
||||||
|
mergePlanCount++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// If Region did not generate any plans, it means the cluster is already balanced.
|
// If Region did not generate any plans, it means the cluster is already balanced.
|
||||||
|
@ -2369,6 +2379,20 @@ public class HMaster extends HRegionServer implements MasterServices, Server {
|
||||||
}
|
}
|
||||||
return regionStates.getAverageLoad();
|
return regionStates.getAverageLoad();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @return the count of region split plans executed
|
||||||
|
*/
|
||||||
|
public long getSplitPlanCount() {
|
||||||
|
return splitPlanCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @return the count of region merge plans executed
|
||||||
|
*/
|
||||||
|
public long getMergePlanCount() {
|
||||||
|
return mergePlanCount;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean registerService(Service instance) {
|
public boolean registerService(Service instance) {
|
||||||
|
|
|
@ -39,6 +39,16 @@ public class MetricsMasterWrapperImpl implements MetricsMasterWrapper {
|
||||||
return master.getAverageLoad();
|
return master.getAverageLoad();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public long getSplitPlanCount() {
|
||||||
|
return master.getSplitPlanCount();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public long getMergePlanCount() {
|
||||||
|
return master.getMergePlanCount();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getClusterId() {
|
public String getClusterId() {
|
||||||
return master.getClusterId();
|
return master.getClusterId();
|
||||||
|
|
|
@ -49,6 +49,8 @@ public class TestMasterMetricsWrapper {
|
||||||
public void testInfo() {
|
public void testInfo() {
|
||||||
HMaster master = TEST_UTIL.getHBaseCluster().getMaster();
|
HMaster master = TEST_UTIL.getHBaseCluster().getMaster();
|
||||||
MetricsMasterWrapperImpl info = new MetricsMasterWrapperImpl(master);
|
MetricsMasterWrapperImpl info = new MetricsMasterWrapperImpl(master);
|
||||||
|
assertEquals(master.getSplitPlanCount(), info.getSplitPlanCount(), 0);
|
||||||
|
assertEquals(master.getMergePlanCount(), info.getMergePlanCount(), 0);
|
||||||
assertEquals(master.getAverageLoad(), info.getAverageLoad(), 0);
|
assertEquals(master.getAverageLoad(), info.getAverageLoad(), 0);
|
||||||
assertEquals(master.getClusterId(), info.getClusterId());
|
assertEquals(master.getClusterId(), info.getClusterId());
|
||||||
assertEquals(master.getMasterActiveTime(), info.getActiveTime());
|
assertEquals(master.getMasterActiveTime(), info.getActiveTime());
|
||||||
|
|
Loading…
Reference in New Issue