Commit Graph
1551 Commits
Author SHA1 Message Date
Ping Qiu c2e13b45cf Merge pull request #164 from seaweedfs/docs/block-design
docs: add the block design document
2026-11-16 12:48:07 -08:00
Ping Qiu dbefb9c7db Merge pull request #163 from seaweedfs/test/real-filer-concurrent-head-cas
Test concurrent HEAD CAS through real filer RPCs
2026-11-16 12:48:01 -08:00
Ping Qiu 248f17017e Merge pull request #162 from seaweedfs/chore/scrub-reviewer-names-in-comments
chore: drop reviewer names and ruling timestamps from code comments
2026-11-16 12:47:54 -08:00
Ping Qiu 2699f82a94 Merge pull request #168 from seaweedfs/ci/test-workflow
ci: add a test workflow (build, vet, go test -short) and harden dead-port tests
2026-11-16 12:47:48 -08:00
pingqiuandClaude Opus 5.5 ba5eeec356 blockvolume: help and README say auto refuses a walstore-chunk root
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-16 12:47:04 -08:00
pingqiuandClaude Opus 5.5 d65471908f durable: auto refuses a chunk-managed root instead of opening it as walstore
walstore-chunk volumes share walstore's on-disk format (SWBK), and on a
fresh host their published bytes may exist only in the remote HEAD. Opened
by auto as plain walstore, such a root would skip chunk recovery, install no
read-miss or fencing hooks and serve the local, absent extent.

Auto now refuses any volume whose root carries chunk metadata
(<volume>.chunk*: fresh marker, dirty bitmap and deltas, presence map),
on both the open and the create path, with ErrImplKindMismatch naming the
files and asking for --durable-impl=walstore-chunk with its remote
configuration. Nothing is deleted or converted.

Tests: a lazy fresh-host chunk root (block published on host A, host B
attached and closed before fetching it) is refused by auto and read
exactly by the explicit walstore-chunk selector; any chunk root is
refused; a stray fresh marker without a volume file is refused and left
in place. autoProvider registers its cleanup (review P3).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-16 12:46:51 -08:00
pingqiuandClaude Opus 5.5 1af91e6a8d storage: per-mechanism oracles for the file-level fsync boundary
Two controls that each isolate one part of the fix:
- TestWALStoreExtentFsyncFaultAfterThePublicationCheck: a direct-frontier
  Sync is in its metadata barrier, past every earlier check, when the
  flusher's extent fsync fails; only the fault check at the publication's
  own superblock fsync (syncFile) refuses it.
- TestWALStoreFsyncsOfTheFileAreSerialized: an extent fsync waits for a
  WAL fsync of the same file in flight (fileSyncMu).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-16 12:41:08 -08:00
pingqiuandClaude Opus 5.5 125d895d26 storage: serialize every fsync of the walstore file with fault latching
The fault check under the store lock did not share a boundary with the
latching: the flusher's extent fsync (and a WAL fsync) latch without the
store lock, so a publication could pass the check, wait in its metadata
barrier, and still publish after another path's fsync failed.

Every fsync of the store's file (WAL batch, flusher extent, checkpoint,
recovered bounds, direct frontier, frontier seed) now runs through
syncFile under one leaf mutex, fileSyncMu: it is refused if a fault is
latched, and a failure latches the fault before the mutex is released.
Superblock publications run their pwrite and fsync together under it, so
a refused publication does not even dirty the superblock; a pwrite
failure still returns without latching. Nothing is acquired under
fileSyncMu (callers may hold the store lock), so it adds no lock-order
edge beyond store lock -> fileSyncMu.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-16 12:38:38 -08:00
pingqiuandClaude Opus 5.5 4b76bfd23c storage: RED: an fsync fault from another path must stop a running publication
Review of 45efc13c: the fault check under the store lock is not a boundary
shared with fault latching, so a fault from another path can land after a
publication passed it.
- An extent fsync held by the flusher fails while a direct-frontier Sync is
  in its metadata barrier: the Sync still publishes the frontier.
- A WAL fsync fails while the flusher's checkpoint is in its metadata
  barrier: the checkpoint is still published.
