mirror of
https://github.com/kvcache-ai/Mooncake.git
synced 2026-11-05 01:17:55 +00:00
[GH-ISSUE #3808] [RoadMap]: Mooncake Store HA and OpLog Roadmap #971
Labels
No labels
ascend
auto-closed
bug
bug
CI/Build
Common
documentation
enhancement
feature request
good first issue
help wanted
high priority
MetaX
nightly-failure
pull-request
PyTorch Backend
question
RFC
Roadmap
stale
Store
Tests
Transfer Engine
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
kvcache-ai/Mooncake#971
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @Icedcoco on GitHub (Sep 1, 2026).
Original GitHub issue: https://github.com/kvcache-ai/Mooncake/issues/3808
Last reviewed: 2026-08-31
Code baseline:
mainat73471dc28Scope: durable batch OpLog, HA leadership, standby recovery, snapshot migration, replica lifecycle, entity ownership, observability, codecs, and conditional Segment persistence work.
This is the roadmap for the work tracked under
oplog-ha-prs. It consolidates the PR-level specifications and the earlier RFC direction into one delivery view. It is broader than the snapshot implementation: snapshots are the recovery and retention track, while writer correctness, fencing, lifecycle, identity, ownership, metrics, and codec work are independent but connected workstreams.End state
Mooncake Store should converge on one production HA state model:
The program does not introduce multiple authorities for the same state. During migration, old readers may remain for explicit import or historical compatibility, but production selection is explicit and never based on bucket/catalog listing.
Program invariants
ObjectIdentity,ReplicaID, and the futurecreated_atgeneration field are reused by asynchronous callbacks, lifecycle records, restore, promotion, and eviction. No global registry or operation-ID framework is required for the first version.steady_clock; raw steady-clock values are never persisted. Any persisted time field requires a versioned wire contract and defined clock mapping.Baseline on latest main
The following capabilities are already present in
upstream/main:latest/fallbackpublicationN06 is the next active snapshot item. PR #3794 is a draft implementation based on the current N04/N05 components; it is deliberately not a public configuration switch or a production-readiness claim.
Workstreams
1. Writer and storage correctness
This track makes the batch history trustworthy before more recovery features depend on it.
Stop().AwaitDurable(sequence)using the existing async primitives; wake covered waiters on prefix advancement or terminal failure.W02 is needed by lifecycle durable barriers, not by the first snapshot publication path. S03 is the current producer-view layout: the durable prefix carries the batch/sequence cursor, while the standalone view key fences writers.
2. Leadership, serving, and restore safety
These items turn storage errors and restore errors into visible service-state decisions.
enable_oplog + HA + etcd; reject missing view instead of downgrading.The leadership gate is behavioral: a node that cannot prove durable history, fencing ownership, or complete restore must not accept traffic, even if its process is alive.
3. Standby snapshot, recovery, and bounded retention
Snapshots are one workstream within the program. They materialize the state applied by a standby after a complete batch; they are not copies of individual OpLog records.
latestandfallback.latest, thenfallback, then a proven complete OpLog; replay only the suffix after the snapshot cursor.enable_batch_oplog_snapshot, validate configuration, and prove cold restore, suffix replay, promotion, and legacy regression with real etcd.compaction_floorrebuilds temporary state from a valid snapshot and atomically swaps it in.NOSPACE, and long-running bounded-history behavior.The N06 coordinator follows a 600-second default interval, skips an occupied maintenance lease, records the catch-up target observed when capture releases standby state, cancels only the in-memory capture on promotion/stop, and allows post-capture publication to finish independently. It remains inert unless explicitly constructed.
The N08 mode contract is:
The new flag is default-off. Invalid combinations fail before workers, leadership, or RPC serving start. N08 must validate at least two snapshots, cold bootstrap, suffix replay, fallback recovery, corruption handling, crash points, lease competition, promotion, object-store outage, and target-hardware freeze/RSS/upload measurements.
Retention is deliberately ordered: N09 rollout, N11 protected-object cleanup, N12 floor publication, N10 deletion, then N13 backend capacity operations. GC or object-store failures may leak capacity temporarily, but must not stop a healthy OpLog apply loop or change authoritative pointers.
4. Replica lifecycle and durable mutation semantics
The lifecycle track changes the durable model from whole-object mutation payloads to small, identity-scoped Replica events. It is independent of the N-series snapshot schedule, but its reader and identity guarantees must be ready before lifecycle state becomes authoritative.
REPLICA_CREATE,COMPLETE,FAILED, andREMOVE; read new and legacy history with identity-aware idempotence.The hard invariant is that a successful Put/Copy/Move response has durable CREATE evidence, and a Move cannot create a source/target double-loss window. This track also supplies the event model needed for future GET access records.
5. Entity ownership and identity
This track makes restore, promotion, asynchronous callbacks, and resource release refer to the same logical entities.
next_id = max_live + 1only after complete restore.created_atMasterService::ObjectIdentityplus ReplicaID and created_at for short, lock-scoped lookup.unique_ptr<Replica>side path while the value container remains default.I00 is a snapshot/promotion gate. I01-I04 and E01-E07 improve lifecycle correctness and callback safety but should not be stuffed into N06 or the first snapshot switch.
6. Observability and codec evolution
Operational signals and serialization performance are separate tracks with explicit gates.
P02-P04 are not assumed improvements. If P01 does not show a meaningful benefit on representative batches, the binary line stays closed and the existing JSON writer remains the simpler production choice.
7. Segment persistence and
SegmentViewdecisionThe Segment line is conditional, not part of the mandatory snapshot migration.
SegmentViewSegmentViewthe sole Segment recovery authority only after a zero-difference rollout and real etcd evidence.RFC #2979 provides the ownership and SegmentView architecture, but the current decision is evidence-driven: continue with Segment OpLog plus snapshot unless measurements or an incident demonstrate that it cannot provide an authoritative recoverable lifecycle. Do not add a second registry or keyspace just for conceptual cleanliness.
Milestones and dependency gates
NOSPACEbehavior are repeatable.PRs that touch shared production files remain serial even when their designs can be developed in parallel. In particular,
master_service.*,hot_standby_service.*, OpLog storage/writer files, and the E2E harness are dependency bottlenecks. Every parallel branch must rebase onto the current snapshot/HA mainline before merge, followed by combined focused tests.Legacy snapshot retirement
The desired outcome is to remove the old primary snapshot implementation and use only the new HA batch OpLog plus standby-generated snapshot in production. Retirement is a rollout phase, not an N06 feature.
After M4 and a complete migration window:
Once floor publication and OpLog deletion begin, rollback requires a binary that understands the new pointer, snapshot, and floor protocol. Older binaries are not a supported rollback target.
Future GET access OpLog
After M3/M4 stabilize the new HA snapshot path, add a separate ordered OpLog event for successful object access. This is a follow-up protocol change and should not expand N06 or delay the first snapshot switch.
The design must define:
tenant_idplus object key and the applicable Replica generation identity; failed reads do not advance recency.last_accessand the new snapshot format carries the value required for post-recovery eviction without replaying every historical GET.(last_access_time, last_access_sequence)among eligible objects/Replicas while excluding hard pins, active leases, and non-terminal lifecycle states.Tests must cover new-node replay, equal/skewed timestamps, duplicate events, remove-and-recreate, hard-pin/lease exclusions, snapshot restore, floor pruning, and deterministic eviction after promotion.
RFC alignment
steady_clock, while persisted clock information requires an explicit versioned mapping. The v1 standby snapshot therefore does not persist lease deadlines or TTLs.Completion criteria
The full roadmap is complete when HA mutations are fenced and fail-stop, restore and promotion are fail-closed and bounded, lifecycle and identity events are durable and replayable, metrics expose every recovery/capacity decision, optional codec/Segment migrations have evidence, legacy snapshot/lifecycle writers are retired, and GET access history yields deterministic recency-aware eviction after promotion.
Before submitting a new issue...
@github-actions[bot] commented on GitHub (Sep 1, 2026):
Thanks for opening this issue, @Icedcoco!
102317026A maintainer will triage this when possible. To help us respond faster, please include:
Useful links: Documentation · Contributing guide
@WEIXILIN0307 commented on GitHub (Sep 27, 2026):
Hi @Icedcoco, I'd like to take E02 — Active allocation count, provided it is still available.
I checked the roadmap discussion and related PRs and did not find an E02-specific claim or implementation. I also noticed that OffsetAllocator already maintains
m_allocated_num, so I would reuse that rather than introduce another independently maintained counter in the buffer or Segment layer.My proposed scope is:
I would keep this limited to allocator accounting and its tests, preserving RPC/persisted formats and existing byte-accounting semantics. I would not introduce a new registry or change the ownership model. A zero count alone would not become a new unmount/reclamation gate; admission and lifecycle synchronization remain prerequisites.
I see E02 is listed after E01/E03, and #4222 is already implementing E01, including relevant move semantics. I'll coordinate with @0z5a rather than duplicate that work.
Could you confirm that E02 is available and the intended landing order relative to E03?