You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@helix.apache.org by ka...@apache.org on 2013/10/30 02:28:06 UTC

git commit: [HELIX-284] Support participant auto join in YAML cluster setup, rb=15070

Updated Branches:
  refs/heads/helix-0.6.2-release e22db5c1c -> 4383512d0


[HELIX-284] Support participant auto join in YAML cluster setup, rb=15070


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

Branch: refs/heads/helix-0.6.2-release
Commit: 4383512d089f9c63594eac09d561d43e4a992bc9
Parents: e22db5c
Author: Kanak Biscuitwala <ka...@apache.org>
Authored: Tue Oct 29 18:20:50 2013 -0700
Committer: Kanak Biscuitwala <ka...@apache.org>
Committed: Tue Oct 29 18:27:42 2013 -0700

----------------------------------------------------------------------
 .../org/apache/helix/tools/YAMLClusterSetup.java     | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/4383512d/helix-core/src/main/java/org/apache/helix/tools/YAMLClusterSetup.java
----------------------------------------------------------------------
diff --git a/helix-core/src/main/java/org/apache/helix/tools/YAMLClusterSetup.java b/helix-core/src/main/java/org/apache/helix/tools/YAMLClusterSetup.java
index c7233ed..07991a6 100644
--- a/helix-core/src/main/java/org/apache/helix/tools/YAMLClusterSetup.java
+++ b/helix-core/src/main/java/org/apache/helix/tools/YAMLClusterSetup.java
@@ -13,10 +13,14 @@ import java.util.Set;
 import org.apache.helix.HelixAdmin;
 import org.apache.helix.HelixException;
 import org.apache.helix.manager.zk.ZKHelixAdmin;
+import org.apache.helix.manager.zk.ZKHelixManager;
+import org.apache.helix.model.HelixConfigScope;
+import org.apache.helix.model.HelixConfigScope.ConfigScopeProperty;
 import org.apache.helix.model.IdealState;
 import org.apache.helix.model.IdealState.RebalanceMode;
 import org.apache.helix.model.InstanceConfig;
 import org.apache.helix.model.StateModelDefinition;
+import org.apache.helix.model.builder.HelixConfigScopeBuilder;
 import org.apache.helix.tools.YAMLClusterSetup.YAMLClusterConfig.ParticipantConfig;
 import org.apache.helix.tools.YAMLClusterSetup.YAMLClusterConfig.ResourceConfig;
 import org.apache.helix.tools.YAMLClusterSetup.YAMLClusterConfig.ResourceConfig.ConstraintsConfig;
@@ -126,6 +130,16 @@ public class YAMLClusterSetup {
         helixAdmin.rebalance(cfg.clusterName, resource.name, replicas);
       }
     }
+
+    // enable auto join if this option is set
+    if (cfg.autoJoinAllowed != null && cfg.autoJoinAllowed) {
+      HelixConfigScope scope =
+          new HelixConfigScopeBuilder(ConfigScopeProperty.CLUSTER).forCluster(cfg.clusterName)
+              .build();
+      Map<String, String> properties = new HashMap<String, String>();
+      properties.put(ZKHelixManager.ALLOW_PARTICIPANT_AUTO_JOIN, cfg.autoJoinAllowed.toString());
+      helixAdmin.setConfig(scope, properties);
+    }
     return cfg;
   }
 
@@ -226,6 +240,7 @@ public class YAMLClusterSetup {
     public String clusterName;
     public List<ResourceConfig> resources;
     public List<ParticipantConfig> participants;
+    public Boolean autoJoinAllowed;
 
     public static class ResourceConfig {
       public String name;