szetszwo commented on code in PR #6342:
URL: https://github.com/apache/ozone/pull/6342#discussion_r1516639760


##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/ha/SCMRatisResponse.java:
##########
@@ -87,14 +86,13 @@ public static SCMRatisResponse decode(RaftClientReply reply)
       return new SCMRatisResponse(reply.getException());
     }
 
-    final byte[] response = reply.getMessage().getContent().toByteArray();
+    final ByteString response = reply.getMessage().getContent();
 
-    if (response.length == 0) {
+    if (response.isEmpty()) {
       return new SCMRatisResponse();
     }
 
-    final SCMRatisResponseProto responseProto = SCMRatisResponseProto
-        .parseFrom(response);
+    final SCMRatisResponseProto responseProto = 
SCMRatisResponseProto.parseFrom(response.toByteArray());

Review Comment:
   @duongkame , thanks for reviewing this! 
   
   The method `parseFrom(InputStream)` will call `new 
CodedInputStream(InputStream)`, which creates a `byte[]` in the 
`CodedInputStream` constructor.  Since it is `InputStream`, it probably will 
copy at least two times.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to