You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by ec...@apache.org on 2013/03/08 20:55:33 UTC

svn commit: r1454513 - in /accumulo/branches/1.5: server/src/main/java/org/apache/accumulo/server/master/Master.java test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/Config.java

Author: ecn
Date: Fri Mar  8 19:55:33 2013
New Revision: 1454513

URL: http://svn.apache.org/r1454513
Log:
ACCUMULO-1163 modify setProperty to throw a NotFound exception if the table is gone from zookeeper by the time we set the property

Modified:
    accumulo/branches/1.5/server/src/main/java/org/apache/accumulo/server/master/Master.java
    accumulo/branches/1.5/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/Config.java

Modified: accumulo/branches/1.5/server/src/main/java/org/apache/accumulo/server/master/Master.java
URL: http://svn.apache.org/viewvc/accumulo/branches/1.5/server/src/main/java/org/apache/accumulo/server/master/Master.java?rev=1454513&r1=1454512&r2=1454513&view=diff
==============================================================================
--- accumulo/branches/1.5/server/src/main/java/org/apache/accumulo/server/master/Master.java (original)
+++ accumulo/branches/1.5/server/src/main/java/org/apache/accumulo/server/master/Master.java Fri Mar  8 19:55:33 2013
@@ -138,6 +138,7 @@ import org.apache.accumulo.server.master
 import org.apache.accumulo.server.master.tableOps.TraceRepo;
 import org.apache.accumulo.server.master.tserverOps.ShutdownTServer;
 import org.apache.accumulo.server.monitor.Monitor;
+import org.apache.accumulo.server.monitor.util.Table;
 import org.apache.accumulo.server.security.AuditedSecurityOperation;
 import org.apache.accumulo.server.security.SecurityConstants;
 import org.apache.accumulo.server.security.SecurityOperation;
@@ -663,9 +664,14 @@ public class Master implements LiveTServ
         } else if (!TablePropUtil.setTableProperty(tableId, property, value)) {
           throw new Exception("Invalid table property.");
         }
+      } catch (KeeperException.NoNodeException e) {
+        // race condition... table no longer exists?  This call will throw an exception if the table was deleted:
+        checkTableId(tableName, op);
+        log.info("Error altering table property", e);
+        throw new ThriftTableOperationException(tableId, tableName, op, TableOperationExceptionType.OTHER, "Problem altering table property");
       } catch (Exception e) {
         log.error("Problem altering table property", e);
-        throw new ThriftTableOperationException(tableId, tableName, op, TableOperationExceptionType.OTHER, e.getMessage());
+        throw new ThriftTableOperationException(tableId, tableName, op, TableOperationExceptionType.OTHER, "Problem altering table property");
       }
     }
     

Modified: accumulo/branches/1.5/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/Config.java
URL: http://svn.apache.org/viewvc/accumulo/branches/1.5/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/Config.java?rev=1454513&r1=1454512&r2=1454513&view=diff
==============================================================================
--- accumulo/branches/1.5/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/Config.java (original)
+++ accumulo/branches/1.5/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/Config.java Fri Mar  8 19:55:33 2013
@@ -118,11 +118,12 @@ public class Config extends Test {
         try {
           state.getConnector().tableOperations().setProperty(table, property.getKey(), property.getDefaultValue());
         } catch (AccumuloException ex) {
-          if (ex.toString().contains("NoNode for")) {
-            // race condition for a table that has been deleted
-          } else {
-            throw ex;
+          if (ex.getCause() instanceof ThriftTableOperationException) {
+            ThriftTableOperationException ttoe = (ThriftTableOperationException)ex.getCause();
+            if (ttoe.type == TableOperationExceptionType.NOTFOUND)
+              return;
           }
+          throw ex;
         }
       }
     }