accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From e..@apache.org
Subject [1/2] git commit: Check for "namespace doesn't exist" errors.
Date Fri, 24 Jan 2014 18:11:44 GMT
Updated Branches:
  refs/heads/master 9dc84f32f -> b2cde1917


Check for "namespace doesn't exist" errors.


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

Branch: refs/heads/master
Commit: 04a89fce98e7a777d313f1c99cd2fd15e0e0ae06
Parents: e7ba8ea
Author: Eric Newton <eric.newton@gmail.com>
Authored: Fri Jan 24 13:09:54 2014 -0500
Committer: Eric Newton <eric.newton@gmail.com>
Committed: Fri Jan 24 13:11:36 2014 -0500

----------------------------------------------------------------------
 .../test/randomwalk/concurrent/ChangePermissions.java  | 13 ++++++++++++-
 .../test/randomwalk/concurrent/CreateTable.java        |  7 +++++++
 2 files changed, 19 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/04a89fce/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/ChangePermissions.java
----------------------------------------------------------------------
diff --git a/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/ChangePermissions.java
b/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/ChangePermissions.java
index d3c7c70..63af95a 100644
--- a/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/ChangePermissions.java
+++ b/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/ChangePermissions.java
@@ -25,6 +25,8 @@ import java.util.Random;
 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.TableOperationExceptionType;
+import org.apache.accumulo.core.client.impl.thrift.ThriftTableOperationException;
 import org.apache.accumulo.core.security.SystemPermission;
 import org.apache.accumulo.core.security.NamespacePermission;
 import org.apache.accumulo.core.security.TablePermission;
@@ -52,7 +54,7 @@ public class ChangePermissions extends Test {
     String namespace = namespaces.get(rand.nextInt(namespaces.size()));
     
     try {
-      int dice = rand.nextInt(2);
+      int dice = rand.nextInt(3);
       if (dice == 0)
         changeSystemPermission(conn, rand, userName);
       else if (dice == 1)
@@ -61,6 +63,15 @@ public class ChangePermissions extends Test {
         changeNamespacePermission(conn, rand, userName, namespace);
     } catch (AccumuloSecurityException ex) {
       log.debug("Unable to change user permissions: " + ex.getCause());
+    } catch (AccumuloException ex) {
+      Throwable cause = ex.getCause();
+      if (cause != null && cause instanceof ThriftTableOperationException) {
+        ThriftTableOperationException toe = (ThriftTableOperationException)cause.getCause();
+        if (toe.type == TableOperationExceptionType.NAMESPACE_NOTFOUND) {
+          log.debug("Unable to change user permissions: " + toe.getCause());
+          return;
+        }
+      }
     }
   }
   

http://git-wip-us.apache.org/repos/asf/accumulo/blob/04a89fce/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/CreateTable.java
----------------------------------------------------------------------
diff --git a/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/CreateTable.java
b/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/CreateTable.java
index 5a695bc..21ae031 100644
--- a/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/CreateTable.java
+++ b/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/CreateTable.java
@@ -20,8 +20,10 @@ import java.util.List;
 import java.util.Properties;
 import java.util.Random;
 
+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.NamespaceNotFoundException;
 import org.apache.accumulo.core.client.TableExistsException;
 import org.apache.accumulo.test.randomwalk.State;
 import org.apache.accumulo.test.randomwalk.Test;
@@ -44,6 +46,11 @@ public class CreateTable extends Test {
       log.debug("Created table " + tableName);
     } catch (TableExistsException e) {
       log.debug("Create " + tableName + " failed, it exists");
+    } catch (AccumuloException e) {
+      if (e.getCause() != null && e.getCause() instanceof NamespaceNotFoundException)
+        log.debug("Create " + tableName + " failed, the namespace does not exist");
+      else
+        throw e;
     } catch (IllegalArgumentException e) {
       log.debug("Create: " + e.toString());
     } catch (AccumuloSecurityException e) {


Mime
View raw message