mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-12-05 10:37:23 +01:00
82fb2a8a34eceba2b7c124c54517543cb7f1eabc
14
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
ca21ed83d3 |
G6 #2-5: --wal-retention-lsns flag + walstore retention gate + tests
Per G6 §1.A α binding (architect 2026-04-29) + §1.H audit
PROCEED-with-minor-patch verdict at seaweed_block@5b09768.
§1.A α implementation (operator-tunable WAL retention window):
- core/storage/walstore.go (+27 LOC): new field
recoveryRetentionLSNs uint64 + SetRecoveryRetentionLSNs/
RecoveryRetentionLSNs accessors. Zero (default) preserves
pre-G6 strict checkpoint-driven recycle.
- core/storage/walstore_recovery.go (+15 LOC, 8 LOC reshape):
recovery scan gate relaxed from
if fromLSN <= checkpointLSN
to
floor = checkpointLSN - retentionLSNs (saturating to 0)
if fromLSN <= floor
Boundary semantic preserved: == floor is rejected, > floor
accepted. Diagnostic detail string extended with retentionLSNs
+ floor for forensics.
- core/frontend/durable/provider.go (+22 LOC): new ProviderConfig
field WALRetentionLSNs; plumbed into both openExisting (line 346)
and createFresh (line 374) walstore paths via
ws.SetRecoveryRetentionLSNs. ImplSmartWAL ignores the flag
(ring capacity bounds retention; documented in godoc).
- cmd/blockvolume/main.go (+12 LOC, 1 reshape):
--wal-retention-lsns flag (uint64, default 0). Help text
documents substrate-specific semantics (walstore honors;
smartwal sizes via --durable-blocks). Plumbed into
durable.ProviderConfig.WALRetentionLSNs.
§2 #3 engine table-driven dispatch test:
- core/engine/g6_walrecycle_dispatch_test.go (NEW, ~190 LOC):
TestG6_SessionFailed_DispatchByFailureKind_TableDriven (3
subcases): WALRecycled → Decision=Rebuild + RebuildPinned=true
+ StartRebuild emit; Transport / SubstrateIO → no rebuild pin,
retry catch-up.
TestG6_RebuildPinned_StaysSticky_AcrossProbe: post-WAL-recycled
pin survives a fresh probe that would classify as catch-up;
Decision stays Rebuild; no StartCatchUp emit.
TestG6_WALRecycled_PublishDegradedSurfaceFires: PublishDegraded
AND StartRebuild emit on the same Apply (operator-visible
signal alongside recovery dispatch).
§2 substrate retention-gate tests:
- core/storage/walstore_retention_test.go (NEW, ~150 LOC):
4 tests covering Default/Zero=strict-recycle (pre-G6 baseline),
NonZero=widens window with floor=checkpoint-retention,
LargerThanCheckpoint=clamps to 0 (saturating subtraction),
TypedFailureKind=*RecoveryFailure envelope preserved (load-
bearing for transport's classifyRecoveryFailure path).
Test results:
- core/storage/ TestWALStore_RecoveryRetention_*: 4/4 PASS
- core/engine/ TestG6_*: 3 tests + 3 subcases = 6/6 PASS
- Full ./... regression: in progress (will report after).
Pinned by:
- INV-G6-RETENTION-POLICY-OPERATOR-VISIBLE (§2 #2 + #4 hardware
retention-OK case)
- INV-G6-CATCHUP-CONVERGES-WITHIN-RETENTION (§2 #4 hardware)
- INV-G6-WALRECYCLE-DISPATCHES-REBUILD (§2 #3 engine + #5 hardware)
- INV-G6-ENGINE-NO-REBUILD-PINNED-ON-OTHER-FAILURES (§2 #3 negative
control: Transport / SubstrateIO do NOT pin rebuild)
Halt-condition NOT triggered. Full audit plumbing was already in
place (T4d-1 typed envelopes + T4d-1 transport mapping + apply.go
WALRecycled branch); G6 #2-#5 add only the operator knob, the
substrate gate relaxation, and the test pins.
Next: QA harness extension (wait_until_rebuild_dispatched)
unblocked by commit #1's rebuild-START log marker; D-scenario
extended for §2 #4 + #5 single-run per §2 #6.
|
||
|
|
2e8c3a0469 |
G5-5 fix v2: latch on Epoch=0, not all-fields-zero (round-11 bug)
QA round 11 reported the
|
||
|
|
41045e542f |
G5-5 fix: latch StorageBackend.Identity post-Healthy via dp.Open
QA round 10 disambiguated: the iSCSI write reached
StorageBackend.Write but gate-rejected with 'frontend: stale
primary lineage'. Root cause: G5-5 introduced EnsureStorage which
constructs the StorageBackend BEFORE the assignment fact lands.
Original V3 design: dp.Open blocks on waitHealthy; the backend
is constructed AFTER projection.Healthy=true; wrap() captures
proj.Epoch/EV at that moment as the immutable Identity.
G5-5 changed: replicas need open storage even when projection
won't reach Healthy (their authority is the bound primary).
EnsureStorage opens storage role-agnostically. But it ALSO
constructs the backend at construction time — and at that
moment view.Projection() returns zero values (no assignment
landed yet). The captured Identity is zero. Once the assignment
lands and projection flips Healthy with Epoch=1/EV=1, every
subsequent gate compares proj{Epoch:1, EV:1, ...} against
b.id{Epoch:0, ...} and returns ErrStalePrimary.
V2 reference confirms: V2's iscsi.BlockDevice → vol.WriteLBA path
uses the engine's CURRENT epoch (not a captured one), so V2
doesn't have this issue. V3's snapshot model is sound; what's
missing is a re-stamp on first promotion to Healthy.
Fix: add SetIdentity(id) to StorageBackend with latch-from-zero
semantic.
- Latch-from-zero: zero-id backend transitions to the supplied
identity. One-shot — subsequent calls with a different id
are REJECTED (returns false). Preserves the failover safety
net (lineage drift past the latched value still fails closed
via lineageCheck → ErrStalePrimary).
- dp.Open's success path (after waitHealthy) now calls
h.backend.SetIdentity() with the current projection's lineage.
Idempotent for already-latched same-value backends.
Test: TestG5_5_SetIdentity_LatchFromZero — covers (a) zero →
first identity (allowed), (b) same identity again (no-op), (c)
drift attempt (rejected, identity unchanged so lineageCheck
fail-closed still works). Runs against both walstore + smartwal.
Tests still green: durable (0.6s), blockvolume (16.5s, G5-4
integration test still PASS), master, authority.
Refs: QA round 10 — gate-rejected disambiguation; V2 reference
read confirms architectural diff (V2 vol.WriteLBA uses live
epoch; V3 captures snapshot).
|
||
|
|
4ec7bd0c2e |
G5-5 instrumentation: SCSI handler + StorageBackend.Write entry
QA round 9 confirmed: even durable: write observer line is missing.
The iSCSI WRITE never reaches StorageBackend.writeBytes. Need to
walk further upstream — either the iSCSI handler isn't getting the
SCSI WRITE command, or it's getting it but using the wrong backend.
Add 6 instrumentation lines across two layers:
core/frontend/iscsi/scsi.go (doWrite):
- SCSI WRITE handler entry (fires on every WRITE_10/16 arrival)
- SCSI WRITE rejected (LBA out of range)
- SCSI WRITE rejected (short dataOut)
- SCSI WRITE backend.Write FAILED
- SCSI WRITE backend.Write ok
core/frontend/iscsi/scsi.go (handleSCSI SYNC_CACHE branch):
- SCSI SYNCHRONIZE_CACHE handler entry
- SCSI SYNCHRONIZE_CACHE backend.Sync FAILED
- SCSI SYNCHRONIZE_CACHE backend.Sync ok
core/frontend/durable/storage_adapter.go (Write):
- StorageBackend.Write entry (every Write call)
- StorageBackend.Write gate-rejected (gate() returned err)
Disambiguation matrix for QA's next run:
No 'iscsi: SCSI WRITE handler' line:
→ iSCSI session/login layer rejects command before SCSI handler.
Check if Normal session established correctly; check whether
initiator's volume sees the right size via READ_CAPACITY.
iscsi: SCSI WRITE handler line present, but no
durable: StorageBackend.Write entry:
→ SCSI handler reaches a DIFFERENT backend instance (not the
observer-wired StorageBackend). Wiring fix in main.go required.
iscsi: SCSI WRITE handler + durable: StorageBackend.Write entry,
but no observer dispatch:
→ backend gate() rejected (closed/non-operational/lineage drift).
gate-rejected line fires.
All instrumentation fires through to ship/barrier:
→ Replication is working.
Tests still green: iscsi (30.9s), durable (0.5s), blockvolume (16.7s).
Refs: QA round 9 — observer line missing from upstream
instrumentation; need iSCSI-side disambiguation.
|
||
|
|
c6bace4e79 |
G5-5 upstream instrumentation: observer + OnLocalWrite + ship gates
QA round 8: ALL 6 ship/dial/barrier lines from |
||
|
|
be9823b872 |
G5-4: bind T4 replication stack into cmd/blockvolume
Mirror T4d-4 part B's WithEngineDrivenRecovery() (component framework
binding at core/replication/component/cluster.go:357-369) into the
production binary. Constructs ReplicationVolume + ReplicaListener
per volume and wires both into the host lifecycle, so replicas can
accept incoming WAL traffic and primaries can fan out writes.
Architect bindings (mini-plan v0.4 §7.1 round 50):
Replica readiness — frontend.Projection.Healthy is reused with
role-aware semantics: primary reaches Healthy=true via the existing
caught-up + fence-acked path (engine.ModeHealthy); replica role
(assigned to SUPPORTING; engine apply skips OnAssignment via
recordOtherLine) keeps Healthy=false indefinitely. Frontend bind
(--iscsi-listen / --nvme-listen) is operator-controlled per role:
not passed for replicas. G5-4.5 integration test uses precise
assertion names (replica MUST NOT report Healthy=true).
--ctrl-addr reuse REJECTED — verified ReplicaListener should bind
on --data-addr instead. transport executor's Probe + Ship paths
dial peer.DataAddr (executor.go:303); listener must bind on the
address master mints into AssignmentFact.peers[*].DataAddr — i.e.,
--data-addr. --ctrl-addr stays reserved for future control-plane
split (no current binder; verified no conflict with NVMe / iSCSI
/ status: each has its own dedicated --*-listen / --status-addr
flag). Mini-plan v0.4 said "reuse --ctrl-addr"; correct answer
found during code is --data-addr. PR description carries this
finding for ratification.
Files changed:
- core/host/volume/host.go: SetReplicationVolume(rv) + RWMutex
around h.replication so binary can wire post-New (storage opens
after host construction).
- core/frontend/durable/provider.go: EnsureStorage(volumeID) opens
LogicalStorage role-agnostically (without waiting for Healthy);
Backend(volumeID) accessor returns the same StorageBackend
instance dp.Open returns later. Both used by binary main.go.
- cmd/blockvolume/main.go: after EnsureStorage + RecoverVolume,
construct ReplicationVolume(volumeID, store) + h.SetReplicationVolume,
SetWriteObserver on the backend for fan-out, ReplicaListener on
--data-addr + Serve. Cleanup chain (LIFO): listener.Stop +
rv.Close BEFORE durableProv.Close (storage borrowed by both).
- cmd/blockvolume/g5_4_l2_replication_test.go: NEW. L2 subprocess
integration test — real cmd/blockmaster + 2× cmd/blockvolume over
TCP with --expected-slots-per-volume 2; asserts primary reaches
Healthy=true, replica does NOT (role split per architect
binding), replica's --data-addr accepts TCP (listener bound).
Acceptance criteria status (mini-plan v0.4 §4):
#1 binary constructs ReplicationVolume ✅ verified by code review
#2 in-process role-appropriate ready ✅ G5-4.5 PASS
#3 byte-equal primary→replica ⏸ deferred to G5-5 m01
(in-process test would need iSCSI/NVMe Go client to drive
frontend writes; subprocess pin for wiring + role split is in;
m01 hardware has the kernel iSCSI client tooling)
#4 stop-restart catch-up convergence ⏸ deferred to G5-5 m01
(depends on #3 frontend write driver)
#5 no regressions ✅ full V3 suite green
#6 10x -race stress ⏳ pending m01 verification
#7 invariant ledger inscription ✅ 5 INV-BIN-WIRING-* in
v3-invariant-ledger.md (companion commit in seaweedfs repo)
Refs: sw-block/design/v3-phase-15-g5-4-mini-plan.md v0.4
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
||
|
|
44f87603fd |
T4b-5: ReplicationVolume.Sync + WriteObserver.Sync seam
Wires DurabilityCoordinator (T4b-4) into the per-volume Sync path.
Host-side FLUSH / SYNCHRONIZE_CACHE now drives the full local fsync
+ per-peer barrier closure in parallel with mode-dependent arithmetic.
Changes:
core/frontend/durable/storage_adapter.go
WriteObserver interface extended: Sync(ctx, targetLSN) joins the
existing Observe(ctx, lba, lsn, data) method. Contract documented
inline — observer.Sync OWNS the full sync job (both local
fsync and peer barriers) when installed; StorageBackend delegates
rather than calling storage.Sync locally.
StorageBackend.Sync branches: observer==nil preserves the
pre-T4b behavior (local storage.Sync only); observer!=nil reads
walHead from LogicalStorage.Boundaries() and calls observer.Sync
with that as targetLSN. The observer (ReplicationVolume) then
invokes DurabilityCoordinator.SyncLocalAndReplicas which runs
local + barriers in parallel inside its own goroutines.
core/replication/volume.go
ReplicationVolume gains:
- coord field set to NewDurabilityCoordinator at construction
- durabilityMode field, SetDurabilityMode setter +
DurabilityMode accessor. Default BestEffort (zero value).
Per mini-plan §5, T4b does not support per-Sync-call mode
override — mode is a per-volume setting.
- Sync(ctx, targetLSN) method — snapshots peers under v.mu,
builds a localSync closure around v.store.Sync, delegates
to coord.SyncLocalAndReplicas, returns error verbatim.
Lock scope: v.mu held across the FULL Sync call. Matches the
T4a-4 round-15 Condition A discipline — concurrent Sync +
OnLocalWrite calls are serialized on v.mu, preserving the V2
shipMu semantics extended from ship-only into ship+barrier.
Accepted correctness-first trade-off: a slow peer barrier stalls
other writers on the same volume; async-queue optimization
(Option Z) is deferred post-T4.
Tests (2 required per mini-plan §2 T4b-5):
- TestReplicationVolume_Sync_BestEffort_E2E — full end-to-end
smoke: StorageBackend.Write 10 LBAs → Observe → ship → replica
applies. StorageBackend.Sync → observer.Sync →
DurabilityCoordinator → local fsync + peer barrier in parallel.
Replica's R-boundary (durable frontier) must reach primary's
H (walHead) after Sync returns. Peer stays Healthy throughout.
- TestReplicationVolume_Sync_PreservesLSNOrderUnderConcurrency —
forward-carry fence for INV-REPL-LSN-ORDER-FANOUT-001 under
the new Sync code path. 40 goroutines, caller-side serialized
LSN allocation + OnLocalWrite, periodic Sync calls interleaved
every 4th iteration. LBA ordering is inverted from LSN order so
any reorder is byte-detectable. All 40 LBAs must settle to the
correct LSN marker at the replica.
Forward-carry verification: T4a-4's
TestReplicationVolume_OnLocalWrite_ConcurrentLSNs_OrderedAtReplica
continues to pass — the existing ordering invariant is not regressed
by the new Sync code path that shares v.mu.
Verification: full 21-package repo suite green including the
extended WriteObserver interface not breaking core/frontend/durable
tests. G-2 tri-line godoc on SetDurabilityMode, DurabilityMode
accessor, Sync method, extended WriteObserver.Sync contract. G-3
cumulative.
Fifth task in T4b batch. Next: T4b-6 L2 subprocess integration
matrix closes the batch.
|
||
|
|
420a5a1c4a |
T4a-6: L2 subprocess integration test — T4a batch close gate
Ships the end-to-end integration test that proves all five T4a
production commits (T4a-1..T4a-5) compose correctly through the
full frontend→storage→replication→transport→replica wire. This
is the T4a batch close gate per mini-plan §4.
In-scope addition flagged by QA round-20 review and confirmed by
sw (not a discovery-bridge trigger — mini-plan always implied this
wire): StorageBackend.Write did NOT invoke
ReplicationVolume.OnLocalWrite. The hook is added here via a
narrow WriteObserver interface seam so core/frontend/durable does
not import core/replication directly.
Changes:
core/frontend/durable/storage_adapter.go
New WriteObserver interface with Observe(ctx, lba, lsn, data)
method. Named Observe (not OnLocalWrite) to avoid a method-
name collision on ReplicationVolume which already has a
differently-typed OnLocalWrite(ctx, LocalWrite). New
SetWriteObserver(obs) installation seam; called only at setup
(not hot-swappable). writeBytes now takes ctx through and
invokes obs.Observe after each successful LogicalStorage.Write,
best-effort (error logged, does NOT fail the Write — matches
V2 fire-and-forget ShipAll).
Ordering: LSN-order fan-out is preserved because the observer
(ReplicationVolume) serializes its own fan-out under v.mu
(Option X, architect-signed at T4a-4 round-15).
core/replication/volume.go
New Observe(ctx, lba, lsn, data) method that wraps into
LocalWrite and delegates to OnLocalWrite. This lets
*ReplicationVolume satisfy durable.WriteObserver without
either package importing the other's public struct type.
core/replication/l2_integration_test.go (NEW, ~450 LOC)
Internal-package test (access to ReplicationVolume.peers +
ReplicaPeer internals needed for transport-kill simulation).
Matrix harness:
- smartwal_gating — sign-bearing row; t.Fatal on failure
- walstore_nongating — reported row; failures logged with
non-gating note per BUG-007 / T3 matrix discipline
Scenarios:
1. BasicEndToEnd_PrimaryWriteReachesReplicaByteExact —
100 LBAs written through StorageBackend.Write,
verified byte-exact on replica's LogicalStorage. Peer
stays Healthy throughout. Both matrix rows pass.
2. BestEffort_DisconnectThenReassign (QA-requested G5
pass-gate shape) — 30 LBAs shipped Healthy; transport
kill via peer.executor.InvalidateSession +
peer.Invalidate (simulates mid-stream conn severed);
30 more LBAs written best-effort (primary persists
locally, peer Degraded, OnLocalWrite returns nil);
fresh replica spun up on new addr; fake-master
UpdateReplicaSet with gen=2 rebuilds peer (INV-REPL-
PEER-REBUILD-ON-AUTHORITY-CHANGE); 10 LBAs shipped
against fresh replica byte-exact.
Pass-gate fence: asserts the second-batch LBAs do
NOT appear on the fresh replica — catch-up is T4c
territory. Catches scope leak if a future refactor
quietly pulls catch-up into T4a.
Cleanup discipline (learned from T4a-4 test hang):
- replica cleanups registered BEFORE primary so LIFO
ordering closes primary's peer sessions first (no
listener.Stop() wedged on open client conns).
- DisconnectThenReassign creates a second replica after
primary, so it explicitly calls primary.repVol.Close()
at scenario end to unblock the non-LIFO cleanup chain.
Verification: full 20-package repo suite green (all pre-existing
tests pass after WriteObserver addition — backward compat
preserved via optional observer pointer). T4a-6 matrix: 4 test
rows all pass (2 scenarios × 2 backends). No -race on Windows
(CGO_ENABLED=1 requirement documented in MEMORY.md).
T4a batch close now mechanically satisfied; awaiting QA sign +
T-end three-sign per §8C.2 cadence.
|
||
|
|
1d21b0ff68 |
BUG-005 fix: session layer stops closing the Provider-cached Backend
m01 Path B reconnect matrix cycle 2 exposed: kernel gets
nvme1n1: I/O Cmd(0x2) @ LBA 0, I/O Error (sct 0x3 / sc 0x2)
on the very first Read of a second nvme connect after a clean
disconnect.
SCT=3 SC=2 = ANA Asymmetric Access Inaccessible, mapped from
frontend.ErrBackendClosed via nvme.NewBackendClosed(). NOT a
data-integrity bug — bytes on disk are intact. Pure Backend
lifecycle bookkeeping.
## Root cause
Session-layer code was calling Backend.Close() when a TCP session
ended:
- core/frontend/nvme/target.go handleConn: defer backend.Close()
- core/frontend/iscsi/session.go close(): s.backend.Close()
Fine under memback (Provider.Open creates a fresh backend struct
per call). Broken under DurableProvider which MUST cache one
Backend per volumeID because LogicalStorage is an exclusive
resource. The per-session Close flipped the CACHED backend
closed → next session received the same closed handle → all I/O
returned ErrBackendClosed → NVMe mapped to SCT=3 SC=2.
V2 structurally avoided this: Subsystem.Dev is registered via
AddVolume / unregistered via RemoveVolume (admin-level), and
Controller.shutdown() explicitly does NOT touch the device. See
weed/storage/blockvol/nvme/{server.go,controller.go}.
V3 had the right intent (T3a mini plan §3: "Backend.Close marks
closed but does NOT tear down storage; Provider retains storage
handle") but the interface godoc didn't document WHO is allowed
to call Close. T2 target authors treated Backend.Close as
session-owned by pattern-matching memback's accidental shape.
## Changes
Production:
core/frontend/nvme/target.go -1 line (removed defer)
core/frontend/iscsi/session.go -3 lines (removed conditional close)
core/frontend/types.go +11 lines (Backend godoc —
Provider ownership clause)
Tests:
core/frontend/durable/bug005_session_reuse_test.go new (~120 LOC)
- TestT3_Bug005_ProviderCachedBackend_ReusableAcrossSessions
Matrix both impls. Pins: after session 1's "close", session 2's
Open returns a USABLE Backend (not ErrBackendClosed). Sits at
Provider level — doesn't need a real target session to exercise
the invariant the fix establishes.
- TestT3_Bug005_ExplicitBackendClose_IsAllowed
Counterfactual: explicit Close by a caller who owns the handle
is still legal; subsequent I/O returns ErrBackendClosed. This
documents what Close IS for (Provider.Close path) vs what it is
NOT for (implicit session teardown).
## Why existing tests missed it
All T3a/T3b/T3c in-process tests are:
- single-session (no disconnect-reconnect cycle), OR
- direct-handler (SCSIHandler.HandleCommand / IOHandler.Handle),
bypassing target.handleConn's defer
Only "real target × session 1 disconnect × session 2 open"
exercises cross-session cache poisoning. Same L1-passes-L2-fails
shape as BUG-001.
## Contract going forward
frontend.Backend godoc now states:
"Backend.Close() is OWNED BY THE PROVIDER. Session-layer
consumers MUST NOT call Close on a Backend obtained from
Provider.Open — treat the returned Backend as a BORROWED
reference..."
Backend.Close itself stays legal; explicit-owner Close is still
supported (Provider.Close path, tests). The fix is about NOT
having session/target teardown silently call it.
## Regression
go test ./core/... -count=1 → 17/17 packages ok, 0 FAIL
BUG-005 regression tests: 2 × 2 impls = 4 subtests green
Prior T3 suites: unchanged (no impact)
## Ledger row queued ACTIVE
INV-DURABLE-SESSION-LIFECYCLE-001: Across session disconnect +
reconnect, the Provider-cached Backend remains operational; I/O
on the reconnected session MUST NOT receive ErrBackendClosed
caused by prior session teardown.
## T3-end three-sign impact
- Path A rename still stands (INV-DURABLE-CLEAN-RESTART-001 etc.)
- New row INV-DURABLE-SESSION-LIFECYCLE-001 added to closure
- G4 partial-pass gate updated: "clean restart OK + cross-session
reconnect OK"; real-kill + ENOSPC remain T3-DEF-3/4 inventory
items for post-T3 batch
- m01 re-verification pending QA
## References
sw-block/design/bugs/005_backend_close_cross_session.md (full post-mortem)
V2 reference: weed/storage/blockvol/nvme/{server.go,controller.go}
Memory: feedback_porting_discipline.md updated — new-abstraction
ownership drift citation added (third citation; BUG-001 +
pragmatic-evolution-revert + this one)
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
||
|
|
c642e42486 |
T3 pre-sign review fix Phase 1: QA artifacts + doc integrity
PM + architect pre-T3-sign review (2026-04-22) identified 6 blockers + 1 low.
Phase 1 addresses doc-integrity + uncommitted-artifact findings:
- B6 (PM-M1): commit QA artifacts previously uncommitted
- core/frontend/durable/t3b_qa_l1_addendum_test.go (3 L1 tests:
ConcurrentIO_SyncBarrier, RecoverThenServe, LargeSpanningWrite;
all matrix-parameterized walstore + smartwal)
- scripts/iterate-m01-nvme.sh (m01 harness with Matrix A/B/C/D
+ DURABLE_IMPL env var for two-impl coverage per Addendum A #1)
- B7 (PM-L1): perf baseline doc — remove stale "_TBD_ placeholder"
wording since first-light numbers are filled.
Phase 2 (real SIGKILL Matrix E + real ENOSPC Matrix F) follows in a
separate commit.
Review response log lives in
sw-block/design/v3-phase-15-t3-closure-report.md §H.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
||
|
|
6fbdf94df5 |
T3c: 4 scenarios × 2 impls + perf baseline + YAML shape docs
Per T3c mini plan §1 — closes T3 delivery except for T3-end three-sign.
Atomic per mini plan §3 inherited stop rules.
## Scope delivered
### 1. Four scenarios (matrix over walstore + smartwal)
core/frontend/durable/scenario_crash_recovery_test.go
TestT3c_Scenario_CrashRecovery_AckedBytesByteExact
→ pins INV-DURABLE-001 (canonical G4 gate)
core/frontend/durable/scenario_wal_replay_test.go
TestT3c_Scenario_WALReplay_NAckedWrites
→ pins INV-DURABLE-WAL-REPLAY-001
core/frontend/durable/scenario_fsync_boundary_test.go
TestT3c_Scenario_FsyncBoundary_AckedSurvivesUnackedMayVanish
→ pins INV-DURABLE-FSYNC-BOUNDARY-001
core/frontend/durable/scenario_disk_fill_test.go
TestT3c_Scenario_DiskFill_OutOfRange_FailsCleanly
→ pins PCDD-DURABLE-DISK-FULL-001
Each scenario:
- Uses the shared logicalStorageFactories() matrix helper from T3a
- Runs as `{smartwal, walstore}` subtests
- Is an in-process L1 test (not subprocess / not YAML replay)
- Simulates "restart" by building a FRESH DurableProvider over
the same StorageRoot (closes + re-opens all state cleanly)
### 2. YAML shape docs
testrunner/scenarios/testdata/t3c-durable-crash-recovery.yaml
testrunner/scenarios/testdata/t3c-durable-wal-replay.yaml
testrunner/scenarios/testdata/t3c-durable-fsync-boundary.yaml
testrunner/scenarios/testdata/t3c-durable-disk-fill.yaml
Documentation of each scenario's shape, variant matrix, and
ledger pin. Authoritative test is the Go replay; YAML mirrors it
for reviewability per mini plan §1.1.
### 3. Perf baseline
testrunner/perf/t3c-durable-baseline.md
Workload spec + first-light numbers (sw dev Windows 11)
core/frontend/durable/perf_baseline_test.go
BenchmarkT3c_DurablePerf — matrix benchmark, both impls
First-light numbers at 8000 iterations, Sync every 64 writes:
- walstore: 197 µs/op, 20.75 MB/s, ~5k ops/s
- smartwal: 303 µs/op, 13.50 MB/s, ~3.3k ops/s
Characterization only, no threshold. Benchmark caps iterations
at 8000 so WAL capacity is not the bottleneck — not a saturation
benchmark. Real sustained numbers deferred to m01 fio run.
### 4. Closure report
sw-block/design/v3-phase-15-t3-closure-report.md
(seaweedfs repo — not in this commit)
§A-§F: batch history, delivery summary, V2 port depth audit,
ledger rows, T3-end three-sign table, change log.
## Acceptance (mini plan §2)
#1 All 4 scenarios × 2 impls (8 subtests) ✅ all green
#2 Frontend continuity — existing T2 tests green ✅ (see #5)
#3 m01 fs-workload smoke ⏸ post-sign (QA-owned)
#4 Perf baseline artifact ✅ numbers filled
#5 Full regression ✅ 17/17 pkgs ok
#6 Boundary guard ✅ durable/ auto-covered
#7 6 new ledger rows queued ✅ (4 T3c + 5 from T3a/T3b already ACTIVE)
#8 16 T2 ACTIVE rows still ACTIVE ✅ (no regression in iscsi/nvme)
#9 Closure report filled end-to-end ✅ (seaweedfs repo)
#10 T3-end three-sign ⏸ pending architect + PM + QA
## Regression
go test ./core/... -count=1 → 17/17 packages ok
- core/frontend/durable: 2.0s (76 subtests; +16 from T3c: 4 scenarios × 2 + 8 from earlier)
- core/frontend/iscsi: 31.5s (no regression)
- core/frontend/nvme: 61.3s (no regression)
- core/host: 127.7s (subprocess tests still memback; no durable wire)
- all others within normal range
## Stop rules honored
#port-model default ✅ (scenarios use public API only; no
storage internals)
#no scope creep T4 ✅ (no replication / failover surface
introduced)
#no new production code beyond T3a+T3b deliverables ✅
(scenarios + perf are test infra only)
## Out of T3c (post-three-sign, not blocking)
- m01 fs-workload verification (iterate-m01-nvme.sh tweak — QA)
- fio sustained numbers replace Go-bench first-light
- 24h m01 soak
## References
sw-block/design/v3-phase-15-t3-port-audit.md
sw-block/design/v3-phase-15-t3a-mini-plan.md (CLOSED
|
||
|
|
e2ae3910c3 |
T3b follow-up: iSCSI + NVMe → durable matrix integration tests
Per "make sure all test works for regular/smart wal" follow-up:
existing T3a/T3b tests exercise the adapter + provider against
both walstore and smartwal, but the iSCSI/NVMe wire tests (added
in
|
||
|
|
29e3d0de0c |
T3b: DurableProvider + Recovery + iSCSI SYNC_CACHE + NVMe Flush + cmd wire
Atomic per T3b mini plan §3 stop rule #1 — all 5 deliverables one commit.
## Scope delivered (mini plan §0)
### 1. DurableProvider (G-int.4)
New core/frontend/durable/provider.go:
- `ImplName` ("smartwal" | "walstore"); production default smartwal
per PM direction
- `ProviderConfig` with StorageRoot + Impl + geometry + OpenTimeout
- `NewDurableProvider` validates selector; mkdir storage root
- `Open(ctx, volumeID)` caches handle per volumeID; opens existing
file (verifying magic vs selector) or creates fresh
- `RecoverVolume(ctx, volumeID)` runs LogicalStorage.Recover on
the cached storage, flips backend operational bit per report
- `Close()` tears down in correct order (backend close → storage
close); idempotent
- ImplKind mismatch detection: peeks 4-byte magic BEFORE storage
Open so the error message names selector vs on-disk kind
(ErrImplKindMismatch). Never silently coerces (Addendum A #2).
- testback.StaticProvider unchanged (audit §11 G-int.4).
### 2. Recovery wrapper (G-int.5)
New core/frontend/durable/recovery.go:
- Pure function `Recover(storage, volumeID) RecoveryReport`
- Report carries VolumeID, RecoveredLSN, Evidence string, Err
- Zero side-effects on backend — Provider (or cmd) flips
SetOperational based on report
- Option 3 from audit §10.5 honored: no local epoch mirror;
per-I/O adapter fence check remains sole authority-drift guard
- §3.2 boundary: no new publication path; readiness surfaces
via existing /status + adapter's SetOperational
### 3. iSCSI SYNC_CACHE wire
core/frontend/iscsi/scsi.go:
- SYNCHRONIZE_CACHE(10) [0x35] + SYNCHRONIZE_CACHE(16) [0x91]
dispatch to backend.Sync(ctx) (formerly no-op Good)
- Sync errors map to CHECK CONDITION / MEDIUM_ERROR /
WRITE_ERROR (SPC-5 §D.2.14). Stop rule §3.6 (error-faithful
Sync wire): swallowing to Good is forbidden.
core/frontend/iscsi/errors.go:
- Added `ASCWriteError = 0x0C` (SPC-5 ASC table)
### 4. NVMe Flush wire
core/frontend/nvme/io.go + session.go:
- `ioFlush` opcode (0x00) handler dispatches to backend.Sync via
IOHandler.Handle
- Session dispatchIO routes Flush through the handler (was:
direct Success enqueue)
- Sync errors map via mapBackendError; ErrStalePrimary → ANA
Transition, generic → Internal Error
### 5. cmd/blockvolume wire
Added flags:
- --durable-root PATH enables DurableProvider; empty = memback
- --durable-impl NAME "smartwal" (default) | "walstore"
- --durable-blocks N first-create geometry
- --durable-blocksize N first-create block size
Startup sequence (when --durable-root is set):
1. Build DurableProvider
2. Open the served volumeID (creates storage if absent)
3. RecoverVolume → flips adapter operational bit per outcome
4. Use the provider for both iSCSI and NVMe target wiring
5. On shutdown, Close the provider (backend + storage) in order
memback path unchanged when --durable-root is empty.
### 6. Adapter lifecycle design note
Backend.Close() does NOT tear down underlying LogicalStorage
(already was the T3a contract). Provider.Close() is the only
teardown path for storage; both are idempotent.
## Acceptance (mini plan §2)
#1 `TestT3b_DurableProvider_ImplementsProvider` ✅ both impls
#2 `TestT3b_DurableProvider_Open_SelectsImpl_Matrix` ✅ (file magic verified on disk)
#3 `TestT3b_DurableProvider_Open_StartsNotOperational` ✅ Read/Write/Sync → ErrNotReady
#4 `TestT3b_DurableProvider_Open_ImplKindMismatch_FailsFast` ✅ ErrImplKindMismatch named
#5 `TestT3b_Recovery_CleanRecover_FlipsOperational` ✅ + `*UnopenedVolume*` + pure-fn tests
#6 `TestT3b_ISCSI_SyncCache_DispatchesToBackend` ✅ SYNC_CACHE(10) + (16)
#7 `TestT3b_NVMe_Flush_DispatchesToBackend` ✅ ioFlush → backend.Sync
#8 `TestT3b_DurableProvider_Lifecycle_*` ✅ close isolation + double-close idempotent
#9 Full regression ✅ 17/17 core packages ok
#10 Boundary guard ✅ core/frontend/durable/ auto-covered
## Regression
go test ./core/... -count=1 → 17/17 packages ok
- core/frontend/durable: 0.5s (16 T3a + 13 T3b subtests all green)
- core/frontend/iscsi: 31.5s
- core/frontend/nvme: 61.3s
- core/host: 122.8s (no regression)
- all others sub-second or unchanged
## Stop rules honored
#1 atomic (5 deliverables one commit) ✅
#2 no OnDegraded reinstated ✅
#3 no local epoch mirror ✅
#4 no new publication path ✅
#5 Provider.Impl is config-driven string; no compile branch ✅
#6 iSCSI + NVMe Sync errors map faithfully ✅
#7 no scenarios / no perf landed in T3b ✅
## Ledger rows queued ACTIVE at T3b close
- INV-DURABLE-PROVIDER-SELECT-001
- INV-DURABLE-RECOVERY-READSIDE-001
- INV-DURABLE-SYNC-WIRED-001
Existing (T3a / T1) rows stay ACTIVE:
- INV-DURABLE-OPGATE-001, INV-DURABLE-IMPL-IDENTITY-001
- INV-FRONTEND-002.{EPOCH,EV,REPLICA,HEALTHY}
## Out of T3b (per mini plan)
- 4 G6 scenarios → T3c
- m01 iSCSI + NVMe fs-workload smoke → T3c
- Perf baseline → T3c
- T3 closure report + T3-end three-sign → T3c
## References
sw-block/design/v3-phase-15-t3a-mini-plan.md (CLOSED
|
||
|
|
10cd117bb4 |
T3a: StorageBackend adapter + Backend interface extension + superblock impl-identity
Atomic per T3a mini plan §3 stop rules #1-#3: - Adapter file atomic (G-int.1 + G-int.2 + G-int.3 one commit) - Interface extension atomic with all consumers - Superblock schema bump one-way with migration discipline ## Scope delivered (mini plan §0) ### 1. core/frontend/durable/storage_adapter.go (NEW) StorageBackend wraps any LogicalStorage and exposes the full frontend.Backend surface. Four responsibilities: - byte↔LBA translation with RMW on partial blocks (G-int.1) - per-I/O fence check preserving INV-FRONTEND-002.* (G-int.2) - operational gate preserving INV-DURABLE-OPGATE-001 (G-int.3) - Sync dispatches to LogicalStorage.Sync (G-int.2 policy) Storage lifecycle NOT owned by backend — Close marks the handle closed but does not tear down LogicalStorage (Provider owns that, lands in T3b). ### 2. Backend interface extension (core/frontend/types.go) Two new methods: Sync(ctx) error + SetOperational(ok, evidence). SetOperational godoc pins the invariant: does NOT touch identity /lineage/epoch — local readiness only; authority publication stays on the master path (PCDD-STUFFING-001). All 6 existing Backend implementations gain trivial impls in the same commit (stop rule #2): - memback.backend (Sync no-op, SetOperational state-flip) - testback.RecordingBackend (SyncCall recording, SyncCount) - testback.StaleRejectingBackend (Sync returns ErrStalePrimary) - iscsi countingBackend (delegates) - nvme countingFaultBackend (delegates) - nvme writeCountingBackend (delegates) ### 3. Superblock impl-identity (Addendum A Addition 2) Both walstore (core/storage/superblock.go) and smartwal (core/storage/smartwal/superblock.go) headers gain ImplKind + ImplVersion fields. superblockVersion/headerVersion bumped 1→2. - newSuperblock rejects ImplKindUnset (0) at create time - readSuperblock + validate reject unknown ImplKind - CreateWALStore passes ImplKindWALStore=1 + WALStoreImplVersion=1 - smartwal.newHeader passes implKindSmartWAL=2 + smartwalImplVersion=1 Stop rule #3 (one-way bump): no compat read path for v1; opening a v1 file with v2 code returns errSuperblockBadVer. No existing on-disk production data expected since T3 hasn't shipped. ### 4. Matrix test infrastructure (Addendum A Addition 1) core/frontend/durable/storage_adapter_test.go uses a single shared logicalStorageFactories() helper returning {walstore, smartwal} factories. Every adapter test iterates over it — adding a new impl later = one edit (stop rule #4). TestT3a_MatrixCoverage is a sanity canary that trips if the factory list drifts. ## Tests landed (mini plan §2 acceptance) #1 TestT3a_StorageBackend_ImplementsBackend ✅ walstore + smartwal #2 TestT3a_StorageBackend_ByteLBATranslation_Matrix ✅ 6 shape subtests × 2 impls #3 TestT3a_StorageBackend_FenceCheck_{Epoch,EV,Replica,Healthy} ✅ 4×2 #4 TestT3a_StorageBackend_OperationalGate_{BeforeOpen,FlipBack,Evidence} ✅ 3×2 #5 TestT3a_StorageBackend_Sync_DispatchesToStorage ✅ 2 impls #6 All tests matrix-parameterized — N×2 execution TestT3a_MatrixCoverage canary pins factory count #7/#8 Superblock schema bump covered by existing core/storage tests: - newSuperblock rejects ImplKindUnset at create - readSuperblock rejects unknown ImplKind at open - CurrentVersion bump is forward-only #9 Full regression green: 17 core packages, incl. prior T0/T1/T2 suites #10 boundary_guard_test.go auto-covers core/frontend/durable/ (TestFrontendCannotMintAuthority_BoundaryGuard walks the whole frontend tree recursively; no explicit extension needed) ## Regression go test ./core/... -count=1 → 17/17 packages ok - core/frontend: 17.7s - core/frontend/durable: 0.3s (22 subtests all green) - core/frontend/iscsi: 31.3s (no regression) - core/frontend/nvme: 61.1s (no regression) - core/storage: 7.2s (schema bump accepted) - core/storage/smartwal: 0.3s - core/host: 122.4s - All others sub-second ## Out of T3a per mini plan - DurableProvider (T3b) - Recovery integration (T3b) - iSCSI SYNCHRONIZE CACHE / NVMe Flush wiring (T3b) - 4 G6 scenarios + perf baseline (T3c) ## Ledger rows queued ACTIVE at T3a close - INV-DURABLE-OPGATE-001 (operational gate preserves INV-FRONTEND-002.*) - INV-DURABLE-IMPL-IDENTITY-001 (superblock self-identifies; mismatch fails fast) ## References sw-block/design/v3-phase-15-t3-port-audit.md (T3.0 LOCKED) sw-block/design/v3-phase-15-t3a-mini-plan.md (this batch spec) feedback_porting_discipline.md (port-model discipline) Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> |