frankgh commented on code in PR #1754:
URL: https://github.com/apache/cassandra/pull/1754#discussion_r934790710
##########
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:
if this value overflows, it will be negative and
`DataRateSpec#validateQuantity` will throw an `IllegalArgException`. So this
check is sufficient
--
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]