taklwu commented on code in PR #11348:
URL: https://github.com/apache/ozone/pull/11348#discussion_r4169783515


##########
hadoop-hdds/client/src/test/java/org/apache/hadoop/hdds/scm/storage/TestStreamBlockInputStream.java:
##########


Review Comment:
   `StreamBlockInputStream.readPositioned` takes empty buffer as -1, while 
others are returning 0, should we align for the inner stream level ? 
   



##########
hadoop-hdds/client/src/main/java/org/apache/hadoop/hdds/scm/storage/PartInputStream.java:
##########
@@ -18,32 +18,21 @@
 package org.apache.hadoop.hdds.scm.storage;
 
 import java.io.IOException;
-import java.nio.ByteBuffer;
+import org.apache.hadoop.fs.ByteBufferPositionedReadable;
 import org.apache.hadoop.fs.CanUnbuffer;
 import org.apache.hadoop.fs.Seekable;
 
 /**
  * A stream that can be a part of a {@link MultipartInputStream}.
+ * Positioned reads must allow concurrent calls without changing the 
sequential cursor.
  */
 public interface PartInputStream
-    extends CanUnbuffer, Seekable {
+    extends CanUnbuffer, Seekable, ByteBufferPositionedReadable {

Review Comment:
   with ByteBufferPositionedReadable, that looks better.



##########
hadoop-hdds/client/src/test/java/org/apache/hadoop/hdds/scm/storage/PositionedReadTestHelper.java:
##########
@@ -60,7 +60,8 @@ public static void runConcurrentPositionedReads(byte[] source,
         final int threadId = t;
         futures.add(pool.submit((Callable<Void>) () -> {
           for (int i = 0; i < ITERATIONS; i++) {
-            int offset = (threadId * 1000 + i * 17) % (source.length - 
BUFFER_SIZE);
+            int offset = (int) (((long) threadId * source.length / 
THREAD_COUNT + i * 17L)
+                % (source.length - BUFFER_SIZE));

Review Comment:
   thanks for improving this test helper



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