hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From e...@apache.org
Subject [1/2] hbase git commit: HBASE-14674 Rpc handler / task monitoring seems to be broken after 0.98 (Heng Chen)
Date Tue, 27 Oct 2015 21:58:30 GMT
Repository: hbase
Updated Branches:
  refs/heads/0.98 fd18723e3 -> 7bef3b196
  refs/heads/branch-1.0 dd06ddec6 -> ccded0bd6


HBASE-14674 Rpc handler / task monitoring seems to be broken after 0.98 (Heng Chen)

Conflicts:
	hbase-server/src/test/java/org/apache/hadoop/hbase/ipc/TestCallRunner.java

Conflicts:
	hbase-server/src/test/java/org/apache/hadoop/hbase/ipc/TestSimpleRpcScheduler.java

Conflicts:
	hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/CallRunner.java
	hbase-server/src/test/java/org/apache/hadoop/hbase/ipc/TestCallRunner.java


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

Branch: refs/heads/branch-1.0
Commit: ccded0bd6abb635613cd7801245ab15e8e090b0b
Parents: dd06dde
Author: Enis Soztutar <enis@apache.org>
Authored: Tue Oct 27 14:24:21 2015 -0700
Committer: Enis Soztutar <enis@apache.org>
Committed: Tue Oct 27 14:48:30 2015 -0700

----------------------------------------------------------------------
 .../org/apache/hadoop/hbase/ipc/CallRunner.java   | 18 ++++--------------
 .../apache/hadoop/hbase/ipc/FifoRpcScheduler.java |  2 +-
 .../org/apache/hadoop/hbase/ipc/RpcExecutor.java  |  3 +++
 .../org/apache/hadoop/hbase/ipc/RpcServer.java    | 16 +++++++++++++++-
 .../apache/hadoop/hbase/ipc/TestCallRunner.java   |  4 +++-
 .../hadoop/hbase/ipc/TestSimpleRpcScheduler.java  |  6 ++++++
 6 files changed, 32 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/ccded0bd/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/CallRunner.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/CallRunner.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/CallRunner.java
index 51e3fba..ada0df6 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/CallRunner.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/CallRunner.java
@@ -56,7 +56,6 @@ public class CallRunner {
     this.rpcServer = rpcServer;
     // Add size of the call to queue size.
     this.rpcServer.addCallSize(call.getSize());
-    this.status = getStatus();
     this.userProvider = userProvider;
   }
 
@@ -64,13 +63,16 @@ public class CallRunner {
     return call;
   }
 
+  public void setStatus(MonitoredRPCHandler status) {
+    this.status = status;
+  }
+
   /**
    * Cleanup after ourselves... let go of references.
    */
   private void cleanup() {
     this.call = null;
     this.rpcServer = null;
-    this.status = null;
     this.userProvider = null;
   }
 
@@ -159,16 +161,4 @@ public class CallRunner {
       cleanup();
     }
   }
-
-  MonitoredRPCHandler getStatus() {
-    // It is ugly the way we park status up in RpcServer.  Let it be for now.  TODO.
-    MonitoredRPCHandler status = RpcServer.MONITORED_RPC.get();
-    if (status != null) {
-      return status;
-    }
-    status = TaskMonitor.get().createRPCStatus(Thread.currentThread().getName());
-    status.pause("Waiting for a call");
-    RpcServer.MONITORED_RPC.set(status);
-    return status;
-  }
 }

http://git-wip-us.apache.org/repos/asf/hbase/blob/ccded0bd/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/FifoRpcScheduler.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/FifoRpcScheduler.java
b/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/FifoRpcScheduler.java
index 8140c1c..621a8ef 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/FifoRpcScheduler.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/FifoRpcScheduler.java
@@ -24,7 +24,6 @@ import java.io.IOException;
 import java.util.concurrent.ArrayBlockingQueue;
 import java.util.concurrent.ThreadPoolExecutor;
 import java.util.concurrent.TimeUnit;
