LUCENE-10648: Fix failures in TestAssertingPointsFormat.testWithExceptions (#1012)

* Fix failures in TestAssertingPointsFormat.testWithExceptions

* remove redundant finally block

* tidy

* remove TODO as it is done now
This commit is contained in:
Vigya Sharma 2022-07-13 10:55:08 -07:00 committed by GitHub
parent 56462b5f96
commit ca7917472b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 9 deletions

View File

@ -3425,16 +3425,13 @@ public class IndexWriter
if (useCompoundFile) {
Collection<String> filesToDelete = merge.getMergeInfo().files();
TrackingDirectoryWrapper trackingCFSDir = new TrackingDirectoryWrapper(mergeDirectory);
// TODO: unlike merge, on exception we arent sniping any trash cfs files here?
// createCompoundFile tries to cleanup, but it might not always be able to...
try {
createCompoundFile(
infoStream, trackingCFSDir, merge.getMergeInfo().info, context, this::deleteNewFiles);
} finally {
// delete new non cfs files directly: they were never
// registered with IFD
deleteNewFiles(filesToDelete);
}
createCompoundFile(
infoStream, trackingCFSDir, merge.getMergeInfo().info, context, this::deleteNewFiles);
// creating cfs resets the files tracked in SegmentInfo. if it succeeds, we
// delete the non cfs files directly as they are not tracked anymore.
deleteNewFiles(filesToDelete);
merge.getMergeInfo().info.setUseCompoundFile(true);
}