From 17c120f08c2689e7f62b60906c007fd98b078290 Mon Sep 17 00:00:00 2001 From: Jean-Daniel Cryans Date: Wed, 14 Aug 2013 20:48:54 +0000 Subject: [PATCH] HBASE-8719 Fix responseTooSlow formatting git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1514036 13f79535-47bb-0310-9956-ffa450edef68 --- .../hadoop/hbase/protobuf/ProtobufUtil.java | 19 +++++++++++++++++++ .../hadoop/hbase/ipc/RpcCallContext.java | 2 +- .../apache/hadoop/hbase/ipc/RpcServer.java | 8 +++++--- .../hadoop/hbase/regionserver/HRegion.java | 2 +- 4 files changed, 26 insertions(+), 5 deletions(-) diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/protobuf/ProtobufUtil.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/protobuf/ProtobufUtil.java index 4386bc8e8f9..822cefe63e5 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/protobuf/ProtobufUtil.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/protobuf/ProtobufUtil.java @@ -2227,10 +2227,29 @@ public final class ProtobufUtil { return TextFormat.shortDebugString(m); } else if (m instanceof MutationProto) { return toShortString((MutationProto)m); + } else if (m instanceof GetRequest) { + GetRequest r = (GetRequest) m; + return "region= " + getStringForByteString(r.getRegion().getValue()) + + ", row=" + getStringForByteString(r.getGet().getRow()); + } else if (m instanceof ClientProtos.MultiRequest) { + ClientProtos.MultiRequest r = (ClientProtos.MultiRequest) m; + ClientProtos.MultiAction action = r.getActionList().get(0); + return "region= " + getStringForByteString(r.getRegion().getValue()) + + ", for " + r.getActionCount() + + " actions and 1st row key=" + getStringForByteString(action.hasMutation() ? + action.getMutation().getRow() : action.getGet().getRow()); + } else if (m instanceof ClientProtos.MutateRequest) { + ClientProtos.MutateRequest r = (ClientProtos.MutateRequest) m; + return "region= " + getStringForByteString(r.getRegion().getValue()) + + ", row=" + getStringForByteString(r.getMutation().getRow()); } return "TODO: " + m.getClass().toString(); } + private static String getStringForByteString(ByteString bs) { + return Bytes.toStringBinary(bs.toByteArray()); + } + /** * Print out some subset of a MutationProto rather than all of it and its data * @param proto Protobuf to print out diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/RpcCallContext.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/RpcCallContext.java index fd7b6acdab4..cf2687cb918 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/RpcCallContext.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/RpcCallContext.java @@ -24,5 +24,5 @@ public interface RpcCallContext extends Delayable { * If called from outside the context of IPC, this does nothing. * @throws CallerDisconnectedException */ - void throwExceptionIfCallerDisconnected() throws CallerDisconnectedException; + void throwExceptionIfCallerDisconnected(String regionName) throws CallerDisconnectedException; } 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 842363d6138..2742891875c 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 @@ -437,12 +437,14 @@ public class RpcServer implements RpcServerInterface { } @Override - public void throwExceptionIfCallerDisconnected() throws CallerDisconnectedException { + public void throwExceptionIfCallerDisconnected(String regionName) + throws CallerDisconnectedException { if (!connection.channel.isOpen()) { long afterTime = System.currentTimeMillis() - timestamp; throw new CallerDisconnectedException( - "Aborting call " + this + " after " + afterTime + " ms, since " + - "caller disconnected"); + "Aborting on region " + regionName + ", call " + + this + " after " + afterTime + " ms, since " + + "caller disconnected"); } } diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java index a5b396f495f..e24167f1456 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java @@ -3607,7 +3607,7 @@ public class HRegion implements HeapSize { // , Writable{ // client might time out and disconnect while the server side // is still processing the request. We should abort aggressively // in that case. - rpcCall.throwExceptionIfCallerDisconnected(); + rpcCall.throwExceptionIfCallerDisconnected(getRegionNameAsString()); } // Let's see what we have in the storeHeap.