refactor: batch cluster lock and health readiness (#3936)

This commit is contained in:
Zhengchao An
2026-06-27 10:51:06 +08:00
committed by GitHub
parent 675597ec16
commit e1a4b9e0b6
9 changed files with 312 additions and 59 deletions
+59 -19
View File
@@ -5,28 +5,23 @@ Status values: `[ ]` not started, `[~]` in progress, `[x]` complete, `[!]` block
## Current Context
- Issue: [`rustfs/backlog#660`](https://github.com/rustfs/backlog/issues/660)
- Branch: `overtrue/arch-cluster-readonly-control-plane-batch`
- Branch: `overtrue/arch-cluster-lock-health-phase`
- Baseline: completed `C-011/C-012/C-013/API-055/API-059/API-079/API-080/API-081/API-082/API-083/API-084/API-085/API-086/API-087/API-088/API-089/API-090/API-091/API-092/API-093/API-094/API-095/API-096/API-097/API-098/API-099/API-100/API-101/API-102/API-103/API-104/API-105/API-106/API-107/API-108/API-109/API-110/API-111/API-112/API-113/API-114/API-115/API-116/API-117/API-118/API-119/API-120/API-121/API-122/API-123/API-124/API-125/API-126/API-127/API-128/API-129/API-130/API-131/API-132/API-133/API-134/API-135/API-136/API-137/API-138/API-139/API-140/API-141/API-142/API-143/API-144/API-145/API-146/API-147/API-148/API-149/API-150/API-151/API-152/API-153/API-154/API-155/API-156/API-157/API-158/API-159/API-160/API-161/API-162/API-163/API-164/API-165/API-166/API-167/API-168/API-169/API-170/API-171/API-172/API-173/API-174/API-175/API-176/API-177/API-178/API-179/API-180/API-181/API-182/API-183/API-184/API-185/API-186/API-187/API-188/API-189/API-190/API-191/API-192/API-193/API-194/API-195/API-196/API-197/API-198/API-199/API-200/API-201/API-202/API-203/API-204/API-205/API-206/API-207/API-208/API-209/API-210/API-211/API-212/API-213/API-214/API-215/API-216/API-217/API-218/API-219/API-220/API-221/API-222/API-223/API-224/API-225/API-226/API-227/API-228/API-229/API-230/API-231/API-232/API-233/API-234/API-235/API-236/API-237/API-238/API-239/API-240/API-241/API-242/API-243/API-244/API-245/API-246/API-247/API-248/API-249/API-250/API-251/API-252/API-253/API-254/CTX-002`.
- Current baseline also includes API-255 from PR #3923, API-256 from PR
#3925, and CFG-009 from PR #3927.
- Current phase PR: C-007/C-009 cluster read-only control-plane consumer, RPC
boundary, and readiness invariant batch.
- Based on: E-035/E-008 branch while PR #3933 and the E-031 through E-035
follow-up ECStore owner batch are pending; rebase onto `origin/main` after
those PRs merge before opening this PR.
#3925, CFG-009 from PR #3927, and C-007/C-009 from PR #3935.
- Current phase PR: C-008/C-010 cluster lock-registry consumption and gated
peer-health readiness impact batch.
- Based on: `origin/main` after PR #3935 merged.
- PR type for this branch: `contract`.
- Runtime behavior changes: admin readiness reads keep the existing readiness
report collector and, when endpoint context is available, project that same
report through the read-only cluster snapshot runtime status before returning
readiness; `FullReady` publication now uses the existing storage, IAM, and
lock quorum readiness invariant.
- Rust code changes: add a read-only cluster RPC boundary snapshot that models
metadata/lock/health/admin control RPC as gRPC and remote-disk streams as the
internode data transport, expose it through the ECStore public cluster facade,
include it in RustFS cluster snapshots and admin JSON views, route admin
readiness usecase reads through the snapshot runtime status using the existing
readiness report collector, and require lock quorum before publishing
`FullReady`.
- Runtime behavior changes: lock client selection now consumes a runtime
`LockRegistry` snapshot instead of directly scanning global clients inside
each set; peer-health readiness impact is gated by
`RUSTFS_HEALTH_PEER_READY_CHECK_ENABLE` and remains disabled by default.
- Rust code changes: add the ECStore lock-registry runtime source, route
`Sets::new` through endpoint-ordered registry selection, add a disabled-by
default peer-health readiness gate, carry the peer-health readiness bit
through health and cluster runtime status views, and cover default-disabled
and enabled-degraded readiness behavior.
- CI/script changes: guard that the ECStore RPC boundary snapshot and
internode data-transport control-plane separation note remain present; reject
restoring ECStore root `store.rs`, `set_disk.rs`,
@@ -1409,6 +1404,20 @@ Status values: `[ ]` not started, `[~]` in progress, `[x]` complete, `[!]` block
coverage, migration guard, formatting, diff hygiene, risk scan, PR quality
gate, and three-expert review.
- [x] `C-008` Migrate lock group consumption.
- Completed slice: add an ECStore runtime `LockRegistry` snapshot and route
erasure set lock-client selection through endpoint-ordered registry
consumption.
- Acceptance: lock clients are selected by endpoint host-port in set order,
duplicate endpoint entries are deduplicated, missing hosts are skipped, and
existing host-port, quorum, connected-count, and client-count semantics stay
intact.
- Must preserve: remote lock behavior, namespace lock quorum checks, endpoint
layout ownership, and object hot-path behavior.
- Verification: focused ECStore lock-registry test, compile coverage,
formatting, diff hygiene, risk scan, PR quality gate, and three-expert
review.
- [x] `C-009` Model control RPC separately.
- Completed slice: add a read-only RPC boundary snapshot that keeps
metadata, lock, health, and administrative control RPC on the gRPC control
@@ -1423,6 +1432,20 @@ Status values: `[ ]` not started, `[~]` in progress, `[x]` complete, `[!]` block
compile coverage, migration guard, formatting, diff hygiene, risk scan, PR
quality gate, and three-expert review.
- [x] `C-010` Peer health impact gate.
- Completed slice: add a disabled-by-default peer-health readiness gate that
consumes the read-only peer-health snapshot before impacting runtime
readiness.
- Acceptance: default-disabled behavior preserves existing readiness results;
when enabled, unsupported or unknown peer health degrades readiness with an
explicit `peer_health_unavailable` reason.
- Must preserve: object hot paths, peer-health snapshot read-only behavior,
storage/IAM/lock readiness behavior when the gate is disabled, and existing
health payload compatibility.
- Verification: focused RustFS readiness, health, and cluster snapshot tests,
compile coverage, formatting, diff hygiene, risk scan, PR quality gate, and
three-expert review.
- [x] `TEST-PRTYPE-001` Check PR type enum consistency.
- Acceptance: `./scripts/check_architecture_migration_rules.sh` parses the
allowed PR types from [`crate-boundaries.md`](crate-boundaries.md) and fails
@@ -9398,6 +9421,23 @@ Notes:
public APIs, boxed public errors, production println/eprintln, or relaxed
ordering introduced in changed Rust files.
- Issue #660 C-008/C-010 current slice:
- `cargo test -p rustfs-ecstore --lib lock_registry`: passed, 1 passed.
- `cargo test -p rustfs --lib readiness`: passed, 33 passed.
- `cargo test -p rustfs --lib health`: passed, 41 passed.
- `cargo test -p rustfs --lib cluster_snapshot`: passed, 9 passed.
- `cargo check -p rustfs-ecstore --lib`: passed.
- `cargo check -p rustfs --lib`: passed.
- `cargo fmt --all --check`: passed.
- `./scripts/check_architecture_migration_rules.sh`: passed.
- `./scripts/check_layer_dependencies.sh`: passed.
- `git diff --check`: passed.
- `make pre-pr`: passed.
- Rust risk scan: passed; only new `.expect()` matches are focused test URL
builders, with no new production unwrap/expect, numeric casts, string error
public APIs, boxed public errors, production println/eprintln, or relaxed
ordering introduced in changed Rust files.
## Handoff Notes
- Continue with larger consumer-migration batches outside the cleaned