mirror of https://github.com/apache/lucene.git
LUCENE-3197: must also count the segment being produced by an in-flight merge as original (as of when optimize starts) to ensure all deletions against that segment are also merged away
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1137330 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
2e48814dff
commit
9c2a21ce29
|
@ -34,6 +34,7 @@ import org.apache.lucene.util.Version;
|
|||
/**
|
||||
* Split an index based on a {@link Filter}.
|
||||
*/
|
||||
|
||||
public class PKIndexSplitter {
|
||||
private final Filter docsInFirstIndex;
|
||||
private final Directory input;
|
||||
|
|
|
@ -1674,11 +1674,13 @@ public class IndexWriter implements Closeable, TwoPhaseCommit {
|
|||
for(final MergePolicy.OneMerge merge : pendingMerges) {
|
||||
merge.optimize = true;
|
||||
merge.maxNumSegmentsOptimize = maxNumSegments;
|
||||
segmentsToOptimize.put(merge.info, Boolean.TRUE);
|
||||
}
|
||||
|
||||
for ( final MergePolicy.OneMerge merge: runningMerges ) {
|
||||
merge.optimize = true;
|
||||
merge.maxNumSegmentsOptimize = maxNumSegments;
|
||||
segmentsToOptimize.put(merge.info, Boolean.TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1891,7 +1893,6 @@ public class IndexWriter implements Closeable, TwoPhaseCommit {
|
|||
final MergePolicy.MergeSpecification spec;
|
||||
if (optimize) {
|
||||
spec = mergePolicy.findMergesForOptimize(segmentInfos, maxNumSegmentsOptimize, Collections.unmodifiableMap(segmentsToOptimize));
|
||||
|
||||
if (spec != null) {
|
||||
final int numMerges = spec.merges.size();
|
||||
for(int i=0;i<numMerges;i++) {
|
||||
|
@ -3044,8 +3045,10 @@ public class IndexWriter implements Closeable, TwoPhaseCommit {
|
|||
|
||||
if (merge.optimize) {
|
||||
// cascade the optimize:
|
||||
if (!segmentsToOptimize.containsKey(merge.info)) {
|
||||
segmentsToOptimize.put(merge.info, Boolean.FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue