Commit Graph
143 Commits
Author SHA1 Message Date
Ping Qiu f24312e39f Merge pull request #609 from seaweedfs/fix/store-learn-bringup
replication: a failed store-learning barrier never degrades the peer
2026-11-25 12:44:03 -08:00
pingqiuandClaude Opus 5.5 6354c7087d replication: the store-learning controls fail, never skip, when the replica cannot re-bind
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-25 12:36:40 -08:00
pingqiuandClaude Opus 5.5 cd0d17bcd8 replication: the redial control waits for the dropped connection
The control slept a fixed time and could pass with no connection accepted
and dropped. It now waits for the listener's accept-then-drop and fails if
none happened; without the transport fix it fails at the store assertion.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-25 12:04:48 -08:00
pingqiuandClaude Opus 5.5 353df5993e transport: a barrier that fails on its connection drops it
A send or receive failure left session.conn in place, so a caller that
does not invalidate the session (the store learner) reused the dead
socket on every retry and never learned a restarted replica's store. The
barrier now detaches and closes the connection, as the catch-up and
rebuild senders do; the next barrier re-dials.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-25 11:55:27 -08:00
pingqiuandClaude Opus 5.5 c7cff76f00 replication: the store learner runs on the peer's queue worker
The learning barrier used the peer's connection from its own goroutine,
outside the work queue that keeps one writer per connection, so on an
exposed volume it could overlap the first ship. It is now a queue job on
that worker; it is queued only when there is room (it never saturates the
queue, which would degrade the peer) and retried otherwise.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-25 11:47:43 -08:00
pingqiuandClaude Opus 5.5 9bcb6c28cd replication: a failed store-learning barrier never degrades the peer
At bring-up the primary may install a peer whose replica does not listen
yet. The barrier that learns the replica's store then failed and degraded
the peer; nothing re-probes a degraded peer before a write, so its store
was never attested and a new volume never left creating. The store-learning
barrier now leaves the peer as it is on failure and retries in the
background (100 ms doubling to 2 s) until the store is learned or the peer
leaves.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-25 11:43:24 -08:00
pingqiuandClaude Opus 5.5 314b79bff1 volume: a probe dispatch acts only for the peer it was admitted for
Priming and the adapter lookup were keyed by ReplicaID. A dispatch the loop
admitted for an old degraded peer, delayed while a lineage bump replaced the
peer under the same ReplicaID, then primed the new healthy peer's adapter,
whose probe raced the volume's live session again. The registry now keeps
the exact peer each adapter was added for; PrimePendingFor and
AdapterForPeer compare it under the registry lock, and a mismatch primes
nothing and sends no wire probe.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-25 10:33:10 -08:00
pingqiuandClaude Opus 5.5 88a03a40bb component: the apply-failure recovery test follows deferred priming
The test waited for its registry adapter to probe the new peer right after
the add, which is the adapter acting on a healthy peer the volume's live
session owns. It now checks the adapter has issued nothing at the add and
wires the probe loop as the binary does (priming on the first dispatch for
a degraded peer); its degrade, recover and replay assertions are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-25 10:33:10 -08:00
Ping Qiu 395a2b0953 Merge pull request #597 from seaweedfs/fix/failover-ship-order-main
volume, replication: a promoted replica moves its ship order to its store before it serves
2026-11-25 09:34:37 -08:00
pingqiuandClaude Opus 5.5 58b3c02386 replication: learn new peers' stores outside the volume lock; convergence test
The frontier-0 store barriers run in parallel after UpdateReplicaSet
releases v.mu. A replica refused for an unrecorded store stays Healthy with
its learned store, so the next attestation records it with no operator.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-25 06:53:38 -08:00
pingqiuandClaude Opus 5.5 a7bbbe5428 replication: test the ship order after replicated entries
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-25 06:51:32 -08:00
pingqiuandClaude Opus 5.5 aa074bc05f volume, replication: a node taking the primary role moves its ship order to its store
A replica applies entries through replication, so its store's next LSN
moves while the write observer's ship cursor stays where the observer was
installed. Promoted, its first local write waited in the LSN resequencer
for an entry that never comes as a local write, and every write after a
failover failed at its deadline. On a transition into the primary role
(listener fenced as primary, frontend not serving yet) the host moves the
ship cursor to the store's next LSN.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-25 06:51:32 -08:00
pingqiuandClaude Opus 5.5 5bf6e17ab1 replication, master, volume: count a peer only with the master-recorded store
A peer counts toward write ACKs only while its barrier store equals the
store the master recorded for it from a primary's attestation, carried in
the replica descriptor; empty never matches, and the peer's own word never
changes it. A record change re-sends the assignment at the same
generation and the primary updates expected stores in place.

