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 2013/12/26 22:48:11 UTC

[1/8] git commit: ACCUMULO-2093 Exclude incomplete tables from listing.

Updated Branches:
  refs/heads/master 00bcb0cb0 -> 8553b4678


ACCUMULO-2093 Exclude incomplete tables from listing.

  Specifically, tables who can't resolve with a fully-qualified table
  name are excluded from a table listing. This ensures that tables being
  created and/or deleted aren't shown in an inconsistent state.


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

Branch: refs/heads/master
Commit: 3cddee9ef10049219b551d578bbfa9f779697993
Parents: db74696
Author: Christopher Tubbs <ct...@apache.org>
Authored: Tue Dec 24 16:18:15 2013 -0500
Committer: Christopher Tubbs <ct...@apache.org>
Committed: Tue Dec 24 16:18:15 2013 -0500

----------------------------------------------------------------------
 .../java/org/apache/accumulo/core/client/impl/Tables.java | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/3cddee9e/core/src/main/java/org/apache/accumulo/core/client/impl/Tables.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/client/impl/Tables.java b/core/src/main/java/org/apache/accumulo/core/client/impl/Tables.java
index 7cf5ccc..f3f46d5 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/impl/Tables.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/impl/Tables.java
@@ -53,9 +53,7 @@ public class Tables {
     ZooCache zc = getZooCache(instance);
 
     List<String> tableIds = zc.getChildren(ZooUtil.getRoot(instance) + Constants.ZTABLES);
-
     TreeMap<String,String> tableMap = new TreeMap<String,String>();
-
     Map<String,String> namespaceIdToNameMap = new HashMap<String,String>();
 
     for (String tableId : tableIds) {
@@ -63,7 +61,9 @@ public class Tables {
       byte[] nId = zc.get(ZooUtil.getRoot(instance) + Constants.ZTABLES + "/" + tableId + Constants.ZTABLE_NAMESPACE);
       String namespaceName = Constants.DEFAULT_NAMESPACE;
       // create fully qualified table name
-      if (nId != null) {
+      if (nId == null) {
+        namespaceName = null;
+      } else if (nId != null) {
         String namespaceId = new String(nId, Constants.UTF8);
         if (!namespaceId.equals(Constants.DEFAULT_NAMESPACE_ID)) {
           try {
@@ -73,12 +73,12 @@ public class Tables {
               namespaceIdToNameMap.put(namespaceId, namespaceName);
             }
           } catch (NamespaceNotFoundException e) {
-            log.error("Table (" + tableId + ") contains reference to namespace (" + namespaceId + ") that doesn't exist");
+            log.error("Table (" + tableId + ") contains reference to namespace (" + namespaceId + ") that doesn't exist", e);
             continue;
           }
         }
       }
-      if (tableName != null) {
+      if (tableName != null && namespaceName != null) {
         String tableNameStr = qualified(new String(tableName, Constants.UTF8), namespaceName);
         if (nameAsKey)
           tableMap.put(tableNameStr, tableId);


[6/8] git commit: Merge branch '1.5.1-SNAPSHOT' into 1.6.0-SNAPSHOT

Posted by el...@apache.org.
Merge branch '1.5.1-SNAPSHOT' into 1.6.0-SNAPSHOT


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

Branch: refs/heads/master
Commit: 06cbd91e61445435f796964f0361614d628e9232
Parents: 86f5927 280b6a6
Author: Josh Elser <el...@apache.org>
Authored: Thu Dec 26 10:51:29 2013 -0500
Committer: Josh Elser <el...@apache.org>
Committed: Thu Dec 26 10:51:29 2013 -0500

----------------------------------------------------------------------
 .../src/test/resources/ClassLoaderTestA/Test.jar | Bin 748 -> 1570 bytes
 .../src/test/resources/ClassLoaderTestB/Test.jar | Bin 748 -> 1572 bytes
 .../src/test/resources/ClassLoaderTestC/Test.jar | Bin 748 -> 1571 bytes
 start/src/test/resources/HelloWorld2.jar         | Bin 575 -> 1483 bytes
 test/src/test/resources/FooConstraint.jar        | Bin 1079 -> 2130 bytes
 test/src/test/resources/TestCombinerX.jar        | Bin 1525 -> 4335 bytes
 test/src/test/resources/TestCombinerY.jar        | Bin 1524 -> 4335 bytes
 7 files changed, 0 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/06cbd91e/test/src/test/resources/TestCombinerX.jar
----------------------------------------------------------------------
diff --cc test/src/test/resources/TestCombinerX.jar
index d9451f7,0000000..849e447
mode 100644,000000..100644
Binary files differ

http://git-wip-us.apache.org/repos/asf/accumulo/blob/06cbd91e/test/src/test/resources/TestCombinerY.jar
----------------------------------------------------------------------
diff --cc test/src/test/resources/TestCombinerY.jar
index a3ce3ae,0000000..6cffd86
mode 100644,000000..100644
Binary files differ


[4/8] git commit: Merge branch '1.4.5-SNAPSHOT' into 1.5.1-SNAPSHOT

Posted by el...@apache.org.
Merge branch '1.4.5-SNAPSHOT' into 1.5.1-SNAPSHOT

Conflicts:
	src/start/src/test/resources/ClassLoaderTestA/Test.jar
	src/start/src/test/resources/ClassLoaderTestB/Test.jar
	src/start/src/test/resources/ClassLoaderTestC/Test.jar
	test/system/auto/TestCombinerX.jar
	test/system/auto/TestCombinerY.jar


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

Branch: refs/heads/master
Commit: 663b7ecc05132ef5aebf2e4a38d0c33e7fb4e374
Parents: 0d58654 43ab1ef
Author: Josh Elser <el...@apache.org>
Authored: Thu Dec 26 10:39:13 2013 -0500
Committer: Josh Elser <el...@apache.org>
Committed: Thu Dec 26 10:39:13 2013 -0500

----------------------------------------------------------------------
 .../src/test/resources/ClassLoaderTestA/Test.jar | Bin 748 -> 1570 bytes
 .../src/test/resources/ClassLoaderTestB/Test.jar | Bin 748 -> 1572 bytes
 .../src/test/resources/ClassLoaderTestC/Test.jar | Bin 748 -> 1571 bytes
 test/system/auto/TestCombinerX.jar               | Bin 1525 -> 4335 bytes
 test/system/auto/TestCombinerY.jar               | Bin 1524 -> 4335 bytes
 5 files changed, 0 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/663b7ecc/start/src/test/resources/ClassLoaderTestA/Test.jar
----------------------------------------------------------------------
diff --cc start/src/test/resources/ClassLoaderTestA/Test.jar
index 0c55958,0000000..8b9c462
mode 100644,000000..100644
Binary files differ

http://git-wip-us.apache.org/repos/asf/accumulo/blob/663b7ecc/start/src/test/resources/ClassLoaderTestB/Test.jar
----------------------------------------------------------------------
diff --cc start/src/test/resources/ClassLoaderTestB/Test.jar
index 0b714c2,0000000..4ced46f
mode 100644,000000..100644
Binary files differ

http://git-wip-us.apache.org/repos/asf/accumulo/blob/663b7ecc/start/src/test/resources/ClassLoaderTestC/Test.jar
----------------------------------------------------------------------
diff --cc start/src/test/resources/ClassLoaderTestC/Test.jar
index 2d21e04,0000000..87b077e
mode 100644,000000..100644
Binary files differ


[3/8] git commit: ACCUMULO-1910 Add source to to test jars that did not have source.

Posted by el...@apache.org.
ACCUMULO-1910 Add source to to test jars that did not have source.

Some of the jars used in test cases did not have source code.  This patch
replaces those jars in 1.4.5-SNAPSHOT with jars that contain both .class
and .java files.

Signed-off-by: Josh Elser <el...@apache.org>


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

Branch: refs/heads/master
Commit: 43ab1ef70581c56169aa6ba4a5f715565519a333
Parents: 55827af
Author: Ed Coleman <de...@etcoleman.com>
Authored: Wed Dec 25 09:00:49 2013 -0500
Committer: Josh Elser <el...@apache.org>
Committed: Thu Dec 26 10:09:45 2013 -0500

----------------------------------------------------------------------
 .../src/test/resources/ClassLoaderTestA/Test.jar  | Bin 748 -> 1570 bytes
 .../src/test/resources/ClassLoaderTestB/Test.jar  | Bin 748 -> 1572 bytes
 .../src/test/resources/ClassLoaderTestC/Test.jar  | Bin 748 -> 1571 bytes
 test/system/auto/TestCombinerX.jar                | Bin 868 -> 4335 bytes
 test/system/auto/TestCombinerY.jar                | Bin 868 -> 4335 bytes
 5 files changed, 0 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/43ab1ef7/src/start/src/test/resources/ClassLoaderTestA/Test.jar
----------------------------------------------------------------------
diff --git a/src/start/src/test/resources/ClassLoaderTestA/Test.jar b/src/start/src/test/resources/ClassLoaderTestA/Test.jar
index db0f238..8b9c462 100644
Binary files a/src/start/src/test/resources/ClassLoaderTestA/Test.jar and b/src/start/src/test/resources/ClassLoaderTestA/Test.jar differ

http://git-wip-us.apache.org/repos/asf/accumulo/blob/43ab1ef7/src/start/src/test/resources/ClassLoaderTestB/Test.jar
----------------------------------------------------------------------
diff --git a/src/start/src/test/resources/ClassLoaderTestB/Test.jar b/src/start/src/test/resources/ClassLoaderTestB/Test.jar
index e6652b4..4ced46f 100644
Binary files a/src/start/src/test/resources/ClassLoaderTestB/Test.jar and b/src/start/src/test/resources/ClassLoaderTestB/Test.jar differ

http://git-wip-us.apache.org/repos/asf/accumulo/blob/43ab1ef7/src/start/src/test/resources/ClassLoaderTestC/Test.jar
----------------------------------------------------------------------
diff --git a/src/start/src/test/resources/ClassLoaderTestC/Test.jar b/src/start/src/test/resources/ClassLoaderTestC/Test.jar
index 717ab02..87b077e 100644
Binary files a/src/start/src/test/resources/ClassLoaderTestC/Test.jar and b/src/start/src/test/resources/ClassLoaderTestC/Test.jar differ

http://git-wip-us.apache.org/repos/asf/accumulo/blob/43ab1ef7/test/system/auto/TestCombinerX.jar
----------------------------------------------------------------------
diff --git a/test/system/auto/TestCombinerX.jar b/test/system/auto/TestCombinerX.jar
index df3f50d..849e447 100644
Binary files a/test/system/auto/TestCombinerX.jar and b/test/system/auto/TestCombinerX.jar differ

http://git-wip-us.apache.org/repos/asf/accumulo/blob/43ab1ef7/test/system/auto/TestCombinerY.jar
----------------------------------------------------------------------
diff --git a/test/system/auto/TestCombinerY.jar b/test/system/auto/TestCombinerY.jar
index c17d92c..6cffd86 100644
Binary files a/test/system/auto/TestCombinerY.jar and b/test/system/auto/TestCombinerY.jar differ


[2/8] git commit: ACCUMULO-2094 Consolidate namespaceId addition with creating table

Posted by el...@apache.org.
ACCUMULO-2094 Consolidate namespaceId addition with creating table

  Also clean up related initialize and upgrade code, and consolidate
  duplicate code.


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

Branch: refs/heads/master
Commit: 86f5927f1177730ab09e9e9c1df055639adadee3
Parents: 3cddee9
Author: Christopher Tubbs <ct...@apache.org>
Authored: Tue Dec 24 18:25:08 2013 -0500
Committer: Christopher Tubbs <ct...@apache.org>
Committed: Tue Dec 24 18:25:08 2013 -0500

----------------------------------------------------------------------
 .../accumulo/core/client/impl/Namespaces.java   |  6 ++
 .../apache/accumulo/server/init/Initialize.java | 24 ++---
 .../accumulo/server/tables/TableManager.java    | 95 +++++---------------
 .../java/org/apache/accumulo/master/Master.java | 62 +++++--------
 .../master/tableOps/CreateNamespace.java        |  2 +-
 .../accumulo/master/tableOps/CreateTable.java   |  4 +-
 .../accumulo/master/tableOps/ImportTable.java   |  4 +-
 7 files changed, 58 insertions(+), 139 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/86f5927f/core/src/main/java/org/apache/accumulo/core/client/impl/Namespaces.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/client/impl/Namespaces.java b/core/src/main/java/org/apache/accumulo/core/client/impl/Namespaces.java
index 2480f68..64a6441 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/impl/Namespaces.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/impl/Namespaces.java
@@ -58,6 +58,12 @@ public class Namespaces {
     return namespaceMap;
   }
 
+  public static boolean exists(Instance instance, String namespaceId) {
+    ZooCache zc = getZooCache(instance);
+    List<String> namespaceIds = zc.getChildren(ZooUtil.getRoot(instance) + Constants.ZNAMESPACES);
+    return namespaceIds.contains(namespaceId);
+  }
+
   public static String getNamespaceId(Instance instance, String namespace) throws NamespaceNotFoundException {
     String id = getNameToIdMap(instance).get(namespace);
     if (id == null)

http://git-wip-us.apache.org/repos/asf/accumulo/blob/86f5927f/server/base/src/main/java/org/apache/accumulo/server/init/Initialize.java
----------------------------------------------------------------------
diff --git a/server/base/src/main/java/org/apache/accumulo/server/init/Initialize.java b/server/base/src/main/java/org/apache/accumulo/server/init/Initialize.java
index a120dbd..7f5e44e 100644
--- a/server/base/src/main/java/org/apache/accumulo/server/init/Initialize.java
+++ b/server/base/src/main/java/org/apache/accumulo/server/init/Initialize.java
@@ -394,8 +394,11 @@ public class Initialize {
     String zkInstanceRoot = Constants.ZROOT + "/" + uuid;
     zoo.putPersistentData(zkInstanceRoot, new byte[0], NodeExistsPolicy.FAIL);
     zoo.putPersistentData(zkInstanceRoot + Constants.ZTABLES, Constants.ZTABLES_INITIAL_ID, NodeExistsPolicy.FAIL);
-    TableManager.prepareNewTableState(uuid, RootTable.ID, RootTable.NAME, TableState.ONLINE, NodeExistsPolicy.FAIL);
-    TableManager.prepareNewTableState(uuid, MetadataTable.ID, MetadataTable.NAME, TableState.ONLINE, NodeExistsPolicy.FAIL);
+    zoo.putPersistentData(zkInstanceRoot + Constants.ZNAMESPACES, new byte[0], NodeExistsPolicy.FAIL);
+    TableManager.prepareNewNamespaceState(uuid, Constants.DEFAULT_NAMESPACE_ID, Constants.DEFAULT_NAMESPACE, NodeExistsPolicy.FAIL);
+    TableManager.prepareNewNamespaceState(uuid, Constants.ACCUMULO_NAMESPACE_ID, Constants.ACCUMULO_NAMESPACE, NodeExistsPolicy.FAIL);
+    TableManager.prepareNewTableState(uuid, RootTable.ID, Constants.ACCUMULO_NAMESPACE_ID, RootTable.NAME, TableState.ONLINE, NodeExistsPolicy.FAIL);
+    TableManager.prepareNewTableState(uuid, MetadataTable.ID, Constants.ACCUMULO_NAMESPACE_ID, MetadataTable.NAME, TableState.ONLINE, NodeExistsPolicy.FAIL);
     zoo.putPersistentData(zkInstanceRoot + Constants.ZTSERVERS, new byte[0], NodeExistsPolicy.FAIL);
     zoo.putPersistentData(zkInstanceRoot + Constants.ZPROBLEMS, new byte[0], NodeExistsPolicy.FAIL);
     zoo.putPersistentData(zkInstanceRoot + RootTable.ZROOT_TABLET, new byte[0], NodeExistsPolicy.FAIL);
@@ -412,23 +415,6 @@ public class Initialize {
     zoo.putPersistentData(zkInstanceRoot + Constants.ZHDFS_RESERVATIONS, new byte[0], NodeExistsPolicy.FAIL);
     zoo.putPersistentData(zkInstanceRoot + Constants.ZNEXT_FILE, new byte[] {'0'}, NodeExistsPolicy.FAIL);
     zoo.putPersistentData(zkInstanceRoot + Constants.ZRECOVERY, new byte[] {'0'}, NodeExistsPolicy.FAIL);
-    zoo.putPersistentData(zkInstanceRoot + Constants.ZNAMESPACES, new byte[0], NodeExistsPolicy.FAIL);
-    
-    createInitialNamespace(zoo, zkInstanceRoot, Constants.DEFAULT_NAMESPACE_ID, Constants.DEFAULT_NAMESPACE);
-    createInitialNamespace(zoo, zkInstanceRoot, Constants.ACCUMULO_NAMESPACE_ID, Constants.ACCUMULO_NAMESPACE);
-    
-    zoo.putPersistentData(zkInstanceRoot + Constants.ZTABLES + "/" + MetadataTable.ID + Constants.ZTABLE_NAMESPACE,
-        Constants.ACCUMULO_NAMESPACE_ID.getBytes(Constants.UTF8), NodeExistsPolicy.OVERWRITE);
-    zoo.putPersistentData(zkInstanceRoot + Constants.ZTABLES + "/" + RootTable.ID + Constants.ZTABLE_NAMESPACE,
-        Constants.ACCUMULO_NAMESPACE_ID.getBytes(Constants.UTF8), NodeExistsPolicy.OVERWRITE);
-  }
-  
-  private static void createInitialNamespace(IZooReaderWriter zoo, String root, String id, String namespace) throws KeeperException,
-      InterruptedException {
-    String zPath = root + Constants.ZNAMESPACES + "/" + id;
-    zoo.putPersistentData(zPath, new byte[0], NodeExistsPolicy.FAIL);
-    zoo.putPersistentData(zPath + Constants.ZNAMESPACE_NAME, namespace.getBytes(Constants.UTF8), NodeExistsPolicy.FAIL);
-    zoo.putPersistentData(zPath + Constants.ZNAMESPACE_CONF, new byte[0], NodeExistsPolicy.FAIL);
   }
 
   private static String getInstanceNamePath(Opts opts) throws IOException, KeeperException, InterruptedException {

http://git-wip-us.apache.org/repos/asf/accumulo/blob/86f5927f/server/base/src/main/java/org/apache/accumulo/server/tables/TableManager.java
----------------------------------------------------------------------
diff --git a/server/base/src/main/java/org/apache/accumulo/server/tables/TableManager.java b/server/base/src/main/java/org/apache/accumulo/server/tables/TableManager.java
index 8a5a682..0766a17 100644
--- a/server/base/src/main/java/org/apache/accumulo/server/tables/TableManager.java
+++ b/server/base/src/main/java/org/apache/accumulo/server/tables/TableManager.java
@@ -26,6 +26,7 @@ import java.util.Set;
 
 import org.apache.accumulo.core.Constants;
 import org.apache.accumulo.core.client.Instance;
+import org.apache.accumulo.core.client.NamespaceNotFoundException;
 import org.apache.accumulo.core.client.impl.Tables;
 import org.apache.accumulo.core.master.state.tables.TableState;
 import org.apache.accumulo.core.util.Pair;
@@ -35,7 +36,6 @@ import org.apache.accumulo.fate.zookeeper.IZooReaderWriter.Mutator;
 import org.apache.accumulo.fate.zookeeper.ZooUtil.NodeExistsPolicy;
 import org.apache.accumulo.fate.zookeeper.ZooUtil.NodeMissingPolicy;
 import org.apache.accumulo.server.client.HdfsZooInstance;
-import org.apache.accumulo.server.util.NamespacePropUtil;
 import org.apache.accumulo.server.util.TablePropUtil;
 import org.apache.accumulo.server.zookeeper.ZooCache;
 import org.apache.accumulo.server.zookeeper.ZooReaderWriter;
@@ -57,8 +57,19 @@ public class TableManager {
   private final Instance instance;
   private ZooCache zooStateCache;
 
-  public static void prepareNewTableState(String instanceId, String tableId, String tableName, TableState state, NodeExistsPolicy existsPolicy)
-      throws KeeperException, InterruptedException {
+  public static void prepareNewNamespaceState(String instanceId, String namespaceId, String namespace, NodeExistsPolicy existsPolicy) throws KeeperException,
+      InterruptedException {
+    // state gets created last
+    String zPath = Constants.ZROOT + "/" + instanceId + Constants.ZNAMESPACES + "/" + namespaceId;
+
+    IZooReaderWriter zoo = ZooReaderWriter.getRetryingInstance();
+    zoo.putPersistentData(zPath, new byte[0], existsPolicy);
+    zoo.putPersistentData(zPath + Constants.ZNAMESPACE_NAME, namespace.getBytes(Constants.UTF8), existsPolicy);
+    zoo.putPersistentData(zPath + Constants.ZNAMESPACE_CONF, new byte[0], existsPolicy);
+  }
+
+  public static void prepareNewTableState(String instanceId, String tableId, String namespaceId, String tableName, TableState state,
+      NodeExistsPolicy existsPolicy) throws KeeperException, InterruptedException {
     // state gets created last
     Pair<String,String> qualifiedTableName = Tables.qualify(tableName);
     tableName = qualifiedTableName.getSecond();
@@ -66,12 +77,12 @@ public class TableManager {
     IZooReaderWriter zoo = ZooReaderWriter.getRetryingInstance();
     zoo.putPersistentData(zTablePath, new byte[0], existsPolicy);
     zoo.putPersistentData(zTablePath + Constants.ZTABLE_CONF, new byte[0], existsPolicy);
+    zoo.putPersistentData(zTablePath + Constants.ZTABLE_NAMESPACE, namespaceId.getBytes(Constants.UTF8), existsPolicy);
     zoo.putPersistentData(zTablePath + Constants.ZTABLE_NAME, tableName.getBytes(Constants.UTF8), existsPolicy);
     zoo.putPersistentData(zTablePath + Constants.ZTABLE_STATE, state.name().getBytes(Constants.UTF8), existsPolicy);
     zoo.putPersistentData(zTablePath + Constants.ZTABLE_FLUSH_ID, "0".getBytes(Constants.UTF8), existsPolicy);
     zoo.putPersistentData(zTablePath + Constants.ZTABLE_COMPACT_ID, "0".getBytes(Constants.UTF8), existsPolicy);
     zoo.putPersistentData(zTablePath + Constants.ZTABLE_COMPACT_CANCEL_ID, "0".getBytes(Constants.UTF8), existsPolicy);
-    zoo.putPersistentData(zTablePath + Constants.ZTABLE_NAMESPACE, qualifiedTableName.getFirst().getBytes(Constants.UTF8), existsPolicy);
   }
 
   public synchronized static TableManager getInstance() {
@@ -180,17 +191,16 @@ public class TableManager {
     }
   }
 
-  public void addTable(String tableId, String tableName, NodeExistsPolicy existsPolicy) throws KeeperException, InterruptedException {
-    prepareNewTableState(instance.getInstanceID(), tableId, tableName, TableState.NEW, existsPolicy);
+  public void addTable(String tableId, String namespaceId, String tableName, NodeExistsPolicy existsPolicy) throws KeeperException, InterruptedException,
+      NamespaceNotFoundException {
+    prepareNewTableState(instance.getInstanceID(), tableId, namespaceId, tableName, TableState.NEW, existsPolicy);
     updateTableStateCache(tableId);
   }
 
-  public void cloneTable(String srcTable, String tableId, String tableName, String namespaceId, Map<String,String> propertiesToSet, Set<String> propertiesToExclude,
-      NodeExistsPolicy existsPolicy) throws KeeperException, InterruptedException {
-    prepareNewTableState(instance.getInstanceID(), tableId, tableName, TableState.NEW, existsPolicy);
-    
-    addNamespaceToTable(tableId, namespaceId);
-    
+  public void cloneTable(String srcTable, String tableId, String tableName, String namespaceId, Map<String,String> propertiesToSet,
+      Set<String> propertiesToExclude, NodeExistsPolicy existsPolicy) throws KeeperException, InterruptedException {
+    prepareNewTableState(instance.getInstanceID(), tableId, namespaceId, tableName, TableState.NEW, existsPolicy);
+
     String srcTablePath = Constants.ZROOT + "/" + instance.getInstanceID() + Constants.ZTABLES + "/" + srcTable + Constants.ZTABLE_CONF;
     String newTablePath = Constants.ZROOT + "/" + instance.getInstanceID() + Constants.ZTABLES + "/" + tableId + Constants.ZTABLE_CONF;
     ZooReaderWriter.getRetryingInstance().recursiveCopyPersistent(srcTablePath, newTablePath, NodeExistsPolicy.OVERWRITE);
@@ -299,69 +309,8 @@ public class TableManager {
     }
   }
 
-  public void addNamespace(String namespaceId, String namespace, NodeExistsPolicy existsPolicy) throws KeeperException, InterruptedException {
-    // state gets created last
-    String zPath = Constants.ZROOT + "/" + instance.getInstanceID() + Constants.ZNAMESPACES + "/" + namespaceId;
-
-    IZooReaderWriter zoo = ZooReaderWriter.getRetryingInstance();
-
-    zoo.putPersistentData(zPath, new byte[0], existsPolicy);
-    zoo.putPersistentData(zPath + Constants.ZNAMESPACE_NAME, namespace.getBytes(Constants.UTF8), existsPolicy);
-    zoo.putPersistentData(zPath + Constants.ZNAMESPACE_CONF, new byte[0], existsPolicy);
-  }
-
   public void removeNamespace(String namespaceId) throws KeeperException, InterruptedException {
     ZooReaderWriter.getRetryingInstance().recursiveDelete(ZooUtil.getRoot(instance) + Constants.ZNAMESPACES + "/" + namespaceId, NodeMissingPolicy.SKIP);
   }
 
-  public void addNamespaceToTable(String tableId, String namespaceId) throws KeeperException, InterruptedException {
-    String zPath = Constants.ZROOT + "/" + instance.getInstanceID() + Constants.ZTABLES + "/" + tableId + Constants.ZTABLE_NAMESPACE;
-    ZooReaderWriter.getRetryingInstance().putPersistentData(zPath, namespaceId.getBytes(Constants.UTF8), NodeExistsPolicy.OVERWRITE);
-  }
-
-  public void removeNamespaceFromTable(String tableId, String namespaceId) throws KeeperException, InterruptedException {
-    // actually, revert it to the default namespace.
-    String zPath = Constants.ZROOT + "/" + instance.getInstanceID() + Constants.ZTABLES + "/" + tableId + Constants.ZTABLE_NAMESPACE;
-    ZooReaderWriter.getRetryingInstance().putPersistentData(zPath, Constants.DEFAULT_NAMESPACE_ID.getBytes(Constants.UTF8), NodeExistsPolicy.OVERWRITE);
-  }
-
-  public void cloneNamespace(String srcId, String newId, String namespaceName, Map<String,String> propertiesToSet, Set<String> propertiesToExclude,
-      NodeExistsPolicy existsPolicy) throws KeeperException, InterruptedException {
-    String srcPath = Constants.ZROOT + "/" + instance.getInstanceID() + Constants.ZNAMESPACES + "/" + srcId + Constants.ZNAMESPACE_CONF;
-    String newPath = Constants.ZROOT + "/" + instance.getInstanceID() + Constants.ZNAMESPACES + "/" + newId + Constants.ZNAMESPACE_CONF;
-    ZooReaderWriter.getRetryingInstance().recursiveCopyPersistent(srcPath, newPath, NodeExistsPolicy.OVERWRITE);
-
-    for (Entry<String,String> entry : propertiesToSet.entrySet())
-      NamespacePropUtil.setNamespaceProperty(newId, entry.getKey(), entry.getValue());
-
-    for (String prop : propertiesToExclude)
-      ZooReaderWriter.getRetryingInstance().recursiveDelete(
-          Constants.ZROOT + "/" + instance.getInstanceID() + Constants.ZNAMESPACES + "/" + newId + Constants.ZNAMESPACE_CONF + "/" + prop,
-          NodeMissingPolicy.SKIP);
-  }
-
-  /*
-   * private static boolean verifyTabletAssignments(String tableId) { log.info( "Sending message to load balancer to verify assignment of tablets with tableId="
-   * + tableId); // Return true only if transitions to other states did not interrupt // this process. (like deleting the table) return true; }
-   * 
-   * private static synchronized boolean unloadTable(String tableId) { int loadedTabletCount = 0; while (loadedTabletCount > 0) { // wait for tables to be
-   * unloaded } log.info("Table unloaded. tableId=" + tableId); return true; }
-   * 
-   * private static void cleanupDeletedTable(String tableId) { log.info("Sending message to cleanup the deleted table with tableId=" + tableId); }
-   * 
-   * switch (tState) { case NEW: // this should really only happen before the watcher // knows about the table log.error("Unexpected transition to " + tState +
-   * " @ " + event); break;
-   * 
-   * case LOADING: // a table has started coming online or has pending // migrations (maybe?) if (verifyTabletAssignments(tableId))
-   * TableState.transition(instance, tableId, TableState.ONLINE); break; case ONLINE: log.trace("Table online with tableId=" + tableId); break;
-   * 
-   * case DISABLING: if (unloadTable(tableId)) TableState.transition(instance, tableId, TableState.DISABLED); break; case DISABLED:
-   * log.trace("Table disabled with tableId=" + tableId); break;
-   * 
-   * case UNLOADING: unloadTable(tableId); TableState.transition(instance, tableId, TableState.OFFLINE); case OFFLINE: break;
-   * 
-   * case DELETING: unloadTable(tableId); cleanupDeletedTable(tableId); break;
-   * 
-   * default: log.error("Unrecognized transition to " + tState + " @ " + event); }
-   */
 }

http://git-wip-us.apache.org/repos/asf/accumulo/blob/86f5927f/server/master/src/main/java/org/apache/accumulo/master/Master.java
----------------------------------------------------------------------
diff --git a/server/master/src/main/java/org/apache/accumulo/master/Master.java b/server/master/src/main/java/org/apache/accumulo/master/Master.java
index bd6ee27..65d6030 100644
--- a/server/master/src/main/java/org/apache/accumulo/master/Master.java
+++ b/server/master/src/main/java/org/apache/accumulo/master/Master.java
@@ -316,56 +316,38 @@ public class Master implements LiveTServerSet.Listener, TableObserver, CurrentSt
 
         IZooReaderWriter zoo = ZooReaderWriter.getInstance();
 
+        // create initial namespaces
+        String namespaces = ZooUtil.getRoot(instance) + Constants.ZNAMESPACES;
+        zoo.putPersistentData(namespaces, new byte[0], NodeExistsPolicy.SKIP);
+        if (!Namespaces.exists(instance, Constants.ACCUMULO_NAMESPACE_ID))
+          TableManager.prepareNewNamespaceState(instance.getInstanceID(), Constants.ACCUMULO_NAMESPACE_ID, Constants.ACCUMULO_NAMESPACE, NodeExistsPolicy.SKIP);
+        if (!Namespaces.exists(instance, Constants.DEFAULT_NAMESPACE_ID))
+          TableManager.prepareNewNamespaceState(instance.getInstanceID(), Constants.DEFAULT_NAMESPACE_ID, Constants.DEFAULT_NAMESPACE, NodeExistsPolicy.SKIP);
+
+        // create root table
         if (!Tables.exists(instance, RootTable.ID)) {
-          TableManager.prepareNewTableState(instance.getInstanceID(), RootTable.ID, RootTable.NAME, TableState.ONLINE, NodeExistsPolicy.SKIP);
+          TableManager.prepareNewTableState(instance.getInstanceID(), RootTable.ID, Constants.ACCUMULO_NAMESPACE_ID, RootTable.NAME, TableState.ONLINE,
+              NodeExistsPolicy.SKIP);
           Initialize.initMetadataConfig(RootTable.ID);
           // ensure root user can flush root table
           security.grantTablePermission(SystemCredentials.get().toThrift(instance), security.getRootUsername(), RootTable.ID, TablePermission.ALTER_TABLE);
         }
 
-        moveRootTabletToRootTable(zoo);
-
-        zoo.recursiveDelete(ZooUtil.getRoot(instance) + "/loggers", NodeMissingPolicy.SKIP);
-        zoo.recursiveDelete(ZooUtil.getRoot(instance) + "/dead/loggers", NodeMissingPolicy.SKIP);
-        zoo.putPersistentData(ZooUtil.getRoot(instance) + Constants.ZRECOVERY, new byte[] {'0'}, NodeExistsPolicy.SKIP);
-
-        for (String id : Tables.getIdToNameMap(instance).keySet()) {
-
-          zoo.putPersistentData(ZooUtil.getRoot(instance) + Constants.ZTABLES + "/" + id + Constants.ZTABLE_COMPACT_CANCEL_ID, "0".getBytes(),
-              NodeExistsPolicy.SKIP);
-        }
-
-        // setup default and system namespaces if not already there
-        String namespaces = ZooUtil.getRoot(instance) + Constants.ZNAMESPACES;
-        String defaultNamespace = ZooUtil.getRoot(instance) + Constants.ZNAMESPACES + "/" + Constants.DEFAULT_NAMESPACE_ID;
-        String systemNamespace = ZooUtil.getRoot(instance) + Constants.ZNAMESPACES + "/" + Constants.ACCUMULO_NAMESPACE_ID;
+        // put existing tables in the correct namespaces
         String tables = ZooUtil.getRoot(instance) + Constants.ZTABLES;
-        zoo.putPersistentData(namespaces, new byte[0], NodeExistsPolicy.SKIP);
-
-        zoo.putPersistentData(defaultNamespace, new byte[0], NodeExistsPolicy.SKIP);
-        zoo.putPersistentData(defaultNamespace + Constants.ZNAMESPACE_CONF, new byte[0], NodeExistsPolicy.SKIP);
-        zoo.putPersistentData(defaultNamespace + Constants.ZNAMESPACE_NAME, Constants.DEFAULT_NAMESPACE.getBytes(Constants.UTF8), NodeExistsPolicy.SKIP);
-
-        zoo.putPersistentData(systemNamespace, new byte[0], NodeExistsPolicy.SKIP);
-        zoo.putPersistentData(systemNamespace + Constants.ZNAMESPACE_CONF, new byte[0], NodeExistsPolicy.SKIP);
-        zoo.putPersistentData(systemNamespace + Constants.ZNAMESPACE_NAME, Constants.ACCUMULO_NAMESPACE.getBytes(Constants.UTF8), NodeExistsPolicy.SKIP);
-
-        Map<String,String> opts = IteratorUtil.generateInitialTableProperties(true);
-        for (Entry<String,String> e : opts.entrySet()) {
-          zoo.putPersistentData(defaultNamespace + Constants.ZNAMESPACE_CONF + "/" + e.getKey(), e.getValue().getBytes(Constants.UTF8), NodeExistsPolicy.SKIP);
-        }
-
         for (Entry<String,String> table : Tables.getIdToNameMap(instance).entrySet()) {
-          if (table.getValue().equals(MetadataTable.NAME) || table.getValue().equals(RootTable.NAME)) {
-            zoo.putPersistentData(tables + "/" + table.getKey() + Constants.ZTABLE_NAMESPACE, Constants.ACCUMULO_NAMESPACE_ID.getBytes(Constants.UTF8),
-                NodeExistsPolicy.SKIP);
-          } else {
-            zoo.putPersistentData(tables + "/" + table.getKey() + Constants.ZTABLE_NAMESPACE, Constants.DEFAULT_NAMESPACE_ID.getBytes(Constants.UTF8),
-                NodeExistsPolicy.SKIP);
-          }
+          String targetNamespace = (MetadataTable.ID.equals(table.getKey()) || RootTable.ID.equals(table.getKey())) ? Constants.ACCUMULO_NAMESPACE_ID
+              : Constants.DEFAULT_NAMESPACE_ID;
+          zoo.putPersistentData(tables + "/" + table.getKey() + Constants.ZTABLE_NAMESPACE, targetNamespace.getBytes(Constants.UTF8), NodeExistsPolicy.SKIP);
         }
 
-        // add namespace permissions to existing users
+        // rename metadata table
+        zoo.putPersistentData(tables + "/" + MetadataTable.ID + Constants.ZTABLE_NAME, Tables.qualify(MetadataTable.NAME).getSecond().getBytes(Constants.UTF8),
+            NodeExistsPolicy.OVERWRITE);
+
+        moveRootTabletToRootTable(zoo);
+
+        // add system namespace permissions to existing users
         ZKPermHandler perm = new ZKPermHandler();
         perm.initialize(instance.getInstanceID(), true);
         String users = ZooUtil.getRoot(instance) + "/users";

http://git-wip-us.apache.org/repos/asf/accumulo/blob/86f5927f/server/master/src/main/java/org/apache/accumulo/master/tableOps/CreateNamespace.java
----------------------------------------------------------------------
diff --git a/server/master/src/main/java/org/apache/accumulo/master/tableOps/CreateNamespace.java b/server/master/src/main/java/org/apache/accumulo/master/tableOps/CreateNamespace.java
index fac0cb2..8d0aa26 100644
--- a/server/master/src/main/java/org/apache/accumulo/master/tableOps/CreateNamespace.java
+++ b/server/master/src/main/java/org/apache/accumulo/master/tableOps/CreateNamespace.java
@@ -107,7 +107,7 @@ class PopulateZookeeperWithNamespace extends MasterRepo {
 
       Utils.checkNamespaceDoesNotExist(instance, namespaceInfo.namespaceName, namespaceInfo.namespaceId, TableOperation.CREATE);
 
-      TableManager.getInstance().addNamespace(namespaceInfo.namespaceId, namespaceInfo.namespaceName, NodeExistsPolicy.OVERWRITE);
+      TableManager.prepareNewNamespaceState(instance.getInstanceID(), namespaceInfo.namespaceId, namespaceInfo.namespaceName, NodeExistsPolicy.OVERWRITE);
 
       for (Entry<String,String> entry : namespaceInfo.props.entrySet())
         NamespacePropUtil.setNamespaceProperty(namespaceInfo.namespaceId, entry.getKey(), entry.getValue());

http://git-wip-us.apache.org/repos/asf/accumulo/blob/86f5927f/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 671bf23..9535781 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
@@ -215,9 +215,7 @@ class PopulateZookeeper extends MasterRepo {
 
       Utils.checkTableDoesNotExist(instance, tableInfo.tableName, tableInfo.tableId, TableOperation.CREATE);
 
-      TableManager.getInstance().addTable(tableInfo.tableId, tableInfo.tableName, NodeExistsPolicy.OVERWRITE);
-
-      TableManager.getInstance().addNamespaceToTable(tableInfo.tableId, tableInfo.namespaceId);
+      TableManager.getInstance().addTable(tableInfo.tableId, tableInfo.namespaceId, tableInfo.tableName, NodeExistsPolicy.OVERWRITE);
 
       for (Entry<String,String> entry : tableInfo.props.entrySet())
         TablePropUtil.setTableProperty(tableInfo.tableId, entry.getKey(), entry.getValue());

http://git-wip-us.apache.org/repos/asf/accumulo/blob/86f5927f/server/master/src/main/java/org/apache/accumulo/master/tableOps/ImportTable.java
----------------------------------------------------------------------
diff --git a/server/master/src/main/java/org/apache/accumulo/master/tableOps/ImportTable.java b/server/master/src/main/java/org/apache/accumulo/master/tableOps/ImportTable.java
index 5ddf129..9f35628 100644
--- a/server/master/src/main/java/org/apache/accumulo/master/tableOps/ImportTable.java
+++ b/server/master/src/main/java/org/apache/accumulo/master/tableOps/ImportTable.java
@@ -447,11 +447,9 @@ class ImportPopulateZookeeper extends MasterRepo {
 
       Utils.checkTableDoesNotExist(instance, tableInfo.tableName, tableInfo.tableId, TableOperation.CREATE);
 
-      TableManager.getInstance().addTable(tableInfo.tableId, tableInfo.tableName, NodeExistsPolicy.OVERWRITE);
-
       String namespace = Tables.qualify(tableInfo.tableName).getFirst();
       String namespaceId = Namespaces.getNamespaceId(instance, namespace);
-      TableManager.getInstance().addNamespaceToTable(tableInfo.tableId, namespaceId);
+      TableManager.getInstance().addTable(tableInfo.tableId, namespaceId, tableInfo.tableName, NodeExistsPolicy.OVERWRITE);
 
       Tables.clearCache(instance);
     } finally {


[7/8] git commit: ACCUMULO-2096 Clean up the security RW tests.

Posted by el...@apache.org.
ACCUMULO-2096 Clean up the security RW tests.

Ensure that tableID is used where necessary and ensure that the correct SecurityErrorCode is used when using the
internal method calls (that throw ThriftSecurityException and not AccumuloSecurityException) so the assertions work
correctly.


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

Branch: refs/heads/master
Commit: 9f59c0022777fc86d0b269d064bcc898b27c9b23
Parents: 06cbd91
Author: Josh Elser <el...@apache.org>
Authored: Thu Dec 26 16:36:25 2013 -0500
Committer: Josh Elser <el...@apache.org>
Committed: Thu Dec 26 16:36:25 2013 -0500

----------------------------------------------------------------------
 .../test/randomwalk/security/AlterTable.java    | 26 ++++++++++-
 .../randomwalk/security/AlterTablePerm.java     | 45 ++++++++++++++------
 .../test/randomwalk/security/ChangePass.java    |  2 +-
 .../test/randomwalk/security/DropTable.java     | 21 ++++++++-
 .../test/randomwalk/security/TableOp.java       |  3 +-
 .../test/randomwalk/security/Validate.java      |  4 +-
 6 files changed, 81 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/9f59c002/test/src/main/java/org/apache/accumulo/test/randomwalk/security/AlterTable.java
----------------------------------------------------------------------
diff --git a/test/src/main/java/org/apache/accumulo/test/randomwalk/security/AlterTable.java b/test/src/main/java/org/apache/accumulo/test/randomwalk/security/AlterTable.java
index b2c4c87..91f5ba8 100644
--- a/test/src/main/java/org/apache/accumulo/test/randomwalk/security/AlterTable.java
+++ b/test/src/main/java/org/apache/accumulo/test/randomwalk/security/AlterTable.java
@@ -17,6 +17,7 @@
 package org.apache.accumulo.test.randomwalk.security;
 
 import java.net.InetAddress;
+import java.util.Map;
 import java.util.Properties;
 
 import org.apache.accumulo.core.client.AccumuloException;
@@ -27,8 +28,10 @@ import org.apache.accumulo.core.client.TableNotFoundException;
 import org.apache.accumulo.core.client.security.SecurityErrorCode;
 import org.apache.accumulo.test.randomwalk.State;
 import org.apache.accumulo.test.randomwalk.Test;
+import org.apache.log4j.Logger;
 
 public class AlterTable extends Test {
+  private static final Logger log = Logger.getLogger(AlterTable.class);
   
   @Override
   public void visit(State state, Properties props) throws Exception {
@@ -36,12 +39,33 @@ public class AlterTable extends Test {
     
     String tableName = WalkingSecurity.get(state).getTableName();
     
+    Map<String,String> nameToId = conn.tableOperations().tableIdMap();
+    String tableId = nameToId.get(tableName);
+    
     boolean exists = WalkingSecurity.get(state).getTableExists();
-    boolean hasPermission = WalkingSecurity.get(state).canAlterTable(WalkingSecurity.get(state).getSysCredentials(), tableName);
+    
+    if ((null == tableId && exists) || (null != tableId && !exists)) {
+      log.error("For table " + tableName + ": found table ID " + tableId + " and " + (exists ? "expect" : "did not expect") + " it to exist");
+      throw new TableNotFoundException(null, tableName, "Could not find table ID when it should exist");
+    }
+    
+    boolean hasPermission;
+    try {
+      hasPermission = WalkingSecurity.get(state).canAlterTable(WalkingSecurity.get(state).getSysCredentials(), tableId);
+    } catch (Exception e) {
+      if (!exists) {
+        log.debug("Ignoring exception when trying to alter non-existent table", e);
+        return;
+      }
+      
+      throw e;
+    }
+    
     String newTableName = String.format("security_%s_%s_%d", InetAddress.getLocalHost().getHostName().replaceAll("[-.]", "_"), state.getPid(),
         System.currentTimeMillis());
     
     renameTable(conn, state, tableName, newTableName, hasPermission, exists);
+
   }
   
   public static void renameTable(Connector conn, State state, String oldName, String newName, boolean hasPermission, boolean tableExists)

http://git-wip-us.apache.org/repos/asf/accumulo/blob/9f59c002/test/src/main/java/org/apache/accumulo/test/randomwalk/security/AlterTablePerm.java
----------------------------------------------------------------------
diff --git a/test/src/main/java/org/apache/accumulo/test/randomwalk/security/AlterTablePerm.java b/test/src/main/java/org/apache/accumulo/test/randomwalk/security/AlterTablePerm.java
index bad7b28..4bd0d64 100644
--- a/test/src/main/java/org/apache/accumulo/test/randomwalk/security/AlterTablePerm.java
+++ b/test/src/main/java/org/apache/accumulo/test/randomwalk/security/AlterTablePerm.java
@@ -27,30 +27,32 @@ import org.apache.accumulo.core.security.Credentials;
 import org.apache.accumulo.core.security.TablePermission;
 import org.apache.accumulo.test.randomwalk.State;
 import org.apache.accumulo.test.randomwalk.Test;
+import org.apache.log4j.Logger;
 
 public class AlterTablePerm extends Test {
-  
+  private static final Logger log = Logger.getLogger(AlterTablePerm.class);
+
   @Override
   public void visit(State state, Properties props) throws Exception {
     alter(state, props);
   }
-  
+
   public static void alter(State state, Properties props) throws Exception {
     String action = props.getProperty("task", "toggle");
     String perm = props.getProperty("perm", "random");
     String sourceUserProp = props.getProperty("source", "system");
     String targetUser = props.getProperty("target", "table");
     boolean tabExists = WalkingSecurity.get(state).getTableExists();
-    
+
     String target;
     if ("table".equals(targetUser))
       target = WalkingSecurity.get(state).getTabUserName();
     else
       target = WalkingSecurity.get(state).getSysUserName();
-    
+
     boolean exists = WalkingSecurity.get(state).userExists(target);
     boolean tableExists = WalkingSecurity.get(state).getTableExists();
-    
+
     TablePermission tabPerm;
     if (perm.equals("random")) {
       Random r = new Random();
@@ -74,10 +76,25 @@ public class AlterTablePerm extends Test {
       sourceToken = state.getToken();
     }
     Connector conn = state.getInstance().getConnector(sourceUser, sourceToken);
-    
-    canGive = WalkingSecurity.get(state).canGrantTable(new Credentials(sourceUser, sourceToken).toThrift(state.getInstance()), target,
-        WalkingSecurity.get(state).getTableName());
-    
+    String tableId = conn.tableOperations().tableIdMap().get(tableName);
+
+    // Make sure we get an ID when we can
+    if ((null == tableId && tableExists) || (null != tableId && !tableExists)) {
+      log.error("For table " + tableName + ": found table ID " + tableId + " and we " + (exists ? "expect" : "did not expect") + " it to exist");
+      throw new AccumuloException("Could not find table ID for " + tableName + " but it should have existed");
+    }
+
+    try {
+      canGive = WalkingSecurity.get(state).canGrantTable(new Credentials(sourceUser, sourceToken).toThrift(state.getInstance()), target, tableId);
+    } catch (Exception e) {
+      if (!tableExists) {
+        log.debug("Ignoring exception checking permission on non-existent table", e);
+        return;
+      }
+
+      throw e;
+    }
+
     // toggle
     if (!"take".equals(action) && !"give".equals(action)) {
       try {
@@ -85,7 +102,7 @@ public class AlterTablePerm extends Test {
         if (hasPerm != (res = state.getConnector().securityOperations().hasTablePermission(target, tableName, tabPerm)))
           throw new AccumuloException("Test framework and accumulo are out of sync for user " + conn.whoami() + " for perm " + tabPerm.name()
               + " with local vs. accumulo being " + hasPerm + " " + res);
-        
+
         if (hasPerm)
           action = "take";
         else
@@ -107,7 +124,7 @@ public class AlterTablePerm extends Test {
         }
       }
     }
-    
+
     boolean trans = WalkingSecurity.get(state).userPassTransient(conn.whoami());
     if ("take".equals(action)) {
       try {
@@ -166,14 +183,14 @@ public class AlterTablePerm extends Test {
       }
       WalkingSecurity.get(state).grantTablePermission(target, tableName, tabPerm);
     }
-    
+
     if (!exists)
       throw new AccumuloException("User shouldn't have existed, but apparantly does");
     if (!tableExists)
       throw new AccumuloException("Table shouldn't have existed, but apparantly does");
     if (!canGive)
       throw new AccumuloException(conn.whoami() + " shouldn't have been able to grant privilege");
-    
+
   }
-  
+
 }

http://git-wip-us.apache.org/repos/asf/accumulo/blob/9f59c002/test/src/main/java/org/apache/accumulo/test/randomwalk/security/ChangePass.java
----------------------------------------------------------------------
diff --git a/test/src/main/java/org/apache/accumulo/test/randomwalk/security/ChangePass.java b/test/src/main/java/org/apache/accumulo/test/randomwalk/security/ChangePass.java
index 439e724..6287d6a 100644
--- a/test/src/main/java/org/apache/accumulo/test/randomwalk/security/ChangePass.java
+++ b/test/src/main/java/org/apache/accumulo/test/randomwalk/security/ChangePass.java
@@ -85,7 +85,7 @@ public class ChangePass extends Test {
       }
     }
     WalkingSecurity.get(state).changePassword(target, newPass);
-    // Waiting 1 second for password to propogate through Zk
+    // Waiting 1 second for password to propagate through Zk
     Thread.sleep(1000);
     if (!hasPerm)
       throw new AccumuloException("Password change succeeded when it should have failed for " + source + " changing the password for " + target + ".");

http://git-wip-us.apache.org/repos/asf/accumulo/blob/9f59c002/test/src/main/java/org/apache/accumulo/test/randomwalk/security/DropTable.java
----------------------------------------------------------------------
diff --git a/test/src/main/java/org/apache/accumulo/test/randomwalk/security/DropTable.java b/test/src/main/java/org/apache/accumulo/test/randomwalk/security/DropTable.java
index 52b6e25..4dc25ea 100644
--- a/test/src/main/java/org/apache/accumulo/test/randomwalk/security/DropTable.java
+++ b/test/src/main/java/org/apache/accumulo/test/randomwalk/security/DropTable.java
@@ -28,8 +28,10 @@ import org.apache.accumulo.core.client.security.tokens.AuthenticationToken;
 import org.apache.accumulo.core.security.Credentials;
 import org.apache.accumulo.test.randomwalk.State;
 import org.apache.accumulo.test.randomwalk.Test;
+import org.apache.log4j.Logger;
 
 public class DropTable extends Test {
+  private static final Logger log = Logger.getLogger(DropTable.class);
   
   @Override
   public void visit(State state, Properties props) throws Exception {
@@ -50,9 +52,26 @@ public class DropTable extends Test {
     Connector conn = state.getInstance().getConnector(principal, token);
     
     String tableName = WalkingSecurity.get(state).getTableName();
+    String tableId = conn.tableOperations().tableIdMap().get(tableName);
     
     boolean exists = WalkingSecurity.get(state).getTableExists();
-    boolean hasPermission = WalkingSecurity.get(state).canDeleteTable(new Credentials(principal, token).toThrift(state.getInstance()), tableName);
+    
+    if ((null == tableId && exists) || (null != tableId && !exists)) {
+      log.error("For table " + tableName + ": found table ID " + tableId + " and " + (exists ? "expect" : "did not expect") + " it to exist");
+      throw new AccumuloException("Test and Accumulo state differ on " + tableName + " existence.");
+    }
+    
+    boolean hasPermission;
+    try {
+      hasPermission = WalkingSecurity.get(state).canDeleteTable(new Credentials(principal, token).toThrift(state.getInstance()), tableId);
+    } catch (Exception e) {
+      if (!exists) {
+        log.error("Ignoring exception checking permissions on non-existent table", e);
+        return;
+      }
+      
+      throw e;
+    }
     
     try {
       conn.tableOperations().delete(tableName);

http://git-wip-us.apache.org/repos/asf/accumulo/blob/9f59c002/test/src/main/java/org/apache/accumulo/test/randomwalk/security/TableOp.java
----------------------------------------------------------------------
diff --git a/test/src/main/java/org/apache/accumulo/test/randomwalk/security/TableOp.java b/test/src/main/java/org/apache/accumulo/test/randomwalk/security/TableOp.java
index 347be89..7199322 100644
--- a/test/src/main/java/org/apache/accumulo/test/randomwalk/security/TableOp.java
+++ b/test/src/main/java/org/apache/accumulo/test/randomwalk/security/TableOp.java
@@ -75,13 +75,14 @@ public class TableOp extends Test {
 
     switch (tp) {
       case READ: {
-        boolean canRead = WalkingSecurity.get(state).canScan(WalkingSecurity.get(state).getTabCredentials(), tableId);
         Authorizations auths = WalkingSecurity.get(state).getUserAuthorizations(WalkingSecurity.get(state).getTabCredentials());
         boolean ambiguousZone = WalkingSecurity.get(state).inAmbiguousZone(conn.whoami(), tp);
         boolean ambiguousAuths = WalkingSecurity.get(state).ambiguousAuthorizations(conn.whoami());
 
         Scanner scan = null;
+        boolean canRead = false;
         try {
+          canRead = WalkingSecurity.get(state).canScan(WalkingSecurity.get(state).getTabCredentials(), tableId);
           scan = conn.createScanner(tableName, conn.securityOperations().getUserAuthorizations(conn.whoami()));
           int seen = 0;
           Iterator<Entry<Key,Value>> iter = scan.iterator();

http://git-wip-us.apache.org/repos/asf/accumulo/blob/9f59c002/test/src/main/java/org/apache/accumulo/test/randomwalk/security/Validate.java
----------------------------------------------------------------------
diff --git a/test/src/main/java/org/apache/accumulo/test/randomwalk/security/Validate.java b/test/src/main/java/org/apache/accumulo/test/randomwalk/security/Validate.java
index 2a3e445..48586c3 100644
--- a/test/src/main/java/org/apache/accumulo/test/randomwalk/security/Validate.java
+++ b/test/src/main/java/org/apache/accumulo/test/randomwalk/security/Validate.java
@@ -21,8 +21,8 @@ import java.util.Properties;
 import org.apache.accumulo.core.client.AccumuloException;
 import org.apache.accumulo.core.client.AccumuloSecurityException;
 import org.apache.accumulo.core.client.Connector;
-import org.apache.accumulo.core.client.impl.thrift.ThriftSecurityException;
 import org.apache.accumulo.core.client.security.SecurityErrorCode;
+import org.apache.accumulo.core.client.impl.thrift.ThriftSecurityException;
 import org.apache.accumulo.core.security.Authorizations;
 import org.apache.accumulo.core.security.SystemPermission;
 import org.apache.accumulo.core.security.TablePermission;
@@ -108,7 +108,7 @@ public class Validate extends Test {
       auths = WalkingSecurity.get(state).getUserAuthorizations(WalkingSecurity.get(state).getTabCredentials());
       accuAuths = conn.securityOperations().getUserAuthorizations(WalkingSecurity.get(state).getTabUserName());
     } catch (ThriftSecurityException ae) {
-      if (ae.getCode().equals(SecurityErrorCode.USER_DOESNT_EXIST)) {
+      if (ae.getCode().equals(org.apache.accumulo.core.client.impl.thrift.SecurityErrorCode.USER_DOESNT_EXIST)) {
         if (tableUserExists)
           throw new AccumuloException("Table user didn't exist when they should.", ae);
         else


[5/8] git commit: ACCUMULO-1910 Add updated HelloWorld2.jar and FooConstraint.jar, provided by Ed Coleman, which contain source files as well as the class files.

Posted by el...@apache.org.
ACCUMULO-1910 Add updated HelloWorld2.jar and FooConstraint.jar, provided by Ed Coleman, which contain source files as well as the class files.


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

Branch: refs/heads/master
Commit: 280b6a6dee719bcef68d7f4f8e187b2a6abcd3d2
Parents: 663b7ec
Author: Josh Elser <el...@apache.org>
Authored: Thu Dec 26 10:49:44 2013 -0500
Committer: Josh Elser <el...@apache.org>
Committed: Thu Dec 26 10:49:44 2013 -0500

----------------------------------------------------------------------
 start/src/test/resources/HelloWorld2.jar  | Bin 575 -> 1483 bytes
 test/src/test/resources/FooConstraint.jar | Bin 1079 -> 2130 bytes
 2 files changed, 0 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/280b6a6d/start/src/test/resources/HelloWorld2.jar
----------------------------------------------------------------------
diff --git a/start/src/test/resources/HelloWorld2.jar b/start/src/test/resources/HelloWorld2.jar
index aa8db21..2dc06ea 100644
Binary files a/start/src/test/resources/HelloWorld2.jar and b/start/src/test/resources/HelloWorld2.jar differ

http://git-wip-us.apache.org/repos/asf/accumulo/blob/280b6a6d/test/src/test/resources/FooConstraint.jar
----------------------------------------------------------------------
diff --git a/test/src/test/resources/FooConstraint.jar b/test/src/test/resources/FooConstraint.jar
index c856a26..14673da 100644
Binary files a/test/src/test/resources/FooConstraint.jar and b/test/src/test/resources/FooConstraint.jar differ


[8/8] git commit: Merge branch '1.6.0-SNAPSHOT'

Posted by el...@apache.org.
Merge branch '1.6.0-SNAPSHOT'


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

Branch: refs/heads/master
Commit: 8553b467851693f32fc2b8272ba17e301da96d84
Parents: 00bcb0c 9f59c00
Author: Josh Elser <el...@apache.org>
Authored: Thu Dec 26 16:39:51 2013 -0500
Committer: Josh Elser <el...@apache.org>
Committed: Thu Dec 26 16:39:51 2013 -0500

----------------------------------------------------------------------
 .../accumulo/core/client/impl/Namespaces.java   |   6 ++
 .../accumulo/core/client/impl/Tables.java       |  10 +-
 .../apache/accumulo/server/init/Initialize.java |  24 +----
 .../accumulo/server/tables/TableManager.java    |  95 +++++--------------
 .../java/org/apache/accumulo/master/Master.java |  62 +++++-------
 .../master/tableOps/CreateNamespace.java        |   2 +-
 .../accumulo/master/tableOps/CreateTable.java   |   4 +-
 .../accumulo/master/tableOps/ImportTable.java   |   4 +-
 .../test/resources/ClassLoaderTestA/Test.jar    | Bin 748 -> 1570 bytes
 .../test/resources/ClassLoaderTestB/Test.jar    | Bin 748 -> 1572 bytes
 .../test/resources/ClassLoaderTestC/Test.jar    | Bin 748 -> 1571 bytes
 start/src/test/resources/HelloWorld2.jar        | Bin 575 -> 1483 bytes
 .../test/randomwalk/security/AlterTable.java    |  26 ++++-
 .../randomwalk/security/AlterTablePerm.java     |  45 ++++++---
 .../test/randomwalk/security/ChangePass.java    |   2 +-
 .../test/randomwalk/security/DropTable.java     |  21 +++-
 .../test/randomwalk/security/TableOp.java       |   3 +-
 .../test/randomwalk/security/Validate.java      |   4 +-
 test/src/test/resources/FooConstraint.jar       | Bin 1079 -> 2130 bytes
 test/src/test/resources/TestCombinerX.jar       | Bin 1525 -> 4335 bytes
 test/src/test/resources/TestCombinerY.jar       | Bin 1524 -> 4335 bytes
 21 files changed, 144 insertions(+), 164 deletions(-)
----------------------------------------------------------------------