helix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vinay...@apache.org
Subject helix git commit: [HELIX-597] Added dropStateModelDef method to HelixAdmin
Date Thu, 21 May 2015 03:52:25 GMT
Repository: helix
Updated Branches:
  refs/heads/vinayakb/597_dropStateModelDef [created] 57a0d00b6


[HELIX-597] Added dropStateModelDef method to HelixAdmin


Project: http://git-wip-us.apache.org/repos/asf/helix/repo
Commit: http://git-wip-us.apache.org/repos/asf/helix/commit/57a0d00b
Tree: http://git-wip-us.apache.org/repos/asf/helix/tree/57a0d00b
Diff: http://git-wip-us.apache.org/repos/asf/helix/diff/57a0d00b

Branch: refs/heads/vinayakb/597_dropStateModelDef
Commit: 57a0d00b67088fbf2fa5c136f5dfe70a700693f9
Parents: a29ac9f
Author: Vinayak Borkar <vinayakb@netbook.local>
Authored: Wed May 20 20:52:18 2015 -0700
Committer: Vinayak Borkar <vinayakb@netbook.local>
Committed: Wed May 20 20:52:18 2015 -0700

----------------------------------------------------------------------
 .../src/main/java/org/apache/helix/HelixAdmin.java      |  7 +++++++
 .../java/org/apache/helix/manager/zk/ZKHelixAdmin.java  | 12 ++++++++++++
 2 files changed, 19 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/helix/blob/57a0d00b/helix-core/src/main/java/org/apache/helix/HelixAdmin.java
----------------------------------------------------------------------
diff --git a/helix-core/src/main/java/org/apache/helix/HelixAdmin.java b/helix-core/src/main/java/org/apache/helix/HelixAdmin.java
index 5337cdd..2a8d291 100644
--- a/helix-core/src/main/java/org/apache/helix/HelixAdmin.java
+++ b/helix-core/src/main/java/org/apache/helix/HelixAdmin.java
@@ -236,6 +236,13 @@ public interface HelixAdmin {
   void addStateModelDef(String clusterName, String stateModelDef, StateModelDefinition record);
 
   /**
+   * Drop a state model definition
+   * @param clusterName
+   * @param stateModelDef
+   */
+  void dropStateModelDef(String clusterName, String stateModelDef);
+
+  /**
    * Drop a resource from a cluster
    * @param clusterName
    * @param resourceName

http://git-wip-us.apache.org/repos/asf/helix/blob/57a0d00b/helix-core/src/main/java/org/apache/helix/manager/zk/ZKHelixAdmin.java
----------------------------------------------------------------------
diff --git a/helix-core/src/main/java/org/apache/helix/manager/zk/ZKHelixAdmin.java b/helix-core/src/main/java/org/apache/helix/manager/zk/ZKHelixAdmin.java
index dee343f..530bcf9 100644
--- a/helix-core/src/main/java/org/apache/helix/manager/zk/ZKHelixAdmin.java
+++ b/helix-core/src/main/java/org/apache/helix/manager/zk/ZKHelixAdmin.java
@@ -721,6 +721,18 @@ public class ZKHelixAdmin implements HelixAdmin {
   }
 
   @Override
+  public void dropStateModelDef(String clusterName, String stateModelDef) {
+    if (!ZKUtil.isClusterSetup(clusterName, _zkClient)) {
+      throw new HelixException("cluster " + clusterName + " is not setup yet");
+    }
+    String stateModelDefPath = HelixUtil.getStateModelDefinitionPath(clusterName);
+    String stateModelPath = stateModelDefPath + "/" + stateModelDef;
+    if (_zkClient.exists(stateModelPath)) {
+      _zkClient.deleteRecursive(stateModelPath);
+    }
+  }
+
+  @Override
   public void dropResource(String clusterName, String resourceName) {
     HelixDataAccessor accessor =
         new ZKHelixDataAccessor(clusterName, new ZkBaseDataAccessor<ZNRecord>(_zkClient));


Mime
View raw message