lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jpou...@apache.org
Subject [7/9] lucene-solr:branch_7x: LUCENE-8393: TieredMergePolicy needs to take into account the maximum segment size when computing the allowed number of segments.
Date Tue, 10 Jul 2018 07:28:20 GMT
LUCENE-8393: TieredMergePolicy needs to take into account the maximum segment size when computing
the allowed number of segments.


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/97833b72
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/97833b72
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/97833b72

Branch: refs/heads/branch_7x
Commit: 97833b729e310a8cd4a1ba5a8e0e132927a82699
Parents: 43481f2
Author: Adrien Grand <jpountz@gmail.com>
Authored: Tue Jul 10 08:47:41 2018 +0200
Committer: Adrien Grand <jpountz@gmail.com>
Committed: Tue Jul 10 09:18:10 2018 +0200

----------------------------------------------------------------------
 .../core/src/java/org/apache/lucene/index/TieredMergePolicy.java | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/97833b72/lucene/core/src/java/org/apache/lucene/index/TieredMergePolicy.java
----------------------------------------------------------------------
diff --git a/lucene/core/src/java/org/apache/lucene/index/TieredMergePolicy.java b/lucene/core/src/java/org/apache/lucene/index/TieredMergePolicy.java
index 34d7af6..499273d 100644
--- a/lucene/core/src/java/org/apache/lucene/index/TieredMergePolicy.java
+++ b/lucene/core/src/java/org/apache/lucene/index/TieredMergePolicy.java
@@ -402,13 +402,13 @@ public class TieredMergePolicy extends MergePolicy {
     double allowedSegCount = 0;
     while (true) {
       final double segCountLevel = bytesLeft / (double) levelSize;
-      if (segCountLevel < segsPerTier) {
+      if (segCountLevel < segsPerTier || levelSize == maxMergedSegmentBytes) {
         allowedSegCount += Math.ceil(segCountLevel);
         break;
       }
       allowedSegCount += segsPerTier;
       bytesLeft -= segsPerTier * levelSize;
-      levelSize *= mergeFactor;
+      levelSize = Math.min(maxMergedSegmentBytes, levelSize * mergeFactor);
     }
 
     if (verbose(mergeContext) && tooBigCount > 0) {


Mime
View raw message