Jackie-Jiang 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_r311749856
 
 

 ##########
 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:
   Don't change the default behavior, join as PARTICIPANT by default

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to