mirror of https://github.com/apache/lucene.git
also rollback commit if SegmentInfos.files(..) throws exc; delete segments file one exc during finishCommit
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1395403 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
1997a9c345
commit
6d3ac7d5e0
|
@ -4030,10 +4030,11 @@ public class IndexWriter implements Closeable, TwoPhaseCommit {
|
|||
}
|
||||
|
||||
// This call can take a long time -- 10s of seconds
|
||||
// or more. We do it without sync:
|
||||
// or more. We do it without syncing on this:
|
||||
boolean success = false;
|
||||
final Collection<String> filesToSync = toSync.files(directory, false);
|
||||
final Collection<String> filesToSync;
|
||||
try {
|
||||
filesToSync = toSync.files(directory, false);
|
||||
directory.sync(filesToSync);
|
||||
success = true;
|
||||
} finally {
|
||||
|
|
|
@ -804,7 +804,7 @@ public final class SegmentInfos implements Cloneable, Iterable<SegmentInfoPerCom
|
|||
success = true;
|
||||
} finally {
|
||||
if (!success) {
|
||||
IOUtils.closeWhileHandlingException(pendingSegnOutput);
|
||||
// Closes pendingSegnOutput & deletes partial segments_N:
|
||||
rollbackCommit(dir);
|
||||
} else {
|
||||
success = false;
|
||||
|
@ -813,12 +813,11 @@ public final class SegmentInfos implements Cloneable, Iterable<SegmentInfoPerCom
|
|||
success = true;
|
||||
} finally {
|
||||
if (!success) {
|
||||
final String segmentFileName = IndexFileNames.fileNameFromGeneration(IndexFileNames.SEGMENTS,
|
||||
"",
|
||||
generation);
|
||||
IOUtils.deleteFilesIgnoringExceptions(dir, segmentFileName);
|
||||
// Closes pendingSegnOutput & deletes partial segments_N:
|
||||
rollbackCommit(dir);
|
||||
} else {
|
||||
pendingSegnOutput = null;
|
||||
}
|
||||
pendingSegnOutput = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue