You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by jl...@apache.org on 2019/07/19 18:12:28 UTC

[incubator-pinot] 01/01: Add resource config for lead controller resource

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

jlli pushed a commit to branch add-resource-for-lead-controller-resource
in repository https://gitbox.apache.org/repos/asf/incubator-pinot.git

commit d3624f715a4cb3ad447445b64492d3fa284a34c6
Author: jackjlli <jl...@linkedin.com>
AuthorDate: Fri Jul 19 11:12:05 2019 -0700

    Add resource config for lead controller resource
---
 .../pinot/controller/helix/core/util/HelixSetupUtils.java     | 11 +++++++++++
 1 file changed, 11 insertions(+)

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 eda9779..eb721f3 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
@@ -20,6 +20,8 @@ package org.apache.pinot.controller.helix.core.util;
 
 import com.google.common.base.Preconditions;
 import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
 import java.util.concurrent.TimeUnit;
 import org.apache.helix.HelixAdmin;
 import org.apache.helix.HelixDataAccessor;
@@ -41,6 +43,7 @@ import org.apache.helix.model.StateModelDefinition;
 import org.apache.helix.model.builder.CustomModeISBuilder;
 import org.apache.helix.model.builder.FullAutoModeISBuilder;
 import org.apache.helix.model.builder.HelixConfigScopeBuilder;
+import org.apache.pinot.common.utils.helix.HelixHelper;
 import org.apache.pinot.controller.helix.core.PinotHelixBrokerResourceOnlineOfflineStateModelGenerator;
 import org.apache.pinot.controller.helix.core.PinotHelixSegmentOnlineOfflineStateModelGenerator;
 import org.slf4j.Logger;
@@ -177,5 +180,13 @@ public class HelixSetupUtils {
 
       helixAdmin.addResource(helixClusterName, LEAD_CONTROLLER_RESOURCE_NAME, idealState);
     }
+
+    // Create resource config for lead controller resource if it doesn't exist
+    Map<String, String> resourceConfigMap =
+        HelixHelper.getResourceConfigsFor(helixClusterName, LEAD_CONTROLLER_RESOURCE_NAME, helixAdmin);
+    if (resourceConfigMap == null) {
+      HelixHelper
+          .updateResourceConfigsFor(new HashMap<>(), LEAD_CONTROLLER_RESOURCE_NAME, helixClusterName, helixAdmin);
+    }
   }
 }


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