cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From yu...@apache.org
Subject [3/6] cassandra git commit: Fix streaming throttle unit to bits
Date Wed, 25 Feb 2015 16:59:29 GMT
Fix streaming throttle unit to bits

patch by Björn Hegerfors; reviewed by yukim for CASSANDRA-8852


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/da9f030c
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/da9f030c
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/da9f030c

Branch: refs/heads/trunk
Commit: da9f030c2912748349d1874a544b97b9f08642d1
Parents: ee160a9
Author: Björn Hegerfors <bjornheg@kth.se>
Authored: Wed Feb 25 08:50:37 2015 -0800
Committer: Yuki Morishita <yukim@apache.org>
Committed: Wed Feb 25 08:52:14 2015 -0800

----------------------------------------------------------------------
 src/java/org/apache/cassandra/streaming/StreamManager.java | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/da9f030c/src/java/org/apache/cassandra/streaming/StreamManager.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/streaming/StreamManager.java b/src/java/org/apache/cassandra/streaming/StreamManager.java
index b5b1c7f..4871078 100644
--- a/src/java/org/apache/cassandra/streaming/StreamManager.java
+++ b/src/java/org/apache/cassandra/streaming/StreamManager.java
@@ -63,17 +63,17 @@ public class StreamManager implements StreamManagerMBean
 
     public static class StreamRateLimiter
     {
-        private static final double ONE_MEGA_BIT = 1024 * 1024 * 8;
+        private static final double BYTES_PER_MEGABIT = 1024 * 1024 / 8;
         private static final RateLimiter limiter = RateLimiter.create(Double.MAX_VALUE);
         private static final RateLimiter interDCLimiter = RateLimiter.create(Double.MAX_VALUE);
         private final boolean isLocalDC;
 
         public StreamRateLimiter(InetAddress peer)
         {
-            double throughput = ((double) DatabaseDescriptor.getStreamThroughputOutboundMegabitsPerSec())
* ONE_MEGA_BIT;
+            double throughput = ((double) DatabaseDescriptor.getStreamThroughputOutboundMegabitsPerSec())
* BYTES_PER_MEGABIT;
             mayUpdateThroughput(throughput, limiter);
 
-            double interDCThroughput = ((double) DatabaseDescriptor.getInterDCStreamThroughputOutboundMegabitsPerSec())
* ONE_MEGA_BIT;
+            double interDCThroughput = ((double) DatabaseDescriptor.getInterDCStreamThroughputOutboundMegabitsPerSec())
* BYTES_PER_MEGABIT;
             mayUpdateThroughput(interDCThroughput, interDCLimiter);
 
             if (DatabaseDescriptor.getLocalDataCenter() != null && DatabaseDescriptor.getEndpointSnitch()
!= null)


Mime
View raw message