Skip to content

[ISSUE #9215]🐛Release Broker store lease after healthy shutdown - #9217

Merged
mxsm merged 1 commit into
mainfrom
mxsm/fix-9215-broker-store-lease
Aug 11, 2026
Merged

[ISSUE #9215]🐛Release Broker store lease after healthy shutdown#9217
mxsm merged 1 commit into
mainfrom
mxsm/fix-9215-broker-store-lease

Conversation

@mxsm

@mxsm mxsm commented Aug 11, 2026

Copy link
Copy Markdown
Owner

Which Issue(s) This PR Fixes(Closes)

Brief Description

Release the Broker runtime's final message-store owner after a completed durable shutdown so StoreRootLeaseInner drops before an immediate same-path restart. Failed and timed-out shutdowns retain the owner for a safe retry instead of releasing a potentially active store.

The restart regressions now assert the ownership boundary directly. Controller failover/rejoin tests use an explicit test-only shutdown deadline and require a healthy message-store report before reusing the old store root, which keeps the check deterministic on loaded CI runners without changing the production deadline.

How Did You Test This Change?

  • cargo test -p rocketmq-broker --lib --all-features (790 passed, 0 failed, 2 ignored)
  • cargo test -p rocketmq-broker --lib broker_shutdown_cancels_scheduled_store_lease_before_store_lock_release -- --nocapture
  • cargo test -p rocketmq-broker --lib three_controller_two_broker_controller_mode_failover -- --nocapture
  • cargo fmt -p rocketmq-broker -- --check
  • cargo clippy --workspace --no-deps --all-targets --all-features -- -D warnings
  • .\scripts\runtime-audit.ps1 -SkipBaseline -EnforceBoundaryBaseline
  • cargo +nightly-2026-07-05 check --locked --all-targets --all-features from fuzz/
  • git diff --check

Summary by CodeRabbit

  • Bug Fixes

    • Improved graceful broker shutdown handling to preserve message-store ownership when shutdown fails, times out, or does not complete.
    • Successfully completed shutdowns now release message-store ownership, supporting reliable broker rejoin and failover scenarios.
  • Tests

    • Added coverage for healthy shutdown, ownership release, and broker rejoin behavior.

@mxsm
mxsm merged commit 61e85b0 into main Aug 11, 2026
20 of 27 checks passed
@coderabbitai

coderabbitai Bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: a13d3518-bad4-402d-89b6-95b4add5f6fe

📥 Commits

Reviewing files that changed from the base of the PR and between 5678cd0 and ab39575.

📒 Files selected for processing (2)
  • rocketmq-broker/src/broker_runtime/lifecycle.rs
  • rocketmq-broker/tests/broker_runtime/unit.rs

Walkthrough

The broker runtime now detaches its message-store owner only after healthy shutdown. Tests verify owner release before same-path restart, controller failover, and broker rejoin.

Changes

Broker store shutdown lifecycle

Layer / File(s) Summary
Conditional message-store detachment
rocketmq-broker/src/broker_runtime/lifecycle.rs
The runtime removes the message-store owner only after completed shutdown. Failed, timed-out, or absent shutdown outcomes retain ownership.
Shutdown and rejoin validation
rocketmq-broker/tests/broker_runtime/unit.rs
Tests assert owner release after healthy shutdown. Controller failover and rejoin tests use a bounded shutdown helper that verifies healthy store termination.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

Suggested labels: bug🐛, approved, auto merge, AI review first

Suggested reviewers: rocketmq-rust-bot, spacexcn, teslarustor

Poem

I’m a rabbit guarding the store,
The lease slips free when shutdown is sure.
Failed stops keep their owner near,
Rejoins now pass with paths clear.
Hop, hop—healthy state is here!

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch mxsm/fix-9215-broker-store-lease

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@mxsm
mxsm deleted the mxsm/fix-9215-broker-store-lease branch August 11, 2026 04:14
@rocketmq-rust-robot rocketmq-rust-robot added the bug🐛 Something isn't working label Aug 11, 2026
@rocketmq-rust-bot

Copy link
Copy Markdown
Collaborator

🔊@mxsm 🚀Thanks for your contribution🎉!

💡CodeRabbit(AI) will review your code first🔥!

Note

🚨The code review suggestions from CodeRabbit are to be used as a reference only, and the PR submitter can decide whether to make changes based on their own judgment. Ultimately, the project management personnel will conduct the final code review💥.

@rocketmq-rust-bot rocketmq-rust-bot added AI review first Ai review pr first auto merge ready to review waiting-review waiting review this PR approved PR has approved and removed ready to review waiting-review waiting review this PR labels Aug 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AI review first Ai review pr first approved PR has approved auto merge bug🐛 Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug🐛] Release the Broker store root lease after healthy shutdown

3 participants