shbhar commented on code in PR #16923:
URL: https://github.com/apache/lucene/pull/16923#discussion_r4476821070


##########
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:
   thanks, the randomized concurrent tests look good! They help build 
confidence in this complicated logic. The extra bug fix is great too, lets keep 
it.
   
   The overall changes look good to me right now, but I want to spend a bit 
more time on it to make sure Im not still missing something (will do tomorrow)



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