You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by ct...@apache.org on 2013/11/01 03:00:17 UTC
[16/54] git commit: ACCUMULO-802 updated ConstraintCommand to work
with namespaces
ACCUMULO-802 updated ConstraintCommand to work with namespaces
Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/57dd6c9d
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/57dd6c9d
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/57dd6c9d
Branch: refs/heads/ACCUMULO-802
Commit: 57dd6c9dc545a23895cc1131ced9c372edf8df43
Parents: c9ab4c9
Author: Sean Hickey <ta...@gmail.com>
Authored: Thu Jul 25 15:27:37 2013 -0400
Committer: Christopher Tubbs <ct...@apache.org>
Committed: Thu Oct 31 21:25:34 2013 -0400
----------------------------------------------------------------------
.../util/shell/commands/ConstraintCommand.java | 6 +++++-
.../core/util/shell/commands/DUCommand.java | 5 -----
.../tserver/constraints/ConstraintChecker.java | 1 -
.../org/apache/accumulo/test/ShellServerIT.java | 21 +++++++++++++++-----
4 files changed, 21 insertions(+), 12 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/accumulo/blob/57dd6c9d/core/src/main/java/org/apache/accumulo/core/util/shell/commands/ConstraintCommand.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/util/shell/commands/ConstraintCommand.java b/core/src/main/java/org/apache/accumulo/core/util/shell/commands/ConstraintCommand.java
index 8be52cf..f72fa32 100644
--- a/core/src/main/java/org/apache/accumulo/core/util/shell/commands/ConstraintCommand.java
+++ b/core/src/main/java/org/apache/accumulo/core/util/shell/commands/ConstraintCommand.java
@@ -43,7 +43,11 @@ public class ConstraintCommand extends Command {
namespace = null;
}
- tableName = OptUtil.getTableOpt(cl, shellState);
+ if (cl.hasOption(OptUtil.tableOpt().getOpt()) || !shellState.getTableName().isEmpty()) {
+ tableName = OptUtil.getTableOpt(cl, shellState);
+ } else {
+ tableName = null;
+ }
int i;
http://git-wip-us.apache.org/repos/asf/accumulo/blob/57dd6c9d/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 fcfa772..817809d 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,15 +71,10 @@ 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);
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/57dd6c9d/server/tserver/src/main/java/org/apache/accumulo/tserver/constraints/ConstraintChecker.java
----------------------------------------------------------------------
diff --git a/server/tserver/src/main/java/org/apache/accumulo/tserver/constraints/ConstraintChecker.java b/server/tserver/src/main/java/org/apache/accumulo/tserver/constraints/ConstraintChecker.java
index 902f12b..6f52485 100644
--- a/server/tserver/src/main/java/org/apache/accumulo/tserver/constraints/ConstraintChecker.java
+++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/constraints/ConstraintChecker.java
@@ -59,7 +59,6 @@ public class ConstraintChecker {
for (Entry<String,String> entry : conf) {
if (entry.getKey().startsWith(Property.TABLE_CONSTRAINT_PREFIX.getKey())) {
- System.err.println("FOUND A CONSTRAINT: " + entry.toString() + " for table " + conf.getTableId());
String className = entry.getValue();
Class<? extends Constraint> clazz = loader.loadClass(className).asSubclass(Constraint.class);
log.debug("Loaded constraint " + clazz.getName() + " for " + conf.getTableId());
http://git-wip-us.apache.org/repos/asf/accumulo/blob/57dd6c9d/test/src/test/java/org/apache/accumulo/test/ShellServerIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/ShellServerIT.java b/test/src/test/java/org/apache/accumulo/test/ShellServerIT.java
index 79230a5..8fdaefc 100644
--- a/test/src/test/java/org/apache/accumulo/test/ShellServerIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/ShellServerIT.java
@@ -844,11 +844,10 @@ public class ShellServerIT extends SimpleMacIT {
exec("y");
exec("namespaces", true, "thing2", true);
- /* doesn't work yet, waiting on ACCUMULO-1565
- exec("clonenamespace thing2 testers -e table.file.max", true);
- exec("namespaces", true, "testers", true);
- exec("tables", true, "testers.thingy", true);
- exec("clonenamespace thing2 testers2 -s table.file.max=42", true);*/
+ /*
+ * doesn't work yet, waiting on ACCUMULO-1565 exec("clonenamespace thing2 testers -e table.file.max", true); exec("namespaces", true, "testers", true);
+ * exec("tables", true, "testers.thingy", true); exec("clonenamespace thing2 testers2 -s table.file.max=42", true);
+ */
exec("du -tn thing2", true, "thing2.thingy", true);
@@ -857,6 +856,7 @@ public class ShellServerIT extends SimpleMacIT {
exec("online -tn thing2", true);
exec("flush -tn thing2", true);
exec("compact -tn thing2", true);
+ exec("createnamespace testers", true);
exec("createtable testers.1", true);
exec("createtable testers.2", true);
exec("deletetable -tn testers -f", true);
@@ -880,6 +880,17 @@ public class ShellServerIT extends SimpleMacIT {
exec("deletenamespace -f thing2", true);
exec("namespaces", true, "thing2", false);
exec("tables", true, "thing2.thingy", false);
+
+ // put constraints on a table namespace
+ exec("constraint -tn thing4 -a org.apache.accumulo.examples.simple.constraints.NumericValueConstraint", true);
+ exec("createtable thing4.constrained", true);
+ exec("table thing4.constrained", true);
+ // should fail
+ exec("insert r cf cq abc", false);
+ exec("constraint -l", true, "NumericValueConstraint", true);
+ exec("constraint -tn thing4 -d 2");
+ exec("sleep 1");
+ exec("insert r cf cq abc", true);
}
private int countkeys(String table) throws IOException {