You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by yu...@apache.org on 2016/05/31 22:08:05 UTC

[03/10] cassandra git commit: Avoid showing estimated key as -1 in tablestats

Avoid showing estimated key as -1 in tablestats

patch by Mahdi Mohammadi; reviewed by yukim for CASSANDRA-11587


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

Branch: refs/heads/cassandra-3.7
Commit: 39b86e3792721cfc8aeef639cfd4ac06c56288e8
Parents: a5dac12
Author: Mahdi Mohammadi <mm...@binary.com>
Authored: Sat May 28 05:01:46 2016 +0800
Committer: Yuki Morishita <yu...@apache.org>
Committed: Tue May 31 16:08:35 2016 -0500

----------------------------------------------------------------------
 CHANGES.txt                                               |  1 +
 .../org/apache/cassandra/tools/nodetool/TableStats.java   | 10 +++++++++-
 2 files changed, 10 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/39b86e37/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 7215836..7c66125 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
 2.2.7
+ * Avoid showing estimated key as -1 in tablestats (CASSANDRA-11587)
  * Fix possible race condition in CommitLog.recover (CASSANDRA-11743)
  * Enable client encryption in sstableloader with cli options (CASSANDRA-11708)
  * Possible memory leak in NIODataInputStream (CASSANDRA-11867)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/39b86e37/src/java/org/apache/cassandra/tools/nodetool/TableStats.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/tools/nodetool/TableStats.java b/src/java/org/apache/cassandra/tools/nodetool/TableStats.java
index 8293960..a1d2038 100644
--- a/src/java/org/apache/cassandra/tools/nodetool/TableStats.java
+++ b/src/java/org/apache/cassandra/tools/nodetool/TableStats.java
@@ -185,7 +185,15 @@ public class TableStats extends NodeToolCmd
                 if (offHeapSize != null)
                     System.out.println("\t\tOff heap memory used (total): " + format(offHeapSize, humanReadable));
                 System.out.println("\t\tSSTable Compression Ratio: " + probe.getColumnFamilyMetric(keyspaceName, tableName, "CompressionRatio"));
-                System.out.println("\t\tNumber of keys (estimate): " + probe.getColumnFamilyMetric(keyspaceName, tableName, "EstimatedRowCount"));
+
+                Object estimatedRowCount = probe.getColumnFamilyMetric(keyspaceName, tableName, "EstimatedRowCount");
+                if (Long.valueOf(-1L).equals(estimatedRowCount))
+                {
+                    estimatedRowCount = 0L;
+                }
+
+                System.out.println("\t\tNumber of keys (estimate): " + estimatedRowCount);
+
                 System.out.println("\t\tMemtable cell count: " + probe.getColumnFamilyMetric(keyspaceName, tableName, "MemtableColumnsCount"));
                 System.out.println("\t\tMemtable data size: " + format((Long) probe.getColumnFamilyMetric(keyspaceName, tableName, "MemtableLiveDataSize"), humanReadable));
                 if (memtableOffHeapSize != null)