I forgot that ZookeeperClusterStatus doesn't extend BaseClusterStatus, so the 
same code that was added in BCS needed to be added in ZCS.  In the future we 
should have ZCS extend BCS.


Project: http://git-wip-us.apache.org/repos/asf/incubator-blur/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-blur/commit/fad2dc89
Tree: http://git-wip-us.apache.org/repos/asf/incubator-blur/tree/fad2dc89
Diff: http://git-wip-us.apache.org/repos/asf/incubator-blur/diff/fad2dc89

Branch: refs/heads/0.2-dev
Commit: fad2dc8979d7231f10716902aa8e8410b044d9fc
Parents: fd44874
Author: Aaron McCurry <[email protected]>
Authored: Mon Mar 4 21:33:08 2013 -0500
Committer: Aaron McCurry <[email protected]>
Committed: Mon Mar 4 21:33:08 2013 -0500

----------------------------------------------------------------------
 .../manager/clusterstatus/BaseClusterStatus.java   |   10 ++++----
 .../clusterstatus/ZookeeperClusterStatus.java      |   17 +++++++++++---
 2 files changed, 18 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/fad2dc89/src/blur-core/src/main/java/org/apache/blur/manager/clusterstatus/BaseClusterStatus.java
----------------------------------------------------------------------
diff --git 
a/src/blur-core/src/main/java/org/apache/blur/manager/clusterstatus/BaseClusterStatus.java
 
b/src/blur-core/src/main/java/org/apache/blur/manager/clusterstatus/BaseClusterStatus.java
index cf93550..041bf94 100644
--- 
a/src/blur-core/src/main/java/org/apache/blur/manager/clusterstatus/BaseClusterStatus.java
+++ 
b/src/blur-core/src/main/java/org/apache/blur/manager/clusterstatus/BaseClusterStatus.java
@@ -75,13 +75,13 @@ public abstract class BaseClusterStatus extends 
ClusterStatus {
       if (getZooKeeper().exists(tablePath, false) != null) {
         throw new IOException("Table [" + table + "] already exists.");
       }
-      //checking if table is referring to same index path.     
+      // checking if table is referring to same index path.
       List<String> tables = getTableList(false);
-      for(String tableName : tables){
+      for (String tableName : tables) {
         TableDescriptor tableDesc = getTableDescriptor(false, tableName);
-        
if(tableDesc.getStoragePath().equals(tableDescriptor.getStoragePath())){
-          throw new IOException("Table [" + table + "]" + " can not be created 
because [" + tableName + "] is already referring to " 
-              + "[" +tableDescriptor.getStoragePath() + "]" +" index path.");
+        if 
(tableDesc.getStoragePath().equals(tableDescriptor.getStoragePath())) {
+          throw new IOException("Table [" + table + "]" + " can not be created 
because [" + tableName + "] is already referring to " + "[" + 
tableDescriptor.getStoragePath() + "]"
+              + " index path.");
         }
       }
       BlurUtil.setupFileSystem(uri, shardCount);

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/fad2dc89/src/blur-core/src/main/java/org/apache/blur/manager/clusterstatus/ZookeeperClusterStatus.java
----------------------------------------------------------------------
diff --git 
a/src/blur-core/src/main/java/org/apache/blur/manager/clusterstatus/ZookeeperClusterStatus.java
 
b/src/blur-core/src/main/java/org/apache/blur/manager/clusterstatus/ZookeeperClusterStatus.java
index 52419a8..be490e4 100644
--- 
a/src/blur-core/src/main/java/org/apache/blur/manager/clusterstatus/ZookeeperClusterStatus.java
+++ 
b/src/blur-core/src/main/java/org/apache/blur/manager/clusterstatus/ZookeeperClusterStatus.java
@@ -341,6 +341,15 @@ public class ZookeeperClusterStatus extends ClusterStatus {
       if (_zk.exists(tablePath, false) != null) {
         throw new IOException("Table [" + table + "] already exists.");
       }
+      // checking if table is referring to same index path.
+      List<String> tables = getTableList(false);
+      for (String tableName : tables) {
+        TableDescriptor tableDesc = getTableDescriptor(false, tableName);
+        if 
(tableDesc.getStoragePath().equals(tableDescriptor.getStoragePath())) {
+          throw new IOException("Table [" + table + "]" + " can not be created 
because [" + tableName + "] is already referring to " + "[" + 
tableDescriptor.getStoragePath() + "]"
+              + " index path.");
+        }
+      }
       BlurUtil.setupFileSystem(uri, shardCount);
       BlurUtil.createPath(_zk, tablePath, BlurUtil.read(tableDescriptor));
     } catch (IOException e) {
@@ -368,8 +377,8 @@ public class ZookeeperClusterStatus extends ClusterStatus {
       if (!tableDescriptor.isEnabled()) {
         LOG.info("Table [" + table + "] is already disabled.");
       } else {
-       tableDescriptor.setEnabled(false);
-       _zk.setData(tablePath, BlurUtil.read(tableDescriptor), -1);
+        tableDescriptor.setEnabled(false);
+        _zk.setData(tablePath, BlurUtil.read(tableDescriptor), -1);
       }
     } catch (InterruptedException e) {
       throw new RuntimeException(e);
@@ -394,8 +403,8 @@ public class ZookeeperClusterStatus extends ClusterStatus {
       if (tableDescriptor.isEnabled()) {
         LOG.info("Table [" + table + "] is already enabled.");
       } else {
-       tableDescriptor.setEnabled(true);
-       _zk.setData(tablePath, BlurUtil.read(tableDescriptor), -1);
+        tableDescriptor.setEnabled(true);
+        _zk.setData(tablePath, BlurUtil.read(tableDescriptor), -1);
       }
     } catch (IOException e) {
       throw new RuntimeException(e);

Reply via email to