Skip to content

[fix] Fix graceful scale-down pod recreation - #567

Open
biley06 wants to merge 1 commit into
apache:masterfrom
biley06:fix/graceful-scale-down-recreation
Open

biley06 wants to merge 1 commit into
apache:masterfrom
biley06:fix/graceful-scale-down-recreation

Conversation

@biley06

@biley06 biley06 commented Nov 29, 2026 •

Copy link
Copy Markdown

What problem does this PR solve?

Issue Number: close #566

Related PR: N/A

Problem Summary:

During graceful scale-down, the operator drains a backend and removes it from Doris, then deletes its Pod before reducing the StatefulSet replica count. During that gap, the StatefulSet still considers the ordinal part of its desired replica set. If the Pod disappears while that is true, the StatefulSet controller may create a replacement Pod.

The replacement backend can start and may register with FE or MetaService again, then be deleted during a later reconciliation while handling queries. This can cause query failures and leave stale backend entries.

This change lowers the StatefulSet replica count before deleting the Pod. If the replica update fails, the handler returns without deleting the Pod, leaving the graceful action available for a later reconciliation. If Kubernetes or an earlier reconciliation has already removed the Pod, the handler still lowers replicas and advances the action.

Release Note:

Fix graceful scale-down recreating a removed BE pod.

Check List (For Author)

  • Test

    • Unit Test

    go test ./pkg/controller/sub_controller/disaggregated_cluster/computegroups -count=1 passes. go vet ./... and go build ./cmd/operator pass.

  • Behavior changed:

    • No.
    • Yes.
      The StatefulSet replica count is lowered before the drained Pod is deleted.
  • Does this need documentation?

    • No.
    • Yes.

Check List (For Reviewer who merge this PR)

  • Confirm the release note
  • Confirm test cases
  • Confirm document
  • Add branch pick label

@biley06
biley06 force-pushed the fix/graceful-scale-down-recreation branch from 35a20bb to 2961d6b Compare November 29, 2026 19:31
@biley06 biley06 changed the title Fix graceful scale-down pod recreation [fix] Fix graceful scale-down pod recreation Nov 29, 2026
Lower the StatefulSet replicas before deleting the drained pod. This
prevents the StatefulSet from recreating the ordinal before scale-down
completes.

Fixes apache#566
@biley06
biley06 force-pushed the fix/graceful-scale-down-recreation branch from 2961d6b to bb317af Compare November 29, 2026 19:39
@biley06

biley06 commented Dec 1, 2026

Copy link
Copy Markdown
Author

Hi @Al-assad @catpineapple @intelligentfu8 @morningman ,

I've raised this PR to fix the phantom BE recreation issue during graceful scale-down.

We encountered this issue internally while using Doris in our organization. The fix has been running on our fork and has eliminated phantom BE recreations and query failures during scale-downs in our verification.

Could you please take a look and share your feedback on the approach?

Thanks!

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.

[Bug] Graceful scale-down can recreate a drained BE pod when StatefulSet replica update fails, resulting in phantom BE

1 participant