A volume's first bind records its initial replicas: until each has an
attested store the fact carries the awaited count, the primary serves no
frontend I/O and reports "creating: waiting for replica attestations
(n of N)"; the primary learns new peers' stores with a barrier at LSN 0.
Replica rows show store_attested/store_id.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-25 06:43:45 -08:00
pingqiuandClaude Opus 5.5 5d315bcf5d replication: tests for the write-ACK count of an unacknowledged store
An unacknowledged replica's ack does not complete a sync_quorum flush
(it does once its store is acknowledged). The first-heartbeat window's
defect is pinned by a skipped red test: a fresh primary with healthy
replicas must fail no flush before its first acknowledged heartbeat.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-25 06:18:03 -08:00
pingqiuandClaude Opus 5.5 91fce5380c replication, volume: a peer counts toward write ACKs only with a master-acked store
Where the primary attests its write-ACK stores (every heartbeat of a
volume host), a Healthy peer counts toward write ACKs only once the
master has acknowledged the attestation naming its current store. A peer
rebuilt onto a new store still answers barriers (that is how its store
is learned) but does not count until that store is acked, so it can
never be the only holder of an acknowledged write that a promotion
cannot verify. The host passes an acknowledged attestation to the
replication volume after each successful heartbeat.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-25 06:13:24 -08:00
pingqiuandClaude Opus 5.5 85171f71fa replication, master: read the epoch row after the sync; the HTTP evidence provider is test-only
LocalPrimaryEvidence synced after reading the table, so a row appended in
between was paired with a newer end. Sync first, then read the table.

The workload-plan HTTP provider has no production caller since the probe
round; it moves to a test file so the round is the one way to evidence.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-25 03:26:59 -08:00
pingqiuandClaude Opus 5.5 121a4ec5ed master, volume, replication: a promotion survivor is the store its primary attested
The primary attests, in its heartbeat, the store id (superblock UUID) of
each replica counted toward its write ACKs. A probe round answer carries
the replica's store id; a candidate is ready only when that id is the one
its primary attested (a replaced or never-attested store is not a
survivor). The promotion line carries the probed store id, and the target
refuses a promotion whose store id is missing or is not its own.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-25 03:23:18 -08:00
pingqiuandClaude Opus 5.5 26ffb11403 master, volume: the promotion probe round
When blockmaster decides a promotion it mints a fresh round id and sends a
ProbeRound to the node of each replica it asks, over that node's
authenticated round stream (SubscribeProbeRounds); each replica answers
from its store as it is now: durable end, the epoch-table row there,
whether the table is present and valid, and its role (AnswerProbe). Only
an answer with this round's id, from the node asked, for the replica
asked, counts; reports, old answers and answers from another node never
do. The round replaces the /status probe, which mutual TLS keeps on
loopback, and is installed at startup for every deployment (it was
launcher-only). Both methods are node-only.

