diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/SimpleRpcScheduler.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/SimpleRpcScheduler.java index 0c3e6c2517..950fc9f76d 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/SimpleRpcScheduler.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/SimpleRpcScheduler.java @@ -42,6 +42,11 @@ public class SimpleRpcScheduler extends RpcScheduler implements ConfigurationObs private final RpcExecutor priorityExecutor; private final RpcExecutor replicationExecutor; + /** + * Executor for root region only. + */ + private final RpcExecutor rootTransitionExecutor; + /** * This executor is only for meta transition */ @@ -122,6 +127,9 @@ public class SimpleRpcScheduler extends RpcScheduler implements ConfigurationObs RpcExecutor.CALL_QUEUE_TYPE_FIFO_CONF_VALUE, maxPriorityQueueLength, priority, conf, abortable) : null; + this.rootTransitionExecutor = new FastPathBalancedQueueRpcExecutor("rootPriority.FPBQ", 1, + RpcExecutor.CALL_QUEUE_TYPE_FIFO_CONF_VALUE, maxPriorityQueueLength, priority, conf, + abortable); } public SimpleRpcScheduler(Configuration conf, int handlerCount, int priorityHandlerCount, @@ -168,10 +176,12 @@ public class SimpleRpcScheduler extends RpcScheduler implements ConfigurationObs if (replicationExecutor != null) { replicationExecutor.start(port); } + if (rootTransitionExecutor != null) { + rootTransitionExecutor.start(port); + } if (metaTransitionExecutor != null) { metaTransitionExecutor.start(port); } - } @Override @@ -186,7 +196,9 @@ public class SimpleRpcScheduler extends RpcScheduler implements ConfigurationObs if (metaTransitionExecutor != null) { metaTransitionExecutor.stop(); } - + if (rootTransitionExecutor != null) { + rootTransitionExecutor.stop(); + } } @Override @@ -197,7 +209,10 @@ public class SimpleRpcScheduler extends RpcScheduler implements ConfigurationObs if (level == HConstants.PRIORITY_UNSET) { level = HConstants.NORMAL_QOS; } - if (metaTransitionExecutor != null && + if (rootTransitionExecutor != null && + level == MasterAnnotationReadingPriorityFunction.ROOT_TRANSITION_QOS) { + return rootTransitionExecutor.dispatch(callTask); + } else if (metaTransitionExecutor != null && level == MasterAnnotationReadingPriorityFunction.META_TRANSITION_QOS) { return metaTransitionExecutor.dispatch(callTask); } else if (priorityExecutor != null && level > highPriorityLevel) { @@ -326,6 +341,13 @@ public class SimpleRpcScheduler extends RpcScheduler implements ConfigurationObs callQueueInfo.setCallMethodSize(queueName, metaTransitionExecutor.getCallQueueSizeSummary()); } + if (null != rootTransitionExecutor) { + queueName = "ROOT Transition Queue"; + callQueueInfo.setCallMethodCount(queueName, + rootTransitionExecutor.getCallQueueCountsSummary()); + callQueueInfo.setCallMethodSize(queueName, rootTransitionExecutor.getCallQueueSizeSummary()); + } + return callQueueInfo; } diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterAnnotationReadingPriorityFunction.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterAnnotationReadingPriorityFunction.java index 87f345e38f..3a6cb5b5a2 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterAnnotationReadingPriorityFunction.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterAnnotationReadingPriorityFunction.java @@ -50,7 +50,8 @@ import org.apache.hadoop.hbase.shaded.protobuf.generated.RegionServerStatusProto @InterfaceAudience.Private public class MasterAnnotationReadingPriorityFunction extends AnnotationReadingPriorityFunction { - public static final int META_TRANSITION_QOS = 300; + public static final int ROOT_TRANSITION_QOS = 300; + public static final int META_TRANSITION_QOS = 299; public MasterAnnotationReadingPriorityFunction(final RSRpcServices rpcServices) { this(rpcServices, rpcServices.getClass()); @@ -69,7 +70,7 @@ public class MasterAnnotationReadingPriorityFunction extends AnnotationReadingPr // every single RPC request. int priorityByAnnotation = getAnnotatedPriority(header); if (priorityByAnnotation >= 0) { - // no one can have higher priority than meta transition. + // No one can have higher priority than ROOT and META transition. if (priorityByAnnotation >= META_TRANSITION_QOS) { return META_TRANSITION_QOS - 1; } else { @@ -77,7 +78,7 @@ public class MasterAnnotationReadingPriorityFunction extends AnnotationReadingPr } } - // If meta is moving then all the other of reports of state transitions will be + // If ROOT or meta are moving then all the other of reports of state transitions will be // un able to edit meta. Those blocked reports should not keep the report that opens meta from // running. Hence all reports of meta transition should always be in a different thread. // This keeps from deadlocking the cluster. @@ -89,7 +90,9 @@ public class MasterAnnotationReadingPriorityFunction extends AnnotationReadingPr if (rst.getRegionInfoList() != null) { for (HBaseProtos.RegionInfo info : rst.getRegionInfoList()) { TableName tn = ProtobufUtil.toTableName(info.getTableName()); - if (TableName.META_TABLE_NAME.equals(tn)) { + if (TableName.ROOT_TABLE_NAME.equals(tn)) { + return ROOT_TRANSITION_QOS; + } else if (TableName.META_TABLE_NAME.equals(tn)) { return META_TRANSITION_QOS; } }