hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From apurt...@apache.org
Subject [1/2] hbase git commit: HBASE-13941 Backport HBASE-13917 (Remove string comparison to identify request priority)
Date Wed, 19 Aug 2015 22:07:28 GMT
Repository: hbase
Updated Branches:
  refs/heads/branch-1.0 de5bdbe6b -> 585cd22c9
  refs/heads/branch-1.1 062c69cef -> 6062dc618


HBASE-13941 Backport HBASE-13917 (Remove string comparison to identify request priority)


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

Branch: refs/heads/branch-1.0
Commit: 585cd22c90e3f56ab1441305cd4aee2827adb177
Parents: de5bdbe
Author: Matteo Bertozzi <matteo.bertozzi@cloudera.com>
Authored: Tue Aug 18 14:08:50 2015 -0700
Committer: Andrew Purtell <apurtell@apache.org>
Committed: Wed Aug 19 14:47:21 2015 -0700

----------------------------------------------------------------------
 .../apache/hadoop/hbase/ipc/RWQueueRpcExecutor.java    | 13 +++++++------
 .../AnnotationReadingPriorityFunction.java             |  9 ++++-----
 .../hadoop/hbase/ipc/TestSimpleRpcScheduler.java       |  8 ++++++++
 3 files changed, 19 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/585cd22c/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/RWQueueRpcExecutor.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/RWQueueRpcExecutor.java
b/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/RWQueueRpcExecutor.java
index a0ea160..7b28e74 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/RWQueueRpcExecutor.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/RWQueueRpcExecutor.java
@@ -33,6 +33,9 @@ import org.apache.hadoop.hbase.classification.InterfaceAudience;
 import org.apache.hadoop.hbase.classification.InterfaceStability;
 import org.apache.hadoop.hbase.protobuf.generated.ClientProtos.Action;
 import org.apache.hadoop.hbase.protobuf.generated.ClientProtos.MultiRequest;
+import org.apache.hadoop.hbase.protobuf.generated.ClientProtos.MutateRequest;
+import org.apache.hadoop.hbase.protobuf.generated
+  .RegionServerStatusProtos.ReportRegionStateTransitionRequest;
 import org.apache.hadoop.hbase.protobuf.generated.ClientProtos.RegionAction;
 import org.apache.hadoop.hbase.protobuf.generated.ClientProtos.ScanRequest;
 import org.apache.hadoop.hbase.protobuf.generated.RPCProtos.RequestHeader;
