You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by to...@apache.org on 2020/08/10 04:21:47 UTC

[hbase] 04/04: added root priority and executor on master

This is an automated email from the ASF dual-hosted git repository.

toffer pushed a commit to branch HBASE-11288.branch-2
in repository https://gitbox.apache.org/repos/asf/hbase.git

commit 075bea4d8fa4d7c2c3465811a0b50841a6534fb3
Author: Francis Liu <to...@apache.org>
AuthorDate: Sun Aug 9 15:20:10 2020 -0700

    added root priority and executor on master
---
 .../hadoop/hbase/ipc/SimpleRpcScheduler.java       | 33 +++++++++++++++++++---
 .../MasterAnnotationReadingPriorityFunction.java   | 11 +++++---
 2 files changed, 36 insertions(+), 8 deletions(-)

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 0c3e6c2..b424099 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
@@ -43,6 +43,11 @@ public class SimpleRpcScheduler extends RpcScheduler implements ConfigurationObs
   private final RpcExecutor replicationExecutor;
 
   /**
+   * Executor for root region only.
+   */
+  private final RpcExecutor rootTransitionExecutor;
+
+  /**
    * This executor is only for meta transition
    */
   private final RpcExecutor metaTransitionExecutor;
@@ -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,
@@ -143,6 +151,9 @@ public class SimpleRpcScheduler extends RpcScheduler implements ConfigurationObs
     if (replicationExecutor != null) {
       replicationExecutor.resizeQueues(conf);
     }
+    if (rootTransitionExecutor != null) {
+      rootTransitionExecutor.resizeQueues(conf);
+    }
     if (metaTransitionExecutor != null) {
       metaTransitionExecutor.resizeQueues(conf);
     }
@@ -168,10 +179,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 +199,9 @@ public class SimpleRpcScheduler extends RpcScheduler implements ConfigurationObs
     if (metaTransitionExecutor != null) {
       metaTransitionExecutor.stop();
     }
-
+    if (rootTransitionExecutor != null) {
+      rootTransitionExecutor.stop();
+    }
   }
 
   @Override
@@ -197,7 +212,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) {
@@ -208,7 +226,7 @@ public class SimpleRpcScheduler extends RpcScheduler implements ConfigurationObs
       return callExecutor.dispatch(callTask);
     }
   }
-
+  
   @Override
   public int getMetaPriorityQueueLength() {
     return metaTransitionExecutor == null ? 0 : metaTransitionExecutor.getQueueLength();
@@ -326,6 +344,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 87f345e..3a6cb5b 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;
             }
           }