diff --git a/fe/fe-core/src/main/java/org/apache/doris/load/routineload/RoutineLoadManager.java b/fe/fe-core/src/main/java/org/apache/doris/load/routineload/RoutineLoadManager.java index 4c66c5101264f4..371251322eab82 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/load/routineload/RoutineLoadManager.java +++ b/fe/fe-core/src/main/java/org/apache/doris/load/routineload/RoutineLoadManager.java @@ -480,7 +480,7 @@ public long getAvailableBeForTask(long jobId, long previousBeId, String clusterN try { Map beIdToConcurrentTasks = getBeCurrentTasksNumMap(); - // 1. Find if the given BE id has available slots + // 1. Find if the given BE id has more than half of available slots if (previousBeId != -1L && availableBeIds.contains(previousBeId)) { // get the previousBackend info Backend previousBackend = Env.getCurrentSystemInfo().getBackend(previousBeId); @@ -495,7 +495,7 @@ public long getAvailableBeForTask(long jobId, long previousBeId, String clusterN } else { idleTaskNum = beIdToMaxConcurrentTasks.get(previousBeId); } - if (idleTaskNum > 0) { + if (idleTaskNum > (Config.max_routine_load_task_num_per_be >> 1)) { return previousBeId; } } diff --git a/fe/fe-core/src/main/java/org/apache/doris/load/routineload/RoutineLoadTaskScheduler.java b/fe/fe-core/src/main/java/org/apache/doris/load/routineload/RoutineLoadTaskScheduler.java index 5c01375e7dc873..10eec92b5e38b4 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/load/routineload/RoutineLoadTaskScheduler.java +++ b/fe/fe-core/src/main/java/org/apache/doris/load/routineload/RoutineLoadTaskScheduler.java @@ -284,7 +284,8 @@ private void submitTask(long beId, TRoutineLoadTask tTask) throws LoadException } // try to allocate a task to BE which has idle slot. - // 1. First is to check if the previous allocated BE is available. If yes, allocate task to previous BE. + // 1. First is to check if the previous allocated BE has more than half of available slots. + // If yes, allocate task to previous BE. // 2. If not, try to find a better one with most idle slots. // return true if allocate successfully. return false if failed. // throw exception if unrecoverable errors happen.