amrishlal commented on a change in pull request #7174: URL: https://github.com/apache/pinot/pull/7174#discussion_r691665938
########## File path: pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/periodictask/ControllerPeriodicTask.java ########## @@ -54,14 +55,27 @@ public ControllerPeriodicTask(String taskName, long runFrequencyInSeconds, long _controllerMetrics = controllerMetrics; } + // Determine if this task can run on the specified table. Task can run on all tables for which the controller is lead + // if "tablename" property is not set. However, if "tablename" property is set (by calling the /periodictask/run + // controller API), then the task will only run on the specified by the "tablename" property key. + private boolean shouldRunTaskForTable(String tableNameWithType) { + if (_leadControllerManager.isLeaderForTable(tableNameWithType)) { + String propTableNameWithType = (String) _activePeriodicTaskProperties.get(PeriodicTask.PROPERTY_KEY_TABLE_NAME); + return propTableNameWithType == null || propTableNameWithType.equals(tableNameWithType); + } + return false; + } + @Override protected final void runTask() { _controllerMetrics.addMeteredTableValue(_taskName, ControllerMeter.CONTROLLER_PERIODIC_TASK_RUN, 1L); try { // Process the tables that are managed by this controller + // TODO: creating tablesToProcess list below is redundant since processTables will unroll the list anyway. This Review comment: As a function, `ControllerPeriodicTask.runTask() `doesn't do much. If it was merged with the `ControllerPeriodicTask.processTables` function then there would be no need to create the `tablesToProcess` array because `processTable` could directly be called on the tables that pass the filter criteria. -- 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. To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org For additional commands, e-mail: commits-h...@pinot.apache.org