cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sn...@apache.org
Subject [1/3] cassandra git commit: IllegalArgumentException in CompactionTask
Date Tue, 04 Oct 2016 12:38:41 GMT
Repository: cassandra
Updated Branches:
  refs/heads/cassandra-3.X c2106e145 -> 433dd1c0a
  refs/heads/trunk 4ddd7b903 -> fb227618d


IllegalArgumentException in CompactionTask

patch by Yasuharu Goto; reviewed by Robert Stupp for CASSANDRA-12717


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

Branch: refs/heads/cassandra-3.X
Commit: 433dd1c0ab77d296dafcc6c2079aa9445a6c1b2a
Parents: c2106e1
Author: Yasuharu Goto <matope.ono@gmail.com>
Authored: Tue Oct 4 13:39:42 2016 +0200
Committer: Robert Stupp <snazy@snazy-ds15.fritz.box>
Committed: Tue Oct 4 13:39:42 2016 +0200

----------------------------------------------------------------------
 CHANGES.txt                                        |  2 +-
 .../cassandra/db/compaction/CompactionManager.java | 17 +++++++++++++++--
 .../cassandra/db/compaction/CompactionTask.java    |  3 +--
 3 files changed, 17 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/433dd1c0/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index af81195..b503fd9 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -37,7 +37,7 @@
  * Make decommission operation resumable (CASSANDRA-12008)
  * Add support to one-way targeted repair (CASSANDRA-9876)
  * Remove clientutil jar (CASSANDRA-11635)
- * Fix compaction throughput throttle (CASSANDRA-12366)
+ * Fix compaction throughput throttle (CASSANDRA-12366, CASSANDRA-12717)
  * Delay releasing Memtable memory on flush until PostFlush has finished running (CASSANDRA-12358)
  * Cassandra stress should dump all setting on startup (CASSANDRA-11914)
  * Make it possible to compact a given token range (CASSANDRA-10643)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/433dd1c0/src/java/org/apache/cassandra/db/compaction/CompactionManager.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/compaction/CompactionManager.java b/src/java/org/apache/cassandra/db/compaction/CompactionManager.java
index 510eb94..06c67b1 100644
--- a/src/java/org/apache/cassandra/db/compaction/CompactionManager.java
+++ b/src/java/org/apache/cassandra/db/compaction/CompactionManager.java
@@ -1114,8 +1114,7 @@ public class CompactionManager implements CompactionManagerMBean
 
                     long bytesScanned = scanner.getBytesScanned();
 
-                    int lengthRead = (int) (Ints.checkedCast(bytesScanned - lastBytesScanned)
* compressionRatio);
-                    limiter.acquire(lengthRead + 1);
+                    compactionRateLimiterAcquire(limiter, bytesScanned, lastBytesScanned,
compressionRatio);
 
                     lastBytesScanned = bytesScanned;
                 }
@@ -1142,6 +1141,20 @@ public class CompactionManager implements CompactionManagerMBean
 
     }
 
+    static void compactionRateLimiterAcquire(RateLimiter limiter, long bytesScanned, long
lastBytesScanned, double compressionRatio)
+    {
+        long lengthRead = (long) ((bytesScanned - lastBytesScanned) * compressionRatio) +
1;
+        while (lengthRead >= Integer.MAX_VALUE)
+        {
+            limiter.acquire(Integer.MAX_VALUE);
+            lengthRead -= Integer.MAX_VALUE;
+        }
+        if (lengthRead > 0)
+        {
+            limiter.acquire((int) lengthRead);
+        }
+    }
+
     private static abstract class CleanupStrategy
     {
         protected final Collection<Range<Token>> ranges;

http://git-wip-us.apache.org/repos/asf/cassandra/blob/433dd1c0/src/java/org/apache/cassandra/db/compaction/CompactionTask.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/compaction/CompactionTask.java b/src/java/org/apache/cassandra/db/compaction/CompactionTask.java
index 3ddd544..2f90c7b 100644
--- a/src/java/org/apache/cassandra/db/compaction/CompactionTask.java
+++ b/src/java/org/apache/cassandra/db/compaction/CompactionTask.java
@@ -203,8 +203,7 @@ public class CompactionTask extends AbstractCompactionTask
                         long bytesScanned = scanners.getTotalBytesScanned();
 
                         //Rate limit the scanners, and account for compression
-                        int lengthRead = (int) (Ints.checkedCast(bytesScanned - lastBytesScanned)
* compressionRatio);
-                        limiter.acquire(lengthRead + 1);
+                        CompactionManager.compactionRateLimiterAcquire(limiter, bytesScanned,
lastBytesScanned, compressionRatio);
 
                         lastBytesScanned = bytesScanned;
 


Mime
View raw message