HBASE-20826 Truncate really long RpcServer warnings unless TRACE is on Signed-off-by: zhangduo <[email protected]> Signed-off-by: Ted Yu <[email protected]> Signed-off-by: Michael Stack <[email protected]>
Project: http://git-wip-us.apache.org/repos/asf/hbase/repo Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/a5c69c8a Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/a5c69c8a Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/a5c69c8a Branch: refs/heads/branch-1.2 Commit: a5c69c8ab44430879dd417043bab0dc86b04063e Parents: 3845c08 Author: Josh Elser <[email protected]> Authored: Fri Jun 29 15:19:59 2018 -0400 Committer: Andrew Purtell <[email protected]> Committed: Thu Jul 5 17:22:20 2018 -0700 ---------------------------------------------------------------------- .../main/java/org/apache/hadoop/hbase/ipc/RpcServer.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hbase/blob/a5c69c8a/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 7137530..4a973c6 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 @@ -2278,7 +2278,14 @@ public class RpcServer implements RpcServerInterface, ConfigurationObserver { responseInfo.put("class", server == null? "": server.getClass().getSimpleName()); responseInfo.put("method", methodName); responseInfo.put("call", call); - responseInfo.put("param", ProtobufUtil.getShortTextFormat(param)); + // The params could be really big, make sure they don't kill us at WARN + String stringifiedParam = ProtobufUtil.getShortTextFormat(param); + if (stringifiedParam.length() > 150) { + // Truncate to 1000 chars if TRACE is on, else to 150 chars + stringifiedParam = stringifiedParam.subSequence( + 0, LOG.isTraceEnabled() ? 1000 : 150) + " <TRUNCATED>"; + } + responseInfo.put("param", stringifiedParam); if (param instanceof ClientProtos.ScanRequest && rsRpcServices != null) { ClientProtos.ScanRequest request = ((ClientProtos.ScanRequest) param); if (request.hasScannerId()) {
