You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by "chungen0126 (via GitHub)" <gi...@apache.org> on 2026/07/14 15:17:08 UTC

[PR] HDDS-15734. Implementing position read in BlockInputStream [ozone]

chungen0126 opened a new pull request, #10765:
URL: https://github.com/apache/ozone/pull/10765

   ## What changes were proposed in this pull request?
   ### Summary
   To resolve the significant lock contention experienced during concurrent readVectored operations, this PR implements the ByteBufferPositionedReadable interface for both BlockInputStream and ChunkInputStream. By supporting thread-safe, position-based reads directly into ByteBuffer, we bypass the synchronization overhead of traditional stream locks and greatly improve parallel read performance.  
   ### Detailed Changes
   1. Improve Visibility of Initialization State
   
     - Declared the initialized flag as volatile. This ensures that once the stream is initialized, the state change is instantly visible to all other concurrent threads, preventing redundant initialization. 
   
   2. Locking for Stream Refresh/Re-acquisition
   
     - Introduced a ReentrantLock (passed from BlockInputStream to ChunkInputStream) to guard critical operations such as refreshBlockInfo, acquireClient, and handling read errors. This ensures thread safety during network/client state transitions without locking the entire read path.  
   
   3. Avoid Redundant Pipeline Refreshing
   
     - Added a failedPipeline variable to track the pipeline that encountered an issue.  
     - During refreshBlockInfo, the stream now checks if the current pipeline matches failedPipeline. If it does, the redundant refresh operation is skipped, preventing multiple threads from hammering the refresh logic concurrently for the same failure.  
   
   ## What is the link to the Apache JIRA
   
   https://issues.apache.org/jira/browse/HDDS-15734
   
   ## How was this patch tested?
   
   Add test in `TestChunkInputStream` and `TestBlockInputStream`.
   CI: https://github.com/chungen0126/ozone/actions/runs/29289303279
   


-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-15734. Implementing position read in BlockInputStream [ozone]

Posted by "yandrey321 (via GitHub)" <gi...@apache.org>.
yandrey321 commented on code in PR #10765:
URL: https://github.com/apache/ozone/pull/10765#discussion_r3595929355


