diff --git a/CHANGES.txt b/CHANGES.txt index 7215836185..7c66125b73 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) diff --git a/src/java/org/apache/cassandra/tools/nodetool/TableStats.java b/src/java/org/apache/cassandra/tools/nodetool/TableStats.java index 8293960eda..a1d2038bc4 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)