The held-caller tests now release their gates and bound every wait before
the store closes, and each queued writer path is its own subtest that
acknowledges, through a test hook placed after the entry checks and before
the append lock (testAfterAdmit, nil in production), that it was admitted
before the fault. The reopened seed handle closes on a failure.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-16 12:38:04 -08:00
pingqiuandClaude Opus 5.5 e573edb0f1 docs(design): walstore is the default engine; smartwal is experimental
Match blockvolume's auto default (new volumes are walstore, an existing
volume opens with its on-disk format): §1.3 lists smartwal's open issues
and says it is not a default; the open-items entry no longer says the
standalone default is smartwal.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-16 12:34:23 -08:00
pingqiuandClaude Opus 5.5 1f10755b0e blockvolume: walstore is the default for new volumes; smartwal is experimental
--durable-impl now defaults to empty (auto). A new volume is created as
walstore. An existing volume opens with the implementation its on-disk
superblock names, so volumes created under the old smartwal default keep
opening (no ImplKindMismatch on upgrade). An explicit selector keeps the
exact ErrImplKindMismatch refusal, and an unrecognized on-disk format is
still refused.

- core/frontend/durable: ImplAuto (the zero value) is resolved per volume
  in openOrCreate; openExisting/createFresh take the resolved
  implementation, and each volume handle records it, so DurableStatuses
  reports the on-disk implementation. ImplSmartWAL is documented as
  experimental; the 'production default' comments are removed.
- cmd/blockvolume: --durable-impl default '' with help text 'auto';
  smartwal (experimental). The walstore-only options still require an
  explicit --durable-impl=walstore.
- README: smartwal listed under 'Not claimed yet' with its open issues.

Tests: auto creates walstore; auto opens existing smartwal, walstore and
parallel-walstore volumes by their on-disk format; auto refuses an
unrecognized file; the flag default is empty; explicit values accepted.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-16 12:31:27 -08:00
pingqiuandClaude Opus 5.5 45efc13cf6 storage: enforce the sticky fault where callers commit, not only at entry
A Sync queued behind a failing fsync, and writers waiting for the store
lock behind a failing append, passed the entry check before the fault was
latched. The latch is now checked where they commit:
- syncWALBatch, before its dedup return and before any fsync, so a batch
  queued behind a failed fsync neither fsyncs again nor reports success;
- Sync, under the store lock before it publishes a frontier (covering a
  deduplicated Sync and a fault latched by a flusher fsync);
- Write, WriteBatch (including the multi-block path) and ApplyEntry,
  under the append lock before allocating LSNs or touching the WAL;
- persistCheckpoint, under the store lock.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-16 12:23:11 -08:00
pingqiuandClaude Opus 5.5 c6ae103276 storage: RED: callers admitted before the sticky fault is latched
Review of 8f56445f (two P1, two P2):
- A Sync queued behind an fsync that then fails is acknowledged by the
  next fsync of the batch run (syncWALBatch does not check the latch).
- Write, WriteBatch and ApplyEntry waiting for the store lock while an
  append fails are admitted on their stale entry check and reuse its
  LSNs and offsets.
- The direct-frontier test now recovers before advancing, asserts a
  reconstructed nonzero head, and checks the frontier after a crash.
- The frontier seed test checks the reseed after a crash and reopen.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-16 12:22:01 -08:00
pingqiuandClaude Opus 5.5 8f56445ff3 storage: a failed WAL append is sticky for the open walstore
A batch append whose pwrite left its records on disk and then failed kept
nextLSN and the head, so the next write reused the batch's first LSN and
offset; the batch's later record survived past it, and after that write's
acknowledged Sync and a crash recovery replayed the stale record over it.

An append that fails while writing (marked errWALPwrite by the WAL writer:
the record or padding pwrite, single or batch) now latches the store's
I/O fault as ErrAppendFailed, wrapped in a SubstrateIO RecoveryFailure
(io_error), on the same latch as a failed fsync. Until the store is
reopened it refuses further appends and Syncs, so no LSN or offset is
reused. Space and encoding refusals, which write nothing, do not latch. A
reopen may replay the failed, never-acknowledged records.

