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


##########
lucene/core/src/java/org/apache/lucene/index/IndexWriter.java:
##########
@@ -1179,6 +1184,10 @@ public IndexWriter(Directory d, IndexWriterConfig conf) 
throws IOException {
         // We incRef all files when we return an NRT reader from IW, so all 
files must exist even in
         // the NRT case:
         assert create || filesExist(segmentInfos);
+        // rollback() returns to the segments we start from, also when we 
start from an NRT reader
+        // and not from its commit. The deletion policy may delete the commit 
we started from, so
+        // keep their files:
+        setRollbackSegments(segmentInfos.createBackupSegmentInfos());

Review Comment:
   This is a nice cleanup/refactoring/generalization, moving the rollback 
segments out of that huge `if` above so it's not special-cased depending on how 
you are init'ing this writer.



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