mirror of https://github.com/apache/lucene.git
LUCENE-8393: TieredMergePolicy needs to take into account the maximum segment size when computing the allowed number of segments.
This commit is contained in:
parent
9433ab79e2
commit
8e0d9849bd
|
@ -402,13 +402,13 @@ public class TieredMergePolicy extends MergePolicy {
|
||||||
double allowedSegCount = 0;
|
double allowedSegCount = 0;
|
||||||
while (true) {
|
while (true) {
|
||||||
final double segCountLevel = bytesLeft / (double) levelSize;
|
final double segCountLevel = bytesLeft / (double) levelSize;
|
||||||
if (segCountLevel < segsPerTier) {
|
if (segCountLevel < segsPerTier || levelSize == maxMergedSegmentBytes) {
|
||||||
allowedSegCount += Math.ceil(segCountLevel);
|
allowedSegCount += Math.ceil(segCountLevel);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
allowedSegCount += segsPerTier;
|
allowedSegCount += segsPerTier;
|
||||||
bytesLeft -= segsPerTier * levelSize;
|
bytesLeft -= segsPerTier * levelSize;
|
||||||
levelSize *= mergeFactor;
|
levelSize = Math.min(maxMergedSegmentBytes, levelSize * mergeFactor);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (verbose(mergeContext) && tooBigCount > 0) {
|
if (verbose(mergeContext) && tooBigCount > 0) {
|
||||||
|
|
Loading…
Reference in New Issue