accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ctubb...@apache.org
Subject [20/50] [abbrv] git commit: ACCUMULO-802 fixed up some places in the code where a namespace might be null
Date Wed, 04 Dec 2013 23:59:01 GMT
ACCUMULO-802 fixed up some places in the code where a namespace might be null


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

Branch: refs/heads/master
Commit: 7b4f068e81b282469c106ef3c9e239d8f3d0e412
Parents: 5262bd5
Author: Sean Hickey <tallirishllama@gmail.com>
Authored: Mon Aug 12 15:06:22 2013 -0400
Committer: Christopher Tubbs <ctubbsii@apache.org>
Committed: Wed Dec 4 18:46:10 2013 -0500

----------------------------------------------------------------------
 .../org/apache/accumulo/server/init/Initialize.java     |  4 ++--
 .../org/apache/accumulo/server/tables/TableManager.java |  1 +
 .../apache/accumulo/master/tableOps/RenameTable.java    | 12 ++++++------
 3 files changed, 9 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/7b4f068e/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 042811a..0e51b6c 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
@@ -420,9 +420,9 @@ public class Initialize {
     createInitialTableNamespace(zoo, zkInstanceRoot, Constants.SYSTEM_TABLE_NAMESPACE_ID,
Constants.SYSTEM_TABLE_NAMESPACE, false);
     
     zoo.putPersistentData(zkInstanceRoot + Constants.ZTABLES + "/" + MetadataTable.ID + Constants.ZTABLE_NAMESPACE,
-        Constants.SYSTEM_TABLE_NAMESPACE_ID.getBytes(Constants.UTF8), NodeExistsPolicy.FAIL);
+        Constants.SYSTEM_TABLE_NAMESPACE_ID.getBytes(Constants.UTF8), NodeExistsPolicy.OVERWRITE);
     zoo.putPersistentData(zkInstanceRoot + Constants.ZTABLES + "/" + RootTable.ID + Constants.ZTABLE_NAMESPACE,
-        Constants.SYSTEM_TABLE_NAMESPACE_ID.getBytes(Constants.UTF8), NodeExistsPolicy.FAIL);
+        Constants.SYSTEM_TABLE_NAMESPACE_ID.getBytes(Constants.UTF8), NodeExistsPolicy.OVERWRITE);
   }
   
   private static void createInitialTableNamespace(IZooReaderWriter zoo, String root, String
id, String namespace, boolean defaultOpts) throws KeeperException,

http://git-wip-us.apache.org/repos/asf/accumulo/blob/7b4f068e/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 911459c..09bf92f 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
@@ -69,6 +69,7 @@ public class TableManager {
     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, Constants.DEFAULT_TABLE_NAMESPACE_ID.getBytes(Constants.UTF8),
existsPolicy);
   }
   
   public synchronized static TableManager getInstance() {

http://git-wip-us.apache.org/repos/asf/accumulo/blob/7b4f068e/server/master/src/main/java/org/apache/accumulo/master/tableOps/RenameTable.java
----------------------------------------------------------------------
diff --git a/server/master/src/main/java/org/apache/accumulo/master/tableOps/RenameTable.java
b/server/master/src/main/java/org/apache/accumulo/master/tableOps/RenameTable.java
index 18b7532..8b82593 100644
--- a/server/master/src/main/java/org/apache/accumulo/master/tableOps/RenameTable.java
+++ b/server/master/src/main/java/org/apache/accumulo/master/tableOps/RenameTable.java
@@ -68,28 +68,28 @@ public class RenameTable extends MasterRepo {
       tm.addNamespaceToTable(tableId, namespaceId);
     }
 
-    newTableName = Tables.extractTableName(newTableName);
-    oldTableName = Tables.extractTableName(oldTableName);
-
     IZooReaderWriter zoo = ZooReaderWriter.getRetryingInstance();
 
     Utils.tableNameLock.lock();
     try {
       Utils.checkTableDoesNotExist(instance, newTableName, tableId, TableOperation.RENAME);
 
+      final String newName = Tables.extractTableName(newTableName);
+      final String oldName = Tables.extractTableName(oldTableName);
+
       final String tap = ZooUtil.getRoot(instance) + Constants.ZTABLES + "/" + tableId +
Constants.ZTABLE_NAME;
 
       zoo.mutate(tap, null, null, new Mutator() {
         @Override
         public byte[] mutate(byte[] current) throws Exception {
           final String currentName = new String(current);
-          if (currentName.equals(newTableName))
+          if (currentName.equals(newName))
             return null; // assume in this case the operation is running again, so we are
done
-          if (!currentName.equals(oldTableName)) {
+          if (!currentName.equals(oldName)) {
             throw new ThriftTableOperationException(null, oldTableName, TableOperation.RENAME,
TableOperationExceptionType.NOTFOUND,
                 "Name changed while processing");
           }
-          return newTableName.getBytes();
+          return newName.getBytes();
         }
       });
       Tables.clearCache(instance);


Mime
View raw message