mirror of https://github.com/apache/lucene.git
LUCENE-4456: close merged readers first, then checkpoint
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1394464 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
53fd5c850d
commit
b6c924e26d
|
@ -3211,15 +3211,27 @@ public class IndexWriter implements Closeable, TwoPhaseCommit {
|
|||
deleter.deleteNewFiles(merge.info.files());
|
||||
}
|
||||
|
||||
// Must note the change to segmentInfos so any commits
|
||||
// in-flight don't lose it (IFD will incRef/protect the
|
||||
// new files we created):
|
||||
checkpoint();
|
||||
|
||||
// Must close before checkpoint, otherwise IFD won't be
|
||||
// able to delete the held-open files from the merge
|
||||
// readers:
|
||||
closeMergeReaders(merge, false);
|
||||
boolean success = false;
|
||||
try {
|
||||
// Must close before checkpoint, otherwise IFD won't be
|
||||
// able to delete the held-open files from the merge
|
||||
// readers:
|
||||
closeMergeReaders(merge, false);
|
||||
success = true;
|
||||
} finally {
|
||||
// Must note the change to segmentInfos so any commits
|
||||
// in-flight don't lose it (IFD will incRef/protect the
|
||||
// new files we created):
|
||||
if (success) {
|
||||
checkpoint();
|
||||
} else {
|
||||
try {
|
||||
checkpoint();
|
||||
} catch (Throwable t) {
|
||||
// Ignore so we keep throwing original exception.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
deleter.deletePendingFiles();
|
||||
|
||||
|
|
Loading…
Reference in New Issue