epotyom commented on code in PR #15556:
URL: https://github.com/apache/lucene/pull/15556#discussion_r2687562282


##########
lucene/core/src/java/org/apache/lucene/index/StandardDirectoryReader.java:
##########
@@ -290,12 +292,22 @@ private static SegmentReader createOrReuseSegmentReader(
       SegmentCommitInfo commitInfo, SegmentReader oldReader, int 
indexCreatedVersionMajor)
       throws IOException {
 
+    // Extract IndexingMode from directory if it's MMapDirectory
+    // We need it before openInput is called in MMapDirectory
+    IOContext context = IOContext.DEFAULT;
+    if (commitInfo.info.dir instanceof MMapDirectory mmapDir) {

Review Comment:
   Thinking about the ways we can avoid casting here. My understanding is that 
we only need it to pass Index~~ing~~Mode to SegmentTermsEnum. But maybe we 
don't need it in SegmentTermsEnum itself, and can instead handle it in 
MemorySegmentIndexInput, which can get the mode directly from 
MMapDirectory#openInput. As far as I understand, the only thing that changes is 
that SegmentTermsEnum has to call `ste.initIndexInput()` before `prefetch`, but 
I don't think that changes performance much, as we call `initIndexInput` as 
part of `loadBlock` later anyway.



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