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) { if (useCompoundFile) {
Collection<String> filesToDelete = merge.getMergeInfo().files(); Collection<String> filesToDelete = merge.getMergeInfo().files();
TrackingDirectoryWrapper trackingCFSDir = new TrackingDirectoryWrapper(mergeDirectory); 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... // createCompoundFile tries to cleanup, but it might not always be able to...
try { createCompoundFile(
createCompoundFile( infoStream, trackingCFSDir, merge.getMergeInfo().info, context, this::deleteNewFiles);
infoStream, trackingCFSDir, merge.getMergeInfo().info, context, this::deleteNewFiles);
} finally { // creating cfs resets the files tracked in SegmentInfo. if it succeeds, we
// delete new non cfs files directly: they were never // delete the non cfs files directly as they are not tracked anymore.
// registered with IFD deleteNewFiles(filesToDelete);
deleteNewFiles(filesToDelete);
}
merge.getMergeInfo().info.setUseCompoundFile(true); merge.getMergeInfo().info.setUseCompoundFile(true);
} }