LUCENE-5263: if merge hits exc when releasing merged reader then drop changes and remove it from the pool, since the merge will be aborted

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1531836 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael McCandless 2013-10-14 10:12:20 +00:00
parent eedb448b41
commit e4ee6188ef
1 changed files with 13 additions and 4 deletions

View File

@ -3357,13 +3357,22 @@ public class IndexWriter implements Closeable, TwoPhaseCommit{
assert merge.info.info.getDocCount() != 0 || keepFullyDeletedSegments || dropSegment; assert merge.info.info.getDocCount() != 0 || keepFullyDeletedSegments || dropSegment;
if (mergedDeletes != null) { if (mergedDeletes != null) {
if (dropSegment) {
mergedDeletes.dropChanges();
}
// Pass false for assertInfoLive because the merged // Pass false for assertInfoLive because the merged
// segment is not yet live (only below do we commit it // segment is not yet live (only below do we commit it
// to the segmentInfos): // to the segmentInfos):
boolean success = false;
try {
if (dropSegment) {
mergedDeletes.dropChanges();
}
readerPool.release(mergedDeletes, false); readerPool.release(mergedDeletes, false);
success = true;
} finally {
if (!success) {
mergedDeletes.dropChanges();
readerPool.drop(merge.info);
}
}
} }
// Must do this after readerPool.release, in case an // Must do this after readerPool.release, in case an