maedhroz commented on code in PR #1754:
URL: https://github.com/apache/cassandra/pull/1754#discussion_r931608438
##########
src/java/org/apache/cassandra/tools/nodetool/GetInterDCStreamThroughput.java:
##########
@@ -17,27 +17,71 @@
*/
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 = "getinterdcstreamthroughput", description = "Print the
throughput cap for inter-datacenter streaming and entire SSTable
inter-datacenter streaming in the system")
+@Command(name = "getinterdcstreamthroughput", description = "Print the
throughput cap for inter-datacenter streaming and entire SSTable
inter-datacenter streaming in the system" +
+ "in rounded
megabits. For precise number, please, use option -d")
public class GetInterDCStreamThroughput extends NodeToolCmd
{
@SuppressWarnings("UnusedDeclaration")
- @Option(name = { "-e", "--entire-sstable-throughput" }, description =
"Print entire SSTable streaming throughput")
+ @Option(name = { "-e", "--entire-sstable-throughput" }, description =
"Print entire SSTable streaming throughput in MiB/s")
private boolean entireSSTableThroughput;
+ @SuppressWarnings("UnusedDeclaration")
+ @Option(name = { "-m", "--mib" }, description = "Print the throughput cap
for inter-datacenter streaming in MiB/s")
+ private boolean interDCStreamThroughputMiB;
+
+ @SuppressWarnings("UnusedDeclaration")
+ @Option(name = { "-d", "--precise-mbit" }, description = "Print the
throughput cap for inter-datacenter streaming in precise Mbits (double)")
+ private boolean interDCStreamThroughputDoubleMbit;
+
@Override
public void execute(NodeProbe probe)
{
- int throughput = entireSSTableThroughput ?
probe.getEntireSSTableInterDCStreamThroughput() :
probe.getInterDCStreamThroughput();
+ int throughput;
+ double throughputInDouble;
+
+ if (entireSSTableThroughput)
+ {
+ if(interDCStreamThroughputDoubleMbit || interDCStreamThroughputMiB)
+ throw new IllegalArgumentException("You cannot use more than
one flag with this command");
+
+ throughputInDouble =
probe.getEntireSSTableInterDCStreamThroughput();
+ probe.output().out.printf("Current entire SSTable inter-datacenter
stream throughput: %s%n",
+ throughputInDouble > 0 ?
throughputInDouble + " MiB/s" : "unlimited");
+ }
+ else if (interDCStreamThroughputMiB)
+ {
+ if(interDCStreamThroughputDoubleMbit)
+ throw new IllegalArgumentException("You cannot use more than
one flag with this command");
+
+ throughputInDouble = probe.getInterDCStreamThroughputMibAsDouble();
+ probe.output().out.printf("Current inter-datacenter stream
throughput: %s%n",
+ throughputInDouble > 0 ?
throughputInDouble + " MiB/s" : "unlimited");
+
+ }
+ else if(interDCStreamThroughputDoubleMbit)
Review Comment:
```suggestion
else if (interDCStreamThroughputDoubleMbit)
```
--
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]