hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject hbase git commit: HBASE-13351 Annotate internal MasterRpcServices methods with admin priority (Josh Elser)
Date Wed, 29 Apr 2015 06:45:37 GMT
Repository: hbase
Updated Branches:
  refs/heads/branch-1.1 37d088e03 -> 0165fe6ce


HBASE-13351 Annotate internal MasterRpcServices methods with admin priority (Josh Elser)


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/0165fe6c
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/0165fe6c
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/0165fe6c

Branch: refs/heads/branch-1.1
Commit: 0165fe6ce47eb97b26cfe9b18a4564eb6c3063d8
Parents: 37d088e
Author: Devaraj Das <ddas@apache.org>
Authored: Tue Apr 28 23:38:28 2015 -0700
Committer: Devaraj Das <ddas@apache.org>
Committed: Tue Apr 28 23:45:30 2015 -0700

----------------------------------------------------------------------
 .../org/apache/hadoop/hbase/HConstants.java     |  9 +-
 .../apache/hadoop/hbase/ipc/QosPriority.java    | 32 +++++++
 .../org/apache/hadoop/hbase/master/HMaster.java | 12 ++-
 .../hadoop/hbase/master/MasterRpcServices.java  |  6 ++
 .../AnnotationReadingPriorityFunction.java      | 29 +++++-
 .../hbase/regionserver/RSRpcServices.java       | 12 +--
 .../apache/hadoop/hbase/client/TestAdmin2.java  |  1 +
 .../client/TestCloneSnapshotFromClient.java     |  1 +
 .../master/TestDistributedLogSplitting.java     |  1 +
 .../hbase/master/TestMasterPriorityRpc.java     | 94 ++++++++++++++++++++
 .../hadoop/hbase/master/TestRollingRestart.java |  2 +
 .../hbase/regionserver/TestQosFunction.java     |  2 +-
 .../regionserver/TestRegionReplicaFailover.java |  1 +
 .../hbase/snapshot/TestExportSnapshot.java      |  1 +
 .../apache/hadoop/hbase/util/TestHBaseFsck.java |  2 +-
 15 files changed, 184 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/0165fe6c/hbase-common/src/main/java/org/apache/hadoop/hbase/HConstants.java
