KKcorps commented on code in PR #14829: URL: https://github.com/apache/pinot/pull/14829#discussion_r1938930469
########## pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/minion/PinotTaskManager.java: ########## @@ -548,27 +572,64 @@ public synchronized TaskSchedulingInfo scheduleTaskForDatabase(String taskType, * - list of task generation errors if any * - list of task scheduling errors if any */ + @Deprecated(forRemoval = true) public synchronized TaskSchedulingInfo scheduleTaskForTable(String taskType, String tableNameWithType, @Nullable String minionInstanceTag) { - return scheduleTask(taskType, List.of(tableNameWithType), minionInstanceTag); + TaskSchedulingContext context = new TaskSchedulingContext() + .setTasksToSchedule(Collections.singleton(taskType)) + .setTablesToSchedule(Collections.singleton(tableNameWithType)) + .setMinionInstanceTag(minionInstanceTag); + return scheduleTasks(context).get(taskType); } /** * Helper method to schedule tasks (all task types) for the given tables that have the tasks enabled. * Returns a map from the task type to the {@link TaskSchedulingInfo} of the tasks scheduled. */ + @Deprecated(forRemoval = true) protected synchronized Map<String, TaskSchedulingInfo> scheduleTasks(List<String> tableNamesWithType, boolean isLeader, @Nullable String minionInstanceTag) { + TaskSchedulingContext context = new TaskSchedulingContext() + .setTablesToSchedule(new HashSet<>(tableNamesWithType)) + .setLeader(isLeader) + .setMinionInstanceTag(minionInstanceTag); + return scheduleTasks(context); + } + + /** + * Helper method to schedule tasks (all task types) for the given tables that have the tasks enabled. + * Returns a map from the task type to the {@link TaskSchedulingInfo} of the tasks scheduled. + */ + public synchronized Map<String, TaskSchedulingInfo> scheduleTasks(TaskSchedulingContext context) { _controllerMetrics.addMeteredGlobalValue(ControllerMeter.NUMBER_TIMES_SCHEDULE_TASKS_CALLED, 1L); - // Scan all table configs to get the tables with tasks enabled Map<String, List<TableConfig>> enabledTableConfigMap = new HashMap<>(); - for (String tableNameWithType : tableNamesWithType) { + Set<String> tablesToSchedule = context.getTablesToSchedule(); + Set<String> databasesToSchedule = context.getDatabasesToSchedule(); + Set<String> tasksToSchedule = context.getTasksToSchedule(); + Set<String> finalTablesToSchedule = new HashSet<>(); + if (tablesToSchedule != null) { + finalTablesToSchedule.addAll(tablesToSchedule); Review Comment: nit: you can rename these as `targetTables` `targetDatabases` and `consolidatedTables` instead of `tablesToSchedule`, `databasesToSchedule` and `finalTablesToSchedule` -- 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