Commit Graph
923 Commits
Author SHA1 Message Date
Ping QiuandClaude Opus 5.5 cb353bccea fix(G2): a new primary fences its own replica listener (#82)
* test(G2): red - a promoted host applies the deposed primary's ship

fencing-gaps-todo.md G2, red test first. A real ReplicaListener and the
real Host.applyFact primary path: ship at epoch 1 to listener B, master
promotes B to primary at epoch 2 (a self AssignmentFact), the old primary
ships at epoch 1 again. Today the ship is applied.

Adds the seam the fix uses: Host.SetSelfFence / fenceSelf call the
host's own listener on the primary path (after UpdateReplicaSet, before
OnAssignment) and on the supporting-replica path, and replay an already
adopted role when the listener is installed later (cmd/blockvolume wires
it before Serve). The listener's FenceAsPrimary / AdmitAsReplica are
no-ops in this commit, so the test is red on behaviour.

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

* fix(G2): a new primary fences its own replica listener

fencing-gaps-todo.md G2. The replica listener gets an epoch floor and a
primary flag. FenceAsPrimary(e), called by the host on the primary path
before OnAssignment, sets the floor to at least e and refuses every
replication mutation; AdmitAsReplica(e), on the supporting-replica path,
re-admits replication but keeps the floor. acceptMutationLineage, the
single gate for ship, recovery lane start and rebuild block/done,
applies both. Probes are unchanged.

Green: TestG2_PromotedHostRefusesShipFromDeposedPrimary (real
Host.applyFact primary path + real listener) passes 3/3; new listener
tests: a primary refuses ship / recovery lane start / rebuild but answers
probes; the floor stays after AdmitAsReplica and never goes down.
Ledger: INV-FENCE-SELF-ON-PROMOTE-001.

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

* style(G2): gofmt replica.go field alignment

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

* fix(G2): the fence drains replication mutations already past the gate

Review of cc884db (claude03 P2-1, codex01 P1): acceptMutationLineage
released r.mu before the store write, and FenceAsPrimary only flipped
flags, so a deposed-epoch ship or rebuild admitted just before promotion
was applied after the fence returned, while the host served as primary.

Each mutating frame (ship, recovery lane start, rebuild block, rebuild
done, barrier) is now counted under r.mu from before its gate check until
its storage effect is done; its ack is written after it is uncounted, so
the fence never waits on the network. FenceAsPrimary sets primary and the
floor (no new admissions), then waits for the count to reach zero, bounded
(10 s); on timeout it returns an error and the host fails closed: no
OnAssignment, as for an UpdateReplicaSet failure; master redelivers.

Lock order: Host.selfFenceMu -> ReplicaListener.mu, never the reverse;
r.mu is held only for gate state and the counter (Cond.Wait releases it),
never across storage or network calls.

