thecoop commented on code in PR #16883:
URL: https://github.com/apache/lucene/pull/16883#discussion_r4358797898


##########
lucene/core/src/java/org/apache/lucene/store/MMapDirectory.java:
##########
@@ -327,21 +327,20 @@ public IndexInput openInput(String name, IOContext 
context) throws IOException {
     final Arena arena = confined ? Arena.ofConfined() : getSharedArena(name, 
arenas);
     try (var fc = FileChannel.open(path, StandardOpenOption.READ)) {
       final long fileSize = fc.size();
+      final ReadAdvice advice = toReadAdvice.apply(context);
+      final boolean preloaded = preload.test(name, context);
+      // preloaded or within a page, any advice reads the same
+      final boolean withinAPage =
+          NATIVE_ACCESS.filter(na -> fileSize < na.getPageSize()).isPresent();

Review Comment:
   Don't we also need to take account of alignment? A file greater than a page 
but is not aligned can still then share pages with the files either side, which 
might then have their read advice changed from under them.



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