You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by el...@apache.org on 2014/01/23 05:34:04 UTC
[2/6] git commit: ACCUMULO-2235 Make the du shell command successful
when not in a table context.
ACCUMULO-2235 Make the du shell command successful when not in a table context.
Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/707e74e0
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/707e74e0
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/707e74e0
Branch: refs/heads/1.6.0-SNAPSHOT
Commit: 707e74e057bc449aced48147544153d0571801d0
Parents: 7bef404
Author: Josh Elser <el...@apache.org>
Authored: Wed Jan 22 23:18:17 2014 -0500
Committer: Josh Elser <el...@apache.org>
Committed: Wed Jan 22 23:18:17 2014 -0500
----------------------------------------------------------------------
.../apache/accumulo/core/util/shell/commands/DUCommand.java | 8 ++++++--
.../test/java/org/apache/accumulo/test/ShellServerTest.java | 6 +++++-
2 files changed, 11 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/accumulo/blob/707e74e0/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 bdc4d33..b03f516 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
@@ -44,16 +44,20 @@ public class DUCommand extends Command {
boolean prettyPrint = cl.hasOption(optHumanReadble.getOpt()) ? true : false;
+ // Add any patterns
if (cl.hasOption(optTablePattern.getOpt())) {
for (String table : shellState.getConnector().tableOperations().list()) {
if (table.matches(cl.getOptionValue(optTablePattern.getOpt()))) {
tablesToFlush.add(table);
}
}
- } else {
- shellState.checkTableState();
+ }
+
+ // If we didn't get any tables, and we have a table selected, add the current table
+ if (tablesToFlush.isEmpty() && !shellState.getTableName().isEmpty()) {
tablesToFlush.add(shellState.getTableName());
}
+
try {
final AccumuloConfiguration acuConf = new ConfigurationCopy(shellState.getConnector().instanceOperations().getSystemConfiguration());
TableDiskUsage.printDiskUsage(acuConf, tablesToFlush, FileSystem.get(new Configuration()), shellState.getConnector(), new Printer() {
http://git-wip-us.apache.org/repos/asf/accumulo/blob/707e74e0/test/src/test/java/org/apache/accumulo/test/ShellServerTest.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/ShellServerTest.java b/test/src/test/java/org/apache/accumulo/test/ShellServerTest.java
index 014342c..bc73c9f 100644
--- a/test/src/test/java/org/apache/accumulo/test/ShellServerTest.java
+++ b/test/src/test/java/org/apache/accumulo/test/ShellServerTest.java
@@ -245,7 +245,11 @@ public class ShellServerTest {
@Test(timeout = 30000)
public void du() throws Exception {
- // du
+ // Calling du not in a table context shouldn't throw an error
+ output.clear();
+ exec("du", true, "", true);
+
+ output.clear();
exec("createtable t");
make10();
exec("flush -t t -w");