shbhar commented on code in PR #16923:
URL: https://github.com/apache/lucene/pull/16923#discussion_r4451103775
##########
lucene/core/src/java/org/apache/lucene/index/StandardDirectoryReader.java:
##########
@@ -463,10 +463,12 @@ private DirectoryReader doOpenFromWriter(IndexCommit
commit, ExecutorService exe
return null;
}
- DirectoryReader reader = writer.getReader(applyAllDeletes,
writeAllDeletes);
+ StandardDirectoryReader reader = writer.getReader(applyAllDeletes,
writeAllDeletes);
- // If in fact no changes took place, return null:
- if (reader.getVersion() == segmentInfos.getVersion()) {
+ // If in fact no changes took place, return null. A commit that was
syncing files when this
+ // reader was opened changes the referenced segments_N once it completes,
but not the version:
+ if (reader.getVersion() == segmentInfos.getVersion()
+ && reader.segmentInfos.getLastGeneration() ==
segmentInfos.getLastGeneration()) {
Review Comment:
My understanding is that now with same version but different generation, we
can return new reader, which is not correct:
https://github.com/apache/lucene/issues/4594 and will impact
SearcherLifetimeManager which stores the instance by version.
Repro case from AI
> TestSearcherManager.testSearcherManager fails on the PR head (1791cc8c0a0)
with IllegalArgumentException: the provided searcher has the same underlying
reader version yet the searcher instance differs from before (from
SearcherLifetimeManager.record):
▎ ./gradlew :lucene:core:test --tests
"org.apache.lucene.search.TestSearcherManager.testSearcherManager"
-Ptests.seed=DEADBEEF:96FBDC15ECB855F4 -Ptests.iters=30
▎ 7 of 30 iterations fail at that seed, and 4 of 100 with
-Ptests.seed=DEADBEEF -Ptests.iters=100. The base (20ced71c1e6) passes the same
runs.
Maybe we need to bump the version in this case?
--
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]