Engine execution layer for V2 replication protocol: - RebuildInstaller: full state handoff (dirty map, WAL, superblock, flusher) - TruncateToLSN: exact safety predicate (checkpointLSN == truncateLSN), ErrTruncationUnsafe escalation to NeedsRebuild - SyncReceiverProgress: unconditional Store for post-rebuild alignment - V2StatusSnapshot: CommittedLSN = nextLSN-1 for sync_all V2 bridge real I/O executors: - TransferFullBase: TCP streaming + RebuildInstaller + second catch-up - TransferSnapshot: SHA-256 verified streaming to disk - TruncateWAL: ErrTruncationUnsafe detection + escalation - StreamWALEntries: rebuild-mode TCP apply Engine executor interfaces: - CatchUpIO.TruncateWAL, RebuildIO.TransferFullBase returns achievedLSN - CatchUpExecutor truncation-only skip, NeedsRebuild escalation - RebuildExecutor uses achievedLSN for progress tracking Design docs reorganized: superseded planning docs removed, protocol truths and closure map added. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
7.7 KiB
Phase 07
Date: 2026-03-30 Status: complete Purpose: connect the broader runnable V2 engine stage to a real-system service slice and decide the first product path
Why This Phase Exists
Phase 06 completed the broader runnable engine stage:
- planner/executor/resource contracts are real
- selected real failure classes are validated through the engine path
- cross-layer trusted-base / replayable-tail proof path is validated
What still does not exist is a real-system slice where the engine runs inside actual service boundaries with real control/storage surroundings.
So Phase 07 exists to answer:
- how the engine runs as a real subsystem
- what the first product path should be
- what integration risks remain before pre-production hardening
Phase Goal
Establish a real-system integration slice for the V2 engine and make the first product-path decision without reopening protocol shape.
Scope
In scope
- service-slice integration around
sw-block/engine/replication/ - real control-plane / lifecycle entry path into the engine
- real storage-side adapter hookup into existing system boundaries
- selected real-system failure replay and diagnosis
- explicit product-path decision framing
Out of scope
- broad performance optimization
- Smart WAL expansion
- full V1 replacement rollout
- broad backend redesign
- production rollout itself
Phase 07 Items
P0: Service-Slice Plan
- define the first real-system service slice that will host the engine
- define adapter/module boundaries at the service boundary
- choose the concrete integration path to exercise first
- identify which current adapters are still mock/test-only and must be replaced first
- make the first-slice identity/epoch mapping explicit
- treat
blockvolas execution backend only, not recovery-policy owner
Status:
- delivered
- planning artifact:
sw-block/docs/archive/design/phase-07-service-slice-plan.md
- implementation slice proposal:
- engine core:
sw-block/engine/replication/ - bridge adapters:
sw-block/bridge/blockvol/ - real blockvol integration target:
weed/storage/blockvol/v2bridge/(P1)
- engine core:
- adapter replacement order:
control_adapter.go(P0) donestorage_adapter.go(P0) doneexecutor_bridge.go(P1) deferredobserve_adapter.go(P1) deferred
- first-slice identity mapping is explicit:
ReplicaID = <volume-name>/<server-id>- not derived from any address field
- engine / blockvol boundary is explicit:
- bridge maps intent and state
blockvolexecutes I/Oblockvoldoes not own recovery policy
- service-slice validation gaps called out for
P1:- real blockvol field mapping
- real pin/release lifecycle against reclaim/GC
- assignment timing vs engine session lifecycle
- executor bridge into real WAL/snapshot work
P1: Real Entry-Path Integration
- connect real control/lifecycle events into the engine entry path
- connect real storage/base/recoverability signals into the engine adapters
- preserve accepted engine authority/execution/recoverability contracts
Status:
- accepted
- real integration now established for:
- reader via
weed/storage/blockvol/v2bridge/reader.go - pinner via
weed/storage/blockvol/v2bridge/pinner.go - catch-up executor path via
weed/storage/blockvol/v2bridge/executor.go
- reader via
- direct real-adapter tests now exist in:
weed/storage/blockvol/v2bridge/bridge_test.go
- accepted scope is explicit:
- real reader
- real retention hold / release
- real WAL catch-up scan path
- direct real bridge evidence for the integrated path
- still deferred:
TransferSnapshotTransferFullBaseTruncateWAL- control intent from confirmed failover / master-side integration
- carry-forward limitation:
- under interim
CommittedLSN = CheckpointLSN, this slice proves a real bridge path, not general post-checkpoint catch-up viability - post-checkpoint catch-up semantics therefore remain narrower than final V2 intent and do not represent final V2 commit semantics
- under interim
P2: Real-System Failure Replay
- replay selected real failure classes against the integrated service slice
- confirm diagnosability from logs/status
- identify any remaining mismatch between engine-stage assumptions and real system behavior
Status:
- accepted
- real service-path replay now accepted for:
- changed-address restart
- stale epoch / stale session invalidation
- unrecoverable-gap / needs-rebuild replay
- explicit post-checkpoint boundary replay under the interim model
- accepted with scoped limitation:
- real
v2bridgeWAL-scan execution is proven - full integrated engine-driven catch-up semantics are not overclaimed under interim
CommittedLSN = CheckpointLSN
- real
- control-plane delivery remains simulated via direct
AssignmentIntentconstruction - carry-forward remains explicit:
- post-checkpoint catch-up semantics are still narrower than final V2 intent
P3: Product-Path Decision
- choose the first product path for V2
- define what remains before pre-production hardening
- record what is still intentionally deferred
Status:
- accepted
- first product path chosen:
RF=2sync_all- existing master / volume-server heartbeat path
- V2 engine owns recovery policy
v2bridgeprovides real storage truth
- proposal is evidence-grounded and explicitly bounded by accepted
P0/P1/P2evidence - pre-hardening prerequisites are explicit:
- real master control delivery
- full integrated engine -> executor ->
v2bridgecatch-up chain - separation of committed truth from checkpoint truth
- rebuild execution (
snapshot/full-base/truncation) - pinner / flusher behavior under concurrent load
- intentionally deferred:
RF>2- Smart WAL optimizations
best_effortbackground recovery- performance tuning
- full V1 replacement
- non-claims remain explicit:
- not production-ready
- no end-to-end rebuild proof yet
- no general post-checkpoint catch-up proof
- no real master heartbeat/control delivery proof yet
- no full integrated engine -> executor ->
v2bridgecatch-up proof yet
Guardrails
Guardrail 1: Do not re-import V1 structure as the design owner
Use weed/storage/block* and learn/projects/sw-block/ as constraints and validation sources, not as the architecture template.
Guardrail 2: Keep catch-up narrow and rebuild explicit
Do not use integration work as an excuse to widen catch-up semantics or blur rebuild as the formal recovery path.
Guardrail 3: Prefer real entry paths over test-only wrappers
The integrated slice should exercise real service boundaries, not only internal engine helpers.
Guardrail 4: Observability must explain causality
Integrated logs/status must explain:
- why rebuild was required
- why proof was rejected
- why execution was cancelled or invalidated
- why a product-path integration failed
Guardrail 5: Stable identity must not collapse back to address shape
For the first slice, ReplicaID must be derived from master/block-registry identity, not current endpoint addresses.
Guardrail 6: blockvol executes I/O but does not own recovery policy
The service bridge may translate engine decisions into concrete blockvol actions, but it must not re-decide:
- zero-gap / catch-up / rebuild
- trusted-base validity
- replayable-tail sufficiency
- rebuild fallback requirement
Exit Criteria
Phase 07 is done when:
- one real-system service slice is integrated with the engine
- selected real-system failure classes are replayed through that slice
- diagnosability is sufficient for service-slice debugging
- the first product path is explicitly chosen
- the remaining work to pre-production hardening is clear
Assignment For sw
Next tasks move to Phase 08.
Assignment For tester
Next tasks move to Phase 08.