HDDS-2151. Ozone client logs the entire request payload at DEBUG level (#1477)

This commit is contained in:
Doroszlai, Attila 2019-09-19 19:58:33 +02:00 committed by Bharat Viswanadham
parent f260b5aa5b
commit 1ada99b0bd
1 changed files with 24 additions and 1 deletions

View File

@ -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() {