Regenerated with the pinned protoc-gen-go v1.27.1 and protoc-gen-go-grpc
v1.3.0 (the gRPC file's header now names protoc v7.34.1).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-25 02:42:31 -08:00
pingqiuandClaude Opus 5.5 a36a5c03f1 docs: state the divergent-tail rule in the code comment, without internal references
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-25 01:09:25 -08:00
pingqiuandClaude Opus 5.5 a3008d9ff8 transport: a recovery lane start must state its from-LSN; live applies hold the epoch table's fence
A lane start without the LSN it starts after took the mark unconditionally;
it is now refused (nothing is released on this wire). A live entry passed
its note and could be held while a recovery took the mark and installed a
base, then land as a stray block under a table later made valid: live
applies now hold the apply fence shared and run only while the table is
valid, so a recovery's Invalidate drains them. Every lane start sender
states its from-LSN (EncodeRecoveryLaneStart).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-25 00:43:29 -08:00
pingqiuandClaude Opus 5.5 b368aba158 test: the equal-length divergent tail trace (G4) from the promotion regression traces
From the promotion-loss regression PR, with the epoch tables production
keeps beside each store (both wrote LSN 1 at epoch 1; the new primary
wrote LSN 2 at epoch 2; the rejoining replica's LSN 2 is the old primary's
epoch-1 tail, or in the control the new primary's entry). It fails on main
(a conflicting same-length tail acknowledged at LSN 2) and the conflicting
tail is refused with the epoch-table reconciliation; the control still
acknowledges.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-25 00:40:33 -08:00
pingqiuandClaude Opus 5.5 8813162775 transport: recovery applies are fenced against a change of the epoch table's owner; a catch-up over an invalid table needs a rebuild
An apply admitted under recovery A's mark could land after recovery B took
the mark and completed: its entry lay under B's valid table, labelled B's
epoch. Every recovery-data apply (both lanes, dual lane through the gate)
now runs under the table's apply fence, shared, and only while its token
owns the mark; Invalidate, CompleteRecovery and Replace take the fence
exclusive, so a change of owner waits for in-flight applies to settle and
the old owner's later applies are refused. A catch-up may complete only if
the table was valid when it took the mark (one persisted bit); after any
overlap only a rebuild makes it valid. A catch-up states the LSN it starts
after, and the replica takes the mark only if its durable end matches. A
live entry of a new epoch is accepted only at the store's next LSN.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-25 00:36:41 -08:00
pingqiuandClaude Opus 5.5 e42597ce1d transport: the barrier reply carries the first LSN of the replica's last data epoch, and the primary requires it to match
Two tables can agree on an epoch number and still describe different
histories: a survivor whose epoch 2 starts at 7 (an old tail 5..6 kept)
read as in sync with a primary whose epoch 2 starts at 5. The reply is
56 bytes (40 from a replica without the table); SharedEnd takes the
replica's (epoch, first LSN, end) and a different first LSN is diverged.
A rebuild whose table replace fails is not acknowledged, and the stale
table reconciles as diverged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-24 22:53:16 -08:00
pingqiuandClaude Opus 5.5 ab7eb73c31 transport: the rebuild-done frame carries the primary's epoch rows; the replica takes them, cut at its rebuilt end, before the ack
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-24 22:26:48 -08:00
pingqiuandClaude Opus 5.5 a9b4678741 replication: a recovery verdict heals a peer only through an (epoch, LSN) reconciliation in this session
The engine's healthy verdict (a probe saw R >= H) and a completed recovery
session set the peer Healthy on length. Both now run a barrier and compare
the peer's (last data epoch, end) with the primary's epoch table: in sync
-> Healthy; diverged -> NeedsRebuild; behind or unanswered -> Degraded.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-24 22:26:48 -08:00
pingqiuandClaude Opus 5.5 e628a42896 replication: the promotion seed reconciles a survivor by (last data epoch, end) against the primary's epoch table
The ingress owns the volume's epoch table: the listener notes shipped
entries, the primary's row (epoch, durable end + 1) is made durable before
a primary role is adopted, and the replication volume reads it at the seed
barrier. A survivor whose entries are not the primary's (an equal length at
another epoch, a tail above the frontier, data without a table) needs a
rebuild and is not counted.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-24 22:26:48 -08:00
pingqiuandClaude Opus 5.5 b8556ab5bf transport: the barrier reply carries the replica's last data epoch (48 bytes; 40 from an older replica = no table)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-24 22:26:48 -08:00
pingqiuandClaude Opus 5.5 bca75dc945 replication: a sync barrier counts only a healthy peer
Write acknowledgements already count only peers that were healthy; the
sync barrier counted any peer whose reported length covered the target,
so a degraded survivor holding a divergent tail satisfied sync-quorum.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-24 22:26:47 -08:00
pingqiuandClaude Opus 5.5 35a165989f replication: a survivor answering the promotion seed barrier above the frontier is degraded
Above the promoted primary's frontier a survivor holds entries the primary
never had: an unacknowledged tail of the old epoch. The seed barrier
accepted it as caught up on length, kept the peer healthy and counted its
acks; it is now degraded like a peer below the frontier.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-24 22:26:47 -08:00
pingqiuandClaude Opus 5.5 6fe5a9b17d status schema: replication peer, engine projection and chunk usage field comments
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 23:25:11 -08:00
pingqiu 704eedac67 fix: guard promotion readiness and retire settled replica sessions 2026-11-20 05:17:12 -08:00
pingqiu 61274080b0 test: reproduce false readiness and retained settled replica coverage 2026-11-20 05:17:12 -08:00
pingqiu 8bd459c24a fix: require a covered starting image before extending replica prefix 2026-11-20 05:17:12 -08:00
pingqiu 78781527ae test: bind wire pruning assertion to its actual recovery session 2026-11-20 05:17:12 -08:00
pingqiu 85bf19a8bb fix: prune replica versions only behind certified recovery prefixes 2026-11-20 05:17:12 -08:00
pingqiu 28d3054de5 test: preserve lane semantics after durable version pruning 2026-11-20 05:17:12 -08:00
pingqiu 0a95b53940 test: keep long-run source versions monotone 2026-11-20 05:17:12 -08:00
pingqiu bc1b0fbaeb test: expose replica version history growth and recovery holes 2026-11-20 05:17:12 -08:00
pingqiu 364118a28e fix: deduplicate recovery observations and share replica apply versions 2026-11-20 05:17:11 -08:00
pingqiu 14d724e3de test: witness an admitted old wire frame overtaken by a newer session 2026-11-20 05:16:51 -08:00
pingqiu c400b28f5f test: reproduce cross-session replica byte regression 2026-11-20 05:16:51 -08:00
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