abhishekrb19 commented on code in PR #19203:
URL: https://github.com/apache/druid/pull/19203#discussion_r2996027829
##########
indexing-service/src/main/java/org/apache/druid/indexing/overlord/TaskQueue.java:
##########
@@ -417,8 +418,14 @@ private void startPendingTasksOnRunner()
log.info("Notified task runner to clean up [%,d] tasks with IDs[%s].",
unknownTaskIds.size(), unknownTaskIds);
// Attain futures for all active tasks (assuming they are ready to run).
- // Copy tasks list, as notifyStatus may modify it.
- for (final String queuedTaskId : List.copyOf(activeTasks.keySet())) {
+ // Copy tasks list, as notifyStatus may modify it. Sort by priority
(highest first) so that
+ // higher-priority tasks are submitted to the runner before lower-priority
ones.
+ final List<String> queuedTaskIds = new ArrayList<>(activeTasks.keySet());
+ queuedTaskIds.sort(Comparator.comparingInt(id -> {
+ final TaskEntry entry = activeTasks.get(id);
Review Comment:
Avoiding the copy and looking up the concurrent hash map directly makes
sense to me (since a copied snapshot can still have inconsistent views).
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]