This is an automated email from the ASF dual-hosted git repository.

dineshc pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hadoop-ozone.git


The following commit(s) were added to refs/heads/master by this push:
     new a42aa72  HDDS-3815. Avoid buffer copy in ContainerCommandRequestProto. 
(#1085)
a42aa72 is described below

commit a42aa722de69274a2d695c2e2f7f79a8e1b4fddc
Author: Mukul Kumar Singh <[email protected]>
AuthorDate: Tue Jun 23 08:17:18 2020 +0530

    HDDS-3815. Avoid buffer copy in ContainerCommandRequestProto. (#1085)
    
    Co-authored-by: Doroszlai, Attila <[email protected]>
---
 .../apache/hadoop/hdds/ratis/ContainerCommandRequestMessage.java    | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git 
a/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/ratis/ContainerCommandRequestMessage.java
 
b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/ratis/ContainerCommandRequestMessage.java
index 0a20f10..3bf0b13 100644
--- 
a/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/ratis/ContainerCommandRequestMessage.java
+++ 
b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/ratis/ContainerCommandRequestMessage.java
@@ -61,9 +61,11 @@ public final class ContainerCommandRequestMessage implements 
Message {
   public static ContainerCommandRequestProto toProto(
       ByteString bytes, RaftGroupId groupId)
       throws InvalidProtocolBufferException {
-    final int i = 4 + bytes.asReadOnlyByteBuffer().getInt();
+    final int i = Integer.BYTES + bytes.substring(0, Integer.BYTES)
+        .asReadOnlyByteBuffer().getInt();
     final ContainerCommandRequestProto header
-        = ContainerCommandRequestProto.parseFrom(bytes.substring(4, i));
+        = ContainerCommandRequestProto
+        .parseFrom(bytes.substring(Integer.BYTES, i));
     // TODO: setting pipeline id can be avoided if the client is sending it.
     //       In such case, just have to validate the pipeline id.
     final ContainerCommandRequestProto.Builder b = header.toBuilder();


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

Reply via email to