cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject svn commit: r898833 - in /incubator/cassandra/branches/cassandra-0.5: CHANGES.txt src/java/org/apache/cassandra/tools/NodeProbe.java
Date Wed, 13 Jan 2010 16:46:39 GMT
Author: jbellis
Date: Wed Jan 13 16:46:38 2010
New Revision: 898833

URL: http://svn.apache.org/viewvc?rev=898833&view=rev
Log:
fix NaN in nodeprobe totals when some CFs but not others have seen read or write ops.  patch
by jbellis; reviewed by gdusbabek for CASSANDRA-646

Modified:
    incubator/cassandra/branches/cassandra-0.5/CHANGES.txt
    incubator/cassandra/branches/cassandra-0.5/src/java/org/apache/cassandra/tools/NodeProbe.java

Modified: incubator/cassandra/branches/cassandra-0.5/CHANGES.txt
URL: http://svn.apache.org/viewvc/incubator/cassandra/branches/cassandra-0.5/CHANGES.txt?rev=898833&r1=898832&r2=898833&view=diff
==============================================================================
--- incubator/cassandra/branches/cassandra-0.5/CHANGES.txt (original)
+++ incubator/cassandra/branches/cassandra-0.5/CHANGES.txt Wed Jan 13 16:46:38 2010
@@ -1,5 +1,6 @@
 0.5.0 final
  * avoid attempting to delete temporary bootstrap files twice (CASSANDRA-681)
+ * fix bogus NaN in nodeprobe cfstats output (CASSANDRA-646)
 
 
 0.5.0 RC3

Modified: incubator/cassandra/branches/cassandra-0.5/src/java/org/apache/cassandra/tools/NodeProbe.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/branches/cassandra-0.5/src/java/org/apache/cassandra/tools/NodeProbe.java?rev=898833&r1=898832&r2=898833&view=diff
==============================================================================
--- incubator/cassandra/branches/cassandra-0.5/src/java/org/apache/cassandra/tools/NodeProbe.java
(original)
+++ incubator/cassandra/branches/cassandra-0.5/src/java/org/apache/cassandra/tools/NodeProbe.java
Wed Jan 13 16:46:38 2010
@@ -298,22 +298,21 @@
                     int writeCount = cfstore.getWriteCount();
                     int readCount = cfstore.getReadCount();
                     
-                    tableReadCount += readCount;
-                    tableTotalReadTime += cfstore.getReadLatency() * readCount;
-                    tableWriteCount += writeCount;
-                    tableTotalWriteTime += cfstore.getWriteLatency() * writeCount;
+                    if (readCount > 0)
+                    {
+                        tableReadCount += readCount;
+                        tableTotalReadTime += cfstore.getReadLatency() * readCount;
+                    }
+                    if (writeCount > 0)
+                    {
+                        tableWriteCount += writeCount;
+                        tableTotalWriteTime += cfstore.getWriteLatency() * writeCount;
+                    }
                     tablePendingTasks += cfstore.getPendingTasks();
                 }
                 
-                double tableReadLatency = Double.NaN;
-                double tableWriteLatency = Double.NaN;
-                
-                if (tableReadCount > 0.0f) {
-                    tableReadLatency = tableTotalReadTime / tableReadCount;
-                }
-                if (tableWriteCount > 0.0f) {
-                    tableWriteLatency = tableTotalWriteTime / tableWriteCount;
-                }
+                double tableReadLatency = tableReadCount > 0 ? tableTotalReadTime / tableReadCount
: Double.NaN;
+                double tableWriteLatency = tableWriteCount > 0 ? tableTotalWriteTime /
tableWriteCount : Double.NaN;
                 
                 outs.println("\tRead Count: " + tableReadCount);
                 outs.println("\tRead Latency: " + String.format("%01.3f", tableReadLatency)
+ " ms.");



Mime
View raw message