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


##########
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:
   Can use the below to avoid creating new buffer too.
   ```
   final SCMRatisResponseProto responseProto = 
SCMRatisResponseProto.parseFrom(response.newInput());
   ```



-- 
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