From 08147376aa16570c07a4522931cc8fa330519d3e Mon Sep 17 00:00:00 2001 From: Carl Yeksigian Date: Mon, 16 Mar 2015 14:54:08 +0000 Subject: [PATCH] Match estimated tasks arithmetic to score in LCS Patch by carlyeks; reviewed by marcuse for CASSANDRA-8904 --- CHANGES.txt | 1 + .../org/apache/cassandra/db/compaction/LeveledManifest.java | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGES.txt b/CHANGES.txt index 8843908015..65f2da4d16 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 diff --git a/src/java/org/apache/cassandra/db/compaction/LeveledManifest.java b/src/java/org/apache/cassandra/db/compaction/LeveledManifest.java index aefd573ff7..6554eb26cc 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 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]; }