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}.
|
* Split an index based on a {@link Filter}.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class PKIndexSplitter {
|
public class PKIndexSplitter {
|
||||||
private final Filter docsInFirstIndex;
|
private final Filter docsInFirstIndex;
|
||||||
private final Directory input;
|
private final Directory input;
|
||||||
|
|
|
@ -1674,11 +1674,13 @@ public class IndexWriter implements Closeable, TwoPhaseCommit {
|
||||||
for(final MergePolicy.OneMerge merge : pendingMerges) {
|
for(final MergePolicy.OneMerge merge : pendingMerges) {
|
||||||
merge.optimize = true;
|
merge.optimize = true;
|
||||||
merge.maxNumSegmentsOptimize = maxNumSegments;
|
merge.maxNumSegmentsOptimize = maxNumSegments;
|
||||||
|
segmentsToOptimize.put(merge.info, Boolean.TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
for ( final MergePolicy.OneMerge merge: runningMerges ) {
|
for ( final MergePolicy.OneMerge merge: runningMerges ) {
|
||||||
merge.optimize = true;
|
merge.optimize = true;
|
||||||
merge.maxNumSegmentsOptimize = maxNumSegments;
|
merge.maxNumSegmentsOptimize = maxNumSegments;
|
||||||
|
segmentsToOptimize.put(merge.info, Boolean.TRUE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1891,7 +1893,6 @@ public class IndexWriter implements Closeable, TwoPhaseCommit {
|
||||||
final MergePolicy.MergeSpecification spec;
|
final MergePolicy.MergeSpecification spec;
|
||||||
if (optimize) {
|
if (optimize) {
|
||||||
spec = mergePolicy.findMergesForOptimize(segmentInfos, maxNumSegmentsOptimize, Collections.unmodifiableMap(segmentsToOptimize));
|
spec = mergePolicy.findMergesForOptimize(segmentInfos, maxNumSegmentsOptimize, Collections.unmodifiableMap(segmentsToOptimize));
|
||||||
|
|
||||||
if (spec != null) {
|
if (spec != null) {
|
||||||
final int numMerges = spec.merges.size();
|
final int numMerges = spec.merges.size();
|
||||||
for(int i=0;i<numMerges;i++) {
|
for(int i=0;i<numMerges;i++) {
|
||||||
|
@ -3044,7 +3045,9 @@ public class IndexWriter implements Closeable, TwoPhaseCommit {
|
||||||
|
|
||||||
if (merge.optimize) {
|
if (merge.optimize) {
|
||||||
// cascade the optimize:
|
// cascade the optimize:
|
||||||
segmentsToOptimize.put(merge.info, Boolean.FALSE);
|
if (!segmentsToOptimize.containsKey(merge.info)) {
|
||||||
|
segmentsToOptimize.put(merge.info, Boolean.FALSE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -353,7 +353,7 @@ public abstract class LogMergePolicy extends MergePolicy {
|
||||||
|
|
||||||
assert maxNumSegments > 0;
|
assert maxNumSegments > 0;
|
||||||
if (verbose()) {
|
if (verbose()) {
|
||||||
message("findMergesForOptimize: maxNumSegs=" + maxNumSegments + " segsToOptimize= "+ segmentsToOptimize);
|
message("findMergesForOptimize: maxNumSegs=" + maxNumSegments + " segsToOptimize="+ segmentsToOptimize);
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the segments are already optimized (e.g. there's only 1 segment), or
|
// If the segments are already optimized (e.g. there's only 1 segment), or
|
||||||
|
|
Loading…
Reference in New Issue