Red (fence without the wait) / green: in-flight controls for ship (direct
and ApplyHook paths) and a rebuild base write fail, then pass 3/3; a
mutation stuck past the bound makes the fence report an error; the host
does not adopt primary when the fence fails.

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

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-07 00:49:38 -08:00
Ping QiuandClaude Opus 5.5 5605d45b97 docs(protocol): track epoch/fencing gaps G1-G5 (#81)
* docs(protocol): track epoch/fencing gaps G1-G5

Opens a TODO for five fencing gaps found while reviewing the epoch
protocol at b1ff581. G1-G3 are confirmed by reading the code (replica
floor in memory only, new primary does not fence its own listener,
production promotion runs without a required ACK frontier). G4 is a
design decision (no primary lease). G5 needs a test first (caught-up
check has no epoch). Each item has the failure scenario, the proposed
fix, and the red test to write first.

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

* docs(protocol): record the G4 decision (option A, non-claim for alpha/beta)

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

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-06 22:39:12 -08:00
Ping Qiu b1ff581924 Merge pull request #80 from seaweedfs/phase174-frontend-replication-execution
storage: close execution architecture decisions
2026-08-01 05:07:22 -07:00
pingqiu e13e3f6620 docs: trim phase174 signoff whitespace 2026-08-01 04:41:56 -07:00
pingqiu 91dd4027c9 docs: record phase174 no-change decision 2026-08-01 04:40:44 -07:00
pingqiu 3b2622f501 docs: archive phase174 architecture decision 2026-08-01 04:40:29 -07:00
pingqiu eab334eff6 docs: close phase174 mounted NVMe attribution 2026-08-01 04:39:00 -07:00
pingqiu 67499939d3 test: classify mounted NVMe write shape 2026-08-01 04:31:30 -07:00
pingqiu 470d0b0056 test: declare mounted NVMe network class 2026-08-01 04:22:53 -07:00
pingqiu 46aa2e122d obs: profile mounted NVMe write phases 2026-08-01 04:18:38 -07:00
pingqiu f795c73e6d docs: record phase174 detailed NVMe attribution 2026-08-01 04:09:48 -07:00
pingqiu 3ae66df58d obs: attribute NVMe write phases 2026-08-01 04:05:08 -07:00
pingqiu c8beef0e13 docs: record phase174 NVMe attribution gate 2026-08-01 03:53:06 -07:00
pingqiu 6d88dc40bf test: record phase174 NVMe source commit 2026-08-01 03:49:47 -07:00
pingqiu d79d280458 test: distinguish phase174 NVMe stability scopes 2026-08-01 03:48:11 -07:00
pingqiu 9fb03057f3 test: add phase174 NVMe fixed-work attribution 2026-08-01 03:44:12 -07:00
pingqiu 437f4752ae docs: close phase174 distinct-node RF3 slice 2026-08-01 03:30:50 -07:00
pingqiu c2c353ac98 test: rebuild recycled phase174 replicas 2026-08-01 03:26:43 -07:00
pingqiu 57e82db212 test: stop phase174 remote helpers on failure 2026-08-01 03:23:23 -07:00
pingqiu 87617aedad fix: require recovery before peer queue reset 2026-08-01 03:19:51 -07:00
pingqiu e8f02591de test: accept prebuilt phase174 RF3 helper 2026-08-01 03:06:24 -07:00
pingqiu 42dca2190d test: add phase174 distinct-node RF3 gate 2026-08-01 03:04:34 -07:00
pingqiu 231e46810e docs: record phase174 RF1 attribution 2026-08-01 02:53:55 -07:00
pingqiu 8b9cbfd046 test: attribute phase174 RF1 write boundaries 2026-08-01 02:45:55 -07:00
pingqiu 8e865cf2b5 docs: record phase174 local baseline hold 2026-08-01 02:38:56 -07:00
pingqiu f44d3245e0 test: reverse phase174 independent sample order 2026-08-01 02:32:28 -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 cd30ac4523 docs: close phase173 architecture decision 2026-08-01 01:55:24 -07:00
pingqiu 3045f140ec test: await PV deletion before CSI teardown 2026-08-01 01:36:16 -07:00
pingqiu 5c6d6e39c0 qa: make phase173 controls attribution-only 2026-08-01 01:18:58 -07:00
pingqiu 36c3c71346 test: parse noisy phase173 adapter benchmark 2026-08-01 01:16:23 -07:00
pingqiu 426d5339a3 qa: fail closed on unstable phase173 controls 2026-08-01 01:14:17 -07:00
pingqiu 46016f727d test: reuse preconditioned phase173 control stores 2026-08-01 01:11:34 -07:00
pingqiu 6165755950 test: isolate phase173 control samples 2026-08-01 01:08:54 -07:00
pingqiu c5356bf85a test: pin phase173 controls to comparable CPUs 2026-08-01 01:05:57 -07:00
pingqiu cf6e95217b test: attribute phase173 control heap variance 2026-08-01 01:03:39 -07:00
pingqiu 3b0bf6d746 test: stabilize phase173 architecture controls 2026-08-01 01:00:52 -07:00
pingqiu 5043bd951c storage: add phase173 architecture controls 2026-08-01 00:55:06 -07:00
pingqiu 17296351a8 qa: close phase173 shipped-path attribution 2026-08-01 00:42:16 -07:00
pingqiu a1f4aac92b qa: complete phase173 attribution summary 2026-08-01 00:39:54 -07:00
pingqiu d4ecfe9c84 qa: scope phase173 memory attribution honestly 2026-08-01 00:37:50 -07:00
pingqiu 86222889cd storage: add exact shipped-path attribution gate 2026-08-01 00:34:52 -07:00
pingqiu 99e746e33c qa: sign off phase173 fixed-work baseline 2026-08-01 00:20:19 -07:00
pingqiu f394379f9f qa: align fixed-work flusher phase 2026-08-01 00:15:53 -07:00
pingqiu 550fb6742d qa: precondition persistent fixed-work stores 2026-08-01 00:10:35 -07:00
pingqiu 3437afe19d qa: isolate fixed-work device state 2026-08-01 00:04:53 -07:00
pingqiu 1ea8dacd95 qa: account for WAL wrap padding writes 2026-07-31 23:49:55 -07:00
pingqiu 1f9bee2b4d qa: stabilize fixed-work admission samples 2026-07-31 23:48:05 -07:00