Skip to content

Commit

Permalink
LUCENE-10648: Fix failures in TestAssertingPointsFormat.testWithExcep…
Browse files Browse the repository at this point in the history
…tions (#1012)

* Fix failures in TestAssertingPointsFormat.testWithExceptions

* remove redundant finally block

* tidy

* remove TODO as it is done now
  • Loading branch information
vigyasharma authored Jul 13, 2022
1 parent 56462b5 commit ca79174
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions lucene/core/src/java/org/apache/lucene/index/IndexWriter.java
Original file line number Diff line number Diff line change
Expand Up @@ -3425,16 +3425,13 @@ public void addIndexesReaderMerge(MergePolicy.OneMerge merge) throws IOException
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);
}

Expand Down

0 comments on commit ca79174

Please sign in to comment.