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

weichiu pushed a commit to branch HDDS-7593
in repository https://gitbox.apache.org/repos/asf/ozone.git


The following commit(s) were added to refs/heads/HDDS-7593 by this push:
     new 9b134354c2 HDDS-10361. [hsync] Output stream should support direct 
byte buffer. (#6256)
9b134354c2 is described below

commit 9b134354c20dc52e4be7b09a36603e7d0bdb57f7
Author: Wei-Chiu Chuang <[email protected]>
AuthorDate: Mon Feb 26 14:14:27 2024 -0800

    HDDS-10361. [hsync] Output stream should support direct byte buffer. (#6256)
    
    Co-authored-by: Siyao Meng <[email protected]>
---
 .../java/org/apache/hadoop/hdds/scm/storage/BlockOutputStream.java  | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git 
a/hadoop-hdds/client/src/main/java/org/apache/hadoop/hdds/scm/storage/BlockOutputStream.java
 
b/hadoop-hdds/client/src/main/java/org/apache/hadoop/hdds/scm/storage/BlockOutputStream.java
index a6cd98e48a..b676b1dc23 100644
--- 
a/hadoop-hdds/client/src/main/java/org/apache/hadoop/hdds/scm/storage/BlockOutputStream.java
+++ 
b/hadoop-hdds/client/src/main/java/org/apache/hadoop/hdds/scm/storage/BlockOutputStream.java
@@ -855,7 +855,11 @@ public class BlockOutputStream extends OutputStream {
         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);
         } catch (BufferOverflowException e) {
           LOG.error("appending from " + copyStart + " for len=" + copyLen +
               ". lastChunkBuffer remaining=" + lastChunkBuffer.remaining() +


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

Reply via email to