chihsuan commented on code in PR #11159:
URL: https://github.com/apache/ozone/pull/11159#discussion_r3888685291
##########
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:
nit: Just a thought, what do you think about giving the `/ 2` a name? A
named constant might make the half-window trigger easier to spot later.
--
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]