----------------------------------------------------------------------
diff --git a/hbase-common/src/main/java/org/apache/hadoop/hbase/HConstants.java b/hbase-common/src/main/java/org/apache/hadoop/hbase/HConstants.java
index 7438171..a2e36c4 100644
--- a/hbase-common/src/main/java/org/apache/hadoop/hbase/HConstants.java
+++ b/hbase-common/src/main/java/org/apache/hadoop/hbase/HConstants.java
@@ -892,7 +892,7 @@ public final class HConstants {
   //High priority handlers to deal with admin requests and system table operation requests
   public static final String REGION_SERVER_HIGH_PRIORITY_HANDLER_COUNT =
       "hbase.regionserver.metahandler.count";
-  public static final int DEFAULT_REGION_SERVER_HIGH_PRIORITY_HANDLER_COUNT = 10;
+  public static final int DEFAULT_REGION_SERVER_HIGH_PRIORITY_HANDLER_COUNT = 20;
 
   public static final String REGION_SERVER_REPLICATION_HANDLER_COUNT =
       "hbase.regionserver.replication.handler.count";
@@ -967,12 +967,13 @@ public final class HConstants {
    * by different set of handlers. For example, HIGH_QOS tagged methods are
    * handled by high priority handlers.
    */
+  // normal_QOS < QOS_threshold < replication_QOS < replay_QOS < admin_QOS <
high_QOS
   public static final int NORMAL_QOS = 0;
   public static final int QOS_THRESHOLD = 10;
   public static final int HIGH_QOS = 200;
-  public static final int REPLICATION_QOS = 5; // normal_QOS < replication_QOS < high_QOS
-  public static final int REPLAY_QOS = 6; // REPLICATION_QOS < REPLAY_QOS < high_QOS
-  public static final int ADMIN_QOS = 100; // QOS_THRESHOLD < ADMIN_QOS < high_QOS
+  public static final int REPLICATION_QOS = 5;
+  public static final int REPLAY_QOS = 6;
+  public static final int ADMIN_QOS = 100;
   public static final int SYSTEMTABLE_QOS = HIGH_QOS;
 
   /** Directory under /hbase where archived hfiles are stored */

http://git-wip-us.apache.org/repos/asf/hbase/blob/0165fe6c/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/QosPriority.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/QosPriority.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/QosPriority.java
new file mode 100644
index 0000000..2762d05
--- /dev/null
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/QosPriority.java
@@ -0,0 +1,32 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.hadoop.hbase.ipc;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+import org.apache.hadoop.hbase.HConstants;
+
+/**
+ * Annotation which decorates RPC methods to denote the relative priority among other RPCs
in the
+ * same server. Provides a basic notion of quality of service (QOS).
+ */
+@Retention(RetentionPolicy.RUNTIME)
+public @interface QosPriority {
+  int priority() default HConstants.NORMAL_QOS;
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/hbase/blob/0165fe6c/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java
index 63a6e49..3b62336 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java
@@ -424,9 +424,15 @@ public class HMaster extends HRegionServer implements MasterServices,
Server {
         getChoreService().scheduleChore(clusterStatusPublisherChore);
       }
     }
-    activeMasterManager = new ActiveMasterManager(zooKeeper, this.serverName, this);
-    int infoPort = putUpJettyServer();
-    startActiveMasterManager(infoPort);
+
+    // Some unit tests don't need a cluster, so no zookeeper at all
+    if (!conf.getBoolean("hbase.testing.nocluster", false)) {
+      activeMasterManager = new ActiveMasterManager(zooKeeper, this.serverName, this);
+      int infoPort = putUpJettyServer();
+      startActiveMasterManager(infoPort);
+    } else {
+      activeMasterManager = null;
+    }
   }
 
   // return the actual infoPort, -1 means disable info server.

http://git-wip-us.apache.org/repos/asf/hbase/blob/0165fe6c/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterRpcServices.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterRpcServices.java
b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterRpcServices.java
index e9b5528..d7083fa 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterRpcServices.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterRpcServices.java
@@ -39,6 +39,7 @@ import org.apache.hadoop.hbase.UnknownRegionException;
 import org.apache.hadoop.hbase.MetaTableAccessor;
 import org.apache.hadoop.hbase.exceptions.MergeRegionException;
 import org.apache.hadoop.hbase.exceptions.UnknownProtocolException;
+import org.apache.hadoop.hbase.ipc.QosPriority;
 import org.apache.hadoop.hbase.ipc.RpcServer.BlockingServiceAndInterface;
 import org.apache.hadoop.hbase.ipc.ServerRpcController;
 import org.apache.hadoop.hbase.procedure.MasterProcedureManager;
@@ -268,6 +269,7 @@ public class MasterRpcServices extends RSRpcServices
   }
 
   @Override