@@ -173,8 +176,7 @@ public class RWQueueRpcExecutor extends RpcExecutor {
 
   private boolean isWriteRequest(final RequestHeader header, final Message param) {
     // TODO: Is there a better way to do this?
-    String methodName = header.getMethodName();
-    if (methodName.equalsIgnoreCase("multi") && param instanceof MultiRequest) {
+    if (param instanceof MultiRequest) {
       MultiRequest multi = (MultiRequest)param;
       for (RegionAction regionAction : multi.getRegionActionList()) {
         for (Action action: regionAction.getActionList()) {
@@ -184,18 +186,17 @@ public class RWQueueRpcExecutor extends RpcExecutor {
         }
       }
     }
-    if (methodName.equalsIgnoreCase("mutate")) {
+    if (param instanceof MutateRequest) {
       return true;
     }
-    if (methodName.equalsIgnoreCase("ReportRegionStateTransition")) {
+    if (param instanceof ReportRegionStateTransitionRequest) {
       return true;
     }
     return false;
   }
 
   private boolean isScanRequest(final RequestHeader header, final Message param) {
-    String methodName = header.getMethodName();
-    if (methodName.equalsIgnoreCase("scan")) {
+    if (param instanceof ScanRequest) {
       // The first scan request will be executed as a "short read"
       ScanRequest request = (ScanRequest)param;
       return request.hasScannerId();

http://git-wip-us.apache.org/repos/asf/hbase/blob/585cd22c/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 8e96af9..8cfb151 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
@@ -163,7 +163,7 @@ class AnnotationReadingPriorityFunction implements PriorityFunction {
     if (param == null) {
       return HConstants.NORMAL_QOS;
     }
-    if (methodName.equalsIgnoreCase("multi") && param instanceof MultiRequest) {
+    if (param instanceof MultiRequest) {
       // The multi call has its priority set in the header.  All calls should work this way
but
       // only this one has been converted so far.  No priority == NORMAL_QOS.
       return header.hasPriority()? header.getPriority(): HConstants.NORMAL_QOS;
@@ -196,7 +196,7 @@ class AnnotationReadingPriorityFunction implements PriorityFunction {
       return HConstants.NORMAL_QOS;
     }
 
-    if (methodName.equalsIgnoreCase("scan")) { // scanner methods...
+    if (param instanceof ScanRequest) { // scanner methods...
       ScanRequest request = (ScanRequest)param;
       if (!request.hasScannerId()) {
         return HConstants.NORMAL_QOS;
@@ -213,7 +213,7 @@ class AnnotationReadingPriorityFunction implements PriorityFunction {
 
     // If meta is moving then all the rest of report the report state transitions will be
     // blocked. We shouldn't be in the same queue.
-    if (methodName.equalsIgnoreCase("ReportRegionStateTransition")) { // Regions are moving
+    if (param instanceof ReportRegionStateTransitionRequest) { // Regions are moving
       ReportRegionStateTransitionRequest tRequest = (ReportRegionStateTransitionRequest)
param;
       for (RegionStateTransition transition : tRequest.getTransitionList()) {
         if (transition.getRegionInfoList() != null) {
@@ -238,8 +238,7 @@ class AnnotationReadingPriorityFunction implements PriorityFunction {
    */
   @Override
   public long getDeadline(RequestHeader header, Message param) {
-    String methodName = header.getMethodName();
-    if (methodName.equalsIgnoreCase("scan")) {
+    if (param instanceof ScanRequest) {
       ScanRequest request = (ScanRequest)param;
       if (!request.hasScannerId()) {
         return 0;

http://git-wip-us.apache.org/repos/asf/hbase/blob/585cd22c/hbase-server/src/test/java/org/apache/hadoop/hbase/ipc/TestSimpleRpcScheduler.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/ipc/TestSimpleRpcScheduler.java
b/hbase-server/src/test/java/org/apache/hadoop/hbase/ipc/TestSimpleRpcScheduler.java
index 815ae1d..3c50150 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/ipc/TestSimpleRpcScheduler.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/ipc/TestSimpleRpcScheduler.java
@@ -21,17 +21,23 @@ import com.google.common.collect.ImmutableList;
 import com.google.common.collect.ImmutableMap;
 import com.google.common.collect.ImmutableSet;
 import com.google.common.collect.Maps;
+
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+
 import com.google.protobuf.Message;
+
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.hbase.HBaseConfiguration;
 import org.apache.hadoop.hbase.HConstants;
 import org.apache.hadoop.hbase.testclassification.SmallTests;
+import org.apache.hadoop.hbase.client.Put;
 import org.apache.hadoop.hbase.ipc.RpcServer.Call;
+import org.apache.hadoop.hbase.protobuf.RequestConverter;
 import org.apache.hadoop.hbase.protobuf.generated.RPCProtos;
 import org.apache.hadoop.hbase.protobuf.generated.RPCProtos.RequestHeader;
 import org.apache.hadoop.hbase.protobuf.generated.ClientProtos.ScanRequest;
+import org.apache.hadoop.hbase.util.Bytes;
 import org.apache.hadoop.hbase.util.Threads;
 import org.junit.Before;
 import org.junit.Test;
@@ -244,6 +250,8 @@ public class TestSimpleRpcScheduler {
 
       CallRunner putCallTask = mock(CallRunner.class);
       RpcServer.Call putCall = mock(RpcServer.Call.class);
+      putCall.param = RequestConverter.buildMutateRequest(
+          Bytes.toBytes("abc"), new Put(Bytes.toBytes("row")));
       RequestHeader putHead = RequestHeader.newBuilder().setMethodName("mutate").build();
       when(putCallTask.getCall()).thenReturn(putCall);
       when(putCall.getHeader()).thenReturn(putHead);


Mime
View raw message