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/12/05 00:58:51 UTC

[10/50] [abbrv] git commit: ACCUMULO-802 fixed problem when cloning a table, its namespace properties are excluded but those could conflict with explicitly set properties

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/45f59ca7
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/45f59ca7
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/45f59ca7

Branch: refs/heads/master
Commit: 45f59ca7fa62d7643f924f56b1215c8d89979cce
Parents: 88d44bc
Author: Sean Hickey <ta...@gmail.com>
Authored: Thu Aug 8 13:18:02 2013 -0400
Committer: Christopher Tubbs <ct...@apache.org>
Committed: Wed Dec 4 18:46:10 2013 -0500

----------------------------------------------------------------------
 .../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/45f59ca7/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 d5e0659..b1ab058 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
@@ -703,7 +703,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);
     }
@@ -726,8 +726,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);
@@ -745,6 +746,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/45f59ca7/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