mcvsubbu 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_r306446963
 
 

 ##########
 File path: 
pinot-controller/src/main/java/org/apache/pinot/controller/ControllerStarter.java
 ##########
 @@ -425,6 +416,23 @@ private void initPinotCrypterFactory() {
     }
   }
 
+  private void registerListeners(HelixManager helixParticipantManager) {
+    // This registration is not needed when the resource is enabled.
+    // However, the resource can be disabled sometime while the cluster is in 
operation, so we keep it here. Plus, it does not add much overhead.
+    // At some point in future when we stop supporting the disabled resource, 
we will remove this line altogether and the logic that goes with it.
+    LOGGER.info("Registering helix controller listener");
+    helixParticipantManager.addControllerListener(
+        (ControllerChangeListener) changeContext -> 
_leadControllerManager.onHelixControllerChange());
+
+    LOGGER.info("Registering resource config listener");
+    try {
+      helixParticipantManager.addResourceConfigChangeListener(
+          (resourceConfigList, changeContext) -> 
_leadControllerManager.onResourceConfigChange());
+    } catch (Exception e) {
+      throw new RuntimeException("Error registering resource config listener", 
e);
 
 Review comment:
   Please add the resource name in the log

----------------------------------------------------------------
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