mirror of https://github.com/apache/lucene.git
In IndexWriter increase use of UNBOUNDED_MAX_MERGE_SEGMENTS (and decrease use of magic -1).
This commit is contained in:
parent
3488f12170
commit
0ec1f228cc
|
@ -1898,7 +1898,7 @@ public class IndexWriter implements Closeable, TwoPhaseCommit, Accountable {
|
||||||
final int size = mergeExceptions.size();
|
final int size = mergeExceptions.size();
|
||||||
for(int i=0;i<size;i++) {
|
for(int i=0;i<size;i++) {
|
||||||
final MergePolicy.OneMerge merge = mergeExceptions.get(i);
|
final MergePolicy.OneMerge merge = mergeExceptions.get(i);
|
||||||
if (merge.maxNumSegments != -1) {
|
if (merge.maxNumSegments != UNBOUNDED_MAX_MERGE_SEGMENTS) {
|
||||||
throw new IOException("background merge hit exception: " + merge.segString(), merge.getException());
|
throw new IOException("background merge hit exception: " + merge.segString(), merge.getException());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1926,12 +1926,12 @@ public class IndexWriter implements Closeable, TwoPhaseCommit, Accountable {
|
||||||
* runningMerges are maxNumSegments merges. */
|
* runningMerges are maxNumSegments merges. */
|
||||||
private synchronized boolean maxNumSegmentsMergesPending() {
|
private synchronized boolean maxNumSegmentsMergesPending() {
|
||||||
for (final MergePolicy.OneMerge merge : pendingMerges) {
|
for (final MergePolicy.OneMerge merge : pendingMerges) {
|
||||||
if (merge.maxNumSegments != -1)
|
if (merge.maxNumSegments != UNBOUNDED_MAX_MERGE_SEGMENTS)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (final MergePolicy.OneMerge merge : runningMerges) {
|
for (final MergePolicy.OneMerge merge : runningMerges) {
|
||||||
if (merge.maxNumSegments != -1)
|
if (merge.maxNumSegments != UNBOUNDED_MAX_MERGE_SEGMENTS)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2059,7 +2059,7 @@ public class IndexWriter implements Closeable, TwoPhaseCommit, Accountable {
|
||||||
// point, try again to log the config here:
|
// point, try again to log the config here:
|
||||||
messageState();
|
messageState();
|
||||||
|
|
||||||
assert maxNumSegments == -1 || maxNumSegments > 0;
|
assert maxNumSegments == UNBOUNDED_MAX_MERGE_SEGMENTS || maxNumSegments > 0;
|
||||||
assert trigger != null;
|
assert trigger != null;
|
||||||
if (stopMerges) {
|
if (stopMerges) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -2771,7 +2771,7 @@ public class IndexWriter implements Closeable, TwoPhaseCommit, Accountable {
|
||||||
// Best-effort up front check:
|
// Best-effort up front check:
|
||||||
testReserveDocs(numDocs);
|
testReserveDocs(numDocs);
|
||||||
|
|
||||||
final IOContext context = new IOContext(new MergeInfo(Math.toIntExact(numDocs), -1, false, -1));
|
final IOContext context = new IOContext(new MergeInfo(Math.toIntExact(numDocs), -1, false, UNBOUNDED_MAX_MERGE_SEGMENTS));
|
||||||
|
|
||||||
// TODO: somehow we should fix this merge so it's
|
// TODO: somehow we should fix this merge so it's
|
||||||
// abortable so that IW.close(false) is able to stop it
|
// abortable so that IW.close(false) is able to stop it
|
||||||
|
@ -3797,7 +3797,7 @@ public class IndexWriter implements Closeable, TwoPhaseCommit, Accountable {
|
||||||
infoStream.message("IW", "after commitMerge: " + segString());
|
infoStream.message("IW", "after commitMerge: " + segString());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (merge.maxNumSegments != -1 && !dropSegment) {
|
if (merge.maxNumSegments != UNBOUNDED_MAX_MERGE_SEGMENTS && !dropSegment) {
|
||||||
// cascade the forceMerge:
|
// cascade the forceMerge:
|
||||||
if (!segmentsToMerge.containsKey(merge.info)) {
|
if (!segmentsToMerge.containsKey(merge.info)) {
|
||||||
segmentsToMerge.put(merge.info, Boolean.FALSE);
|
segmentsToMerge.put(merge.info, Boolean.FALSE);
|
||||||
|
@ -3876,7 +3876,7 @@ public class IndexWriter implements Closeable, TwoPhaseCommit, Accountable {
|
||||||
if (infoStream.isEnabled("IW")) {
|
if (infoStream.isEnabled("IW")) {
|
||||||
infoStream.message("IW", "hit exception during merge");
|
infoStream.message("IW", "hit exception during merge");
|
||||||
}
|
}
|
||||||
} else if (merge.rateLimiter.getAbort() == false && (merge.maxNumSegments != -1 || (!closed && !closing))) {
|
} else if (merge.rateLimiter.getAbort() == false && (merge.maxNumSegments != UNBOUNDED_MAX_MERGE_SEGMENTS || (!closed && !closing))) {
|
||||||
// This merge (and, generally, any change to the
|
// This merge (and, generally, any change to the
|
||||||
// segments) may now enable new merges, so we call
|
// segments) may now enable new merges, so we call
|
||||||
// merge policy & update pending merges.
|
// merge policy & update pending merges.
|
||||||
|
@ -4015,7 +4015,7 @@ public class IndexWriter implements Closeable, TwoPhaseCommit, Accountable {
|
||||||
testPoint("startMergeInit");
|
testPoint("startMergeInit");
|
||||||
|
|
||||||
assert merge.registerDone;
|
assert merge.registerDone;
|
||||||
assert merge.maxNumSegments == -1 || merge.maxNumSegments > 0;
|
assert merge.maxNumSegments == UNBOUNDED_MAX_MERGE_SEGMENTS || merge.maxNumSegments > 0;
|
||||||
|
|
||||||
if (tragedy != null) {
|
if (tragedy != null) {
|
||||||
throw new IllegalStateException("this writer hit an unrecoverable error; cannot merge", tragedy);
|
throw new IllegalStateException("this writer hit an unrecoverable error; cannot merge", tragedy);
|
||||||
|
|
Loading…
Reference in New Issue