Tests that continued on the same open store after a failed append now
assert the refusal and a reopen; the two chunk-layer tests that used a
failed append only to leave a newer record for a same-open Recover now
write that record past the head directly.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-16 12:09:54 -08:00
pingqiuandClaude Opus 5.5 cf35406ef4 storage: RED: a failed append must be sticky (no LSN reuse)
A failed append (single or batch) must make the open store refuse further
appends and Syncs with a typed SubstrateIO failure (ErrAppendFailed) until
a reopen, so no LSN is reused. A reopen may replay the failed,
never-acknowledged records; a write acknowledged after the reopen survives
the next crash.

ErrAppendFailed is declared so the test builds; nothing returns it yet.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-16 12:06:51 -08:00
pingqiuandClaude Opus 5.5 ade70da3f4 storage: RED: a failed batch append can revert a later acked write
A batch append whose pwrite lands every record and then reports an error
leaves nextLSN and the head unchanged. The next write reuses the batch's
first LSN and offset; the batch's second record (a higher LSN) stays past
it. After that write's Sync is acknowledged and the process crashes,
recovery republishes the failed batch's stale record over the acked write.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-16 12:05:51 -08:00
pingqiuandClaude Opus 5.5 98d7fd8181 storage: a failed fsync is sticky for the open walstore
The WAL and the extent share one file, and on Linux a failed fsync may
already have dropped dirty pages of that file, so a later successful fsync
proves nothing about them (the fsyncgate pattern). The first failure of
any fsync on the file (WAL batch, flusher extent, checkpoint, recovered
bounds, direct frontier, frontier seed) now latches ErrFsyncFailed,
wrapped in a SubstrateIO RecoveryFailure (io_error). Until the store is
reopened: Sync refuses without another fsync, writes, batch writes,
ApplyEntry and WriteExtentDirect refuse, the flusher advances no
checkpoint, Recover and the frontier seed refuse, and Close writes no
final superblock. A reopen recovers from what is on disk.

Tests that asserted a same-instance retry after an injected fsync failure
now assert the sticky refusal and a reopen: the generation sync tests, the
checkpoint and direct-frontier metadata tests, the frontier seed test, the
recovered-bounds test and the two restore seed tests (whose real EINVAL
fsync now requires a reopen before the restore succeeds).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-16 12:02:59 -08:00
pingqiuandClaude Opus 5.5 cd16a2a90b docs/spec: add TLA+ models of the volume lifecycle, takeover, WAL recovery, cut pipeline and GC timing
docs/spec/ holds 12 TLA+ models of the block protocols with their TLC
configurations (cfg/, 199 files: designs, RED configs that remove one guard
and must produce a counterexample, and reachability witnesses), run.sh to
check one configuration, and a README: how to run TLC, one row per spec
(invariants, results, the code it maps to), limits, the findings that led
to #152, #156, #158 and #159, and the open model-level items.

Docs only; nothing runs in CI.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-16 11:55:16 -08:00
pingqiuandClaude Opus 5.5 721b496d7a storage: RED: an fsync failure is not sticky
After a failed fsync the open store acknowledges the next Sync once a
later fsync succeeds, although the kernel may already have dropped the
dirty pages (the fsyncgate pattern). These tests fail a WAL fsync, the
flusher's extent fsync and a checkpoint superblock fsync, then require:
no further Sync ack (and no fsync retry), no write, no checkpoint advance,
a typed SubstrateIO failure (ErrFsyncFailed), and a reopen that recovers
the data acknowledged before the fault.

Scaffolding only: ErrFsyncFailed is declared (nothing returns it) and the
flusher's extent fsync goes through a syncExtentFile seam (= f.Sync).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-16 11:53:43 -08:00
pingqiuandClaude Opus 5.5 48db2739ec ci: add a test workflow (build, vet, go test -short) and harden dead-port tests
- .github/workflows/test.yml, job 'go test (linux)': on pull_request and on
  push to main; Go from go.mod; go build ./..., go vet ./..., and
  go test -short -count=1 -timeout 10m ./... with CGO_ENABLED=0. Actions are
  pinned by commit SHA, permissions are contents: read, and a new push to a
  PR cancels the older run.
- core/ops/surface_test.go: fix the two go vet warnings (resp used before
  the error check), so vet covers the whole module.
- cmd/blockvolume: a withdrawn port no longer has to answer ECONNREFUSED.
  A successful connect still fails; any other dial error passes only if the
  address can be bound again.
