ekaterinadimitrova2 commented on code in PR #1754:
URL: https://github.com/apache/cassandra/pull/1754#discussion_r932494770
##########
src/java/org/apache/cassandra/config/DataRateSpec.java:
##########
@@ -252,6 +253,21 @@ public LongBytesPerSecondBound(long bytesPerSecond)
{
this(bytesPerSecond, BYTES_PER_SECOND);
}
+
+ // this one should be used only for backward compatibility for
stream_throughput_outbound and inter_dc_stream_throughput_outbound
+ // which were in megabits per second in 4.0. Do not start using it for
any new properties
+ public static LongBytesPerSecondBound
megabitsPerSecondInBytesPerSecond(long megabitsPerSecond)
+ {
+ final double BYTES_PER_MEGABIT = 125_000;
+ double bytesPerSecond = (double) megabitsPerSecond *
BYTES_PER_MEGABIT;
+
+ if (megabitsPerSecond >= Integer.MAX_VALUE)
+ throw new IllegalArgumentException("Invalid data rate: " +
megabitsPerSecond + " megabits per second; " +
+ "stream_throughput_outbound
and inter_dc_stream_throughput_outbound" +
+ " should be between 0 and "
+ Integer.MAX_VALUE + " in megabits per second");
+
+ return new LongBytesPerSecondBound(bytesPerSecond,
BYTES_PER_SECOND);
Review Comment:
That is a good point if we consider we will have only BytesPerSecondBound
and min units as the other new config classes but I think we won't to get rid
of the min units from now on.
I guess we can just keep the doubles only in the DataRateSpec.DataRateUnit
converters as we need doubles bytes -> mebibytes for example, see nodetool at
the moment.
Wondering whether we should make this change now or not, @maedhroz any
thoughts?
--
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]