Copilot commented on code in PR #65406:
URL: https://github.com/apache/doris/pull/65406#discussion_r3549897305
##########
fe/fe-core/src/main/java/org/apache/doris/load/routineload/RoutineLoadManager.java:
##########
@@ -144,8 +144,13 @@ public void
removeMultiLoadTaskTxnIdToRoutineLoadJobId(long txnId) {
}
public void updateBeIdToMaxConcurrentTasks() {
- beIdToMaxConcurrentTasks =
Env.getCurrentSystemInfo().getAllBackendIds(true).stream().collect(
- Collectors.toMap(beId -> beId, beId ->
Config.max_routine_load_task_num_per_be));
+ beIdToMaxConcurrentTasks =
Env.getCurrentSystemInfo().getAllBackendIds(true).stream()
+ .filter(beId -> {
+ Backend backend =
Env.getCurrentSystemInfo().getBackend(beId);
+ return backend != null && backend.isLoadAvailable()
+ && !backend.isDecommissioned() &&
!backend.isDecommissioning();
Review Comment:
updateBeIdToMaxConcurrentTasks() calls Env.getCurrentSystemInfo() repeatedly
inside the stream, which is harder to read and can lead to inconsistent
snapshots if the reference ever changes. Cache the SystemInfoService once and
reuse it inside the pipeline.
##########
fe/fe-core/src/test/java/org/apache/doris/system/SystemInfoServiceTest.java:
##########
@@ -190,13 +190,17 @@ public void testSelectBackendIdsByPolicy() throws
Exception {
Assert.assertEquals(0, infoService.selectBackendIdsByPolicy(policy4,
3).size());
BeSelectionPolicy policy5 = new
BeSelectionPolicy.Builder().needLoadAvailable().build();
+
Assert.assertTrue(policy5.toString().contains("nonDecommissioned=true"));
Review Comment:
Test assertion is coupled to BeSelectionPolicy.toString() formatting. Since
needNonDecommissioned is a public field, assert the flag directly to avoid
brittle failures if the string representation changes (logging-only).
--
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]