Files
seaweedfs/sw-block/engine/replication/doc.go
pingqiu 61e9408261 fix: separate stable ReplicaID from Endpoint in registry
Registry is now keyed by stable ReplicaID, not by address.
DataAddr changes preserve sender identity — the core V2 invariant.

Changes:
- ReplicaAssignment{ReplicaID, Endpoint} replaces map[string]Endpoint
- AssignmentIntent.Replicas uses []ReplicaAssignment
- Registry.Reconcile takes []ReplicaAssignment
- Tests use stable IDs ("replica-1", "r1") independent of addresses

New test: ChangedDataAddr_PreservesSenderIdentity
- Same ReplicaID, different DataAddr (10.0.0.1 → 10.0.0.2)
- Sender pointer preserved, session invalidated, new session attached
- This is the exact V1/V1.5 regression that V2 must fix

doc.go: clarified Slice 1 core vs carried-forward files

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-29 21:06:11 -07:00

28 lines
1.3 KiB
Go

// Package replication implements V2 per-replica sender/session ownership.
//
// This is the real V2 engine core, promoted from the prototype at
// sw-block/prototype/enginev2/. It preserves all accepted invariants:
//
// - One stable Sender per replica, identified by ReplicaID
// - One active Session per replica per epoch
// - Session identity fencing: stale sessionID rejected at every execution API
// - Endpoint change invalidates active session
// - Epoch bump invalidates all stale-epoch sessions
// - Catch-up is bounded (frozen target, budget enforcement)
// - Rebuild is a separate, exclusive sender-owned execution path
// - Completion requires convergence (catch-up) or ReadyToComplete (rebuild)
//
// File layout:
//
// Slice 1 core (ownership/fencing):
// types.go — Endpoint, ReplicaState, SessionKind, SessionPhase
// sender.go — Sender: per-replica owner with execution APIs
// session.go — Session: recovery lifecycle with FSM phases
// registry.go — Registry: sender group with reconcile + assignment intent
//
// Carried forward from prototype (accepted in Phase 4.5):
// budget.go — CatchUpBudget: bounded catch-up enforcement
// rebuild.go — RebuildState: rebuild execution FSM
// outcome.go — HandshakeResult, RecoveryOutcome classification
package replication