- core/host/volume: probe tests dial a listener they opened and closed,
  not the fixed 127.0.0.1:1.
- core/replication/component: on failure, the G5-5C and G9A catch-up tests
  log frontiers, peer status and the engine trace. Assertions and timeouts
  are unchanged.

Test files and the workflow only; no product code.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-16 11:47:44 -08:00
pingqiuandClaude Opus 5.5 bc07589243 docs: add the block design document
docs/design/block-design.md describes the current design of the block
service: the data path and WAL, replication and recovery, the chunk
snapshot/fork/GC control plane, and the frontends. Each claim names the
source file and the test that pins it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-16 11:46:31 -08:00
pingqiu 64c8fd65d1 test: prove concurrent HEAD CAS against pinned real filer 2026-11-16 11:39:58 -08:00
pingqiuandClaude Opus 5.5 c9273a22be chore: drop reviewer names and ruling timestamps from code comments
Comments in source and tests named individual reviewers and carried the
time a decision was taken (for example "(name's ruling, 06:47Z)"). Those
are review bookkeeping, not design rationale. Remove the names and the
dates/timestamps; keep the rationale, issue and PR references (#51, #82,
#83, #142, #159) and spec section references as plain text.

Comment-only: no code, test logic or string literal changes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-16 11:39:16 -08:00
Ping Qiu ba3bbfe25b Merge pull request #161 from seaweedfs/docs/readme-agent-workspace-disks
docs: README leads with agent workspace disks
2026-11-16 09:43:08 -08:00
pingqiuandClaude Opus 5.5 173b20895b docs: label the snapshot/fork and cut numbers as a host-side proxy
The snapshot, fork and parallel-upload cut numbers come from a host-side
proxy (chunks as local files, a deterministic filer metadata model; no
network, guest fsync or block frontend), not from the Firecracker runs. Say
so in the section intro, the table caption, the cut sentence and the image
footer.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-16 07:58:04 -08:00
pingqiuandClaude Opus 5.5 7b78864588 docs: README leads with agent workspace disks; keep the Kubernetes alpha section
Adds an 'Agent workspace disks' section: a local-speed disk per agent microVM,
incremental chunk snapshots to SeaweedFS, cheap snapshot/fork, host moves with
fenced HEAD takeover, measured workspace workloads and snapshot/fork cost, the
sw-block ops chunk lifecycle commands, correctness work and what is not claimed
yet. Adds the overview image docs/assets/seaweed-block-agent-workspace.svg.

The Kubernetes alpha content is unchanged apart from heading levels and the
status table title.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-16 07:57:26 -08:00
Ping Qiu ca975700f5 Merge pull request #160 from seaweedfs/feat/fsync-latency-breakdown
Expose durable request fsync latency breakdown
2026-11-16 03:11:48 -08:00
pingqiu 882f8aed6a Merge main into fsync latency breakdown; retain recovery and timing status 2026-11-16 02:02:38 -08:00
Ping Qiu af122ae4e7 Merge pull request #158 from seaweedfs/fix/workspace-lease-clock-skew-157
fix(workspace): separate forced moves with a clock-skew margin
2026-11-16 02:01:14 -08:00
Ping Qiu 0517afc77d Merge pull request #159 from seaweedfs/fix/walstore-persisted-tail-reuse
storage: reuse only WAL bytes the persisted tail released
2026-11-16 02:01:03 -08:00
Ping Qiu e5643784f4 Merge pull request #156 from seaweedfs/fix/walstore-recovery-lww
storage: walstore recovery is last-writer-wins by LSN (#51 B)
2026-11-16 02:00:50 -08:00
Ping Qiu 515a092dc9 Merge pull request #155 from seaweedfs/fix/issue51-walstore-midhistory
storage: detect WAL holes (warning only) for issue #51
2026-11-16 02:00:28 -08:00
pingqiu f7a0279211 fix: validate ublk writes before lazy timing provider lookup 2026-11-16 00:53:34 -08:00
pingqiu d0d66bfc6e test: forbid provider opens for invalid Target writes 2026-11-16 00:52:49 -08:00
pingqiu 5256583bfc test: benchmark actual Target provider path against main 2026-11-16 00:43:23 -08:00
pingqiu 2b079007bd fix: forward durable timing through production ublk provider 2026-11-16 00:41:47 -08:00
pingqiu 6c54d88834 test: open storage before recovering Target fixture 2026-11-16 00:40:50 -08:00
pingqiu bd73350e9c test: reproduce missing latency through actual ublk Target 2026-11-16 00:40:37 -08:00
pingqiuandClaude Opus 5.5 c5f619c9dd storage: #159 controls: batch reuse bound, Recover bounds persist failure
codex01's #159 P2-S2 and P2-S3 (tests only):

- TestWALWriterBatchReuseIsBoundedByTheDurableTail: the batch planner,
  with a padding wrap, is refused while a release is in memory only or the
  recovered bounds are pending (no head move, no padding written), and
  accepted once the tail is persisted.
- TestWALStoreRecoverBoundsPersistFailureRefusesAppendsUntilRetry: a
  failing superblock write or fsync fails Recover and admits no Write; a
  same-instance Recover retry persists the bounds; a later Write, Sync and
  reopen keep the exact bytes.

Mutation controls (WSL): reverting only the batch planner's durable-tail
check fails the batch test alone; publishing the tail before Recover's
persist, or dropping the pending flag, fails its own control.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-16 00:29:54 -08:00
pingqiu 3c3274bd7d test: use concrete durable backend in proxy workload 2026-11-16 00:27:55 -08:00
pingqiu eeccf823cc test: exercise chunk status and whole fsync-heavy workload 2026-11-16 00:27:36 -08:00
pingqiu d42e123a89 docs: explain durable latency populations and fsync diagnosis 2026-11-16 00:24:25 -08:00
pingqiu cb17180f10 test: distinguish append attempts and per-waiter queue latency 2026-11-16 00:23:07 -08:00
pingqiu 82a87ca2d6 test: cover histogram stages, frontend counts and failed syncs 2026-11-16 00:22:02 -08:00
pingqiu a8aabd71b1 feat: expose bounded durable I/O latency histograms 2026-11-16 00:20:28 -08:00
pingqiu d71abccf6c test: require durability latency histograms in existing status 2026-11-16 00:18:52 -08:00
pingqiuandClaude Opus 5.5 4ffa3c9a08 storage: frontier-gap guard reads the superblock without opening a store
codex01's AMEND on 980de2b9 (tests-only P2): the helper opened a full
WALStore and only stopped its committer and closed its fd, leaving the
flusher and ticker alive. Read the superblock with a scoped file read
(readSuperblock), and register the original store's cleanup right after
open so a Fatal before the crash step still closes it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-16 00:17:08 -08:00
pingqiuandClaude Opus 5.5 980de2b94a storage: guard: recovery keeps synced entries above an unpersisted frontier jump
claude05's condition (1) for any prefix-cut recovery rule (2026-11-16
07:33Z). A rebuild installs BASE by WriteExtentDirect (no LSN) and applies
WAL-lane entries with their real LSNs by ApplyEntry; AdvanceFrontier runs
only at MarkBaseComplete and is in memory until a Sync. So a store can hold
synced LSN 101-102 with a persisted checkpoint of 0 and no LSN 1..100.
Recovery keeps them; a rule replaying only the contiguous LSN prefix above
the checkpoint would keep none. This pins that, so no such rule lands.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-16 00:09:55 -08:00
pingqiu f99663a69a fix: separate workspace lease expiry with a clock skew margin 2026-11-15 23:53:02 -08:00
pingqiuandClaude Opus 5.5 7184c0f2e3 storage: scan an empty superblock window from its position
A full checkpoint persists head == tail (88fbb345 persists the released
tail). Sync does not persist the head, so appends after it continue
contiguously from that position; recovery now scans [pos, end) then
[0, pos) from it. The footer high-run search stays only for the legacy
(0, 0) superblock. Scanning from offset 0 let a torn unsynced record
wrapped there hide every synced record after it.

Model check (claude05's WALRecovery.tla, rule rootLww = this writer and
scan plus #156's replay by LSN, K=4, 4 LSNs): crash-only I1 and I2 hold
(247,395 distinct states).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 23:48:02 -08:00