jimczi opened a new pull request, #16796:
URL: https://github.com/apache/lucene/pull/16796

   Since #16749 and #16684, a merge reads raw vectors and stored fields through 
a mapping it opens for itself, so the sequential access it advises does not 
replace the random access advised for searches. Inside a compound file this 
does not hold: the reader opens the inner file again through the compound 
reader, which slices the one mapping of the `.cfs` that searches read. The 
merge's advice lands on the pages searches read, and nothing restores it after 
the merge.
   
   `Lucene90CompoundReader` now opens inner files for a merge (an `IOContext` 
whose context is `MERGE`) through a second mapping of the compound file. The 
first merge open maps it, later merge opens share it, and it is closed with the 
reader. Like the mapping searches read, it is opened without advice, so each 
inner file is advised on its own region, from the context it was opened with. 
If the compound file is gone, merge opens fall back to the reader's mapping.
   
   Other opens are unchanged. A reader opened only for a merge maps the 
compound file once more in total.
   
   `BaseCompoundFormatTestCase#testManySubFiles` asserted one file handle per 
compound file. It now allows one more once an inner file is opened for a merge.
   
   Tests:
   - `TestLucene90CompoundFormat`: merge opens share one mapping of their own, 
separate from the reader's, closed with the reader; the fallback when the file 
is gone; and, on `MMapDirectory`, searches keep reading the reader's mapping 
while a merge reads another.
   - `TestVectorsMergeReadAdvice#testACompoundMergeOpensItsOwnMapping`: a merge 
of two compound segments maps each source compound file once, without advice, 
and closes the mapping with the segment's reader.
   
   Relates #16749, #16769, #16684
   


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