##########
hadoop-hdds/client/src/main/java/org/apache/hadoop/hdds/scm/storage/BlockInputStream.java:
##########
@@ -518,15 +646,35 @@ private synchronized void storePosition() {
   }
 
   private void handleReadError(IOException cause) throws IOException {
-    releaseClient();
-    final List<ChunkInputStream> inputStreams = this.chunkStreams;
-    if (inputStreams != null) {
-      for (ChunkInputStream is : inputStreams) {
-        is.releaseClient();
+    lock.lock();
+    try {
+      releaseClient();
+      final List<ChunkInputStream> inputStreams = this.chunkStreams;
+      if (inputStreams != null) {
+        for (ChunkInputStream is : inputStreams) {
+          is.releaseClient();
+        }
       }
+      refreshBlockInfo(cause);
+    } finally {
+      lock.unlock();
     }
+  }
 
-    refreshBlockInfo(cause);
+  private void handlePositionReadError(IOException cause, Pipeline pipeline) throws IOException {
+    lock.lock();
+    try {
+      releaseClient();
+      final List<ChunkInputStream> inputStreams = this.chunkStreams;
+      if (inputStreams != null) {
+        for (ChunkInputStream is : inputStreams) {
+          is.releaseClient();

Review Comment:
   should it be wrapped in try catch?



-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-15734. Implementing position read in BlockInputStream [ozone]

Posted by "jojochuang (via GitHub)" <gi...@apache.org>.
jojochuang commented on PR #10765:
URL: https://github.com/apache/ozone/pull/10765#issuecomment-4977279858

   ## Bugbot review
   
   **readFully succeeds at EOF** — `hadoop-hdds/client/src/main/java/org/apache/hadoop/hdds/scm/storage/BlockInputStream.java:328-338` · Severity: high
   
   `readFully` returns `true` when the target offset is at or past the end of the block, or when no bytes can be read from the current chunk, instead of throwing `EOFException` or otherwise signaling failure. Callers such as `OzoneFSInputStream` treat a `true` return as a completed positioned read and compute bytes transferred from buffer remaining; an unfilled buffer yields zero bytes read while `hasRemaining()` stays true, which can spin forever or return silently short reads.
   
   **Positioned read leaks clients** — `hadoop-hdds/client/src/main/java/org/apache/hadoop/hdds/scm/storage/ChunkInputStream.java:833-851` · Severity: high
   
   `getClientAndUpdateBlock` calls `acquireClientForReadData` on every positioned `read(long, ByteBuffer)` but never calls `releaseClientForReadData`. `BlockInputStream.readFully` uses this path for each chunk segment, so each positioned read leaks an xceiver client and its connections.
   
   **readFully checks buffer capacity** — `hadoop-hdds/client/src/main/java/org/apache/hadoop/hdds/scm/storage/ChunkInputStream.java:824-830` · Severity: medium
   
   `readFully` compares the result of `read` against `byteBuffer.capacity()` instead of the number of bytes the caller asked to fill (`byteBuffer.remaining()` at entry). For a buffer with a non-zero position or a limit below capacity, a successful read can incorrectly throw `EOFException`, or accept a short read as complete.
   
   **Refresh skipped after first failure** — `hadoop-hdds/client/src/main/java/org/apache/hadoop/hdds/scm/storage/BlockInputStream.java:217-223` · Severity: medium
   
   After the first refresh attempt for a pipeline, `failedPipeline` is set to the current `pipelineRef` even when refresh did not obtain new location info. Later connectivity failures on the same pipeline skip `refreshBlockInfo` entirely, so stale pipeline/token metadata may never be refreshed again during retries.
   
   ---
   Generated-by: Cursor Bugbot


-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-15734. Implementing position read in BlockInputStream [ozone]

Posted by "chungen0126 (via GitHub)" <gi...@apache.org>.
chungen0126 commented on PR #10765:
URL: https://github.com/apache/ozone/pull/10765#issuecomment-5410632066

   Thanks @jojochuang and @yandrey321 for reviewing. I noticed that #11102 works on this issue, and I think it provides a better solution. Let's switch our focus and review that one instead.


-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-15734. Implementing position read in BlockInputStream [ozone]

Posted by "yandrey321 (via GitHub)" <gi...@apache.org>.
yandrey321 commented on code in PR #10765:
URL: https://github.com/apache/ozone/pull/10765#discussion_r3596154257


##########
hadoop-hdds/client/src/test/java/org/apache/hadoop/hdds/scm/storage/TestChunkInputStream.java:
##########
@@ -284,4 +284,26 @@ public void connectsToNewPipeline() throws Exception {
       verify(newToken).encodeToUrlString();
     }
   }
+
+  @Test
+  public void testPositionedRead() throws Exception {
+    byte[] buffer = new byte[50];
+    ByteBuffer byteBuffer = ByteBuffer.wrap(buffer);
+    int bytesRead = chunkStream.read(30, byteBuffer);
+
+    assertEquals(50, bytesRead);
+    byte[] expected = Arrays.copyOfRange(chunkData, 30, 80);
+    assertArrayEquals(expected, buffer);
+  }
+
+  @Test
+  public void testPositionedReadFully() throws Exception {

Review Comment:
   how do we assert that stream was read till the end as text name suggest?



-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-15734. Implementing position read in BlockInputStream [ozone]

Posted by "chungen0126 (via GitHub)" <gi...@apache.org>.
chungen0126 commented on code in PR #10765:
URL: https://github.com/apache/ozone/pull/10765#discussion_r3596215556


##########
hadoop-hdds/client/src/main/java/org/apache/hadoop/hdds/scm/storage/BlockInputStream.java:
##########
@@ -289,7 +313,106 @@ protected synchronized void addStream(ChunkInfo chunkInfo) {
 
   protected ChunkInputStream createChunkInputStream(ChunkInfo chunkInfo) {
     return new ChunkInputStream(chunkInfo, blockID,
-        xceiverClientFactory, pipelineRef::get, verifyChecksum, tokenRef::get);
+        xceiverClientFactory, pipelineRef::get, verifyChecksum, tokenRef::get, lock);
+  }
+
+  @Override
+  public boolean readFully(long pos, ByteBuffer buffer) throws IOException {
+    Preconditions.checkArgument(buffer != null);
+    if (!initialized) {
+      initialize();
+    }
+
+    if (pos < 0 || pos > length) {
+      if (pos == 0) {
+        // It is possible for length and pos to be zero in which case
+        // seek should return instead of throwing exception
+        return true;
+      }
+      throw new EOFException(
+          "EOF encountered at pos: " + pos + " for block: " + blockID);
+    }
+
+    checkOpen();
+    int len = buffer.remaining();
+    int innerRetries = 0;
+    int chunkIdx = Arrays.binarySearch(chunkOffsets, pos);
+    if (chunkIdx < 0) {

Review Comment:
   If the binary search doesn't find an exact match in the array, it returns a negative number. For details, please see: https://docs.oracle.com/javase/8/docs/api/java/util/Arrays.html#binarySearch-int:A-int-
   



-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-15734. Implementing position read in BlockInputStream [ozone]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #10765:
URL: https://github.com/apache/ozone/pull/10765#issuecomment-5304848421

   Thank you for your contribution. This PR is being closed due to inactivity. Please contact a maintainer if you would like to reopen it.


-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-15734. Implementing position read in BlockInputStream [ozone]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] closed pull request #10765: HDDS-15734. Implementing position read in BlockInputStream
URL: https://github.com/apache/ozone/pull/10765


-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-15734. Implementing position read in BlockInputStream [ozone]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #10765:
URL: https://github.com/apache/ozone/pull/10765#issuecomment-5223399009

   This PR has been marked as stale due to 21 days of inactivity. Please comment or remove the stale label to keep it open. Otherwise, it will be automatically closed in 7 days.


-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-15734. Implementing position read in BlockInputStream [ozone]

Posted by "chungen0126 (via GitHub)" <gi...@apache.org>.
chungen0126 commented on code in PR #10765:
URL: https://github.com/apache/ozone/pull/10765#discussion_r3600123810


##########
hadoop-hdds/client/src/test/java/org/apache/hadoop/hdds/scm/storage/TestChunkInputStream.java:
##########
@@ -284,4 +284,26 @@ public void connectsToNewPipeline() throws Exception {
       verify(newToken).encodeToUrlString();
     }
   }
+
+  @Test
+  public void testPositionedRead() throws Exception {
+    byte[] buffer = new byte[50];
+    ByteBuffer byteBuffer = ByteBuffer.wrap(buffer);
+    int bytesRead = chunkStream.read(30, byteBuffer);
+
+    assertEquals(50, bytesRead);
+    byte[] expected = Arrays.copyOfRange(chunkData, 30, 80);
+    assertArrayEquals(expected, buffer);
+  }
+
+  @Test
+  public void testPositionedReadFully() throws Exception {

Review Comment:
   As it stands, this method will read as much as possible until either the buffer is full or the stream reaches EOF (End of File). The only way we can verify if we've reached the end of the stream is by checking the final remaining length of the buffer.
   
   However, looking at how the upper-level BlockInputStream actually uses it, we might not even need this method. I think we should consider removing it entirely. What do you think?
   
   Here is how the overall architecture/flow would look:
   
   If the stream reaches EOF but the buffer is not yet full:
   
   1. ChunkInputStream returns normally to BlockInputStream.
   
   2. BlockInputStream has two choices:
   
         a. If there is another ChunkInputStream available, switch to it and continue reading (loop back).
         b. If there are no more chunks, return to MultiPartInputStream.
   
   4. MultiPartInputStream also has two choices:
   
         a. If there is another BlockInputStream available, switch to it (loop back).
         b. If there are no more blocks AND the buffer is still not full, throw an EOFException.



-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-15734. Implementing position read in BlockInputStream [ozone]

Posted by "chungen0126 (via GitHub)" <gi...@apache.org>.
chungen0126 commented on code in PR #10765:
URL: https://github.com/apache/ozone/pull/10765#discussion_r3600133619


##########
hadoop-hdds/client/src/test/java/org/apache/hadoop/hdds/scm/storage/TestChunkInputStream.java:
##########
@@ -284,4 +284,26 @@ public void connectsToNewPipeline() throws Exception {
       verify(newToken).encodeToUrlString();
     }
   }
+
+  @Test
+  public void testPositionedRead() throws Exception {
+    byte[] buffer = new byte[50];
+    ByteBuffer byteBuffer = ByteBuffer.wrap(buffer);
+    int bytesRead = chunkStream.read(30, byteBuffer);
+
+    assertEquals(50, bytesRead);

Review Comment:
   The buffer is filled until the stream reaches its end. For example, if the buffer capacity is 50 but only 10 bytes are left in the stream, only the first 10 bytes of the buffer will be filled.



-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-15734. Implementing position read in BlockInputStream [ozone]

Posted by "yandrey321 (via GitHub)" <gi...@apache.org>.
yandrey321 commented on code in PR #10765:
URL: https://github.com/apache/ozone/pull/10765#discussion_r3596132920


##########
hadoop-hdds/client/src/test/java/org/apache/hadoop/hdds/scm/storage/TestChunkInputStream.java:
##########
@@ -284,4 +284,26 @@ public void connectsToNewPipeline() throws Exception {
       verify(newToken).encodeToUrlString();
     }
   }
+
+  @Test
+  public void testPositionedRead() throws Exception {

Review Comment:
   these should cover moving forward and back in the file.



-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-15734. Implementing position read in BlockInputStream [ozone]

Posted by "chungen0126 (via GitHub)" <gi...@apache.org>.
chungen0126 commented on code in PR #10765:
URL: https://github.com/apache/ozone/pull/10765#discussion_r3596390024


##########
hadoop-hdds/client/src/main/java/org/apache/hadoop/hdds/scm/storage/BlockInputStream.java:
##########
@@ -518,15 +646,35 @@ private synchronized void storePosition() {
   }
 
   private void handleReadError(IOException cause) throws IOException {
-    releaseClient();
-    final List<ChunkInputStream> inputStreams = this.chunkStreams;
-    if (inputStreams != null) {
-      for (ChunkInputStream is : inputStreams) {
-        is.releaseClient();
+    lock.lock();
+    try {
+      releaseClient();
+      final List<ChunkInputStream> inputStreams = this.chunkStreams;
+      if (inputStreams != null) {
+        for (ChunkInputStream is : inputStreams) {
+          is.releaseClient();
+        }
       }
+      refreshBlockInfo(cause);
+    } finally {
+      lock.unlock();
     }
+  }
 
-    refreshBlockInfo(cause);
+  private void handlePositionReadError(IOException cause, Pipeline pipeline) throws IOException {
+    lock.lock();
+    try {
+      releaseClient();
+      final List<ChunkInputStream> inputStreams = this.chunkStreams;
+      if (inputStreams != null) {
+        for (ChunkInputStream is : inputStreams) {
+          is.releaseClient();

Review Comment:
   I don't think it's necessary. They didn't throw any exceptions.



-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-15734. Implementing position read in BlockInputStream [ozone]

Posted by "yandrey321 (via GitHub)" <gi...@apache.org>.
yandrey321 commented on code in PR #10765:
URL: https://github.com/apache/ozone/pull/10765#discussion_r3595754497


##########
hadoop-hdds/client/src/main/java/org/apache/hadoop/hdds/scm/storage/BlockInputStream.java:
##########
@@ -289,7 +313,106 @@ protected synchronized void addStream(ChunkInfo chunkInfo) {
 
   protected ChunkInputStream createChunkInputStream(ChunkInfo chunkInfo) {
     return new ChunkInputStream(chunkInfo, blockID,
-        xceiverClientFactory, pipelineRef::get, verifyChecksum, tokenRef::get);
+        xceiverClientFactory, pipelineRef::get, verifyChecksum, tokenRef::get, lock);
+  }
+
+  @Override
+  public boolean readFully(long pos, ByteBuffer buffer) throws IOException {
+    Preconditions.checkArgument(buffer != null);
+    if (!initialized) {
+      initialize();
+    }
+
+    if (pos < 0 || pos > length) {
+      if (pos == 0) {
+        // It is possible for length and pos to be zero in which case
+        // seek should return instead of throwing exception
+        return true;
+      }
+      throw new EOFException(
+          "EOF encountered at pos: " + pos + " for block: " + blockID);
+    }
+
+    checkOpen();
+    int len = buffer.remaining();
+    int innerRetries = 0;
+    int chunkIdx = Arrays.binarySearch(chunkOffsets, pos);
+    if (chunkIdx < 0) {

Review Comment:
   when index can be negative?



-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-15734. Implementing position read in BlockInputStream [ozone]

Posted by "chungen0126 (via GitHub)" <gi...@apache.org>.
chungen0126 commented on code in PR #10765:
URL: https://github.com/apache/ozone/pull/10765#discussion_r3596151743


##########
hadoop-hdds/client/src/main/java/org/apache/hadoop/hdds/scm/storage/BlockInputStream.java:
##########
@@ -108,6 +110,10 @@ public class BlockInputStream extends BlockExtendedInputStream {
 
   private BlockData blockData;
 
+  private Pipeline failedPipeline;

Review Comment:
   The reason I track previously failed pipelines is that, in my design, I assume a scenario where multiple position read in `BlockInputStream` might fail concurrently and attempt to refresh the block info at the same time. Once the first `BlockInputStream` completes the refresh, subsequent streams will obtain the updated information. If the position read detects that its failed pipeline belongs to the old one and a new pipeline is now available, it should not need to trigger another redundant refresh.



-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-15734. Implementing position read in BlockInputStream [ozone]

Posted by "yandrey321 (via GitHub)" <gi...@apache.org>.
yandrey321 commented on code in PR #10765:
URL: https://github.com/apache/ozone/pull/10765#discussion_r3596142723


##########
hadoop-hdds/client/src/test/java/org/apache/hadoop/hdds/scm/storage/TestChunkInputStream.java:
##########
@@ -284,4 +284,26 @@ public void connectsToNewPipeline() throws Exception {
       verify(newToken).encodeToUrlString();
     }
   }
+
+  @Test
+  public void testPositionedRead() throws Exception {
+    byte[] buffer = new byte[50];
+    ByteBuffer byteBuffer = ByteBuffer.wrap(buffer);
+    int bytesRead = chunkStream.read(30, byteBuffer);
+
+    assertEquals(50, bytesRead);

Review Comment:
   what if chunk stream has less than 50 bytes?



-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-15734. Implementing position read in BlockInputStream [ozone]

Posted by "chungen0126 (via GitHub)" <gi...@apache.org>.
chungen0126 commented on PR #10765:
URL: https://github.com/apache/ozone/pull/10765#issuecomment-4976730043

   cc @yandrey321 


-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-15734. Implementing position read in BlockInputStream [ozone]

Posted by "yandrey321 (via GitHub)" <gi...@apache.org>.
yandrey321 commented on code in PR #10765:
URL: https://github.com/apache/ozone/pull/10765#discussion_r3595744022


##########
hadoop-hdds/client/src/main/java/org/apache/hadoop/hdds/scm/storage/BlockInputStream.java:
##########
@@ -108,6 +110,10 @@ public class BlockInputStream extends BlockExtendedInputStream {
 
   private BlockData blockData;
 
+  private Pipeline failedPipeline;

Review Comment:
   why do we need to track previously failed pipelines?



-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-15734. Implementing position read in BlockInputStream [ozone]

Posted by "chungen0126 (via GitHub)" <gi...@apache.org>.
chungen0126 commented on code in PR #10765:
URL: https://github.com/apache/ozone/pull/10765#discussion_r3600128279


##########
hadoop-hdds/client/src/test/java/org/apache/hadoop/hdds/scm/storage/TestChunkInputStream.java:
##########
@@ -284,4 +284,26 @@ public void connectsToNewPipeline() throws Exception {
       verify(newToken).encodeToUrlString();
     }
   }
+
+  @Test
+  public void testPositionedRead() throws Exception {

Review Comment:
   I have updated the current tests. If you have any suggestions for improvement, please let me know and I'll update them right away.



-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org