when we fix maxMergeAtOnce, make sure to not set it to 1 as its an illegal value

This commit is contained in:
Shay Banon 2013-02-01 18:58:39 +01:00
parent a8c9e580ed
commit ebc0c8cc6d
1 changed files with 4 additions and 0 deletions

View File

@ -82,6 +82,10 @@ public class TieredMergePolicyProvider extends AbstractIndexShardComponent imple
// fixing maxMergeAtOnce, see TieredMergePolicy#setMaxMergeAtOnce
if (!(segmentsPerTier >= maxMergeAtOnce)) {
int newMaxMergeAtOnce = (int) segmentsPerTier;
// max merge at once should be at least 2
if (newMaxMergeAtOnce <= 1) {
newMaxMergeAtOnce = 2;
}
logger.debug("[tiered] merge policy changing max_merge_at_once from [{}] to [{}] because segments_per_tier [{}] has to be higher or equal to it", maxMergeAtOnce, newMaxMergeAtOnce, segmentsPerTier);
this.maxMergeAtOnce = newMaxMergeAtOnce;
}