Skip to content

feat: add safe client metadata rebuild for master high availability. - #3

Open
ShuweiShen772 wants to merge 9 commits into
xLLM-AI:v0.3.12_xllm_patchfrom
ShuweiShen772:feat/ha-rebuild-two-phase-gate-en
Open

feat: add safe client metadata rebuild for master high availability.#3
ShuweiShen772 wants to merge 9 commits into
xLLM-AI:v0.3.12_xllm_patchfrom
ShuweiShen772:feat/ha-rebuild-two-phase-gate-en

Conversation

@ShuweiShen772

Copy link
Copy Markdown

Summary

  • rebuild Master metadata from Client-owned replica records after HA failover
  • gate all normal store traffic until the exact expected Client roster completes rebuilding
  • bind metadata batches and completion signals to the current HA view
  • retry the complete recovery transaction without reporting false completion
  • expose rebuilding, serving, and degraded states with Master and Client metrics
  • enable the HA rebuild gate by default while preserving --enable_ha_rebuild_gate=false as an emergency rollback
  • use English-only comments and documentation throughout the submitted changes

Validation

  • ha_rebuild_gate_test: 7 tests passed, including exact roster, stale epoch, full RPC gating, timeout, and completion/timeout races
  • rebuild_retry_test: 9 tests passed, including all five recovery failure points, whole-transaction retry, stale epoch, and shutdown interruption
  • client_metadata_rebuild_test: 7 tests passed
  • master_service_test: passed
  • gate and retry test suites each passed 20 repeated runs
  • 10 Clients × 5M keys: 10/10 recovered in 16.833 seconds
  • two real xLLM processes: five consecutive leader failovers passed with byte-identical output
  • default-enabled and explicit-disabled rollback paths both verified

Base

Rebased on the latest xLLM-AI/Mooncake:v0.3.12_xllm_patch commit (dd44a522). This PR replaces #2.

🤖 Generated with Claude Code

ShuweiShen772 and others added 9 commits August 31, 2026 22:32
Enable the master to rebuild its metadata from client-side state after a
restart, so that a fresh master process can recover segment and object
location information without recomputation.

- mooncake-store: add rebuild flow across client_service, master_service,
  master_client, rpc_service, segment and allocator
- add rebuild_types.h defining the rebuild request/response types
- add client_metadata_rebuild unit test and ha live-recovery test harness

Co-Authored-By: Claude <noreply@anthropic.com>
Strip references to internal design/impl docs (section numbers like
"impl doc §4.1" and internal .md filenames) from the HA rebuild code
comments, so the comments are self-contained for public review.
Comment-only change; no code logic modified.

Co-Authored-By: Claude <noreply@anthropic.com>
Translate the remaining Chinese comments and assertion messages in the HA
rebuild unit test to English, and replace the draft-era changelog header
with a concise English summary of the seven tests, so the file is ready
for public review. Also apply clang-format (ColumnLimit 80) across the HA
rebuild files to satisfy the format check. Comment, message, and whitespace
only; no test or code logic changed, and all seven unit tests still pass.

Co-Authored-By: Claude <noreply@anthropic.com>
Add a standalone scale benchmark for the HA metadata rebuild feature that
measures rebuild latency, scale across a key-count sweep, and recovery-window
read latency and availability. Includes the benchmark client, its driver
script, and a report of the measured results.

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
@ShuweiShen772

Copy link
Copy Markdown
Author

@Kang-Meng Could you please review this PR? This replaces #1 and includes the completed HA rebuild hardening and validation. Thank you.

@Kang-Meng
Kang-Meng self-requested a review September 1, 2026 09:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants