Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 37000200B13 for ; Wed, 1 Jun 2016 00:08:05 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 35F42160A4A; Tue, 31 May 2016 22:08:05 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 7D84F160A44 for ; Wed, 1 Jun 2016 00:08:04 +0200 (CEST) Received: (qmail 96866 invoked by uid 500); 31 May 2016 22:08:03 -0000 Mailing-List: contact commits-help@cassandra.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cassandra.apache.org Delivered-To: mailing list commits@cassandra.apache.org Received: (qmail 96842 invoked by uid 99); 31 May 2016 22:08:03 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 31 May 2016 22:08:03 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 8482CDFE61; Tue, 31 May 2016 22:08:03 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: yukim@apache.org To: commits@cassandra.apache.org Date: Tue, 31 May 2016 22:08:04 -0000 Message-Id: In-Reply-To: <51a83261187949dd8dd59abad6f9a08f@git.apache.org> References: <51a83261187949dd8dd59abad6f9a08f@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [02/10] cassandra git commit: Avoid showing estimated key as -1 in tablestats archived-at: Tue, 31 May 2016 22:08:05 -0000 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.0 Commit: 39b86e3792721cfc8aeef639cfd4ac06c56288e8 Parents: a5dac12 Author: Mahdi Mohammadi Authored: Sat May 28 05:01:46 2016 +0800 Committer: Yuki Morishita 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)