You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by ja...@apache.org on 2019/06/19 01:58:10 UTC

[incubator-pinot] branch fix_state_transition_max_threads updated (dbbf398 -> 35dad73)

This is an automated email from the ASF dual-hosted git repository.

jackie pushed a change to branch fix_state_transition_max_threads
in repository https://gitbox.apache.org/repos/asf/incubator-pinot.git.


 discard dbbf398  Only set Helix cluster properties when creating the cluster
     new 35dad73  Only set Helix cluster properties when creating the cluster

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (dbbf398)
            \
             N -- N -- N   refs/heads/fix_state_transition_max_threads (35dad73)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../org/apache/pinot/controller/helix/core/util/HelixSetupUtils.java    | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org


[incubator-pinot] 01/01: Only set Helix cluster properties when creating the cluster

Posted by ja...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

jackie pushed a commit to branch fix_state_transition_max_threads
in repository https://gitbox.apache.org/repos/asf/incubator-pinot.git

commit 35dad739b0e6dd2ed1d9f00a959835a076a57dd4
Author: Jackie (Xiaotian) Jiang <xa...@linkedin.com>
AuthorDate: Tue Jun 18 18:54:58 2019 -0700

    Only set Helix cluster properties when creating the cluster
    
    If Helix cluster does not exist, create the cluster with auto-join enabled
    Do not set the STATE_TRANSITION.maxThreads when creating the cluster so Helix can go with the default value (40)
---
 .../helix/core/util/HelixSetupUtils.java           | 51 +++++++---------------
 1 file changed, 15 insertions(+), 36 deletions(-)

diff --git a/pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/util/HelixSetupUtils.java b/pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/util/HelixSetupUtils.java
index f65a8ce..82c4cab 100644
--- a/pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/util/HelixSetupUtils.java
+++ b/pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/util/HelixSetupUtils.java
@@ -19,10 +19,9 @@
 package org.apache.pinot.controller.helix.core.util;
 
 import com.google.common.base.Preconditions;
-import java.util.ArrayList;
+import java.util.Collections;
 import java.util.HashMap;
 import java.util.List;
-import java.util.Map;
 import java.util.concurrent.TimeUnit;
 import org.apache.helix.AccessOption;
 import org.apache.helix.HelixAdmin;
@@ -39,12 +38,10 @@ import org.apache.helix.manager.zk.ZKHelixManager;
 import org.apache.helix.manager.zk.ZNRecordSerializer;
 import org.apache.helix.manager.zk.ZkBaseDataAccessor;
 import org.apache.helix.manager.zk.ZkClient;
-import org.apache.helix.messaging.handling.HelixTaskExecutor;
 import org.apache.helix.model.HelixConfigScope;
 import org.apache.helix.model.HelixConfigScope.ConfigScopeProperty;
 import org.apache.helix.model.IdealState;
 import org.apache.helix.model.MasterSlaveSMD;
-import org.apache.helix.model.Message.MessageType;
 import org.apache.helix.model.StateModelDefinition;
 import org.apache.helix.model.builder.HelixConfigScopeBuilder;
 import org.apache.helix.store.zk.ZkHelixPropertyStore;
