diff --git a/seaweed-block/docs/roadmap.md b/seaweed-block/docs/roadmap.md index 3e8cce6969..2b6f61bbf5 100644 --- a/seaweed-block/docs/roadmap.md +++ b/seaweed-block/docs/roadmap.md @@ -174,11 +174,15 @@ Seaweed Block can already demonstrate a narrow Kubernetes block-storage loop: contract, but the live close gate remains blocked by lab topology. A third remote RoCE-capable Kubernetes initiator is required before the project can claim mounted RDMA multipath survival or reconnect. -- Phase 167 starts the Parallel Write Engine milestone. Earlier 100GbE and WAL - profiling showed the mounted write path remains backend-limited after request - sizing and WAL record-count improvements. The new milestone targets ordered - asynchronous replication, parallel WAL ownership, RF3 slow-peer behavior, - recovery correctness, and mounted scaling as one coherent engine change. +- Phase 167 closed as an opt-in Parallel Write Engine research result. Its + correctness model and batch path passed, but ordinary 4 KiB scaling did not. +- Phase 168 rejected a Linux `io_uring` WAL execution candidate, and Phase 169 + rejected a segmented group-commit format after its four-writer optimistic + upper bound reached only `0.772x` its one-writer rate and `0.990x` the + positioned control. Both candidates were removed. +- Phase 170 moves performance work back to the default `walstore` product path: + profile its staged costs, then use the existing-format `appendBatch` seam + only if CRC/copy/lock evidence justifies a bounded commit pipeline. - Kubernetes NVMe/TCP mounted reconnect is source-gated through changed desired path-set evidence: CSI-node can connect a newly published desired NVMe path, prune the stale old host path for the same NQN, preserve pod @@ -1087,8 +1091,8 @@ control-plane path is mature. protocol=nvme -> nvme connect path ``` -3. `walstore` remains the default backend while segmented group commit is - evaluated. +3. `walstore` remains the default backend while its existing commit pipeline + is optimized. Phase 167's `parallel-walstore` preserves its tested global LSN/frontier, crash recovery, and catch-up/rebuild semantics, but remains explicit and @@ -1097,10 +1101,14 @@ control-plane path is mature. same controls. Correctness passed, but comparable performance did not: native execution reached only 0.96x the legacy single-writer path and 0.96x four-writer scaling, so the candidate was removed rather than promoted. - Phase 169 changes the persistence unit instead: multiple logical writes are - encoded into one checksummed WAL segment and committed with positioned I/O. - Direct I/O, fixed buffers, FUA, and device atomic-write support remain - evidence-gated follow-ups rather than assumed performance features. + Phase 169 then changed the persistence unit to checksummed multi-entry + segments. Format, recovery, Sync, and failure semantics passed, but the + optimistic m02 gate measured four-writer scaling of only `0.772x` and + `0.990x` the positioned control. That candidate was also removed before + checkpoint/rebuild integration. Phase 170 targets the existing default + `WALStore.Write` path and existing-format `appendBatch` seam instead of + adding another backend. Direct I/O, fixed buffers, FUA, and device + atomic-write support remain evidence-gated follow-ups. ## Contributor-Friendly Work Items diff --git a/seaweed-block/internal/docs/current-plan.md b/seaweed-block/internal/docs/current-plan.md index 852645178c..6dc97d388d 100644 --- a/seaweed-block/internal/docs/current-plan.md +++ b/seaweed-block/internal/docs/current-plan.md @@ -1,226 +1,243 @@ -# Current Plan: Phase 169 Segmented WAL Group-Commit Engine +# Current Plan: Phase 170 Default WALStore Staged Commit Pipeline -Status: active design and implementation milestone. +Status: active evidence-first product-path milestone. -Phase 167 proved that lane ownership, COW checkpointing, recovery, and bounded -WAL I/O can be made correct, but its ordinary 4 KiB path did not scale. Phase -168 then proved that replacing positioned writes with buffered-file -`io_uring` does not fix the underlying shape: a synchronous single request -still becomes one submission/completion round, and the extra completion path -can cost more syscalls than `pwrite64`. +Phase 168 proved that replacing positioned writes with `io_uring` does not +improve a one-request-per-round WAL. Phase 169 proved that a separate segmented +format can group queued requests correctly, but one owner that serializes +encode, CRC, `WriteAt`, and publication still does not scale: -Phase 169 changes the unit of persistence rather than the syscall API. It tests -whether multiple independently admitted logical writes can become one bounded -contiguous WAL segment and one commit round while retaining exact per-LSN -completion, Sync, corruption, recovery, and rebuild semantics. +```text +segmented writers=1 101.98 MiB/s +segmented writers=4 78.68 MiB/s +positioned writers=4 79.51 MiB/s +segmented entries/segment 1.348 +four/single 0.772x +four/positioned 0.990x +``` + +The next experiment must improve the shipped default path rather than add a +third backend. The existing `walstore` format already has the useful primitive: +`walWriter.appendBatch` preserves independently recoverable records while +coalescing adjacent encoded bytes into fewer positioned writes. Phase 170 asks +whether a bounded staged pipeline can use that primitive for concurrent +ordinary writes without changing the disk format, durability contract, or +recovery model. ## Goal -Build one opt-in segmented group-commit candidate that: +Build one evidence-gated staged commit candidate inside the default +`WALStore` implementation that: -- preserves the global monotonically increasing LSN and contiguous publication - frontier; -- admits concurrent logical writes into a bounded owner queue; -- encodes multiple records into one checksummed contiguous segment; -- performs one positioned WAL write per segment, without io_uring, direct I/O, - or registered buffers; -- returns each write only after its own segment write succeeds and never - publishes through a failed lower LSN; -- gives Sync an explicit target-LSN fence and durable segment/header barrier; -- proves whether fewer persistence rounds improve four-writer scaling without - penalizing the one-writer path. +- retains the current superblock, WAL entry, circular-region, dirty-map, + flusher, checkpoint, and recovery formats; +- validates and owns caller payloads before asynchronous admission; +- assigns one contiguous LSN range only when a bounded batch is ready to + commit; +- uses the existing `walWriter.appendBatch` path for several ordinary + existing-format records; +- updates dirty-map and visible head state atomically from the complete append + result; +- completes each caller only after its record is appended and readable; +- gives Sync an exact fence over requests admitted before the call; +- keeps queue, payload, encoded bytes, waiter count, and batch size bounded; +- proves a material ordinary-write gain before any mounted or RF3 claim. -This is one large engine milestone. Segment format, owner, failure model, -recovery, benchmark decision, and mounted admission are deliverables inside -Phase 169, not separate phases. +This is one large milestone. Profiling, owner semantics, Sync/failure, +flusher/recovery compatibility, comparable performance, and mounted admission +are deliverables inside Phase 170. -## Why This Follows Phase 168 +## Non-Goals -Phase 168's final evidence was: +- No new backend name or file-format version. +- No segmented record, direct I/O, `io_uring`, SQPOLL, fixed buffer, FUA, raw + device, or NVMe atomic-write claim. +- No arbitrary batching sleep. The owner may consume already admitted work; + an isolated request must not wait for a timer. +- No change to replication protocol, authority, frontend, CSI, or operation + status semantics. +- No weakening of the rule that `Write` is readable after return but becomes + crash durable only after a covering successful `Sync`. +- No mounted test used to excuse a failed local engine gate. + +## Existing Product Seam + +Today `WALStore.Write` holds `s.mu` across: ```text -native single/legacy = 0.960x -native four-writer scaling = 0.963x -native four/positioned = 0.942x -native batch/positioned = 0.961x -native selected syscalls = 1553 -positioned selected syscalls= 1052 +assign tentative LSN +-> wal.append + -> encode + copy + CRC + -> WAL writer lock + -> one WriteAt +-> dirty-map update +-> advance nextLSN/H ``` -The result rejects a syscall-substitution theory. It does not reject -asynchronous admission or batching. Vitastor's useful lesson is not simply -"use io_uring"; it is to keep explicit operation stages, bounded queues, and -journal-sector/segment aggregation so several logical operations share -persistence work. Phase 169 borrows that mechanism while retaining Seaweed -Block's own LSN, recovery, replication, and frontend contracts. +The storage instrumentation already exposes: -## Assumptions And Boundaries +- WAL copy, encode, and checksum operation/byte/time totals; +- WAL append time and append-lock wait; +- whole-write commit-lock wait; +- `WriteAt` calls, bytes, maximum size, wrap count, and padding; +- dirty-map update operation/time totals. -- `walstore` remains the default. -- `parallel-walstore` remains opt-in. The segmented format is a separate - internal candidate and cannot silently open an existing Phase 167 file. -- The initial implementation uses positioned buffered-file I/O. No io_uring, - `O_DIRECT`, FUA, SQPOLL, registered files, fixed buffers, or raw-device claim - is part of this milestone. -- No artificial batching delay is allowed for an isolated one-writer request. - Grouping may use already queued work or a measured bounded handoff, never an - unbounded timer. -- A segment may contain multiple LSNs and LBAs, but user-visible completion - remains per request. -- Sync cadence and durability semantics cannot be weakened to pass a - benchmark. -- Existing iSCSI, NVMe/TCP, NVMe/RDMA, CSI, operation-layer, and replication - APIs remain unchanged until local engine admission passes. +`walWriter.appendBatch` already validates all entries, plans wrap/capacity +before publication, encodes existing-format entries into a bounded buffer, and +coalesces adjacent bytes into one `WriteAt` where possible. Phase 170 should +reuse it, not create another codec. ## Required Invariants -1. Every admitted request owns immutable bytes until terminal completion. -2. Every LSN appears in exactly one committed segment or receives a terminal - error. -3. Segment decode validates geometry, bounds, header CRC, entry CRC, monotonic - and duplicate LSN metadata, and invalid LBA metadata before replay. -4. Torn or corrupt committed segments fail closed; an uncommitted tail is - ignored only under an explicit tail rule. -5. The publication frontier advances only through the contiguous successful - LSN prefix, regardless of segment or checkpoint completion order. -6. A failed segment fails every request it owns and prevents higher LSN - success from escaping. -7. Sync fences the highest LSN admitted before the call and returns only after - its segment and durable header generation are stable. -8. Queue entries, segment bytes, request count, waiters, and retained WAL bytes - are bounded. -9. Close drains or terminally completes all admitted requests before closing - the file. Recover rejects active work. -10. Recovery, catch-up scan, checkpoint, COW rebuild, and source-frontier - behavior remain equivalent to the accepted Phase 167 contracts. +1. The bytes accepted by existing recovery remain unchanged. +2. Every admitted request owns immutable payload bytes until terminal + completion. +3. Queue-full or validation rejection consumes no LSN. +4. A failed batch consumes no visible LSN range, publishes no dirty-map entry, + and returns an error to every request in that batch. +5. A successful batch assigns consecutive LSNs in request order and updates + WAL offsets, dirty-map entries, `nextLSN`, `S/H`, and caller results as one + logical commit. +6. Same-LBA requests remain ordered. Read-after-Write observes the latest + completed LSN. +7. Sync fences the highest request admitted before the call, waits for that + prefix to finish, then preserves the existing fsync and superblock rules. +8. Flusher/admission wakeups cannot deadlock with the owner, Sync, Close, or + WAL-pressure callbacks. +9. Circular wrap may split physical writes, but never split logical success or + expose padding as a record. +10. Close drains or terminally completes every admitted request before file + close. +11. Recovery, `ScanLBAs`, `R/S/H`, checkpoint, recycle-floor, direct BASE + install, and retention behavior remain byte-for-byte or semantically + equivalent. +12. Disabled or rejected candidate code leaves the current synchronous + `walstore` path unchanged. ## Deliverables -### D1. Segment Format And Executable Recovery Proof +### D1. Product-Path Baseline And Headroom Decision -Status: complete at `5a14936`. Adversarial review accepted the trusted recovery -manifest and bounded streaming scanner. Independent m02 QA passed the exact -gate, Linux race, Windows cross-compile, storage regression, frozen-vector CRC -verification, committed-corruption fail-closed, uncommitted-tail, logical -anchor, and same-LBA replay checks. Product selection remains unchanged. +- Extend the existing `BenchmarkPhase167WALStoreContention` evidence rather + than creating a synthetic backend. +- Run 4 KiB ordinary Write with 1/2/4/8 writers and explicit final Sync. +- Run the existing explicit `WriteBatch` control to show whether fewer + `WriteAt` calls have measurable value on the same machine. +- Report median/range, p50/p95/p99, allocations, CPU profile, syscall counts, + flusher/checkpoint activity, all write-instrumentation stages, and exact + Sync cadence. +- Separate cumulative CPU work from wall-clock lock wait; do not sum + overlapping concurrent durations into a false percentage. +- Admit D2 only if the baseline has a reproducible concurrency deficit and + either record encode/copy/checksum/lock work has material parallel headroom + or the existing-format batch control proves material syscall/coalescing + headroom. +- Stop if the profile instead shows an already saturated device or no + existing-format batch advantage. -- Define the minimum versioned segment header and entry table. -- Bound segment bytes and entry count; reject integer overflow before - allocation or I/O. -- Prove clean decode, torn tail, bad header CRC, bad entry CRC, duplicate LSN, - non-monotonic LSN, invalid LBA, and truncated payload. -- Reopen and recover mixed one-entry and multi-entry segments without a product - selector. +### D2. Bounded Existing-Format Commit Owner -### D2. One Bounded Group-Commit Owner +- Add one internal, disabled-by-default candidate mode for tests and + benchmarks; do not add a CLI/product selector yet. +- Reserve request and payload capacity before copying caller bytes. +- Use a fixed queue and explicit maximum entries/bytes per append batch. +- Form batches only from requests already admitted when the owner drains the + queue; no batching timer. +- Assign a tentative contiguous LSN range, call `walWriter.appendBatch`, and + publish offsets/dirty-map/frontier only on complete success. +- Prove one writer, concurrent writers, same-LBA order, wrap, queue-full, + admission failure, partial physical write failure, Close, and bounded memory. +- Run an early same-run performance gate. Remove the owner immediately if it + neither reduces WriteAt calls nor preserves one-writer cost. -Status: complete at `c98072d`. The owner reserves request and payload capacity -before copying caller bytes, bounds active, queued, and copy-in-flight -ownership, assigns LSNs only after queue admission, and drains accepted work on -Close or terminal failure. The exact isolated m02 gate passed all named tests, -Linux race, the four-package storage regression, and Windows cross-compile. -There is no batching timer or product selector. +### D3. Sync, Failure, And Read Visibility -- Add one owner queue for the candidate. -- Form a segment from already queued requests up to explicit byte/count bounds. -- Avoid a forced delay when no other request is ready. -- Complete every request from the segment result and expose admitted requests, - segments, entries/segment, bytes/segment, queue-full, and high-water metrics. -- Prove one writer, concurrent writers, same-LBA order, queue saturation, and - no goroutine/buffer growth. +- Add an admission/publication fence so Sync covers exactly requests admitted + before its call. +- Preserve the current logical-Sync semantics and group-committer behavior. +- Prove that a failed lower batch cannot allow a higher LSN to become visible + or durable. +- Prove read-after-Write, concurrent same-LBA overwrite, Write/Sync races, + Sync/Close races, and no orphaned waiters. +- Inject encode, WAL-full, wrap-padding, short-write, `WriteAt`, fsync, and + superblock metadata failures. +- Keep status/instrumentation truthful for queued, batched, failed, and + completed operations. -### D3. Publication, Sync, And Terminal Failure +### D4. Flusher, Recovery, Retention, And Replication Equivalence -Status: complete at `c8ee7b1`. Sync installs an owner-held publication barrier -at the highest LSN admitted before the call, persists data before the alternate -CRC header, and advances the durable snapshot only after the final fsync. -Terminal data/header failures are recorded before the barrier is released, so -future segment completion cannot publish through a failed durability round. -The exact isolated m02 gate passed all failure injections, 20 race runs, the -four-package storage regression, and Windows cross-compile. - -- Feed segment completions into the existing contiguous global-LSN ledger. -- Implement target-LSN Sync and dual-header durability without per-request - fsync. -- Inject short segment writes, `EIO`, fsync failure, header failure, and lower - segment failure with completed higher work. -- Prove Close, recovery exclusion, and no orphaned waiter. - -### D4. Checkpoint, Retention, Rebuild, And Replication Equivalence - -- Before duplicating or refactoring the accepted checkpoint/rebuild state - machine, run a same-session D4-0 ordinary-write admission gate against the - D3 durable coordinator, Phase 167 positioned WAL, and legacy WAL. -- Stop before full D4 implementation if D4-0 cannot keep one-writer throughput - within 90% of legacy, match positioned four-writer throughput, prove more - than one entry per segment, and either reach 1.5x four-writer scaling or - beat both four-writer controls by at least 25%. -- Treat D4-0 as an optimistic upper bound for the incomplete candidate, not a - product performance claim. The candidate does not yet pay mature dirty-map, - background-flush, checkpoint, or rebuild costs. The positioned control must - report zero checkpoint/recycle work; full D4 must add equivalent candidate - costs before the final D5 decision. -- Reuse the accepted COW extent/checkpoint design where possible. -- Define segment-level retention and wrap/reuse fences. -- Prove catch-up scan and source-frontier behavior across segment boundaries. -- Run corruption, header fallback, wrap, aborted rebuild, and restart matrices. -- Run RF3 logical replication tests without changing the replication protocol. +- Run the existing WAL recovery and corruption suites against candidate-created + files; no new recovery branch is allowed. +- Exercise background flush during active admission and while Sync fences a + target. +- Prove dirty-map offsets for batched records, circular wrap, checkpoint + advancement, WAL admission pressure, recycle-floor pins, and restart. +- Prove `ScanLBAs`, catch-up, direct BASE install, `AdvanceFrontier`, and + rebuild use the unchanged current contracts. +- Run logical replication/RF3 component tests without changing the wire + protocol. ### D5. Comparable Linux Performance Decision -- Compare segmented candidate, Phase 167 positioned parallel WAL, and legacy - WAL in one rotated time-driven m02 session. -- Include 4 KiB Write and 16-block WriteBatch with 1/2/4/8 writers where - applicable. -- Report median/range, p50/p95/p99, allocations, CPU, queue depth, - entries/segment, segments, write syscalls, checkpoint/recycle I/O, and exact - Sync cadence. -- Use external strace/perf where available. +- Compare candidate and unchanged synchronous `walstore` in one rotated m02 + session with five one-second repetitions. +- Include ordinary 4 KiB Write at 1/2/4/8 writers and explicit 16-block + WriteBatch controls. +- Report median/range, p50/p95/p99, allocations, CPU, selected syscalls, + WriteAt calls/bytes, entries per append batch, queue high-water/rejections, + flusher/checkpoint work, and exact Sync cadence. - Admit only if: - - one-writer throughput is at least 90% of same-run legacy; - - four-writer throughput is at least 1.5x candidate one-writer throughput; - - four-writer candidate throughput is not below positioned parallel WAL; - - p99 and sample range remain bounded; - - zero fallback, queue saturation, short write, or durability weakening is - present. + - one-writer throughput is at least 90% of baseline; + - four-writer throughput is at least 1.5x baseline four-writer throughput; + - candidate four-writer throughput is at least 1.3x candidate one-writer + throughput, unless both paths are shown to hit the same measured device + ceiling; + - ordinary writes average more than one entry per append batch and reduce + `WriteAt` calls per entry; + - p99 and five-run range remain bounded; + - queue-full, fallback, partial-write, durability, and recovery counters are + clean. -### D6. Mounted And RF3 Admission +### D6. Mounted RF1 And RF3 Close Gate - Run only if D5 admits the candidate. -- Build matching product/CSI images. -- Run mounted NVMe/TCP RF1 concurrent write/read/flush/checksum and restart - recovery. -- Run RF3 sync-quorum with delayed peer, catch-up/rebuild, restart, status - honesty, and zero-residue cleanup. -- Keep NVMe/RDMA performance and reconnect claims separate. +- Build matching product and CSI images from the exact candidate commit. +- Run mounted NVMe/TCP RF1 concurrent Write/Flush/Read/checksum and durable + restart recovery. +- Run RF3 sync-quorum with a delayed non-quorum peer, catch-up/rebuild, + restart, status honesty, and continued mounted I/O. +- Compare baseline and candidate in the same lab session. +- Finish with product-owned cleanup verification and zero Kubernetes, NVMe, + iSCSI, process, and durable-path residue. +- Add a product setting or change the default only after this gate passes. ## Stop Rules -Stop and remove the segmented candidate if: +Stop and remove the staged owner if: -- one-writer cost cannot stay within 90% of legacy without weakening - durability; -- concurrent writes still map approximately one-to-one to persistence rounds; -- batching requires an arbitrary latency sleep rather than queued work; -- corruption or recovery needs ambiguous tail rules; -- the candidate only wins synthetic WriteBatch while ordinary Write remains - unscaled; -- mounted correctness would be used to excuse a failed local performance gate. +- D1 cannot identify a measured parallelizable or coalescible cost; +- owner batching again serializes four writers below the synchronous baseline; +- batching requires an arbitrary latency delay; +- LSN assignment, dirty-map publication, or Sync needs ambiguous rollback; +- WAL pressure can deadlock because the owner waits for the flusher while the + flusher waits for owner-held state; +- performance depends on disabling normal flusher/checkpoint/recovery work; +- only explicit WriteBatch improves while ordinary Write remains unscaled. -An honest rejection remains a valid outcome. It must leave the Phase 167 -positioned backend and default `walstore` intact. +An honest rejection is a valid Phase 170 outcome. It must leave the default +`walstore`, on-disk format, and all operation/frontend contracts intact. ## Exit Criteria ```text -segment format proof --> bounded group-commit owner --> exact publication/Sync/failure semantics --> checkpoint/rebuild/replication equivalence --> same-run scaling decision +default-product baseline and headroom proof +-> bounded existing-format staged owner +-> exact LSN/visibility/Sync/failure semantics +-> unchanged flusher/recovery/retention/rebuild contracts +-> same-run Linux performance decision -> mounted RF1/RF3 only if admitted --> promote, retain research-only, or remove +-> promote or remove ``` -The milestone succeeds only through an evidence-backed decision, not by adding -another backend name. +The milestone succeeds through an evidence-backed product-path decision, not +through another backend name. diff --git a/seaweed-block/internal/docs/finished-plans/phase169_finishedplan_segmented_wal_group_commit.md b/seaweed-block/internal/docs/finished-plans/phase169_finishedplan_segmented_wal_group_commit.md new file mode 100644 index 0000000000..629eaf04e7 --- /dev/null +++ b/seaweed-block/internal/docs/finished-plans/phase169_finishedplan_segmented_wal_group_commit.md @@ -0,0 +1,105 @@ +# Finished Plan: Phase 169 Segmented WAL Group-Commit Engine + +Status: complete as a rejected persistence-format candidate. D1-D3 proved the +format, bounded owner, recovery, Sync, and terminal-failure contracts. The +D4-0 Linux pre-admission gate then rejected further integration. Candidate +code and executable gates were removed; D5 and D6 were intentionally skipped. + +## Final Outcome + +Phase 169 tested a different hypothesis from Phase 168. Instead of replacing +`pwrite64` with `io_uring`, it changed the persistence unit so several +independent logical writes could share one checksummed contiguous segment and +one positioned write. + +The exact m02 gate used five rotated one-second samples and the same final +logical Sync cadence for segmented, Phase 167 positioned, and default legacy +controls: + +```text +segmented writers=1 101.98 MiB/s +segmented writers=4 78.68 MiB/s +positioned writers=1 91.80 MiB/s +positioned writers=4 79.51 MiB/s +legacy writers=1 45.57 MiB/s +legacy writers=4 43.06 MiB/s +segmented entries/segment 1.348 +segmented four/single 0.772x +segmented four/positioned 0.990x +``` + +Grouping occurred, and the incomplete candidate had a strong one-writer +optimistic upper bound. It did not solve the target problem: four concurrent +writers were slower than one and did not beat the accepted positioned control. +The candidate had not yet paid dirty-map, checkpoint, retention/reuse, rebuild, +recovery-index, or replication costs, so adding full engine semantics was not +a credible route to reverse the result. + +## What Was Proved + +The rejected performance result does not erase the correctness work: + +- a bounded versioned segment header and per-entry table; +- CRC validation, canonical offsets, LSN/sequence continuity, and invalid-LBA + rejection; +- a trusted committed-prefix manifest that fails closed inside the boundary + and ignores only bytes after it; +- a streaming recovery scanner with bounded memory; +- admission and payload reservations before copy, queue bounds, and no LSN + consumption on queue-full rejection; +- one positioned write per segment and exact per-request completion; +- target-LSN Sync with data-fsync, alternate-header write, header-fsync order; +- an owner-held publication barrier that prevents later success escaping a + failed durability round; +- terminal behavior for short write, data fsync, header write, header fsync, + and externally injected failure; +- Linux race, Windows cross-compile, and four-package storage regression. + +The exact evidence remains in: + +- `phase169-d1-segment-format-recovery-qa-signoff.md`; +- `phase169-d2-segment-owner-qa-signoff.md`; +- `phase169-d3-segment-durability-qa-signoff.md`; +- `phase169-d4-segment-performance-qa-signoff.md`. + +## Why The Candidate Was Removed + +The implementation had one `segmentOwner.run()` stage responsible for queue +drain, segment encoding, CRC, `WriteAt`, and publication. Multiple callers +could create a modest batch, but they could not make those stages progress in +parallel. The extra queue/channel/copy coordination reduced four-writer +throughput instead of scaling it. + +The stop rules intentionally reject this shape: + +- grouping alone is not an ordinary-write capability; +- mounted correctness cannot excuse a failed local performance gate; +- a candidate that loses before checkpoint/rebuild integration must not gain + complexity in the hope that more work will make it faster. + +The code and gates remain available in Git history through `ddd69e9`. + +## Surviving Product State + +- `walstore` remains the default backend. +- Phase 167 `parallel-walstore` remains explicit and opt-in. +- No segmented format selector, dead owner, recovery branch, or unused gate + remains in the product tree. +- Existing iSCSI, NVMe/TCP, NVMe/RDMA, CSI, replication, and operation-layer + contracts are unchanged. +- D5 comparable full-engine performance and D6 mounted RF1/RF3 gates were + skipped because D4-0 denied admission. + +## Next Direction + +Phase 169 rejects both “change the syscall” and “add a new segmented backend” +as sufficient answers to the current write bottleneck. The next experiment +must work on the default product path and preserve the existing WAL format. + +The useful seam is already present: `walWriter.appendBatch` can encode +independently recoverable existing-format records and coalesce adjacent bytes +into fewer positioned writes. Phase 170 therefore starts with measurement of +the default `WALStore.Write` pipeline, then may introduce a bounded staged +commit owner only if evidence proves that CRC/copy/global-lock work has enough +parallelizable headroom. It must not add another backend selector or weaken +Sync, flusher, recovery, or retention behavior. diff --git a/seaweed-block/internal/docs/product-roadmap.md b/seaweed-block/internal/docs/product-roadmap.md index d57d96b9fd..8c0e1e7b1f 100644 --- a/seaweed-block/internal/docs/product-roadmap.md +++ b/seaweed-block/internal/docs/product-roadmap.md @@ -127,12 +127,12 @@ This is the short internal roadmap. Keep it current and readable. current lab has only two RoCE target nodes and no third remote RoCE-capable Kubernetes initiator, so it cannot honestly prove two remote surviving paths. The implementation and blocked gate remain tracked independently. -- Phase 167 is the active Parallel Write Engine milestone. It follows the - Phase 122-156 finding that mounted write throughput is backend-limited, not - network-limited. It will address ordered asynchronous replication, - parallel WAL ownership, RF3 slow-peer behavior, recovery compatibility, and - same-run mounted performance evidence as one large milestone rather than a - sequence of one-lock or one-counter phases. +- Phase 167 closed as an opt-in Parallel Write Engine research result. Phase + 168 then rejected native `io_uring` execution, and Phase 169 rejected a + segmented group-commit format after its four-writer optimistic upper bound + failed both scaling and positioned-control thresholds. Phase 170 works on + the default `walstore` pipeline and existing-format `appendBatch` seam rather + than adding another backend. Do not skip from scripts directly to mutating operator lifecycle. Helm has stabilized the installation contract, and Phase 35 added read-only CRD status, @@ -590,10 +590,15 @@ rebuild, delete safety, or cleanup must start as a separate gated phase. passed correctness but failed the comparable 4 KiB throughput and scaling thresholds. The implementation was removed; `walstore` remains the default and `parallel-walstore` remains opt-in. -- Active next: Phase 169 tests segmented group commit with positioned I/O. - This changes the persistence unit by committing multiple logical writes in - one checksummed segment instead of substituting one syscall API for another. - Direct I/O, fixed buffers, FUA, and device atomic writes remain later +- Closed experiment: Phase 169's segmented group-commit candidate passed + format, bounded-owner, durability, failure, and recovery gates. Its m02 + optimistic upper bound grouped `1.348` entries/segment but four writers + reached only `0.772x` one writer and `0.990x` the positioned control. The + implementation was removed before checkpoint/rebuild integration. +- Active next: Phase 170 profiles and stages the default `walstore` write + pipeline. It may use the existing-format `walWriter.appendBatch` seam only + if measured CRC/copy/global-lock headroom justifies a bounded owner. Direct + I/O, fixed buffers, FUA, and device atomic writes remain later evidence-gated decisions. - Protocol hardening now has a dedicated working area under `internal/docs/protocol/`. New protocol semantics should update the control @@ -1226,10 +1231,15 @@ Approximate engineering effort if scope remains tight: single-writer throughput and 0.96x four-writer scaling. The candidate code was removed. The finished plan is `internal/docs/finished-plans/phase168_finishedplan_linux_native_async_wal.md`. -- Phase 169 Segmented WAL Group-Commit Engine is active. It keeps positioned - I/O initially and changes the persistence unit to one checksummed segment - containing multiple ordered logical writes. The contract is - `internal/docs/current-plan.md`. +- Phase 169 Segmented WAL Group-Commit Engine is closed as a rejected + performance candidate. D1-D3 correctness passed; D4-0 measured `0.772x` + four-writer scaling and `0.990x` the positioned four-writer control before + the candidate paid full checkpoint/rebuild costs. The implementation was + removed. The finished plan is + `internal/docs/finished-plans/phase169_finishedplan_segmented_wal_group_commit.md`. +- Phase 170 Default WALStore Staged Commit Pipeline is active. It starts from + the shipped backend and existing WAL format, with an evidence gate before + any queue/owner integration. The contract is `internal/docs/current-plan.md`. - Phase 41-44 are the Operation Layer v0.5 release train: lifecycle-owner foundation, real API/admission proof, first bounded finalizer mutation, and delete lifecycle close gate. diff --git a/seaweed-block/internal/docs/qa-assignments/phase169-d4-segment-performance-qa-signoff.md b/seaweed-block/internal/docs/qa-assignments/phase169-d4-segment-performance-qa-signoff.md new file mode 100644 index 0000000000..f8eb384836 --- /dev/null +++ b/seaweed-block/internal/docs/qa-assignments/phase169-d4-segment-performance-qa-signoff.md @@ -0,0 +1,66 @@ +# Phase 169 D4 Segment Performance Pre-Admission QA Sign-Off + +Verdict: evidence mechanism PASS and segmented candidate REJECT at exact commit +`ddd69e95a38a9432f6eb48df7c7be63ee35a6757`. + +## Environment + +```text +environment=m02 +go_version=go1.25.0 linux/amd64 +cgo_enabled=1 +archive_sha256=1f8308f063c8099edcf9f6f5b1a9131318f7109c5989a42be3fe03ee42fe86fd +gate_exit=0 +gate_duration_seconds=79.3 +``` + +## Final Evidence + +```text +benchmark_time=1s +repetitions=5 +writers=1,4 +sync_cadence=one_final_sync_per_sample +comparison_scope=optimistic_wal_append_core_upper_bound +legacy_background_flush_enabled=true +positioned_checkpoint_recycle_expected=false +segmented_writers_1_mibps_median=101.98 +segmented_writers_4_mibps_median=78.68 +positioned_writers_1_mibps_median=91.80 +positioned_writers_4_mibps_median=79.51 +legacy_writers_1_mibps_median=45.57 +legacy_writers_4_mibps_median=43.06 +segmented_writers_4_entries_per_segment_median=1.348 +segmented_single_vs_legacy_ratio=2.238 +segmented_four_writer_scaling_ratio=0.772 +segmented_four_vs_positioned_ratio=0.990 +segmented_four_vs_legacy_ratio=1.827 +single_writer_threshold_pass=true +four_writer_scaling_threshold_pass=false +absolute_four_writer_gain_threshold_pass=false +concurrency_gain_threshold_pass=false +positioned_threshold_pass=false +grouping_threshold_pass=true +d4_full_engine_admitted=false +next_recommendation=stop_before_full_engine_integration +phase169_segment_pre_admission_performance_status=ok +``` + +All 15 raw logs completed and contained both writer rows. All 30 benchmark rows +reported one final logical Sync. Every positioned sample reported zero +checkpoint and recycle operations. No capacity, WAL-full, panic, or benchmark +failure occurred. + +The format did group concurrent requests, but the one owner still serialized +segment encoding, CRC, `WriteAt`, and publication. Four writers therefore +reached only `0.772x` the candidate's one-writer throughput and `0.990x` the +positioned four-writer control. This result was measured before the candidate +paid mature dirty-map, checkpoint, retention, rebuild, or replication costs, +so full D4 integration could only add work. The stop rule applies. + +The earlier `f752119` run failed because the positioned control exhausted its +test capacity. The intermediate `3d130bb` revision was discarded because +stopping the legacy flusher made its bounded WAL unsustainable. Neither run is +candidate performance evidence. Only `ddd69e9` produced the valid decision. + +QA removed its scoped m02 artifacts and did not modify the shared worktree.