[fix](cloud) Only register watershed txn id once when BE enters decommissioning state - #67322
Open
qzsee wants to merge 1 commit into
Open
[fix](cloud) Only register watershed txn id once when BE enters decommissioning state#67322qzsee wants to merge 1 commit into
qzsee wants to merge 1 commit into
Conversation
Contributor
|
Thank you for your contribution to Apache Doris. Please clearly describe your PR:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What problem does this PR solve?
Issue Number: close #xxx
Related PR: #xxx
Problem Summary:
This caused two issues:
Wrong guard flag. The block checked isDecommissioned() (the final decommissioned state) instead of isDecommissioning() (the in-progress state). As long as the BE had not yet reached the terminal DECOMMISSIONED state, every scheduling round of CloudClusterChecker would re-enter this branch and call registerWaterShedTxnId(be.getId()) again. The watershed txn id is only meaningful to be registered once per decommissioning session; repeatedly registering it on every check interval produces redundant RPCs/log entries and pollutes the upgrade manager's internal state.
Inconsistent state on RPC failure. be.setDecommissioning(true) was executed after the try/catch block, meaning even if registerWaterShedTxnId threw a UserException and the watershed txn id was never successfully registered, the BE would still be marked as decommissioning=true. Subsequent checks would then skip the retry path entirely, leaving the BE in an inconsistent state where it is flagged as decommissioning but has no associated watershed txn id.
Fix
Change the guard from
!be.isDecommissioned()to!be.isDecommissioning(), so the branch is only entered on the first transition into the decommissioning state.Move
be.setDecommissioning(true)inside the try block, right after registerWaterShedTxnId succeeds. This guarantees the in-memory decommissioning flag is only flipped when the watershed txn id has been registered successfully; if the RPC fails, the BE stays in its previous state and will be retried on the next check round.Impact
Eliminates repeated registerWaterShedTxnId calls for a BE that is stuck in DECOMMISSIONING state.
Makes the decommissioning state transition atomic with respect to the watershed txn id registration: either both succeed, or neither takes effect (and the operation is retried next round).
No behavior change for BEs that have already reached NODE_STATUS_DECOMMISSIONED.
Release note
None
Check List (For Author)
Test
Behavior changed:
Does this need documentation?
Check List (For Reviewer who merge this PR)