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 2015/12/14 19:12:07 UTC

cassandra git commit: Make tablehistograms accept the same syntax as tablestats

Repository: cassandra
Updated Branches:
  refs/heads/trunk 6bc363726 -> e5db3f2b1


Make tablehistograms accept the same syntax as tablestats

patch by Sunkret Hasdemir; reviewed by yukim for CASSANDRA-10149


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

Branch: refs/heads/trunk
Commit: e5db3f2b1d77a00308c0e2ef3b5460a8e636388c
Parents: 6bc3637
Author: Sukret Hasdemir <su...@gmail.com>
Authored: Sun Aug 30 06:56:44 2015 -0400
Committer: Yuki Morishita <yu...@apache.org>
Committed: Mon Dec 14 12:10:05 2015 -0600

----------------------------------------------------------------------
 CHANGES.txt                                     |  1 +
 .../tools/nodetool/TableHistograms.java         | 23 +++++++++++++++-----
 2 files changed, 19 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/e5db3f2b/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 7d0ca2e..eadd387 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
 3.2
+ * Make tablehistograms accept the same syntax as tablestats (CASSANDRA-10149)
  * Group pending compactions based on table (CASSANDRA-10718)
  * Add compressor name in sstablemetadata output (CASSANDRA-9879)
  * Fix type casting for counter columns (CASSANDRA-10824)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/e5db3f2b/src/java/org/apache/cassandra/tools/nodetool/TableHistograms.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/tools/nodetool/TableHistograms.java b/src/java/org/apache/cassandra/tools/nodetool/TableHistograms.java
index 23f1c43..f3f9b8a 100644
--- a/src/java/org/apache/cassandra/tools/nodetool/TableHistograms.java
+++ b/src/java/org/apache/cassandra/tools/nodetool/TableHistograms.java
@@ -34,16 +34,29 @@ import org.apache.commons.lang3.ArrayUtils;
 @Command(name = "tablehistograms", description = "Print statistic histograms for a given table")
 public class TableHistograms extends NodeToolCmd
 {
-    @Arguments(usage = "<keyspace> <table>", description = "The keyspace and table name")
+    @Arguments(usage = "<keyspace> <table> | <keyspace.table>", description = "The keyspace and table name")
     private List<String> args = new ArrayList<>();
 
     @Override
     public void execute(NodeProbe probe)
     {
-        checkArgument(args.size() == 2, "tablehistograms requires keyspace and table name arguments");
-
-        String keyspace = args.get(0);
-        String table = args.get(1);
+        String keyspace = null, table = null;
+        if (args.size() == 2)
+        {
+            keyspace = args.get(0);
+            table = args.get(1);
+        }
+        else if (args.size() == 1)
+        {
+            String[] input = args.get(0).split("\\.");
+            checkArgument(input.length == 2, "tablehistograms requires keyspace and table name arguments");
+            keyspace = input[0];
+            table = input[1];
+        }
+        else
+        {
+            checkArgument(false, "tablehistograms requires keyspace and table name arguments");
+        }
 
         // calculate percentile of row size and column count
         long[] estimatedPartitionSize = (long[]) probe.getColumnFamilyMetric(keyspace, table, "EstimatedPartitionSizeHistogram");