anmolanmol1234 commented on code in PR #8212:
URL: https://github.com/apache/hadoop/pull/8212#discussion_r2741082638


##########
hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azurebfs/services/AbfsPrefetchInputStream.java:
##########
@@ -80,10 +81,22 @@ protected int readOneBlock(final byte[] b, final int off, 
final int len) throws
       }
 
       /*
-       * Always start with Prefetch even from first read.
-       * Even if out of order seek comes, prefetches will be triggered for 
next set of blocks.
+        Skips prefetch for the first read if restrictGpsOnOpenFile config is 
enabled.
+        This is required since contentLength is not available yet to determine 
prefetch block size.
        */
-      bytesRead = readInternal(getFCursor(), getBuffer(), 0, getBufferSize(), 
false);
+      if(shouldRestrictGpsOnOpenFile() && isFirstRead()) {
+        getTracingContext().setReadType(ReadType.NORMAL_READ);
+        LOG.debug("RestrictGpsOnOpenFile is enabled. Skip readahead for first 
read even for sequential input policy.");
+        bytesRead = readInternal(getFCursor(), getBuffer(), 0, 
getBufferSize(), true);

Review Comment:
   readRemote should be called, readInternal will trigger prefetch



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