Skip to content

raftstore: avoid early hibernate if pending on applying logs when restart (#18236)#18601

Merged
ti-chi-bot[bot] merged 2 commits intotikv:release-7.5from
ti-chi-bot:cherry-pick-18236-to-release-7.5
Jul 15, 2025
Merged

raftstore: avoid early hibernate if pending on applying logs when restart (#18236)#18601
ti-chi-bot[bot] merged 2 commits intotikv:release-7.5from
ti-chi-bot:cherry-pick-18236-to-release-7.5

Conversation

@ti-chi-bot
Copy link
Member

This is an automated cherry-pick of #18236

What is changed and how it works?

Issue Number: Close #18233

What's Changed:

In previous work #16239, we introduced the busy_on_apply state to indicate
whether a Peer is pending the application of pending Raft logs upon restart.

However, this approach misses a corner case: if the Peer quickly enters the
hibernate state after restarting, the busy_on_apply state may not be updated
in a timely manner. This results in the Node failed to update the count of pending
applying regions, continuously reporting an incorrect is_busy == true state to PD.
Consequently, this can slow down the rolling-restart progress more than expected.

Therefore, this PR addresses this issue by updating the applied state in on_apply_res.

Fix the bug where some hibernated peers, marked with `busy_on_apply == true`, 
cannot be reset with normal even thought the `applied_index == committed_index`.

Related changes

  • PR to update pingcap/docs/pingcap/docs-cn:
  • Need to cherry-pick to the release branch

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No code

Side effects

  • Performance regression: Consumes more CPU
  • Performance regression: Consumes more Memory
  • Breaking backward compatibility

Release note

Fix the bug where some hibernated peers, marked with `busy_on_apply == true`, 
cannot be reset with normal even thought the `applied_index == committed_index`.

close tikv#18233

Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
@ti-chi-bot ti-chi-bot added dco-signoff: yes Indicates the PR's author has signed the dco. do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. type/cherry-pick-for-release-7.5 This PR is cherry-picked to release-7.5 from a source PR. labels Jun 30, 2025
@ti-chi-bot
Copy link
Member Author

@LykxSassinator This PR has conflicts, I have hold it.
Please resolve them or ask others to resolve them, then comment /unhold to remove the hold label.

@ti-chi-bot ti-chi-bot bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Jun 30, 2025
Signed-off-by: lucasliang <nkcs_lykx@hotmail.com>
@ti-chi-bot ti-chi-bot bot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jun 30, 2025
@ti-chi-bot ti-chi-bot bot added needs-1-more-lgtm Indicates a PR needs 1 more LGTM. approved labels Jun 30, 2025
@ti-chi-bot ti-chi-bot bot added cherry-pick-approved Cherry pick PR approved by release team. and removed do-not-merge/cherry-pick-not-approved labels Jul 11, 2025
@LykxSassinator
Copy link
Contributor

/unhold

@ti-chi-bot ti-chi-bot bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jul 15, 2025
@ti-chi-bot ti-chi-bot bot added the lgtm label Jul 15, 2025
@ti-chi-bot
Copy link
Contributor

ti-chi-bot bot commented Jul 15, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: hbisheng, LykxSassinator

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ti-chi-bot ti-chi-bot bot removed the needs-1-more-lgtm Indicates a PR needs 1 more LGTM. label Jul 15, 2025
@ti-chi-bot
Copy link
Contributor

ti-chi-bot bot commented Jul 15, 2025

[LGTM Timeline notifier]

Timeline:

  • 2025-06-30 08:57:30.066885091 +0000 UTC m=+1298902.790064068: ☑️ agreed by LykxSassinator.
  • 2025-07-15 03:46:28.199772773 +0000 UTC m=+2576240.922951752: ☑️ agreed by hbisheng.

@ti-chi-bot ti-chi-bot bot merged commit c4d31e0 into tikv:release-7.5 Jul 15, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved cherry-pick-approved Cherry pick PR approved by release team. dco-signoff: yes Indicates the PR's author has signed the dco. lgtm release-note Denotes a PR that will be considered when it comes time to generate release notes. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. type/cherry-pick-for-release-7.5 This PR is cherry-picked to release-7.5 from a source PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants