Repository navigation
Finish CI tests stuck on shutdown or a restored node identity - #25
Merged
Merged
Conversation
Backup artifacts now include CLUSTER_IDENTITY so a restore reopens the same node instance instead of minting one the replicated binding rejects. Shutdown cancels an in-flight maintenance tick and bounds the auxiliary drain, so a departed voter cannot pin the process on a proposal that can no longer commit. Co-authored-by: RustFS <hello@rustfs.com>
There was a problem hiding this comment.
🟡 Changes recommended
Cancelling split startup can leave a child registered in the router but untracked by the host, causing final flushing and explicit Raft shutdown to miss it.
1 open issue
What changed in this PR
Addresses two failures that prevented the workspace test suite from finishing: restored node identity rejection and shutdown hanging after a Raft voter stops.
Changes:
- Preserve
CLUSTER_IDENTITYin backups and require it during restore. - Reject missing identity metadata when the node already has a persisted instance binding.
- Cancel in-flight background maintenance during shutdown and bound the final drain with a local-flush fallback.
| File | Description |
|---|---|
crates/metadb-server/src/lib.rs |
Adds shutdown-aware maintenance cancellation and a 10-second drain timeout. |
crates/metadb-raft/src/backup.rs |
Copies node identity metadata and validates its presence during restore. |
crates/metadb-cluster/src/cell_manager.rs |
Recovers bindings before identity creation and rejects unsafe identity regeneration. |
Review effort: Balanced
Comment on lines
+722
to
+723
| _ = bg_rx.changed() => break, | ||
| _ = c.run_maintenance_tick_inner(false) => {} |
loverustfs
added a commit
that referenced
this pull request
Nov 19, 2026
Keep a publish-window lock from the final shard-directory and registry check through the artifact rename, read offline MANIFEST files without appending or truncating a torn tail, and hold the crash-scratch lock through the byte copy. Conflict resolution on backup.rs keeps #25's CLUSTER_IDENTITY rules: backup refuses a cell directory that lacks the file, and restore refuses a tree whose manifest lists CELL_MANAGER_STATE without the matching CLUSTER_IDENTITY. A merge is not a first-ship pass.
loverustfs
added a commit
that referenced
this pull request
Nov 19, 2026
Rebuild a missing published snapshot from the LSM, or fail closed with snapshot unrecoverable so a purged shard is not advertised as a live voter and does not accept writes onto an empty LSM. Start checks the unrecoverable latch before register_group. routes_for_live_status probes the snapshot directory through ensure_published_snapshot_sync. There is no fourth copy of the command log. This branch is one commit behind main after #19. A local merge into 3ed51ee has no text conflicts and keeps both #19's SHARD_SET publish lock and #25's identity and shutdown bounds. A merge is not a first-ship pass.
3 tasks
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.

Summary
The automated suite on
maindoes not finish. This change fixes the two failures reproduced from #22 head2007901e76dd0650e50b2a7733b9b10afca81251on both the pull_request run https://github.com/rustfs/MetaDB/actions/runs/44519243170 and the corresponding push run (times Asia/Shanghai, 2026-11-19). This is not a first-ship pass. A green or cancelled CI run is not treated as one.backup_restore_reads_committed_keys_and_rejects_a_truncated_artifactpanicked atcrates/metadb-server/tests/backup_restore.rs:251withIdentityRejected("node 1 is already bound to instance …; refusing a reused node identity"). That binary finished 3 passed, 1 failed. The backup copied cell state but omittedCLUSTER_IDENTITY. Restore then minted a new node instance id, and open rejected it against the instance already bound in the restored Raft state. The artifact now includesCLUSTER_IDENTITY, restore refuses a tree that lacks it, and open refuses to mint a new id when this node is already bound. The truncated-artifact rejection is unchanged.crates/metadb-server/tests/join_existing_group.rsdid not finish and consumed the Format job budget (about 40 minutes, until the 45-minute job timeout). On the pull_request run,interrupted_join_resumes_instead_of_forkingFAILED andjoin_sends_the_shared_secretlogged "has been running for over 60 seconds" at 20:01:24, then hung until the job was cancelled at 20:41. The runner killed leftover processjoin_existing_group-c54f06cb87fe66e5. On the push run, both tests only logged the 60-second warning and hung until cancel, with the same leftover binary. Other tests in that file, includingmetadbd_processes_join_existing_group_and_fail_over, had already passed. Becausecargo test --workspacewaits on this binary, later tests such asscale_in_restart_testsnever started.The hang is shutdown of a leader after another voter has stopped. The background maintenance tick proposes through Raft and does not observe shutdown until that proposal returns. With the peer gone, the proposal cannot commit, so
stop_taskswaits until the job is killed. Shutdown now drops an in-flight tick when the shutdown signal arrives, and the final auxiliary drain is bounded at 10 seconds. If that drain does not finish, shutdown still flushes local memtables and stops Raft. The assertions in the join tests are unchanged.Testing
cargo test -p metadb-server --test backup_restore --test join_existing_group --test e2e_cluster_evolution_testscargo test -p metadb-server --testscargo test -p metadb-cluster -p metadb-raftcargo clippy -p metadb-server -p metadb-raft -p metadb-cluster --all-targets -- -D warnings