maedhroz commented on code in PR #1754:
URL: https://github.com/apache/cassandra/pull/1754#discussion_r931605865
##########
src/java/org/apache/cassandra/tools/nodetool/GetCompactionThroughput.java:
##########
@@ -17,17 +17,34 @@
*/
package org.apache.cassandra.tools.nodetool;
+import com.google.common.math.DoubleMath;
+
import io.airlift.airline.Command;
+import io.airlift.airline.Option;
import org.apache.cassandra.tools.NodeProbe;
import org.apache.cassandra.tools.NodeTool.NodeToolCmd;
-@Command(name = "getcompactionthroughput", description = "Print the MiB/s
throughput cap for compaction in the system")
+@Command(name = "getcompactionthroughput", description = "Print the MiB/s
throughput cap for compaction in the system as a rounded number")
public class GetCompactionThroughput extends NodeToolCmd
{
+ @SuppressWarnings("UnusedDeclaration")
+ @Option(name = { "-d", "--precise-mib" }, description = "Print the MiB/s
throughput cap for compaction in the system as a precise number (double)")
+ private boolean compactionThroughputAsDouble;
+
@Override
public void execute(NodeProbe probe)
{
- probe.output().out.println("Current compaction throughput: " +
probe.getCompactionThroughput() + " MiB/s");
+ double throughput = probe.getCompactionThroughputMebibytesAsDouble();
+
+ if (compactionThroughputAsDouble)
+ probe.output().out.println("Current compaction throughput: " +
throughput + " MiB/s");
+ else
+ {
+ if (!DoubleMath.isMathematicalInteger(throughput))
+ throw new RuntimeException("You should use -d to get exact
throughput in MiB/s");
+
+ probe.output().out.println("Current compaction throughput: " +
probe.getCompactionThroughput() + " MB/s");
Review Comment:
Leaving this `MB/s` for back-compat? Maybe we should just tolerate the risk
and be consistent w/ everything else in this class.
--
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]