hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From l...@apache.org
Subject hbase git commit: HBASE-16972 Log more details for Scan#next request when responseTooSlow
Date Wed, 02 Nov 2016 07:03:17 GMT
Repository: hbase
Updated Branches:
  refs/heads/branch-1 961b95217 -> 514add008


HBASE-16972 Log more details for Scan#next request when responseTooSlow


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

Branch: refs/heads/branch-1
Commit: 514add00867631f5f3c83caad6bb5c172ac8c1f0
Parents: 961b952
Author: Yu Li <liyu@apache.org>
Authored: Wed Nov 2 14:33:44 2016 +0800
Committer: Yu Li <liyu@apache.org>
Committed: Wed Nov 2 14:33:44 2016 +0800

----------------------------------------------------------------------
 .../org/apache/hadoop/hbase/ipc/RpcServer.java  | 23 ++++++++++++++++++++
 .../hadoop/hbase/ipc/RpcServerInterface.java    |  3 +++
 .../hbase/regionserver/RSRpcServices.java       | 12 ++++++++++
 3 files changed, 38 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/514add00/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 c2698b1..e603c4a 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
@@ -94,6 +94,7 @@ import org.apache.hadoop.hbase.io.BoundedByteBufferPool;
 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.ClientProtos;
 import org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.VersionInfo;
 import org.apache.hadoop.hbase.protobuf.generated.RPCProtos.CellBlockMeta;
 import org.apache.hadoop.hbase.protobuf.generated.RPCProtos.ConnectionHeader;
@@ -102,6 +103,7 @@ import org.apache.hadoop.hbase.protobuf.generated.RPCProtos.RequestHeader;
 import org.apache.hadoop.hbase.protobuf.generated.RPCProtos.ResponseHeader;
 import org.apache.hadoop.hbase.protobuf.generated.RPCProtos.UserInformation;
 import org.apache.hadoop.hbase.regionserver.HRegionServer;
+import org.apache.hadoop.hbase.regionserver.RSRpcServices;
 import org.apache.hadoop.hbase.security.AccessDeniedException;
 import org.apache.hadoop.hbase.security.AuthMethod;
 import org.apache.hadoop.hbase.security.HBasePolicyProvider;
@@ -304,6 +306,12 @@ public class RpcServer implements RpcServerInterface, ConfigurationObserver
{
   private volatile boolean allowFallbackToSimpleAuth;
 
   /**
+   * Used to get details for scan with a scanner_id<br/>
+   * TODO try to figure out a better way and remove reference from regionserver package later.
+   */
+  private RSRpcServices rsRpcServices;
+
+  /**
    * Datastructure that holds all necessary to a method invocation and then afterward, carries
    * the result.
    */
@@ -2413,6 +2421,16 @@ public class RpcServer implements RpcServerInterface, ConfigurationObserver
{
     responseInfo.put("method", methodName);
     responseInfo.put("call", call);
     responseInfo.put("param", ProtobufUtil.getShortTextFormat(param));
+    if (param instanceof ClientProtos.ScanRequest && rsRpcServices != null) {
+      ClientProtos.ScanRequest request = ((ClientProtos.ScanRequest) param);
+      if (request.hasScannerId()) {
+        long scannerId = request.getScannerId();
+        String scanDetails = rsRpcServices.getScanDetailsWithId(scannerId);
+        if (scanDetails != null) {
+          responseInfo.put("scandetails", scanDetails);
+        }
+      }
+    }
     LOG.warn("(response" + tag + "): " + MAPPER.writeValueAsString(responseInfo));
   }
 
@@ -2737,4 +2755,9 @@ public class RpcServer implements RpcServerInterface, ConfigurationObserver
{
   public RpcScheduler getScheduler() {
     return scheduler;
   }
+
+  @Override
+  public void setRsRpcServices(RSRpcServices rsRpcServices) {
+    this.rsRpcServices = rsRpcServices;
+  }
 }

http://git-wip-us.apache.org/repos/asf/hbase/blob/514add00/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/RpcServerInterface.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/RpcServerInterface.java
b/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/RpcServerInterface.java
index 5a9092b..bae5a0a 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/RpcServerInterface.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/RpcServerInterface.java
@@ -27,6 +27,7 @@ import org.apache.hadoop.hbase.classification.InterfaceStability;
 import org.apache.hadoop.hbase.CellScanner;
 import org.apache.hadoop.hbase.HBaseInterfaceAudience;
 import org.apache.hadoop.hbase.monitoring.MonitoredRPCHandler;
+import org.apache.hadoop.hbase.regionserver.RSRpcServices;
 import org.apache.hadoop.hbase.util.Pair;
 import org.apache.hadoop.security.authorize.PolicyProvider;
 
@@ -83,4 +84,6 @@ public interface RpcServerInterface {
   void refreshAuthManager(PolicyProvider pp);
   
   RpcScheduler getScheduler();
+
+  void setRsRpcServices(RSRpcServices rsRpcServices);
 }

http://git-wip-us.apache.org/repos/asf/hbase/blob/514add00/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 835f1b2..26fec14 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
@@ -984,6 +984,7 @@ public class RSRpcServices implements HBaseRPCErrorHandler,
           bindAddress, // use final bindAddress for this server.
           rs.conf,
           rpcSchedulerFactory.create(rs.conf, this, rs));
+      rpcServer.setRsRpcServices(this);
     } catch (BindException be) {
       String configName = (this instanceof MasterRpcServices) ? HConstants.MASTER_PORT :
           HConstants.REGIONSERVER_PORT;
@@ -1049,6 +1050,17 @@ public class RSRpcServices implements HBaseRPCErrorHandler,
     return null;
   }
 
+  public String getScanDetailsWithId(long scannerId) {
+    RegionScanner scanner = getScanner(scannerId);
+    if (scanner == null) {
+      return null;
+    }
+    StringBuilder builder = new StringBuilder();
+    builder.append("table: ").append(scanner.getRegionInfo().getTable().getNameAsString());
+    builder.append(" region: ").append(scanner.getRegionInfo().getRegionNameAsString());
+    return builder.toString();
+  }
+
   /**
    * Get the vtime associated with the scanner.
    * Currently the vtime is the number of "next" calls.


Mime
View raw message