ACCUMULO-802 fixed problem when cloning a table, its namespace properties are excluded but those could conflict with explicitly set properties
Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/cfad0b02 Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/cfad0b02 Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/cfad0b02 Branch: refs/heads/ACCUMULO-802 Commit: cfad0b0242db93e10003fc767e06d2f1a52fff00 Parents: 1372292 Author: Sean Hickey <tallirishll...@gmail.com> Authored: Thu Aug 8 13:18:02 2013 -0400 Committer: Christopher Tubbs <ctubb...@apache.org> Committed: Thu Oct 31 21:33:16 2013 -0400 ---------------------------------------------------------------------- .../accumulo/core/client/admin/TableOperationsImpl.java | 11 ++++++++--- .../org/apache/accumulo/master/tableOps/CreateTable.java | 2 +- 2 files changed, 9 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/accumulo/blob/cfad0b02/core/src/main/java/org/apache/accumulo/core/client/admin/TableOperationsImpl.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/accumulo/core/client/admin/TableOperationsImpl.java b/core/src/main/java/org/apache/accumulo/core/client/admin/TableOperationsImpl.java index 2453615..fe35e49 100644 --- a/core/src/main/java/org/apache/accumulo/core/client/admin/TableOperationsImpl.java +++ b/core/src/main/java/org/apache/accumulo/core/client/admin/TableOperationsImpl.java @@ -702,7 +702,7 @@ public class TableOperationsImpl extends TableOperationsHelper { if (propertiesToSet == null) propertiesToSet = Collections.emptyMap(); - HashSet<String> excludeProps = getUniqueNamespaceProperties(namespace, srcTableName); + HashSet<String> excludeProps = getUniqueNamespaceProperties(namespace, srcTableName, propertiesToSet); for (String p : propertiesToExclude) { excludeProps.add(p); } @@ -725,8 +725,9 @@ public class TableOperationsImpl extends TableOperationsHelper { doTableOperation(TableOperation.CLONE, args, opts); } - // get the properties that are only in the table namespace so that we can exclude them when copying table properties - private HashSet<String> getUniqueNamespaceProperties(String namespace, String table) throws TableNotFoundException, AccumuloException { + // get the properties that are only in the table namespace so that we can exclude them when copying table properties. + // also, don't exclude properties that are going to be explicitly set. + private HashSet<String> getUniqueNamespaceProperties(String namespace, String table, Map<String,String> propsToSet) throws TableNotFoundException, AccumuloException { HashSet<String> props = new HashSet<String>(); try { Iterable<Entry<String,String>> n = new TableNamespaceOperationsImpl(instance, credentials).getProperties(namespace); @@ -744,6 +745,10 @@ public class TableOperationsImpl extends TableOperationsHelper { } catch (TableNamespaceNotFoundException e) { throw new IllegalStateException(new TableNamespaceNotFoundException(null, namespace, null)); } + + for (Entry<String,String> e : propsToSet.entrySet()) { + props.remove(e.getKey()); + } return props; } http://git-wip-us.apache.org/repos/asf/accumulo/blob/cfad0b02/server/master/src/main/java/org/apache/accumulo/master/tableOps/CreateTable.java ---------------------------------------------------------------------- diff --git a/server/master/src/main/java/org/apache/accumulo/master/tableOps/CreateTable.java b/server/master/src/main/java/org/apache/accumulo/master/tableOps/CreateTable.java index a2c0344..217bfda 100644 --- a/server/master/src/main/java/org/apache/accumulo/master/tableOps/CreateTable.java +++ b/server/master/src/main/java/org/apache/accumulo/master/tableOps/CreateTable.java @@ -291,7 +291,7 @@ public class CreateTable extends MasterRepo { public long isReady(long tid, Master environment) throws Exception { // reserve the table's namespace to make sure it doesn't change while the table is created tableInfo.namespaceId = TableNamespaces.getNamespaceId(environment.getInstance(), Tables.extractNamespace(tableInfo.tableName)); - return Utils.reserveTableNamespace(tableInfo.namespaceId, tid, false, false, TableOperation.CREATE); + return Utils.reserveTableNamespace(tableInfo.namespaceId, tid, false, true, TableOperation.CREATE); } @Override