lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jpou...@apache.org
Subject [4/4] lucene-solr:branch_7x: LUCENE-8383: Fix computation of mergingBytes in TieredMergePolicy.
Date Mon, 09 Jul 2018 15:51:18 GMT
LUCENE-8383: Fix computation of mergingBytes in TieredMergePolicy.


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

Branch: refs/heads/branch_7x
Commit: fa6a334edca530256521496c767058efbf27e796
Parents: 3caee20
Author: Adrien Grand <jpountz@gmail.com>
Authored: Mon Jul 9 15:23:36 2018 +0200
Committer: Adrien Grand <jpountz@gmail.com>
Committed: Mon Jul 9 16:16:21 2018 +0200

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


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/fa6a334e/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 4da0192..8ac4977 100644
--- a/lucene/core/src/java/org/apache/lucene/index/TieredMergePolicy.java
+++ b/lucene/core/src/java/org/apache/lucene/index/TieredMergePolicy.java
@@ -344,6 +344,8 @@ public class TieredMergePolicy extends MergePolicy {
     int totalDelDocs = 0;
     int totalMaxDoc = 0;
 
+    long mergingBytes = 0;
+
     List<SegmentSizeAndDocs> sortedInfos = getSortedBySegmentSize(infos, mergeContext);
     Iterator<SegmentSizeAndDocs> iter = sortedInfos.iterator();
     while (iter.hasNext()) {
@@ -359,6 +361,7 @@ public class TieredMergePolicy extends MergePolicy {
         message("  seg=" + segString(mergeContext, Collections.singleton(segSizeDocs.segInfo))
+ " size=" + String.format(Locale.ROOT, "%.3f", segBytes / 1024 / 1024.) + " MB" + extra,
mergeContext);
       }
       if (merging.contains(segSizeDocs.segInfo)) {
+        mergingBytes += segSizeDocs.sizeInBytes;
         iter.remove();
       } else {
         totalDelDocs += segSizeDocs.delCount;
@@ -384,8 +387,6 @@ public class TieredMergePolicy extends MergePolicy {
     // 1> Overall percent deleted docs relatively small and this segment is larger than
50% maxSegSize
     // 2> overall percent deleted docs large and this segment is large and has few deleted
docs
 
-    long mergingBytes = 0L;
-
     while (iter.hasNext()) {
       SegmentSizeAndDocs segSizeDocs = iter.next();
       double segDelPct = (double) segSizeDocs.delCount / (double) segSizeDocs.maxDoc;
@@ -393,8 +394,6 @@ public class TieredMergePolicy extends MergePolicy {
         iter.remove();
         tooBigCount++; // Just for reporting purposes.
         totIndexBytes -= segSizeDocs.sizeInBytes;
-      } else {
-        mergingBytes += segSizeDocs.sizeInBytes;
       }
     }
 


Mime
View raw message