ss77892 commented on code in PR #11159:
URL: https://github.com/apache/ozone/pull/11159#discussion_r3900178704


##########
hadoop-hdds/client/src/main/java/org/apache/hadoop/hdds/scm/storage/StreamBlockInputStream.java:
##########
@@ -351,6 +351,11 @@ private synchronized void initialize() throws IOException {
   synchronized void readBlock(int length, boolean preRead) throws IOException {
     final long required = position + length - requestedLength;
     final long preReadLength = preRead ? preReadSize : 0;
+    // Refill the pre-read window in bulk once it drains below half, instead 
of after every response.
+    // Safe to skip: required <= 0 means the DataNode still owes bytes that 
poll() is waiting for.
+    if (required <= 0 && requestedLength - position >= preReadLength / 2) {

Review Comment:
   Sure. I've added preReadRefillThreshold that is computed alongside 
preReadSize, so the test can reference the same value rather than repeating the 
/ 2.



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