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());
|
deleter.deleteNewFiles(merge.info.files());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Must note the change to segmentInfos so any commits
|
boolean success = false;
|
||||||
// in-flight don't lose it (IFD will incRef/protect the
|
try {
|
||||||
// new files we created):
|
// Must close before checkpoint, otherwise IFD won't be
|
||||||
checkpoint();
|
// able to delete the held-open files from the merge
|
||||||
|
// readers:
|
||||||
// Must close before checkpoint, otherwise IFD won't be
|
closeMergeReaders(merge, false);
|
||||||
// able to delete the held-open files from the merge
|
success = true;
|
||||||
// readers:
|
} finally {
|
||||||
closeMergeReaders(merge, false);
|
// 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();
|
deleter.deletePendingFiles();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue