ACCUMULO-802 added a Total to the DUCommand to know the disk usage of a whole 
namespace or for everything


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

Branch: refs/heads/ACCUMULO-802
Commit: 7fc1ff39a376f15b539bc5dfba4926c66921e763
Parents: 2f69350
Author: Sean Hickey <tallirishll...@gmail.com>
Authored: Tue Jul 23 09:48:37 2013 -0400
Committer: Christopher Tubbs <ctubb...@apache.org>
Committed: Thu Oct 31 21:24:36 2013 -0400

----------------------------------------------------------------------
 .../org/apache/accumulo/core/util/shell/commands/DUCommand.java | 5 +++++
 1 file changed, 5 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/7fc1ff39/core/src/main/java/org/apache/accumulo/core/util/shell/commands/DUCommand.java
----------------------------------------------------------------------
diff --git 
a/core/src/main/java/org/apache/accumulo/core/util/shell/commands/DUCommand.java
 
b/core/src/main/java/org/apache/accumulo/core/util/shell/commands/DUCommand.java
index 817809d..fcfa772 100644
--- 
a/core/src/main/java/org/apache/accumulo/core/util/shell/commands/DUCommand.java
+++ 
b/core/src/main/java/org/apache/accumulo/core/util/shell/commands/DUCommand.java
@@ -71,10 +71,15 @@ public class DUCommand extends Command {
     }
     try {
       String valueFormat = prettyPrint ? "%9s" : "%,24d";
+      Long total = 0L;
       for (DiskUsage usage : 
shellState.getConnector().tableOperations().getDiskUsage(tables)) {
         Object value = prettyPrint ? 
NumUtil.bigNumberForSize(usage.getUsage()) : usage.getUsage();
         shellState.getReader().println(String.format(valueFormat + " %s", 
value, usage.getTables()));
+        for (@SuppressWarnings("unused") String t : usage.getTables()) {
+          total += usage.getUsage();
+        }
       }
+      shellState.getReader().println(String.format(valueFormat + " %s", total, 
"Total"));
     } catch (Exception ex) {
       throw new RuntimeException(ex);
     }

Reply via email to