ekaterinadimitrova2 commented on code in PR #1754:
URL: https://github.com/apache/cassandra/pull/1754#discussion_r934802296


##########
src/java/org/apache/cassandra/config/DatabaseDescriptor.java:
##########
@@ -1962,14 +1985,35 @@ public static int 
getCompactionThroughputMebibytesPerSecAsInt()
         return conf.compaction_throughput.toMebibytesPerSecondAsInt();
     }
 
+    public static double getCompactionThroughputBytesPerSec()
+    {
+        return conf.compaction_throughput.toBytesPerSecond();
+    }
+
     public static double getCompactionThroughputMebibytesPerSec()
     {
         return conf.compaction_throughput.toMebibytesPerSecond();
     }
 
+    @VisibleForTesting // only for testing!
+    public static void setCompactionThroughputBytesPerSec(int value)
+    {
+        if (BYTES_PER_SECOND.toMebibytesPerSecond(value) >= Integer.MAX_VALUE)
+            throw new IllegalArgumentException("compaction_throughput: " + 
value +
+                                               " is too large; it should be 
less than " +
+                                               Integer.MAX_VALUE + " in 
MiB/s");
+
+        conf.compaction_throughput = new 
DataRateSpec.LongBytesPerSecondBound(value);
+    }
+
     public static void setCompactionThroughputMebibytesPerSec(int value)
     {
-        conf.compaction_throughput = new 
DataRateSpec.IntMebibytesPerSecondBound(value);
+        if (value == Integer.MAX_VALUE)

Review Comment:
   My line of thinking is that we are expected to provide an int value so we 
cannot even provide something bigger to this method at first place. The JMX 
method does accept also int values only



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to