+  @QosPriority(priority=HConstants.ADMIN_QOS)
   public GetLastFlushedSequenceIdResponse getLastFlushedSequenceId(RpcController controller,
       GetLastFlushedSequenceIdRequest request) throws ServiceException {
     try {
@@ -281,6 +283,7 @@ public class MasterRpcServices extends RSRpcServices
   }
 
   @Override
+  @QosPriority(priority=HConstants.ADMIN_QOS)
   public RegionServerReportResponse regionServerReport(
       RpcController controller, RegionServerReportRequest request) throws ServiceException
{
     try {
@@ -301,6 +304,7 @@ public class MasterRpcServices extends RSRpcServices
   }
 
   @Override
+  @QosPriority(priority=HConstants.ADMIN_QOS)
   public RegionServerStartupResponse regionServerStartup(
       RpcController controller, RegionServerStartupRequest request) throws ServiceException
{
     // Register with server manager
@@ -326,6 +330,7 @@ public class MasterRpcServices extends RSRpcServices
   }
 
   @Override
+  @QosPriority(priority=HConstants.ADMIN_QOS)
   public ReportRSFatalErrorResponse reportRSFatalError(
       RpcController controller, ReportRSFatalErrorRequest request) throws ServiceException
{
     String errorText = request.getErrorMessage();
@@ -1289,6 +1294,7 @@ public class MasterRpcServices extends RSRpcServices
   }
 
   @Override
+  @QosPriority(priority=HConstants.ADMIN_QOS)
   public ReportRegionStateTransitionResponse reportRegionStateTransition(RpcController c,
       ReportRegionStateTransitionRequest req) throws ServiceException {
     try {

http://git-wip-us.apache.org/repos/asf/hbase/blob/0165fe6c/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/AnnotationReadingPriorityFunction.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/AnnotationReadingPriorityFunction.java
b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/AnnotationReadingPriorityFunction.java
index 29228db..5ee20ef 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/AnnotationReadingPriorityFunction.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/AnnotationReadingPriorityFunction.java
@@ -23,10 +23,11 @@ import java.util.Map;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.apache.hadoop.hbase.classification.InterfaceAudience;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.hbase.HConstants;
+import org.apache.hadoop.hbase.classification.InterfaceAudience;
 import org.apache.hadoop.hbase.ipc.PriorityFunction;
+import org.apache.hadoop.hbase.ipc.QosPriority;
 import org.apache.hadoop.hbase.protobuf.generated.AdminProtos.CloseRegionRequest;
 import org.apache.hadoop.hbase.protobuf.generated.AdminProtos.CompactRegionRequest;
 import org.apache.hadoop.hbase.protobuf.generated.AdminProtos.FlushRegionRequest;
@@ -39,7 +40,6 @@ import org.apache.hadoop.hbase.protobuf.generated.ClientProtos.MutateRequest;
 import org.apache.hadoop.hbase.protobuf.generated.ClientProtos.ScanRequest;
 import org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.RegionSpecifier;
 import org.apache.hadoop.hbase.protobuf.generated.RPCProtos.RequestHeader;
-import org.apache.hadoop.hbase.regionserver.RSRpcServices.QosPriority;
 
 import com.google.common.annotations.VisibleForTesting;
 import com.google.protobuf.Message;
@@ -100,9 +100,30 @@ class AnnotationReadingPriorityFunction implements PriorityFunction {
 
   private final float scanVirtualTimeWeight;
 
+  /**
+   * Calls {@link #AnnotationReadingPriorityFunction(RSRpcServices, Class)} using the result
of
+   * {@code rpcServices#getClass()}
+   *
+   * @param rpcServices
+   *          The RPC server implementation
+   */
   AnnotationReadingPriorityFunction(final RSRpcServices rpcServices) {
-    Map<String, Integer> qosMap = new HashMap<String, Integer>();
-    for (Method m : RSRpcServices.class.getMethods()) {
+    this(rpcServices, rpcServices.getClass());
+  }
+
+  /**
+   * Constructs the priority function given the RPC server implementation and the annotations
on the
+   * methods in the provided {@code clz}.
+   *
+   * @param rpcServices
+   *          The RPC server implementation
+   * @param clz
+   *          The concrete RPC server implementation's class
+   */
+  AnnotationReadingPriorityFunction(final RSRpcServices rpcServices,
+      Class<? extends RSRpcServices> clz) {
+    Map<String,Integer> qosMap = new HashMap<String,Integer>();
+    for (Method m : clz.getMethods()) {
       QosPriority p = m.getAnnotation(QosPriority.class);
       if (p != null) {
         // Since we protobuf'd, and then subsequently, when we went with pb style, method
names

http://git-wip-us.apache.org/repos/asf/hbase/blob/0165fe6c/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RSRpcServices.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RSRpcServices.java
b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RSRpcServices.java
index cf2f34b..bf67e91 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RSRpcServices.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RSRpcServices.java
@@ -20,8 +20,6 @@ package org.apache.hadoop.hbase.regionserver;
 
 import java.io.IOException;
 import java.io.InterruptedIOException;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
 import java.net.InetSocketAddress;
 import java.net.UnknownHostException;
 import java.util.ArrayList;
@@ -78,6 +76,7 @@ import org.apache.hadoop.hbase.filter.CompareFilter.CompareOp;
 import org.apache.hadoop.hbase.ipc.HBaseRPCErrorHandler;
 import org.apache.hadoop.hbase.ipc.PayloadCarryingRpcController;
 import org.apache.hadoop.hbase.ipc.PriorityFunction;
+import org.apache.hadoop.hbase.ipc.QosPriority;
 import org.apache.hadoop.hbase.ipc.RpcCallContext;
 import org.apache.hadoop.hbase.ipc.RpcServer;
 import org.apache.hadoop.hbase.ipc.RpcServer.BlockingServiceAndInterface;
@@ -175,6 +174,7 @@ import org.apache.hadoop.hbase.zookeeper.ZKSplitLog;
 import org.apache.hadoop.net.DNS;
 import org.apache.zookeeper.KeeperException;
 
+import com.google.common.annotations.VisibleForTesting;
 import com.google.protobuf.ByteString;
 import com.google.protobuf.Message;
 import com.google.protobuf.RpcController;
@@ -936,7 +936,8 @@ public class RSRpcServices implements HBaseRPCErrorHandler,
         ProtobufUtil.getRegionEncodedName(regionSpecifier));
   }
 
-  PriorityFunction getPriority() {
+  @VisibleForTesting
+  public PriorityFunction getPriority() {
     return priority;
   }
 
@@ -989,11 +990,6 @@ public class RSRpcServices implements HBaseRPCErrorHandler,
     return bssi;
   }
 
-  @Retention(RetentionPolicy.RUNTIME)
-  protected @interface QosPriority {
-    int priority() default HConstants.NORMAL_QOS;
-  }
-
   public InetSocketAddress getSocketAddress() {
     return isa;
   }

http://git-wip-us.apache.org/repos/asf/hbase/blob/0165fe6c/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAdmin2.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAdmin2.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAdmin2.java
index 900c56b..5cf3971 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAdmin2.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAdmin2.java
@@ -84,6 +84,7 @@ public class TestAdmin2 {
     TEST_UTIL.getConfiguration().setInt("hbase.regionserver.msginterval", 100);
     TEST_UTIL.getConfiguration().setInt("hbase.client.pause", 250);
     TEST_UTIL.getConfiguration().setInt("hbase.client.retries.number", 6);
+    TEST_UTIL.getConfiguration().setInt("hbase.regionserver.metahandler.count", 30);
     TEST_UTIL.getConfiguration().setBoolean(
         "hbase.master.enabletable.roundrobin", true);
     TEST_UTIL.startMiniCluster(3);

http://git-wip-us.apache.org/repos/asf/hbase/blob/0165fe6c/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestCloneSnapshotFromClient.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestCloneSnapshotFromClient.java
b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestCloneSnapshotFromClient.java
index e05a2fb..6410393 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestCloneSnapshotFromClient.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestCloneSnapshotFromClient.java
@@ -70,6 +70,7 @@ public class TestCloneSnapshotFromClient {
     TEST_UTIL.getConfiguration().setInt(HConstants.HBASE_CLIENT_RETRIES_NUMBER, 6);
     TEST_UTIL.getConfiguration().setBoolean(
         "hbase.master.enabletable.roundrobin", true);
+    TEST_UTIL.getConfiguration().setInt(HConstants.REGION_SERVER_HIGH_PRIORITY_HANDLER_COUNT,
40);
     TEST_UTIL.startMiniCluster(3);
   }
 

http://git-wip-us.apache.org/repos/asf/hbase/blob/0165fe6c/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestDistributedLogSplitting.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestDistributedLogSplitting.java
b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestDistributedLogSplitting.java
index d61cf60..38e2613 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestDistributedLogSplitting.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestDistributedLogSplitting.java
@@ -169,6 +169,7 @@ public class TestDistributedLogSplitting {
     conf.setFloat(HConstants.LOAD_BALANCER_SLOP_KEY, (float) 100.0); // no load balancing
     conf.setInt("hbase.regionserver.wal.max.splitters", 3);
     conf.setInt("hbase.master.maximum.ping.server.attempts", 3);
+    conf.setInt(HConstants.REGION_SERVER_HIGH_PRIORITY_HANDLER_COUNT, 40);
     TEST_UTIL.shutdownMiniHBaseCluster();
     TEST_UTIL = new HBaseTestingUtility(conf);
     TEST_UTIL.setDFSCluster(dfsCluster);

http://git-wip-us.apache.org/repos/asf/hbase/blob/0165fe6c/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMasterPriorityRpc.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMasterPriorityRpc.java
b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMasterPriorityRpc.java
new file mode 100644
index 0000000..a72f96b
--- /dev/null
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMasterPriorityRpc.java
@@ -0,0 +1,94 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.hadoop.hbase.master;
+
+import static org.junit.Assert.assertEquals;
+
+import java.util.Set;
+
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.hbase.CoordinatedStateManager;
+import org.apache.hadoop.hbase.CoordinatedStateManagerFactory;
+import org.apache.hadoop.hbase.HBaseConfiguration;
+import org.apache.hadoop.hbase.HConstants;
+import org.apache.hadoop.hbase.ipc.PriorityFunction;
+import org.apache.hadoop.hbase.protobuf.generated.RPCProtos.RequestHeader;
+import org.apache.hadoop.hbase.testclassification.MasterTests;
+import org.apache.hadoop.hbase.testclassification.MediumTests;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import com.google.common.collect.Sets;
+
+/**
+ * Tests to verify correct priority on Master RPC methods.
+ */
+@Category({MasterTests.class, MediumTests.class})
+public class TestMasterPriorityRpc {
+  private HMaster master = null;
+  private PriorityFunction priority = null;
+
+  private final Set<String> ADMIN_METHODS = Sets.newHashSet("GetLastFlushedSequenceId",
+      "RegionServerReport", "RegionServerStartup", "ReportRSFatalError",
+      "ReportRegionStateTransition");
+
+  private final Set<String> NORMAL_METHODS = Sets.newHashSet("CreateTable", "DeleteTable",
+      "ModifyColumn", "OfflineRegion", "Shutdown");
+
+  @Before
+  public void setup() {
+    Configuration conf = HBaseConfiguration.create();
+    conf.setBoolean("hbase.testing.nocluster", true); // No need to do ZK
+    CoordinatedStateManager cp = CoordinatedStateManagerFactory.getCoordinatedStateManager(conf);
+    master = HMaster.constructMaster(HMaster.class, conf, cp);
+    priority = master.getMasterRpcServices().getPriority();
+  }
+
+  /**
+   * Asserts that the provided method has the given priority.
+   *
+   * @param methodName
+   *          The name of the RPC method.
+   * @param expectedPriority
+   *          The expected priority.
+   */
+  private void assertPriority(String methodName, int expectedPriority) {
+    assertEquals(methodName + " had unexpected priority", expectedPriority,
+        priority.getPriority(RequestHeader.newBuilder().setMethodName(methodName).build(),
null));
+  }
+
+  @Test
+  public void testNullMessage() {
+    assertPriority("doesnotexist", HConstants.NORMAL_QOS);
+  }
+
+  @Test
+  public void testAdminPriorityMethods() {
+    for (String methodName : ADMIN_METHODS) {
+      assertPriority(methodName, HConstants.ADMIN_QOS);
+    }
+  }
+
+  @Test
+  public void testSomeNormalMethods() {
+    for (String methodName : NORMAL_METHODS) {
+      assertPriority(methodName, HConstants.NORMAL_QOS);
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/hbase/blob/0165fe6c/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestRollingRestart.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestRollingRestart.java
b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestRollingRestart.java
index 0a26399..1908edb 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestRollingRestart.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestRollingRestart.java
@@ -31,6 +31,7 @@ import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.hbase.HBaseConfiguration;
 import org.apache.hadoop.hbase.HBaseTestingUtility;
+import org.apache.hadoop.hbase.HConstants;
 import org.apache.hadoop.hbase.HRegionInfo;
 import org.apache.hadoop.hbase.testclassification.LargeTests;
 import org.apache.hadoop.hbase.MiniHBaseCluster;
@@ -68,6 +69,7 @@ public class  TestRollingRestart {
     // Start the cluster
     log("Starting cluster");
     Configuration conf = HBaseConfiguration.create();
+    conf.setInt(HConstants.REGION_SERVER_HIGH_PRIORITY_HANDLER_COUNT, 40);
     HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility(conf);
     TEST_UTIL.startMiniCluster(NUM_MASTERS, NUM_RS);
     MiniHBaseCluster cluster = TEST_UTIL.getHBaseCluster();

http://git-wip-us.apache.org/repos/asf/hbase/blob/0165fe6c/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestQosFunction.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestQosFunction.java
b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestQosFunction.java
index dde3e37..13e3378 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestQosFunction.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestQosFunction.java
@@ -44,7 +44,7 @@ public class TestQosFunction {
     when(rpcServices.getConfiguration()).thenReturn(conf);
 
     AnnotationReadingPriorityFunction qosFunction =
-      new AnnotationReadingPriorityFunction(rpcServices);
+      new AnnotationReadingPriorityFunction(rpcServices, RSRpcServices.class);
 
     // Set method name in pb style with the method name capitalized.
     checkMethod("ReplicateWALEntry", HConstants.REPLICATION_QOS, qosFunction);

http://git-wip-us.apache.org/repos/asf/hbase/blob/0165fe6c/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestRegionReplicaFailover.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestRegionReplicaFailover.java
b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestRegionReplicaFailover.java
index fab092e..70bbb69 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestRegionReplicaFailover.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestRegionReplicaFailover.java
@@ -111,6 +111,7 @@ public class TestRegionReplicaFailover {
     conf.setInt("replication.stats.thread.period.seconds", 5);
     conf.setBoolean("hbase.tests.use.shortcircuit.reads", false);
     conf.setBoolean(HConstants.DISTRIBUTED_LOG_REPLAY_KEY, distributedLogReplay);
+    conf.setInt(HConstants.REGION_SERVER_HIGH_PRIORITY_HANDLER_COUNT, 60);
 
     HTU.startMiniCluster(NB_SERVERS);
     htd = HTU.createTableDescriptor(

http://git-wip-us.apache.org/repos/asf/hbase/blob/0165fe6c/hbase-server/src/test/java/org/apache/hadoop/hbase/snapshot/TestExportSnapshot.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/snapshot/TestExportSnapshot.java
b/hbase-server/src/test/java/org/apache/hadoop/hbase/snapshot/TestExportSnapshot.java
index 05a3d22..b1bd41f 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/snapshot/TestExportSnapshot.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/snapshot/TestExportSnapshot.java
@@ -81,6 +81,7 @@ public class TestExportSnapshot {
     conf.setInt(HConstants.HBASE_CLIENT_RETRIES_NUMBER, 6);
     conf.setBoolean("hbase.master.enabletable.roundrobin", true);
     conf.setInt("mapreduce.map.maxattempts", 10);
+    conf.setInt(HConstants.REGION_SERVER_HIGH_PRIORITY_HANDLER_COUNT, 40);
   }
 
   @BeforeClass

http://git-wip-us.apache.org/repos/asf/hbase/blob/0165fe6c/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestHBaseFsck.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestHBaseFsck.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestHBaseFsck.java
index 9c654e2..e96c207 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestHBaseFsck.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestHBaseFsck.java
@@ -166,7 +166,7 @@ public class TestHBaseFsck {
       MasterSyncObserver.class.getName());
 
     conf.setInt("hbase.regionserver.handler.count", 2);
-    conf.setInt("hbase.regionserver.metahandler.count", 2);
+    conf.setInt("hbase.regionserver.metahandler.count", 30);
 
     conf.setInt("hbase.htable.threads.max", POOL_SIZE);
     conf.setInt("hbase.hconnection.threads.max", 2 * POOL_SIZE);


Mime
View raw message