Match estimated tasks arithmetic to score in LCS

Patch by carlyeks; reviewed by marcuse for CASSANDRA-8904
This commit is contained in:
Carl Yeksigian 2015-03-16 14:54:08 +00:00 committed by Marcus Eriksson
parent 31a182876e
commit 08147376aa
2 changed files with 3 additions and 1 deletions

View File

@ -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

View File

@ -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];
}