jackjlli commented on a change in pull request #4323: [Controller Separation] 
Add logic for lead controller resource
URL: https://github.com/apache/incubator-pinot/pull/4323#discussion_r313058999
 
 

 ##########
 File path: 
pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/PinotHelixResourceManager.java
 ##########
 @@ -155,21 +160,32 @@ public PinotHelixResourceManager(@Nonnull String zkURL, 
@Nonnull String helixClu
     _isSingleTenantCluster = isSingleTenantCluster;
     _enableBatchMessageMode = enableBatchMessageMode;
     _allowHLCTables = allowHLCTables;
+    _helixInstanceType = helixInstanceType;
+
+    _helixZkManager =
+        HelixManagerFactory.getZKHelixManager(_helixClusterName, _instanceId, 
_helixInstanceType, _helixZkURL);
+    // LeadControllerManager needs to be initialized before registering as 
Helix participant.
+    _leadControllerManager = new LeadControllerManager(_instanceId, 
_helixZkManager);
   }
 
-  public PinotHelixResourceManager(@Nonnull ControllerConf controllerConf) {
-    this(controllerConf.getZkStr(), controllerConf.getHelixClusterName(),
-        CommonConstants.Helix.PREFIX_OF_CONTROLLER_INSTANCE + 
controllerConf.getControllerHost() + "_" + controllerConf
-            .getControllerPort(), controllerConf.getDataDir(), 
controllerConf.getExternalViewOnlineToOfflineTimeout(),
+  // This constructor should only be explicitly called by {@link 
ControllerStarter}.
+  public PinotHelixResourceManager(@Nonnull ControllerConf controllerConf, 
InstanceType instanceType) {
+    this(controllerConf.getZkStr(), controllerConf.getHelixClusterName(), 
LeadControllerUtils
+            
.generateControllerParticipantId(controllerConf.getControllerHost(), 
controllerConf.getControllerPort()),
+        controllerConf.getDataDir(), 
controllerConf.getExternalViewOnlineToOfflineTimeout(),
         controllerConf.tenantIsolationEnabled(), 
controllerConf.getEnableBatchMessageMode(),
-        controllerConf.getHLCTablesAllowed());
+        controllerConf.getHLCTablesAllowed(), instanceType);
+  }
+
+  public PinotHelixResourceManager(@Nonnull ControllerConf controllerConf) {
+    this(controllerConf, InstanceType.ADMINISTRATOR);
 
 Review comment:
   Done.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

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

Reply via email to