helix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ka...@apache.org
Subject [1/2] git commit: [HELIX-284] Support participant auto join in YAML cluster setup, rb=15070
Date Wed, 30 Oct 2013 01:32:33 GMT
Updated Branches:
  refs/heads/master 90faf91bb -> 463f3a941


[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/463f3a94
Tree: http://git-wip-us.apache.org/repos/asf/incubator-helix/tree/463f3a94
Diff: http://git-wip-us.apache.org/repos/asf/incubator-helix/diff/463f3a94

Branch: refs/heads/master
Commit: 463f3a9413237fec357982672712659fab49b222
Parents: 486acd4
Author: Kanak Biscuitwala <kanak@apache.org>
Authored: Tue Oct 29 18:20:50 2013 -0700
Committer: Kanak Biscuitwala <kanak@apache.org>
Committed: Tue Oct 29 18:32:06 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/463f3a94/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;


Mime
View raw message