smengcl commented on code in PR #6256:
URL: https://github.com/apache/ozone/pull/6256#discussion_r1501078828


##########
hadoop-hdds/client/src/main/java/org/apache/hadoop/hdds/scm/storage/BlockOutputStream.java:
##########
@@ -855,7 +855,12 @@ private void appendLastChunkBuffer(ChunkBuffer 
chunkBuffer, int offset,
         try {
           LOG.debug("put into last chunk buffer start = {} len = {}",
               copyStart, copyLen);
-          lastChunkBuffer.put(bb.array(), copyStart, copyLen);
+          int origPos = bb.position();
+          int origLimit = bb.limit();
+          bb.position(copyStart).limit(copyStart + copyLen);
+          lastChunkBuffer.put(bb);
+          bb.position(origPos).limit(origLimit);
+          //lastChunkBuffer.put(bb.array(), copyStart, copyLen);

Review Comment:
   We can probably wrap this line in `if (buffer.hasArray())` just like this 
does:
   
   
https://github.com/apache/ozone/blob/cb35e7ed1c7fb2eef71c2b8a4ff5624c322c5511/hadoop-hdds/client/src/main/java/org/apache/hadoop/ozone/client/io/ByteArrayStreamOutput.java#L44-L46



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