cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject svn commit: r1142050 - in /cassandra/branches/cassandra-0.8: CHANGES.txt src/java/org/apache/cassandra/tools/NodeCmd.java
Date Fri, 01 Jul 2011 19:54:16 GMT
Author: jbellis
Date: Fri Jul  1 19:54:15 2011
New Revision: 1142050

URL: http://svn.apache.org/viewvc?rev=1142050&view=rev
Log:
improve nodetool compactionstats formatting
patch by Wojciech Meler; reviewed by jbellis for CASSANDRA-2844

Modified:
    cassandra/branches/cassandra-0.8/CHANGES.txt
    cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/tools/NodeCmd.java

Modified: cassandra/branches/cassandra-0.8/CHANGES.txt
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.8/CHANGES.txt?rev=1142050&r1=1142049&r2=1142050&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.8/CHANGES.txt (original)
+++ cassandra/branches/cassandra-0.8/CHANGES.txt Fri Jul  1 19:54:15 2011
@@ -11,6 +11,7 @@
    (CASSANDRA-2823)
  * Fix race in SystemTable.getCurrentLocalNodeId (CASSANDRA-2824)
  * Correctly set default for replicate_on_write (CASSANDRA-2835)
+ * improve nodetool compactionstats formatting (CASSANDRA-2844)
 
 
 0.8.1

Modified: cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/tools/NodeCmd.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/tools/NodeCmd.java?rev=1142050&r1=1142049&r2=1142050&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/tools/NodeCmd.java (original)
+++ cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/tools/NodeCmd.java Fri
Jul  1 19:54:15 2011
@@ -354,26 +354,22 @@ public class NodeCmd
             completed += n;
         outs.printf("%-25s%10s%10s%15s%n", "Responses", "n/a", pending, completed);
     }
-   
+
     public void printCompactionStats(PrintStream outs)
     {
         CompactionManagerMBean cm = probe.getCompactionManagerProxy();
+        outs.println("pending tasks: " + cm.getPendingTasks());
+        if (cm.getCompactions().size() > 0)
+            outs.printf("%25s%16s%16s%16s%16s%10s%n", "compaction type", "keyspace", "column
family", "bytes compacted", "bytes total", "progress");
         for (CompactionInfo c : cm.getCompactions())
         {
-            outs.println("compaction type: " + c.getTaskType());
-            outs.println("keyspace: " + c.getKeyspace());
-            outs.println("column family: " + c.getColumnFamily());
-            outs.println("bytes compacted: " + c.getBytesComplete());
-            outs.println("bytes total: " + c.getTotalBytes());
             String percentComplete = c.getTotalBytes() == 0
                                    ? "n/a"
-                                   : new DecimalFormat("#.##").format((double) c.getBytesComplete()
/ c.getTotalBytes() * 100) + "%";
-            outs.println("compaction progress: " + percentComplete);
-            outs.println("-----------------");
+                                   : new DecimalFormat("0.00").format((double) c.getBytesComplete()
/ c.getTotalBytes() * 100) + "%";
+            outs.printf("%25s%16s%16s%16s%16s%10s%n", c.getTaskType(), c.getKeyspace(), c.getColumnFamily(),
c.getBytesComplete(), c.getTotalBytes(), percentComplete);
         }
-        outs.println("pending tasks: " + cm.getPendingTasks());
     }
- 
+
     public void printColumnFamilyStats(PrintStream outs)
     {
         Map <String, List <ColumnFamilyStoreMBean>> cfstoreMap = new HashMap
<String, List <ColumnFamilyStoreMBean>>();



Mime
View raw message