Commit Graph
151 Commits
Author SHA1 Message Date
pingqiuandClaude Opus 5.5 de6a56b453 fix(volume): re-draw the live session above a session whatever its outcome
The replica takes a session's lineage when it admits it; the sender saw
only the exchange's result. A fence the replica admitted whose reply was
lost, or a recovery session whose close failed, left the replica above
the live session with no re-draw. The fence-complete and session-close
callbacks now re-draw the live session above the session on any outcome
(a completed recovery still advances the cursor and heals). A guard test
over the adapter's draw switch lists every command kind that draws a
session and what re-draws after it; the refresh's log line names the
session and the reason instead of 'after recovery='.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-26 21:29:44 -08:00
pingqiuandClaude Opus 5.5 18f39b9646 authority: a restarted primary is re-issued its line at a new endpoint version
A primary restarted at the same epoch and address started its sessions
at 1 while each replica held the dead process's higher one, so every
session was refused as older. The line now records the process it was
issued for (durable); a current primary reporting another process is
re-issued its line at the next endpoint version, and a primary adopts no
line issued for another process.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-25 20:07:02 -08:00
Ping Qiu e9c4c57b43 Merge pull request #632 from seaweedfs/fix/one-session-order
replication: one session order per replica
2026-11-25 19:25:53 -08:00
pingqiuandClaude Opus 5.5 263602e933 replication: one session order per replica
Live-ship and recovery session ids came from two process-wide counters;
once the live counter ran ahead, the replica refused every recovery as
older. Each replica now has one order, kept by the volume across its
peers and executors, and every session toward it takes the next id.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-25 18:49:42 -08:00
pingqiuandClaude Opus 5.5 c2fe9dc639 test: the mid-recovery write test opens the recovery as a dual-lane session
The recovery begins with BeginEpochRecovery, so the primary's live
session stays admissible and only the invalid epoch table can refuse its
frames; a recovery begun and ended is the control. The test is its own
package so its sessions do not reorder another test's.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-25 18:37:49 -08:00
pingqiuandClaude Opus 5.5 eea052d975 test: a replica mid-recovery is never counted
While a recovery owns a replica's store its epoch table is invalid and its
end may sit above a gap. Such a replica is never a fencing round's target,
also with the highest end, and never completes a sync_all or sync_quorum
write.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-25 18:16:22 -08:00
pingqiuandClaude Opus 5.5 662a1d007f transport: the next-LSN rule also holds with the apply gate
The volume's listener always has the apply gate installed, and the gate
checks each block's staleness, not the position, so the live-lane rule
applies on both paths. The tests build the listener as the volume does,
on walstore and smartwal, and check that no live entry lands while a
recovery owns the store.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-25 18:10:08 -08:00
pingqiuandClaude Opus 5.5 d072078640 transport: a replica applies a live entry only at its next LSN
Inside an epoch, a live entry above the store's next LSN is refused and
the connection closed; the primary's catch-up from the barrier end then
applies the gap in order. Fixtures that shipped hand-picked LSNs now ship
at the store's next LSN.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-25 17:56:10 -08:00
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