From 154b77307fd702f4794213d1713a80516cd3c9bd Mon Sep 17 00:00:00 2001 From: Josh Elser Date: Fri, 29 Jun 2018 15:19:59 -0400 Subject: [PATCH] HBASE-20826 Truncate really long RpcServer warnings unless TRACE is on Signed-off-by: zhangduo Signed-off-by: Ted Yu Signed-off-by: Michael Stack --- .../main/java/org/apache/hadoop/hbase/ipc/RpcServer.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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 bc3b33ad7e9..c4c7360c2e4 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 @@ -2441,7 +2441,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) + " "; + } + responseInfo.put("param", stringifiedParam); if (param instanceof ClientProtos.ScanRequest && rsRpcServices != null) { ClientProtos.ScanRequest request = ((ClientProtos.ScanRequest) param); if (request.hasScannerId()) {