From 1ada99b0bd11d12038f2ed50a0166b5b72d4985e Mon Sep 17 00:00:00 2001 From: "Doroszlai, Attila" <6454655+adoroszlai@users.noreply.github.com> Date: Thu, 19 Sep 2019 19:58:33 +0200 Subject: [PATCH] HDDS-2151. Ozone client logs the entire request payload at DEBUG level (#1477) --- .../hadoop/hdds/scm/XceiverClientRatis.java | 25 ++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/hadoop-hdds/client/src/main/java/org/apache/hadoop/hdds/scm/XceiverClientRatis.java b/hadoop-hdds/client/src/main/java/org/apache/hadoop/hdds/scm/XceiverClientRatis.java index e2f0299ce3c..3d836754ed1 100644 --- a/hadoop-hdds/client/src/main/java/org/apache/hadoop/hdds/scm/XceiverClientRatis.java +++ b/hadoop-hdds/client/src/main/java/org/apache/hadoop/hdds/scm/XceiverClientRatis.java @@ -218,13 +218,36 @@ public final class XceiverClientRatis extends XceiverClientSpi { .build(); boolean isReadOnlyRequest = HddsUtils.isReadOnly(finalPayload); ByteString byteString = finalPayload.toByteString(); - LOG.debug("sendCommandAsync {} {}", isReadOnlyRequest, finalPayload); + if (LOG.isDebugEnabled()) { + LOG.debug("sendCommandAsync {} {}", isReadOnlyRequest, + sanitizeForDebug(finalPayload)); + } return isReadOnlyRequest ? getClient().sendReadOnlyAsync(() -> byteString) : getClient().sendAsync(() -> byteString); } } + private ContainerCommandRequestProto sanitizeForDebug( + ContainerCommandRequestProto request) { + switch (request.getCmdType()) { + case PutSmallFile: + return request.toBuilder() + .setPutSmallFile(request.getPutSmallFile().toBuilder() + .clearData() + ) + .build(); + case WriteChunk: + return request.toBuilder() + .setWriteChunk(request.getWriteChunk().toBuilder() + .clearData() + ) + .build(); + default: + return request; + } + } + // gets the minimum log index replicated to all servers @Override public long getReplicatedMinCommitIndex() {