bbeaudreault commented on code in PR #5481: URL: https://github.com/apache/hbase/pull/5481#discussion_r1373529325
########## hbase-server/src/main/java/org/apache/hadoop/hbase/namequeues/RpcLogDetails.java: ########## @@ -60,6 +66,40 @@ public RpcLogDetails(RpcCall rpcCall, Message param, String clientAddress, long // would result in corrupted attributes this.connectionAttributes = rpcCall.getConnectionAttributes(); this.requestAttributes = rpcCall.getRequestAttributes(); + + // We also need to deep copy the message because the CodedInputStream may be + // overwritten before this slow log is consumed. Such overwriting could + // cause the slow log payload to be corrupt + try { + if (param instanceof ClientProtos.ScanRequest) { + ClientProtos.ScanRequest scanRequest = (ClientProtos.ScanRequest) param; + this.param = ClientProtos.ScanRequest.parseFrom(scanRequest.toByteArray()); + } else if (param instanceof ClientProtos.MutationProto) { + ClientProtos.MutationProto mutationProto = (ClientProtos.MutationProto) param; + this.param = ClientProtos.MutationProto.parseFrom(mutationProto.toByteArray()); + } else if (param instanceof ClientProtos.GetRequest) { + ClientProtos.GetRequest getRequest = (ClientProtos.GetRequest) param; + this.param = ClientProtos.GetRequest.parseFrom(getRequest.toByteArray()); + } else if (param instanceof ClientProtos.MultiRequest) { + ClientProtos.MultiRequest multiRequest = (ClientProtos.MultiRequest) param; + this.param = ClientProtos.MultiRequest.parseFrom(multiRequest.toByteArray()); + } else if (param instanceof ClientProtos.MutateRequest) { + ClientProtos.MutateRequest mutateRequest = (ClientProtos.MutateRequest) param; + this.param = ClientProtos.MutateRequest.parseFrom(mutateRequest.toByteArray()); + } else if (param instanceof ClientProtos.CoprocessorServiceRequest) { + ClientProtos.CoprocessorServiceRequest coprocessorServiceRequest = + (ClientProtos.CoprocessorServiceRequest) param; + this.param = + ClientProtos.CoprocessorServiceRequest.parseFrom(coprocessorServiceRequest.toByteArray()); + } else { + this.param = param; + } + } catch (InvalidProtocolBufferException e) { + LOG.error("Failed to parse protobuf for message {}", param, e); + if (this.param == null) { + this.param = param; + } + } Review Comment: Can you try `message.newBuilderForType().mergeFrom(message.toByteArray())`? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@hbase.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org