LUCENE-1638: fix thread hazard when autoCommit=true and multiple threads are committing

git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@775249 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael McCandless 2009-05-15 17:30:43 +00:00
parent ca5a7436fa
commit 130c568b44
1 changed files with 7 additions and 1 deletions

View File

@ -4353,6 +4353,10 @@ public class IndexWriter {
assert !segmentInfos.contains(merge.info); assert !segmentInfos.contains(merge.info);
segmentInfos.add(start, merge.info); segmentInfos.add(start, merge.info);
// Must note the change to segmentInfos so any commits
// in-flight don't lose it:
changeCount++;
// If the merged segments had pending changes, clear // If the merged segments had pending changes, clear
// them so that they don't bother writing them to // them so that they don't bother writing them to
// disk, updating SegmentInfo, etc.: // disk, updating SegmentInfo, etc.:
@ -4865,7 +4869,9 @@ public class IndexWriter {
// Must checkpoint before decrefing so any newly // Must checkpoint before decrefing so any newly
// referenced files in the new merge.info are incref'd // referenced files in the new merge.info are incref'd
// first: // first:
checkpoint(); synchronized(this) {
deleter.checkpoint(segmentInfos, false);
}
decrefMergeSegments(merge); decrefMergeSegments(merge);
if (merge.useCompoundFile) { if (merge.useCompoundFile) {