-import org.apache.hadoop.hbase.ipc.CallRunner;
 
 /**
  * A very simple {@code }RpcScheduler} that serves incoming requests in order.
@@ -70,6 +69,7 @@ public class FifoRpcScheduler extends RpcScheduler {
     executor.submit(new Runnable() {
       @Override
       public void run() {
+        task.setStatus(RpcServer.getStatus());
         task.run();
       }
     });

http://git-wip-us.apache.org/repos/asf/hbase/blob/ccded0bd/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/RpcExecutor.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/RpcExecutor.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/RpcExecutor.java
index 709429d..27750a7 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/RpcExecutor.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/RpcExecutor.java
@@ -31,6 +31,7 @@ import org.apache.hadoop.hbase.Abortable;
 import org.apache.hadoop.hbase.HConstants;
 import org.apache.hadoop.hbase.classification.InterfaceAudience;
 import org.apache.hadoop.hbase.classification.InterfaceStability;
+import org.apache.hadoop.hbase.monitoring.MonitoredRPCHandler;
 import org.apache.hadoop.util.StringUtils;
 
 import com.google.common.base.Preconditions;
@@ -124,7 +125,9 @@ public abstract class RpcExecutor {
     try {
       while (running) {
         try {
+          MonitoredRPCHandler status = RpcServer.getStatus();
           CallRunner task = myQueue.take();
+          task.setStatus(status);
           try {
             activeHandlerCount.incrementAndGet();
             task.run();

http://git-wip-us.apache.org/repos/asf/hbase/blob/ccded0bd/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/RpcServer.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/RpcServer.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/RpcServer.java
index 48ca2e9..35b4b91 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/RpcServer.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/RpcServer.java
@@ -82,6 +82,7 @@ import org.apache.hadoop.hbase.codec.Codec;
 import org.apache.hadoop.hbase.exceptions.RegionMovedException;
 import org.apache.hadoop.hbase.io.ByteBufferOutputStream;
 import org.apache.hadoop.hbase.monitoring.MonitoredRPCHandler;
+import org.apache.hadoop.hbase.monitoring.TaskMonitor;
 import org.apache.hadoop.hbase.protobuf.ProtobufUtil;
 import org.apache.hadoop.hbase.protobuf.generated.RPCProtos.CellBlockMeta;
 import org.apache.hadoop.hbase.protobuf.generated.RPCProtos.ConnectionHeader;
@@ -2213,7 +2214,8 @@ public class RpcServer implements RpcServerInterface {
    * @param user client user
    * @param connection incoming connection
    * @param addr InetAddress of incoming connection
-   * @throws org.apache.hadoop.security.authorize.AuthorizationException when the client
isn't authorized to talk the protocol
+   * @throws org.apache.hadoop.security.authorize.AuthorizationException
+   *         when the client isn't authorized to talk the protocol
    */
   public void authorize(UserGroupInformation user, ConnectionHeader connection, InetAddress
addr)
   throws AuthorizationException {
@@ -2376,6 +2378,18 @@ public class RpcServer implements RpcServerInterface {
     return bsasi == null? null: bsasi.getBlockingService();
   }
 
+  static MonitoredRPCHandler getStatus() {
+    // It is ugly the way we park status up in RpcServer.  Let it be for now.  TODO.
+    MonitoredRPCHandler status = RpcServer.MONITORED_RPC.get();
+    if (status != null) {
+      return status;
+    }
+    status = TaskMonitor.get().createRPCStatus(Thread.currentThread().getName());
+    status.pause("Waiting for a call");
+    RpcServer.MONITORED_RPC.set(status);
+    return status;
+  }
+
   /** Returns the remote side ip address when invoked inside an RPC
    *  Returns null incase of an error.
    *  @return InetAddress

http://git-wip-us.apache.org/repos/asf/hbase/blob/ccded0bd/hbase-server/src/test/java/org/apache/hadoop/hbase/ipc/TestCallRunner.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/ipc/TestCallRunner.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/ipc/TestCallRunner.java
index 8cbef91..e8759c5 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/ipc/TestCallRunner.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/ipc/TestCallRunner.java
@@ -17,6 +17,7 @@
  */
 package org.apache.hadoop.hbase.ipc;
 
+import org.apache.hadoop.hbase.monitoring.MonitoredRPCHandlerImpl;
 import org.apache.hadoop.hbase.testclassification.SmallTests;
 import org.apache.hadoop.hbase.security.UserProvider;
 import org.junit.Test;
@@ -35,6 +36,7 @@ public class TestCallRunner {
     RpcServer.Call mockCall = Mockito.mock(RpcServer.Call.class);
     mockCall.connection = Mockito.mock(RpcServer.Connection.class);
     CallRunner cr = new CallRunner(mockRpcServer, mockCall, new UserProvider());
+    cr.setStatus(new MonitoredRPCHandlerImpl());
     cr.run();
   }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/hbase/blob/ccded0bd/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 3c50150..fc9e8a2 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
@@ -30,6 +30,9 @@ 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.client.Put;
+import org.apache.hadoop.hbase.monitoring.MonitoredRPCHandlerImpl;
+import org.apache.hadoop.hbase.security.User;
 import org.apache.hadoop.hbase.testclassification.SmallTests;
 import org.apache.hadoop.hbase.client.Put;
 import org.apache.hadoop.hbase.ipc.RpcServer.Call;
@@ -88,6 +91,7 @@ public class TestSimpleRpcScheduler {
     scheduler.init(CONTEXT);
     scheduler.start();
     CallRunner task = createMockTask();
+    task.setStatus(new MonitoredRPCHandlerImpl());
     scheduler.dispatch(task);
     verify(task, timeout(1000)).run();
     scheduler.stop();
@@ -122,6 +126,7 @@ public class TestSimpleRpcScheduler {
       }
     };
     for (CallRunner task : tasks) {
+      task.setStatus(new MonitoredRPCHandlerImpl());
       doAnswer(answerToRun).when(task).run();
     }
 
@@ -302,6 +307,7 @@ public class TestSimpleRpcScheduler {
 
   private void doAnswerTaskExecution(final CallRunner callTask,
       final ArrayList<Integer> results, final int value, final int sleepInterval) {
+    callTask.setStatus(new MonitoredRPCHandlerImpl());
     doAnswer(new Answer<Object>() {
       @Override
       public Object answer(InvocationOnMock invocation) {


Mime
View raw message