Skip to content

branch-4.1: [fix](fe) Skip decommissioning BE for load#65406

Open
liaoxin01 wants to merge 1 commit into
apache:branch-4.1from
liaoxin01:codex/pick-65049-to-branch-4.1
Open

branch-4.1: [fix](fe) Skip decommissioning BE for load#65406
liaoxin01 wants to merge 1 commit into
apache:branch-4.1from
liaoxin01:codex/pick-65049-to-branch-4.1

Conversation

@liaoxin01

Copy link
Copy Markdown
Contributor

Pick #65049

Problem Summary: Stream load backend selection could still choose a
backend that is being decommissioned because load availability only
checks alive/load-disabled/shutdown state. This can redirect new stream
load requests to a draining backend. This change adds an explicit
non-decommissioned selection policy and applies it to stream load
redirect, upload submitter, MySQL load, and transaction stream load
backend selection. Cloud stream load redirect and group commit backend
availability now also skip backends that are decommissioned or
decommissioning.
@liaoxin01 liaoxin01 requested a review from yiguolei as a code owner July 9, 2026 07:53
Copilot AI review requested due to automatic review settings July 9, 2026 07:53
@hello-stephen

Copy link
Copy Markdown
Contributor

Thank you for your contribution to Apache Doris.
Don't know what should be done next? See How to process your PR.

Please clearly describe your PR:

  1. What problem was fixed (it's best to include specific error reporting information). How it was fixed.
  2. Which behaviors were modified. What was the previous behavior, what is it now, why was it modified, and what possible impacts might there be.
  3. What features were added. Why was this function added?
  4. Which code was refactored and why was this part of the code refactored?
  5. Which functions were optimized and what is the difference before and after the optimization?

@liaoxin01

Copy link
Copy Markdown
Contributor Author

run buildall

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR hardens backend selection for load-related paths by ensuring decommissioned/decommissioning BEs are not chosen for stream load, routine load, streaming jobs, group commit, and Kafka meta requests. It also extends BeSelectionPolicy so that “load available” selection inherently excludes decommissioning states, and adds/updates unit tests to lock in the intended behavior.

Changes:

  • Add needNonDecommissioned to BeSelectionPolicy and automatically enable it when needLoadAvailable() is requested.
  • Filter out decommissioned/decommissioning backends across multiple load-selection entry points (stream load, routine load, streaming jobs, group commit, Kafka meta).
  • Add/update FE unit tests covering decommissioning/load-disabled backend exclusion and saturated-slot edge cases.

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
fe/fe-core/src/main/java/org/apache/doris/system/BeSelectionPolicy.java Introduces needNonDecommissioned and applies it to load selection; updates matching logic and toString().
fe/fe-core/src/main/java/org/apache/doris/load/StreamLoadHandler.java Prevents stream load redirect from selecting decommissioned/decommissioning BEs.
fe/fe-core/src/main/java/org/apache/doris/load/routineload/RoutineLoadManager.java Excludes decommissioning/decommissioned BEs from routine-load concurrency map and avoids reusing saturated/invalid previous BEs.
fe/fe-core/src/main/java/org/apache/doris/cloud/load/CloudRoutineLoadManager.java Uses load-availability + non-decommission filters for cloud routine load backend selection.
fe/fe-core/src/main/java/org/apache/doris/load/GroupCommitManager.java Improves “no suitable backend” diagnostics and excludes decommissioning BEs in availability check.
fe/fe-core/src/main/java/org/apache/doris/job/util/StreamingJobUtils.java Ensures streaming job backend selection skips decommissioned/decommissioning BEs in cloud mode.
fe/fe-core/src/main/java/org/apache/doris/datasource/kafka/KafkaUtil.java Centralizes backend availability checks for Kafka meta requests and excludes decommissioning BEs.
fe/fe-core/src/test/java/org/apache/doris/system/SystemInfoServiceTest.java Updates selection-policy tests to validate decommissioning/decommissioned exclusion for load.
fe/fe-core/src/test/java/org/apache/doris/load/StreamLoadHandlerTest.java Adds a unit test verifying stream load backend selection skips decommissioning BEs.
fe/fe-core/src/test/java/org/apache/doris/load/routineload/RoutineLoadManagerTest.java Adjusts mocks to align with new backend-availability filtering in routine load.
fe/fe-core/src/test/java/org/apache/doris/load/routineload/RoutineLoadBackendSelectionTest.java Adds coverage for decommissioning previous-BE reuse prevention and cloud load-disabled BE filtering.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 146 to +151
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();
Comment on lines 192 to +193
BeSelectionPolicy policy5 = new BeSelectionPolicy.Builder().needLoadAvailable().build();
Assert.assertTrue(policy5.toString().contains("nonDecommissioned=true"));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants