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


##########
src/java/org/apache/cassandra/config/DatabaseDescriptor.java:
##########
@@ -1953,14 +1975,31 @@ 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 (MEBIBYTES_PER_SECOND.toMebibytesPerSecond(value) >= 
Integer.MAX_VALUE)
+            throw new IllegalArgumentException("Invalid value of 
compaction_throughput: " + value);
+
+        conf.compaction_throughput = new 
DataRateSpec.LongBytesPerSecondBound(value);
+    }
+
     public static void setCompactionThroughputMebibytesPerSec(int value)
     {
-        conf.compaction_throughput = new 
DataRateSpec.IntMebibytesPerSecondBound(value);
+        if (MEBIBYTES_PER_SECOND.toMebibytesPerSecond(value) >= 
Integer.MAX_VALUE)

Review Comment:
   This whole method is messy... 
   It should be changed to:
   ```
   if (value == Integer.MAX_VALUE)
               throw new IllegalArgumentException("Invalid value of 
compaction_throughput: " + value);
   
           conf.compaction_throughput = new 
DataRateSpec.LongBytesPerSecondBound(value, MEBIBYTES_PER_SECOND);
   ```



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