Commit Graph
102 Commits
Author SHA1 Message Date
pingqiu 731f278542 storage: fail rebuild snapshots on read faults and preserve RMW fencing 2026-11-19 16:03:15 -08:00
Ping Qiu bcd86f6659 Merge pull request #211 from seaweedfs/fix/rf1-write-log
replication: drop the per-write INFO line at RF=1 (#204)
2026-11-18 09:34:34 -08:00
pingqiuandClaude Opus 5.5 7fab4770c2 replication: drop the per-write INFO line from the local write path (#204)
At RF=1 every local write logged 'replication: OnLocalWrite volume=...
lba=... lsn=... peers=0'; under sustained writes one volume's log grew to
162 MB in 13 minutes and the useful lines were buried. The counters (Stats:
WriteOps, WriteFanoutNanos) keep the per-write evidence.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 08:09:06 -08:00
pingqiuandClaude Opus 5.5 cfbec68926 replication: RED: a local write must not log one line per write (#204)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 08:08:35 -08:00
pingqiu 80ba50dfd2 test(replication): pin WAL across both two-replica catch-up sessions 2026-11-18 07:22:56 -08:00
pingqiu 731b1118eb test(replication): retain WAL for both RF2 catch-up sessions across checkpoint 2026-11-18 04:23:00 -08:00
pingqiu a81bca4926 feat(storage): activate mapped v3 through the production storage callers 2026-11-18 03:49:47 -08:00
pingqiuandClaude Opus 5.5 af0e3d7210 feat(storage): v3 ordinary replicated ApplyEntry (codex03 12a inventory)
Ordinary replicated ApplyEntry was still refused (errV3NotYet) on dark
v3, while its real callers are the replica's MsgShipEntry handler
(replica.go) and the ReplicaApplyGate's recovery and live lanes. It now
shares one body with the install-lane apply (applyEntryV3, DESIGN 8.1,
6.7, r16.1): through the v3 writer in LSN order; an LSN at or below the
highest appended is a superseded no-op when the LBA holds a higher LSN
and ErrWALLSNOrder otherwise; an unanchored gap is refused (recovery
needs a contiguous prefix); and an ordinary apply while installing is
refused with ErrBaseInstalling (the install lane is the handle's).

Controls: the store rules and a crash; the real ship handler on a v3
replica (apply, barrier ack, crash and reopen; an out-of-order entry
ends the connection); the real apply gate (recovery lane with its
stale-skip, live lane). Mutants: ApplyEntry refused on v3, no gap check,
no installing refusal. The store's order check alone is equivalent: the
v3 writer refuses the same LSN with ErrWALLSNOrder.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 21:24:48 -08:00
pingqiuandClaude Opus 5.5 eb1a244db1 test(replication): drop the unreachable Unknown invalidation case
A new peer starts Healthy and Unknown is only set by Close, after which
Invalidate returns early.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-16 21:23:20 -08:00
pingqiuandClaude Opus 5.5 dc8449aef0 fix(replication): Invalidate obeys the peer state transition gate
Invalidate stored Degraded directly, so a NeedsRebuild peer could be
invalidated to Degraded and then set Healthy, escaping the terminal
state. Invalidate now checks replicaStateTransitionAllowed like
SetState: from NeedsRebuild the state is kept and the reason is still
logged; every other state still moves to Degraded.

Fixes #182.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-16 21:19:50 -08:00
pingqiuandClaude Opus 5.5 76c41c6c56 test(replication): Invalidate must preserve the NeedsRebuild terminal state
Reproducer for #182, unchanged from #184.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-16 21:19:50 -08:00
pingqiu 4d5e5f556f test: derive recovery session markers from current live sessions 2026-11-16 16:10:11 -08:00
pingqiu ddcc379470 test: assert durable global Sync frontier and retain replay fixture WAL 2026-11-16 15:50:40 -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
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 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
pingqiuandClaude Opus 5.5 78f56c31d8 test: release the stale-BASE hold with a defer, before executor shutdown
Review follow-up: the release was a t.Cleanup registered before Start, and
cleanups run LIFO, so the executor shutdown Start registers ran first; a
t.Fatal while the base frame was held would deadlock StopAndWait. A defer
inside the scenario runs before every t.Cleanup, including on t.Fatal.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 16:07:23 -08:00
pingqiuandClaude Opus 5.5 02fb0914b4 test: Pillar3 SameLBAArbitration holds a stale BASE frame instead of a pre-barrier hook
Review follow-up. The pre-barrier hold proved in-session delivery and
convergence but no longer the test's point: a newer WAL write for an LBA must
win over an OLDER base frame for that LBA that arrives later.

Drop the production SetPreBarrierHook seam (core/recovery is back to main)
and hold the base lane instead, through the existing WithPrimaryStorageWrap:
staleBaseHold captures the base read of LBA 5 (old value A) and holds it; the
test pushes the same-LBA overwrites (the session cannot seal its recovery cut
while base is held, so they ship in-session: this is also what fixes the
flake), waits until the replica holds B at LBA 5, then releases the stale A
frame. Convergence requires LBA 5 == B: RebuildSession.ApplyBaseBlock must
skip a base frame for an LBA the WAL lane already applied (bitmap).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 15:57:37 -08:00
pingqiuandClaude Opus 5.5 16f22e903a test: make Pillar3 SameLBAArbitration deterministic with a pre-barrier hold
TestPillar3Slice2_EngineDriven_SameLBAArbitration was flaky (on main baca5fd,
-race -count=40: 25/40 failures at -cpu 1, 6/40 at -cpu 2, 1/40 at -cpu 4).
Root cause is a timing assumption in the test, not a product race: with a
12-LBA backlog, base copy and DrainBacklog finish in microseconds and
Sender.Run seals the recovery cut (SealBeforeBarrier) before the test pushes
its same-LBA overwrites. PushLiveWrite then returns ErrSinkBarrierSealed,
the documented 'retain the WAL entry for replay' outcome that production
FeedLiveWrite maps to LiveWriteRetained, and the test treated it as fatal.
Once in a while the whole session also finished inside waitBridgeLiveReady's
1 ms poll gap.

Tolerating the error would defeat the test (the overwrites would never ship
in-session, so convergence could not be checked), and a larger backlog would
only shift the timing. Instead add a test-only hook,
PrimaryBridge.SetPreBarrierHook: each sender runs it after base + backlog
drain and before SealBeforeBarrier. The test installs it before the probe
that starts the rebuild, waits until the sender reaches it (session live,
cut not made), pushes the overwrites, releases, and asserts convergence.
With no hook installed the sender path is unchanged.

The now-unused waitBridgeLiveReady helper in this package is removed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 15:48:26 -08:00
pingqiuandClaude Opus 5.5 26fd85069d component: accept every push outcome the production caller treats as non-failure
A push between HasActiveSession and live-ready returns
ErrSessionNotLiveReady (2 of 200 runs on Linux). ship_sender treats
it, ErrSinkBarrierSealed, ErrSinkSealed and ErrNoActiveSession as
retained or handed back to the steady path; the test now accepts the
same set, and the replica byte check still pins arrival.

Refs #94

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 10:42:43 -08:00
pingqiuandClaude Opus 5.5 57f0359f8a component: the push-live-during-rebuild test accepts a session that already sealed or closed
TestDualLane_EngineDrivenRebuild_WithPushLiveDuringSession pushed its
live write straight into PrimaryBridge and failed on any error. Since
the dual-lane sink seals at the pre-barrier cut (8682e15), a push after
the cut returns ErrSinkBarrierSealed and the entry stays in the WAL for
replay; the production live-write path treats that as retained. A
12-entry rebuild usually reaches its cut before the push, and sometimes
closes before the test sees it live, so the test failed on most runs.

The test now accepts both: ErrSinkBarrierSealed from the push, or a
session that already closed (no push). The existing byte check that
the live LBA matches on the replica still pins that the write arrived.

Refs #94

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 10:38:27 -08:00
pingqiuandClaude Opus 5.5 273ca809d8 durable: a refused observer rebase never leaves I/O open; seed and install serialized
SetWriteObserver published the observer first and only logged a refused
ship-LSN rebase, so the volume kept serving writes its observer would
mis-order.

Now:
- SetWriteObserver rebases an LSN-ordering observer to the store's next
  LSN before installing it. If the rebase is refused, the observer is
  not installed and the error is returned. The backend also records the
  fault and refuses every I/O until an install succeeds, so a later
  attach that marks the volume operational cannot reopen it. blockvolume
  reports the error.
- The frontier seed and its observer rebase run in one critical section
  with observer installs (observerMu). Whichever runs second sees the
  other's result; a seed landing between an install's rebase and its
  publication can no longer leave the observer on the old LSN. A refused
  rebase after the seed records the same fault.
- RebaseShipLSN documents that it moves only the ordering cursor:
  entries already dispatched to peer queues carry lower LSNs and are
  untouched.

The composition test checks the install error.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 10:15:04 -08:00
pingqiuandClaude Opus 5.5 d7d1718358 replication, durable: rebase the ship order after a restored host's frontier seed
A ReplicationVolume orders writes from the store's next LSN, captured
when it is built. On a restored walstore-chunk host the frontier seed
moves that LSN to HEAD.remote_lsn+1 later, during the deferred attach.
The resequencer then waited forever for the LSNs below it, and writes
and flushes hung.

Whoever moves the next LSN now tells every component that cached it:
- ReplicationVolume.RebaseShipLSN(lsn) moves the ship order forward. It
  is refused while any write is pending or in flight, never dropping
  one, and never moves backwards; an equal LSN is a no-op.
- The provider calls it through the backend's observer right after
  SeedChunkFrontier, before the layer attaches and the volume serves
  I/O.
- StorageBackend.SetWriteObserver rebases a newly installed observer
  to the store's next LSN, covering a seed that landed before the
  observer was installed (blockvolume installs it after
  SetReplicationVolume, while the attach is still deferred).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 10:14:54 -08:00
Ping QiuandClaude Opus 5.5 cd1555b705 transport: close the replica connection when ApplyEntry fails (#93)
* storage: bound flusher snapshot to published LSN cut

* storage: make checkpoint snapshot atomic with write publication

* transport: close the replica connection when ApplyEntry fails (#89)

The production replica listener (no apply hook) only logged a failed
store.ApplyEntry and kept reading. Later entries on the same connection
were still applied, so the next barrier acked a frontier past the LSN
that was never applied. walstore's ApplyEntry can fail when its WAL is
full, and the primary only checks that AchievedLSN reaches the target,
so the gap went unnoticed.

A failed apply now ends the connection, as the apply-gate path already
does. Nothing after the failed LSN is applied on that connection, and
the primary sees the close, marks the peer degraded and recovers it
from the replica's real frontier.

The new test ships LSNs 1, 2 and 3 with LSN 2 failing and checks that
no barrier, on the same connection or a fresh one, acks LSN 2 or later.
It fails before this change (the barrier acks 3) and passes after.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test: prove the failed apply, the close and the primary's recovery (#89)

The replica test now waits for the injected ApplyEntry(2) failure, requires
the failed connection to end with EOF or a reset (a timeout fails), and
checks that LSN 3 never reaches the store.

A new component test runs the production primary path with the host's
PeerAdapterRegistry and probe loop: a transient replica apply failure
degrades the peer, recovery replays from the replica's frontier starting
exactly at the failed LSN with exact bytes, the peer returns to healthy,
and a later write and barrier succeed. Without the fix the peer is never
degraded and the failed block stays missing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 02:10:50 -08:00
pingqiu c2c353ac98 test: rebuild recycled phase174 replicas 2026-08-01 03:26:43 -07:00
pingqiu 87617aedad fix: require recovery before peer queue reset 2026-08-01 03:19:51 -07:00
pingqiu 42dca2190d test: add phase174 distinct-node RF3 gate 2026-08-01 03:04:34 -07:00
pingqiu 8b9cbfd046 test: attribute phase174 RF1 write boundaries 2026-08-01 02:45:55 -07:00
pingqiu 5d2e7cdb61 test: align phase174 flusher measurement start 2026-08-01 02:26:20 -07:00
pingqiu c7624e55bb test: reset phase174 flusher measurement phase 2026-08-01 02:18:13 -07:00
pingqiu d427ed8efa test: add phase174 comparable pipeline work 2026-08-01 02:11:18 -07:00
pingqiu 45b21313b4 replication: close executor lifecycle before store teardown 2026-07-30 03:33:05 -07:00
pingqiu 080b80e25f test: synchronize restart catch-up admission probe 2026-07-30 01:59:37 -07:00
pingqiu 99bcd363a0 phase167: add ordered asynchronous replication 2026-07-29 17:56:21 -07:00
pingqiu 8303e7235a phase167: harden ordered write durability 2026-07-29 17:08:40 -07:00
pingqiu d84ca10bdd phase167: establish concurrent write baseline 2026-07-29 16:36:32 -07:00
pingqiu 108c0da490 review: fail closed on missing runtime dependencies 2026-06-29 00:01:12 -07:00
pingqiu 1dde8647af phase65: add runtime terminal evidence 2026-06-25 01:39:32 -07:00
pingqiu 869e64f858 phase64: add blockvolume runtime rebuild endpoint 2026-06-25 01:28:45 -07:00
Ping Qiu 5c4f995c55 v0.2 alpha: Day-1 activation and first-volume loop (#48)
Package the Kubernetes alpha into a script-based Day-1 activation loop: activate the stack, create the first PVC-backed volume, verify writer/reader data, collect product-owned observation evidence, render a local read-only report, and clean up.

Includes multi-node-safe activation defaults, first-volume example automation, read-only ops report output, README/quickstart/release note updates, and review-driven hardening for fail-fast configuration, promotion evidence, inventory fail-closed behavior, and test guards.

Validated by Day-1 activation run 20260517-205252-04e9 and read-only report run 20260517-212358-bfba. Local targeted tests passed.
2026-05-18 16:43:35 -07:00
Ping Qiu dfa31007a1 testops: add beta hardening gates and storage readiness evidence
Adds the beta-hardening test and operations foundation for Seaweed Block, including runner-native protocol/beta gates, CSI lifecycle and durable restart coverage, iSCSI/NVMe protocol release gates, returned-replica evidence, read-only operations status reports, OS initiator compatibility gates, and fast iSCSI L2 durable restart/reconnect coverage.
2026-05-11 10:38:00 -07:00
pingqiuandClaude Opus 4.7 6a5d54678c docs(core): drop internal phase/gate prefixes from production comments
Strip T4a/T4b/T4c/T4d, G3+/G5-5/G5-5A/G5-5C/G6/G7-redo, P14/P15, and
"architect round-NN" prose from godoc and in-body comments across the
core/ tree. Preserve stable invariant identifiers (INV-* names) since
they're searchable across the codebase.

Files: core/engine/apply.go, core/host/master/services.go,
core/replication/component/cluster.go, core/replication/probe_loop.go,
core/storage/walstore.go, core/storage/walstore_recovery.go,
core/transport/executor.go, core/transport/replica.go.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-03 16:05:49 -07:00
pingqiuandClaude Opus 4.7 4a15e6271c docs(replication): drop internal phase/gate prefixes from peer + volume comments
Pass scope: package docs, exported func godocs, struct field docs,
inline comments. Removes T4a/T4b/T4c/T4d / G5-5/G5-5C / G6 / 'architect'
date-stamped historical pedigree from peer.go (50 hits) and volume.go
(28 hits) while preserving:

  - state-machine transition tables
  - stable invariant IDs (INV-REPL-*, INV-G5-5C-PER-PEER-ADAPTER-*)
  - lock-ordering discipline
  - 'Called by / Owns / Borrows' lifecycle blocks

No behavior change.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-03 15:49:13 -07:00
pingqiu f476817e34 G9C: pin replica ready after post-close ack in dual-lane component path 2026-05-02 19:56:23 -07:00
pingqiu 5d9f377aa9 test(g9a): pin RF3 sync quorum ACK semantics 2026-05-02 18:46:40 -07:00
pingqiu 13f168f592 test(g9a): prove best-effort still recovers lagging peer 2026-05-02 18:38:18 -07:00
pingqiu 5c454d1716 G9A: fail strict write ACK when peer is recovering 2026-05-02 16:40:14 -07:00
pingqiu b3f4bbcd80 test(g8): pin failover authority fence and data continuity prelude 2026-05-02 14:53:15 -07:00
pingqiu 0a08b9238c adapter: expose flow control diagnostics 2026-05-02 12:31:22 -07:00
pingqiu 75f748b079 component: observe flow control from storage boundaries 2026-05-02 12:28:28 -07:00