@@ -70,28 +67,30 @@ import static org.apache.pinot.common.utils.CommonConstants.Helix.REBALANCE_DELA
 public class HelixSetupUtils {
   private static final Logger LOGGER = LoggerFactory.getLogger(HelixSetupUtils.class);
 
-  public static synchronized HelixManager setup(String helixClusterName, String zkPath,
-      String helixControllerInstanceId) {
-    setupHelixCluster(helixClusterName, zkPath);
-
-    return startHelixControllerInStandadloneMode(helixClusterName, zkPath, helixControllerInstanceId);
+  public static HelixManager setup(String helixClusterName, String zkPath, String helixControllerInstanceId) {
+    setupHelixClusterIfNeeded(helixClusterName, zkPath);
+    return startHelixControllerInStandaloneMode(helixClusterName, zkPath, helixControllerInstanceId);
   }
 
   /**
    * Set up a brand new Helix cluster if it doesn't exist.
    */
-  public static void setupHelixCluster(String helixClusterName, String zkPath) {
-    final HelixAdmin admin = new ZKHelixAdmin(zkPath);
+  private static void setupHelixClusterIfNeeded(String helixClusterName, String zkPath) {
+    HelixAdmin admin = new ZKHelixAdmin(zkPath);
     if (admin.getClusters().contains(helixClusterName)) {
       LOGGER.info("Helix cluster: {} already exists", helixClusterName);
-      return;
+    } else {
+      LOGGER.info("Creating a new Helix cluster: {}", helixClusterName);
+      admin.addCluster(helixClusterName, false);
+      // Enable Auto-Join for the cluster
+      HelixConfigScope configScope =
+          new HelixConfigScopeBuilder(ConfigScopeProperty.CLUSTER).forCluster(helixClusterName).build();
+      admin.setConfig(configScope, Collections.singletonMap(ZKHelixManager.ALLOW_PARTICIPANT_AUTO_JOIN, "true"));
+      LOGGER.info("New Helix cluster: {} created", helixClusterName);
     }
-    LOGGER.info("Creating a new Helix cluster: {}", helixClusterName);
-    admin.addCluster(helixClusterName, false);
-    LOGGER.info("New Cluster: {} created.", helixClusterName);
   }
 
-  private static HelixManager startHelixControllerInStandadloneMode(String helixClusterName, String zkUrl,
+  private static HelixManager startHelixControllerInStandaloneMode(String helixClusterName, String zkUrl,
       String pinotControllerInstanceId) {
     LOGGER.info("Starting Helix Standalone Controller ... ");
     return HelixControllerMain
@@ -107,9 +106,6 @@ public class HelixSetupUtils {
     Preconditions.checkState(admin.getClusters().contains(helixClusterName),
         String.format("Helix cluster: %s hasn't been set up", helixClusterName));
 
-    // Ensure auto join.
-    ensureAutoJoin(helixClusterName, admin);
-
     // Add segment state model definition if needed
     addSegmentStateModelDefinitionIfNeeded(helixClusterName, admin, zkPath, isUpdateStateModel);
 
@@ -123,23 +119,6 @@ public class HelixSetupUtils {
     initPropertyStoreIfNeeded(helixClusterName, zkPath);
   }
 
-  private static void ensureAutoJoin(String helixClusterName, HelixAdmin admin) {
-    final HelixConfigScope scope =
-        new HelixConfigScopeBuilder(ConfigScopeProperty.CLUSTER).forCluster(helixClusterName).build();
-    String stateTransitionMaxThreads = MessageType.STATE_TRANSITION + "." + HelixTaskExecutor.MAX_THREADS;
-    List<String> keys = new ArrayList<>();
-    keys.add(ZKHelixManager.ALLOW_PARTICIPANT_AUTO_JOIN);
-    keys.add(stateTransitionMaxThreads);
-    Map<String, String> configs = admin.getConfig(scope, keys);
-    if (!Boolean.TRUE.toString().equals(configs.get(ZKHelixManager.ALLOW_PARTICIPANT_AUTO_JOIN))) {
-      configs.put(ZKHelixManager.ALLOW_PARTICIPANT_AUTO_JOIN, Boolean.TRUE.toString());
-    }
-    if (!Integer.toString(1).equals(configs.get(stateTransitionMaxThreads))) {
-      configs.put(stateTransitionMaxThreads, String.valueOf(1));
-    }
-    admin.setConfig(scope, configs);
-  }
-
   private static void addSegmentStateModelDefinitionIfNeeded(String helixClusterName, HelixAdmin admin, String zkPath,
       boolean isUpdateStateModel) {
     final String segmentStateModelName =


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org