You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by ma...@apache.org on 2015/03/17 11:19:21 UTC

[3/5] cassandra git commit: Match estimated tasks arithmetic to score in LCS

Match estimated tasks arithmetic to score in LCS

Patch by carlyeks; reviewed by marcuse for CASSANDRA-8904


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

Branch: refs/heads/trunk
Commit: 08147376aa16570c07a4522931cc8fa330519d3e
Parents: 31a1828
Author: Carl Yeksigian <ca...@apache.org>
Authored: Mon Mar 16 14:54:08 2015 +0000
Committer: Marcus Eriksson <ma...@apache.org>
Committed: Tue Mar 17 11:10:14 2015 +0100

----------------------------------------------------------------------
 CHANGES.txt                                                      | 1 +
 src/java/org/apache/cassandra/db/compaction/LeveledManifest.java | 3 ++-
 2 files changed, 3 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/08147376/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 8843908..65f2da4 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
 2.0.14:
+ * Improve compaction estimated tasks estimation (CASSANDRA-8904)
  * Fix duplicate up/down messages sent to native clients (CASSANDRA-7816)
  * Expose commit log archive status via JMX (CASSANDRA-8734)
  * Provide better exceptions for invalid replication strategy parameters

http://git-wip-us.apache.org/repos/asf/cassandra/blob/08147376/src/java/org/apache/cassandra/db/compaction/LeveledManifest.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/compaction/LeveledManifest.java b/src/java/org/apache/cassandra/db/compaction/LeveledManifest.java
index aefd573..6554eb2 100644
--- a/src/java/org/apache/cassandra/db/compaction/LeveledManifest.java
+++ b/src/java/org/apache/cassandra/db/compaction/LeveledManifest.java
@@ -623,7 +623,8 @@ public class LeveledManifest
         for (int i = generations.length - 1; i >= 0; i--)
         {
             List<SSTableReader> sstables = generations[i];
-            estimated[i] = Math.max(0L, SSTableReader.getTotalBytes(sstables) - maxBytesForLevel(i)) / maxSSTableSizeInBytes;
+	    // If there is 1 byte over TBL - (MBL * 1.001), there is still a task left, so we need to round up.
+	    estimated[i] = (long)Math.ceil((double)Math.max(0L, SSTableReader.getTotalBytes(sstables) - (long)(maxBytesForLevel(i) * 1.001)) / (double)maxSSTableSizeInBytes);
             tasks += estimated[i];
         }