mirror of https://github.com/apache/lucene.git
LUCENE-5434: drop the merged reader if the merge was aborted, before trying to delete its files
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1566013 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
b5926da2d6
commit
ce4a5b9459
|
@ -3489,6 +3489,16 @@ public class IndexWriter implements Closeable, TwoPhaseCommit{
|
|||
if (infoStream.isEnabled("IW")) {
|
||||
infoStream.message("IW", "commitMerge: skip: it was aborted");
|
||||
}
|
||||
// In case we opened and pooled a reader for this
|
||||
// segment, drop it now. This ensures that we close
|
||||
// the reader before trying to delete any of its
|
||||
// files. This is not a very big deal, since this
|
||||
// reader will never be used by any NRT reader, and
|
||||
// another thread is currently running close(false)
|
||||
// so it will be dropped shortly anyway, but not
|
||||
// doing this makes MockDirWrapper angry in
|
||||
// TestNRTThreads (LUCENE-5434):
|
||||
readerPool.drop(merge.info);
|
||||
deleter.deleteNewFiles(merge.info.files());
|
||||
return false;
|
||||
}
|
||||
|
@ -4186,7 +4196,8 @@ public class IndexWriter implements Closeable, TwoPhaseCommit{
|
|||
// Force READ context because we merge deletes onto
|
||||
// this reader:
|
||||
if (!commitMerge(merge, mergeState)) {
|
||||
// commitMerge will return false if this merge was aborted
|
||||
// commitMerge will return false if this merge was
|
||||
// aborted
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue