morningman commented on a change in pull request #333: Add distributor which
allocate task to be fairly
URL: https://github.com/apache/incubator-doris/pull/333#discussion_r235322244
##########
File path: fe/src/main/java/org/apache/doris/load/routineload/RoutineLoad.java
##########
@@ -71,23 +78,69 @@ public RoutineLoad() {
idToRunningRoutineLoadJob = Maps.newHashMap();
idToCancelledRoutineLoadJob = Maps.newHashMap();
idToRoutineLoadTask = Maps.newHashMap();
- idToNeedSchedulerRoutineLoadTask = Maps.newHashMap();
+ needSchedulerRoutineLoadTask = Queues.newLinkedBlockingQueue();
+ beIdToConcurrentTasks = Maps.newHashMap();
+ taskIdToJobId = Maps.newHashMap();
lock = new ReentrantReadWriteLock(true);
}
+ public void initBeIdToMaxConcurrentTasks() {
+ if (beIdToMaxConcurrentTasks == null) {
+ beIdToMaxConcurrentTasks =
Catalog.getCurrentSystemInfo().getBackendIds(true)
+ .parallelStream().collect(Collectors.toMap(beId -> beId,
beId -> DEFAULT_BE_CONCURRENT_TASK_NUM));
+ }
+ }
+
public int getTotalMaxConcurrentTaskNum() {
readLock();
try {
- if (beIdToMaxConcurrentTasks == null) {
- beIdToMaxConcurrentTasks =
Catalog.getCurrentSystemInfo().getBackendIds(true)
- .parallelStream().collect(Collectors.toMap(beId ->
beId, beId -> DEFAULT_BE_CONCURRENT_TASK_NUM));
- }
+ initBeIdToMaxConcurrentTasks();
return beIdToMaxConcurrentTasks.values().stream().mapToInt(i ->
i).sum();
} finally {
readUnlock();
}
}
+ public void updateBeIdTaskMaps() {
+ writeLock();
+ try {
+ initBeIdToMaxConcurrentTasks();
+ List<Long> beIds =
Catalog.getCurrentSystemInfo().getBackendIds(true);
+
+ // diff beIds and beIdToMaxConcurrentTasks.keys()
+ List<Long> newBeIds = beIds.parallelStream().filter(entity ->
beIdToMaxConcurrentTasks.get(entity) == null)
+ .collect(Collectors.toList());
+ List<Long> decommissionBeIds =
beIdToMaxConcurrentTasks.keySet().parallelStream()
Review comment:
Do not name as 'decommissionBeIds', cause 'decommission' means the backend
is being decommissioned.
So just name it as 'unavailableBeIds'
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]