Commit Graph
101 Commits
Author SHA1 Message Date
pingqiu 6dfde8c227 fix(master): accept validated format 3 HEADs for workspace moves 2026-11-19 17:19:55 -08:00
pingqiu 6937d04e3c test(master): join F4 manifest writer to workspace HEAD reader 2026-11-19 17:19:34 -08:00
pingqiu 7508c71e00 test(master): reproduce format 3 workspace HEAD refusal 2026-11-19 17:17:45 -08:00
pingqiuandClaude Opus 5.5 ec40814443 master: validate a move target's endpoints; log a refusal outside the lock
Fold of the #260 review:
- the target endpoints get the binding endpoint rules before admission
  (host:port, numeric port 1..65535, data and ctrl distinct), without
  registering anything: a host match alone admitted ':0', ':65536', a
  non-numeric or empty port, or identical data and ctrl, and the move
  would have issued and cleared the source lease;
- host parts compare in canonical form (equivalent IP spellings);
- the refusal log runs after workspaceMu is released;
- the comment no longer calls the host match a proof; the invariants
  ledger gets the move-admission row.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 05:34:16 -08:00
pingqiuandClaude Opus 5.5 d8c42d0928 master: a move target may use any port on the target node's host
A volume without per-volume bindings could move only to the target
node's single registered address pair, which models one slot per node: a
host serving several slots refused every move whose target landed on a
slot other than the registered one (slot 1 while slot 0 is held). The
target now needs both endpoints on the node's registered hosts (literal
host part, any port, no name resolution), and the existing collision
check still refuses endpoints another live assignment or binding owns.
Volumes with per-volume bindings keep the exact binding match.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 04:57:41 -08:00
pingqiuandClaude Opus 5.5 e9aecf52dc master: name the precondition that refused a workspace move
MoveWorkspace refused four different conditions with one message and no
log line: an unknown source, an unregistered target node, a target that
is the source, and target endpoints that are not registered. Each now has
its own FailedPrecondition message, logged with the volume and request.
The endpoint refusal also says what is registered: the node's own pair
for a volume without per-volume bindings, else its live bindings on that
node (a slot-1 target on a node registered at slot 0 shows up here).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 04:42:38 -08:00
pingqiuandClaude Opus 5.5 966384d2a8 master: give the exited-holder test room after the lease horizon
The test waits out the real ~45 s horizon; a 60 s budget left ~15 s for
the takeover, cut, detach and delete, which load and -race exceeded.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 01:48:55 -08:00
pingqiuandClaude Opus 5.5 898c0fd046 master: test the exited-holder recovery path (forced move, then delete)
A holder that exits never detaches or ACKs, so its live authority keeps
a volume delete refused. The existing path recovers it: after the lease
horizon plus skew a forced move grants epoch+1 on another host, which
claims HEAD, serves the last cut and writes past it, then detaches with
a clean ACK, after which the delete is admitted and later renewals and
moves are refused. Real master runtime and providers, in-memory remote.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 01:48:55 -08:00
pingqiuandClaude Opus 5.5 7116f6dbf8 test: #247 review fold: release before join; credit only renewals started under the hold
- master slow store: each held Put takes a generation; a renewal is credited
  with the generation it read before its call, so a reply computed before
  the hold never releases it. slow.release() runs as the first cleanup, so a
  held Put cannot block the publisher/extender joins after a failure.
- authority WritersExtendersClose: only grants of calls that started after
  the extension write was held count (flag set before the hold blocks).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 00:02:05 -08:00
pingqiuandClaude Opus 5.5 9f46fb8d7d test: workspace-lease family waits by progress, not wall-clock bounds (#227)
- core/host/master TestWorkspaceLeaseGuardSurvivesSlowAuthorityStore: each
  lease write is held until a renewal succeeded during the hold (slowness by
  progress), three held writes must complete, a sampler records any fence;
  replaces the 2.5 s sleeps and the 10 s watch. A renewal that waited for the
  store would let the guard lapse and fail the test at once.
- TestWorkspaceHeldRenewalBoundary, TestWorkspaceMoveRestoresLazilyAndFencesOldHost:
  the test context has no wall-clock bound (3 s / 10 s); each step completes
  or the go test timeout reports the hang. The guard's own RPC timeout stays.
- core/authority TestWorkspaceLeaseConcurrentRenewalsWritersExtendersClose:
  wait for the held extension write and for renewals under it by progress
  (were 5 s / 2 s bounds); joins after release unchanged.
- waitExtenders joins the finite extenders without a 10 s bound.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 23:41:12 -08:00
pingqiuandClaude Opus 5.5 dfd65907d4 test(workspace): log unrounded renewal timings in r1-r5 (#205)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 05:01:45 -08:00
pingqiuandClaude Opus 5.5 31b911dac7 test(workspace): safety controls for the lease horizon (#205)
GREEN-gating controls for the memory-only renewal:
- grants clamp to the durable horizon under a permanently stalled
  store, renewals without host validity or at the horizon are refused,
  and a real guard fences by horizon - skew/2;
- a restart honours the persisted horizon in the forced barrier;
- an extension whose rename landed but whose directory sync failed
  latches uncertainty, refuses the next renewal, and reloads with the
  landed horizon barring a forced move until horizon + skew;
- an extender held inside its write orders a same-volume revocation or
  forced move after it;
- same-volume renewals during held revocation and forced-move writes;
- the lease view equals derive(published) after every writer kind;
- N volumes renew concurrently with apply, revocation, ACK, a clean
  move, extenders and Close (run with -race);
- Close joins a held extender, and an extender admitted before closing
  writes nothing;
- lifecycle snapshots follow every records change, stay immutable, are
  read without the store mutex, and keep a protective unknown outcome;
- through the services layer, query and revoke replies report the
  grant, and a renewal during a held same-volume reservation returns
  the revoking lease.

The r1-r3 slow-store wrappers count the delayed writes and require at
least one, so a green cannot bypass the injected stall. Tests that own
a Publisher directly join its extenders before their store closes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 04:58:54 -08:00
pingqiuandClaude Opus 5.5 a4fd1303ef fix(workspace): answer lease renewals from memory under a durable horizon (#205)
A renewal of a live workspace lease persisted the new expiry with a
temp-file fsync under the publisher's global lock, and the renewal RPC
also read two lifecycle stores whose mutexes writers hold across file
I/O. A slow or busy master disk therefore made the host's 2 s renewal
RPC time out, the guard fence and the volume shut down.

Renewal now takes only a small leaf lock (leaseMu) over a per-volume
lease view and does no I/O:
- grant = min(now+TTL, durable horizon), where the horizon is the
  published Lease.ExpiresAtNS; the deadline is raised to the grant.
- It refuses stale, pending-move, expired, uncertain or storeless
  state as before (never bypasses INV-AUTH-UNCERTAIN-001), and refuses
  with an error when the grant would leave no positive host validity.
- The first grant of a lease still writes synchronously under p.mu and
  persists horizon = now + 1.5*TTL.
- A per-volume single-flight extender is an ordinary p.mu writer: it
  writes horizon = trigger + 1.5*TTL through persistWorkspaceLocked, so
  its write and publication are one p.mu section; any write error
  latches uncertainty as before.

Writers keep persist-before-publish and refresh the view (p.mu ->
leaseMu, the only new lock edge) at every derive-input change.
Revocation and query replies report the granted expiry, never the
horizon. Host.Close joins extenders before the store closes.

The renewal RPC reads lock-free immutable snapshots of the Volumes and
deletion-reservation stores, republished at every records change
(including load, delete and the protective unknown outcome).

Behaviour change: a forced move now waits for the durable horizon plus
skew, at most TTL/2 later than before. Existing tests that read the
persisted lease as the grant, or waited only grant + skew, are updated
with that reason. The store-write boundary guard now skips _test.go
files: a test double that delays and delegates Put is not a production
write caller.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 04:58:54 -08:00
pingqiuandClaude Opus 5.5 1193cb751b test(workspace): reservation persist hook and RED for renewal behind a held lifecycle write (#205)
Add DeletionReservationStore.SetPersistHookForTest, an instance-local
test seam that installs the existing write-fault hook under the store
mutex (nil by default).

r5: while the deletion-reservation write of an unrelated volume is held
in that hook, a renewal through the services layer must return within
2 s. On main it waits on the reservation store's mutex.

r4 and r5 now release held writes first and settle every worker with
bounded waits before clearing hooks or closing fixtures.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 04:42:15 -08:00
pingqiuandClaude Opus 5.5 75490ef76c test(workspace): RED for lease renewal waiting on a slow authority store (#205)
A renewal of a live workspace lease persists the new expiry with a
temp-file fsync under the publisher's global lock. When the master's
disk is slow, the host's 2 s renewal RPC times out, the guard fences
and the volume shuts down.

- r1: one renewal behind a 2.5 s store write must return within 2 s.
- r2: six concurrent renewals behind 0.5 s writes must not serialize.
- r3: a real WorkspaceLeaseGuard must not fence while the store takes
  2.5 s per write (TTL 6 s).

Tests only; no fix.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 04:03:52 -08:00
pingqiuandClaude Opus 5.5 9a226af141 test(master): a survivor seen last tick but missing now does not count
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-16 19:51:47 -08:00
pingqiuandClaude Opus 5.5 86d4eb6c94 fix(master): prove frontier coverage before an RF3 promotion (docs, gofmt)
State the survivor rule for an unknown required frontier in the design
doc and keep the missing acknowledged-frontier source as a known gap.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-16 19:49:08 -08:00
pingqiuandClaude Opus 5.5 7953c3af33 test(master): cover the RF3 frontier coverage rule
Known frontier covered/behind, known zero, unknown with all, some or
stale survivors, sync_all, best_effort, provider knownness, observation
freshness, and RF2 not consulting the gate.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-16 19:47:26 -08:00
pingqiuandClaude Opus 5.5 7b3b0fb54d test(master): give single-survivor boot-grace fixtures a covered frontier
The boot-grace and recovery-watchdog tests fail over to r2 while r3 is
silent. With an unknown frontier that promotion is no longer provable
(#181), so their fixtures now state a known required frontier that r2
covers. Their assertions are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-16 19:47:26 -08:00
pingqiuandClaude Opus 5.5 870d920871 fix(master): prove frontier coverage before an RF3 promotion
An unknown required acknowledgement frontier was read as zero, so the
highest durable ready candidate was promoted even when only some peers
were seen; an acknowledged write could live only on an unseen peer.

The probe result now says whether the required frontier is known. With a
known frontier the candidate must cover it, as before. With an unknown
frontier under a quorum ack profile, the highest durable candidate is
promoted only when enough peers are probed ready and fresh to intersect
every acknowledgement quorum (peerCount-K+1, K from waitForSyncAcks):
RF3 sync_quorum needs both peers, sync_all needs one. Otherwise nothing
is promoted. best_effort is unchanged.

Fixes #181.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-16 19:42:57 -08:00
pingqiuandClaude Opus 5.5 b331ffc57a test(master): RF3 promotion with a missing required frontier must be refused
Reproducer for #181, unchanged from #184.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-16 19:42:57 -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
pingqiu f99663a69a fix: separate workspace lease expiry with a clock skew margin 2026-11-15 23:53:02 -08:00
pingqiu dae0bb9072 test: seed skew controls through authority publication 2026-11-15 23:32:51 -08:00
pingqiu 342dc3529a fix: separate workspace lease expiry with a clock skew margin 2026-11-15 23:30:05 -08:00
pingqiuandClaude Opus 5.5 41f00e5b1a volume delete: terminal-state fork replay; reservation-aware import
- Fork's early replay of a completed request refuses (volume_deleted)
  a target whose HEAD is deleting, purging or deleted, also before its
  VOLUME is marked, like the later publication path.
- Host.ImportLifecycleVolume registers a cluster-spec volume under the
  CreateVolume RPC's boundary (workspaceMu, reservation check through
  the create); blockmaster startup uses it, skipping (and logging) a
  reserved id, and the placement import skips reserved ids too.
  Unreserved ids keep importing idempotently.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 21:06:24 -08:00
pingqiuandClaude Opus 5.5 a60daf2376 volume delete: RED controls for the r4 P2s
codex01's r4 review (V:/share/rdma/codex01-block152-r4-review-
20261116T0445Z/REVIEW.md). Controls failing against stubs:

- Fork's early replay reports success for a target past the delete mark
  (deleting, purging, HEAD deleted before VOLUME is marked)
  (TestCatalog_ForkReplayRefusesADeletingTarget);
- the cluster-spec import re-creates and places a reserved id after a
  restart with the original spec (TestClusterSpecImportSkipsAReserved
  Volume).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 21:06:23 -08:00
pingqiuandClaude Opus 5.5 4ac23effec Merge origin/main (139d649) into feat/volume-delete
No conflicts (#147-#151; no proto change on main).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 20:32:58 -08:00
Ping Qiu 139d649ddf Merge pull request #151 from seaweedfs/feat/parallel-segment-manifests
Parallelize chunk uploads and publish immutable manifest segments
2026-11-15 20:30:17 -08:00
pingqiuandClaude Opus 5.5 9f82dcd48a volume delete: no snapshot cascade; incarnation-bound commit
claude05's cut (04:08Z): volume-delete refuses with
volume_has_snapshots while the volume has any snapshot name record (a
published snapshot, one being deleted, or an attempt in flight); the
operator deletes snapshots first. The delete never touches snapshot
names, attempts or roots: the snapshot loop, the claim check and claim
release (a claim lives on a named snapshot; a deleted target's claim is
dead by rule), and CreateSnapshot's back-out are gone. CreateSnapshot
and Fork still refuse once they see the delete mark.

codex01's r3 P2s:
- the snapshot check, the revert and the commit are bound to one
  deleting incarnation (its generation); if HEAD moved, the check runs
  again on the incarnation found;
- the CLI's admission token is --request-id (required), so a rerun
  adopts and can give back an earlier invocation's hold;
- CreateVolume holds workspaceMu through the create;
- the reservation store syncs its parent directory before use (the
  binding store's helper).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 20:27:44 -08:00
pingqiuandClaude Opus 5.5 425161bbe3 volume delete: RED controls for the cut and the r3 P2s
claude05's 04:08Z cut (no snapshot cascade) and codex01's r3 P2s
(V:/share/rdma/codex01-block152-r3-review-20261116T0405Z/REVIEW.md).
Controls failing against stubs:

- the cut: a volume with a snapshot, an in-flight snapshot attempt, or
  a fork's snapshot is deleted (TestCatalog_DeleteVolumeRefusesWhile
  SnapshotsExist, TestCatalog_InFlightSnapshotRefusesTheDelete, ...Fork
  DuringTheDeleteMarkRefuses, ...TombstonesAndRefusesReuse);
- incarnation: a claim check under generation G commits a re-marked G'
  (TestCatalog_DeleteCommitIsBoundToItsIncarnation);
- lost CLI token: a rerun cannot release the earlier hold
  (TestOpsChunk_VolumeDelete, real master, restart);
- CreateVolume drops workspaceMu before the create
  (TestMarkVolumeDeleting_CreateHoldsTheReservationLock);
- the reservation directory's parent is not synced
  (TestDeletionReservations_ParentSyncBeforeUse).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 20:27:44 -08:00
pingqiuandClaude Opus 5.5 2e078746ee volume delete: durable master reservation, commit point, settled abort
- Master: a deletion reservation store (core/lifecycle), separate from
  the desired-volume records, so an unknown id is reserved too and the
  ordinary DeleteVolume/CreateVolume path cannot clear it. Held by
  per-delete tokens (admitted), permanent once committed. Writes reuse
  the binding store's crash-safe pattern (synced temp file, atomic
  rename, synced directory); an unknown outcome keeps a protective
  change in memory (fail closed). MarkVolumeDeleting records it under
  RecordWorkspaceDeletion's check; new AbortVolumeDeleting and
  CommitVolumeDeleting. Every gate (publication admission, reconciler,
  workload planner, binding/placement/move, CreateVolume) consults it.
  VolumeRecord.Deleting is gone.
- Catalog: Admission is Admit/Commit/Abort; ErrNotAdmitted marks a
  definite refusal, anything else is an unknown outcome
  (admissionUncertain). Every give-back aborts this delete's admission.
  A commit point (HEAD deleting -> purging, conditioned on the HEAD
  read) precedes the irreversible steps; a revert races on the same
  write, so a delete that sampled a claim cannot undo another delete's
  commit, and reports an error instead of a give-back.
- CreateSnapshot's back-out settles its name like the delete does: the
  name is freed only after the attempt's tombstone or winning
  publication is confirmed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 19:54:32 -08:00
pingqiuandClaude Opus 5.5 77d238ce59 volume delete: RED controls for the r2 review
Review of dfc8f19 (codex01, V:/share/rdma/codex01-block152-r2-review-
20261116T0342Z/REVIEW.md). Controls failing against stubs restoring the
reviewed behaviour:

- P1: an unknown id's admission and a known record's ordinary
  DeleteVolume leave CreateVolume free, also after a restart
  (TestMarkVolumeDeleting_ReservesUnknownIdsAndSurvivesDeleteAndRestart).
- P2 persistence: the mark is intent-only (no write/sync); write,
  rename and directory-sync faults and a restart lose it
  (TestDeletionReservations_*).
- P2 rollback: a give-back (claim, held HEAD) leaves the master
  exclusion in place; a lost admission response reads as a refusal
  (TestCatalog_DeleteVolumeGivesBackOnALiveClaim, ...HeldAfterAdmission
  GivesBack, ...LostAdmissionResponse, TestOpsChunk_VolumeDelete with a
  real master: claim refusal must leave the id usable).
- P2 failed abort: B's failed tombstone write still frees the name, so
  A's late publication survives a completed delete
  (TestCatalog_FailedAbortCannotHideALatePublication).
- P2 concurrent deletes: D1's revert after D2 committed counts as a
  give-back (TestCatalog_ConcurrentDeleteCannotRollBackACommittedOne).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 19:54:32 -08:00
pingqiuandClaude Opus 5.5 dfc8f19ef1 volume delete: master admission, one HEAD linearization point
(a) Admission at the master: LifecycleService.MarkVolumeDeleting holds
    workspaceMu (every assignment, placement and binding write) and marks
    VolumeRecord.Deleting inside RecordWorkspaceDeletion's check (refused
    with live authority without a clean revocation ACK, a pending move or
    a queued placement). Afterwards publication admission, the placement
    reconciler, the workload planner, binding/placement/move RPCs and
    CreateVolume refuse the volume.
(b) One HEAD write from the HEAD read (active or detached, not held) to
    state deleting, chunks kept. Every read decides "held" afresh.
    ChunkRemote.CASHead refuses to move a deleting or deleted HEAD
    (ErrChunkHeadPrecondition + ErrChunkHeadDeleted), so no attach,
    claim or restore revives it; EnsureVolume refuses it; Fork and
    CreateSnapshot check the volume again after taking their claim/name
    and back out.
(c) Claims read after (b): a live claim reverts HEAD (detached or
    active, as before) and refuses with snapshot_claimed.
(d) Then every snapshot name, published or not (an unpublished attempt
    gets an aborted tombstone), goes through markDeleting and is freed;
    the fork claim is released and reported only when confirmed.
(e) HEAD becomes deleted (no chunks), VOLUME is marked deleted.

A failed delete reports what it did (admitted, headMarked, reverted,
snapshots, aborted attempts, claimReleased, completed, uncertain); the
CLI prints that with the error and exits nonzero. The CLI's admission
is MarkVolumeDeleting (QueryVolumeStatus is no longer used).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 19:31:09 -08:00
pingqiuandClaude Opus 5.5 5b82b324d6 volume delete: RED controls for one linearization point
Review of 626c7de (codex01). One control per schedule, each failing
against a stub that restores the reviewed behaviour:

- P1 1: a holder that attaches before the HEAD mark's first read is
  deleted (TestCatalog_DeleteVolumeRefusesAnAttachBeforeTheMark).
- P1 2: an attach that passed EnsureVolume revives a deleting/deleted
  HEAD through CASHead (TestCatalog_DeletedHeadCannotBeRevivedByAClaim).
- P1 3: after the master's delete mark, an existing placement still
  leads to an assignment, the reconciler places, the id can be created
  and bound again (TestMarkVolumeDeleting_StopsLaterAssignment...).
- P2: a fork claim after the check is refused only after irreversible
  writes (TestCatalog_DeleteVolumeGivesBackOnALiveClaim); a fork after
  the mark installs (TestCatalog_ForkAfterTheDeleteMarkRefuses); a held
  snapshot publication and a snapshot started after the mark escape the
  delete (TestCatalog_DeleteVolumeCatchesInFlightSnapshots); a failed
  claim removal is reported released, and the CLI drops partial effects
  (TestCatalog_DeleteVolumeTombstonesAndReleases, TestOpsChunk_VolumeDelete).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 19:31:08 -08:00
pingqiu ae907d6ea6 fix: reject mixed manifests and share segmented roots with master and usage 2026-11-15 18:56:14 -08:00
pingqiu 701a304257 test: refuse mixed roots and cover segmented accounting and clean moves 2026-11-15 18:55:13 -08:00
pingqiu f9da1a371d fix: register desired volumes from complete cluster specifications 2026-11-15 17:21:12 -08:00
pingqiu 28e8b293d3 fix: validate workspace ownership through authority publication 2026-11-15 15:07:19 -08:00
pingqiu a42401ef6a fix: close workspace binding admission and retirement schedules 2026-11-15 14:45:35 -08:00
pingqiu 52cd6debc5 feat: register per-volume workspace endpoints and chosen-node intent 2026-11-15 14:24:53 -08:00
pingqiu 9b4d8e1598 Merge remote-tracking branch 'origin/main' into feat/recovery-watchdog
# Conflicts:
#	cmd/blockvolume/main.go
2026-11-15 14:06:21 -08:00
pingqiuandClaude Opus 5.5 e3a0495003 authority, master: refuse a report that names the same slot twice
Review of #134 r2 (one P2): duplicate volume/replica keys in one report
were accepted. The health transition compared against the first prior
match while every entry was stored, so repeating [healthy, unhealthy]
for one key invented a replica_unhealthy event that did not describe
the stored slot.

The observation store now refuses an observation with a repeated slot
key (ErrInvalidObservation) before any mutation, so no transition and
no store change result; validateHeartbeat refuses it at the RPC with
the offending indices. Distinct slots are unchanged.

TestStatusFrontendsForAssignedVolume_DedupesRepeatedFacts ingested its
fact through a heartbeat that repeated the slot; what it pins is the
status dedupe over repeated replica IDs, so it now ingests the fact
once. No production heartbeat repeats a slot (one slot per blockvolume
process).

Refs #128

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 13:51:25 -08:00
pingqiuandClaude Opus 5.5 d44bae2eea authority, master: duplicate slot keys in one report must be refused (RED)
Review of #134 r2: store controls (conflicting and identical duplicate
volume/replica keys refused with no transition and no mutation; distinct
slots still yield one transition each) and an RPC control (a duplicate-slot
heartbeat is refused; status and timeline unchanged).

Refs #128

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 13:46:33 -08:00
pingqiuandClaude Opus 5.5 774dee5403 volume, master: bind watchdog readiness to the watched epoch, G1 first; derive health events from the accepted ingest
codex01's AMEND on #134 (three P2s; the disarm policy is unchanged):

1. Only a ready fact for the watched primary epoch clears or disarms
   the watchdog. The full promotion fact is passed and its epoch is
   compared with the watched epoch under the watchdog lock, so an
   engine still ready at an older epoch (its new assignment refused at
   admission) cannot disarm the new assignment, and an assignment that
   advances while the fact is read is not cleared by it.
2. The G1 role-admission latch of a primary-assigned replica is checked
   before readiness: it reports role_admission_failed for as long as it
   holds, whatever an older engine-ready fact says.
3. Health events come from the accepted store mutation itself:
   ObservationStore.IngestWithHealthTransitions returns, under the
   store lock, each slot whose unhealthy reason the accepted report
   changed against the same server's previously stored fact. A refused
   report yields none and expiry never fabricates a clear. The master
   ingests and records those events under healthMu, so events follow
   accepted order across concurrent heartbeats.

Lock order: healthMu -> store.mu (released inside ingest) -> event
ring; nothing else takes healthMu, and neither the store nor the ring
calls back into the host. The watchdog keeps its own mutex and calls
nothing while holding it.

Refs #128

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 13:39:10 -08:00
pingqiuandClaude Opus 5.5 31db16dbb3 volume, master: watchdog review controls (RED)
Controls for codex01's AMEND on #134 (three P2s), with the API shape
only (the watchdog takes the promotion fact's epoch; the store can
return accepted health transitions; the master Host has healthMu), the
behavior still as in 845bdc0:

- real host: ready at epoch 2, the epoch-3 primary assignment refused
  at admission (peer-set install fails): the engine still ready at
  epoch 2 must not disarm epoch 3, which times out; a genuine epoch-3
  ready fact clears it;
- real host: a ready primary whose epoch-3 role call fails (G1 latch)
  must report role_admission_failed despite its old ready fact; a
  successful redelivery clears it;
- master: a second heartbeat landing between the first one's ingest and
  its event bookkeeping must leave both events, in accepted order;
- master: expiry during an ingest that reports unhealthy again must not
  fabricate a clear;
- control: a refused older heartbeat records nothing.

Refs #128

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 13:36:25 -08:00
pingqiuandClaude Opus 5.5 845bdc0a63 volume, master: watchdog disarm and incarnation re-arm controls
claude05 accepted the disarm rule (21:24Z): after a fresh ready fact
clears it, the watchdog stays disarmed until the next primary epoch or a
new process incarnation. Tests:

- ready, then not ready an hour later on the same incarnation (and the
  same assignment replayed): no recovery_timeout;
- a restarted process (new incarnation, same primary epoch) is re-armed
  and reports recovery_timeout past the timeout, while the old process
  stays disarmed;
- master: a running primary that degrades on the same incarnation (no
  unhealthy reason) follows the normal failover rules to the qualified
  peer, and nothing is listed as unhealthy.

Doc only otherwise: the watchdog comment names the incarnation re-arm.

Refs #128

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 13:25:46 -08:00
pingqiuandClaude Opus 5.5 81575168cc volume, master: recovery watchdog reports an explicit unhealthy fact (#128 rule 6)
Volume: a replica holding the PRIMARY assignment that has not produced
the engine's promotion-ready fact within --recover-timeout (default 30s,
from the primary assignment in this incarnation) reports
Eligible=false with unhealthy_reason=recovery_timeout instead of staying
silently not-ready. The G1 role-admission latch of a primary-assigned
replica reports role_admission_failed. A fresh ready fact clears it
(Eligible=true, reason empty) and disarms the watchdog until the next
primary epoch. Supporting replicas are never flagged; /status shows
their catch-up state (elapsed, lag).

Master: an explicit unhealthy slot is ineligible, so it gets no boot
grace and fails over at once to a peer that passes the promotion
evidence gate; with no qualified peer nobody is promoted. The reason is
listed in QueryVolumeStatus (unhealthy_replicas) and recorded as
replica_unhealthy / replica_unhealthy_cleared events when a slot's
stored reason changes.

wal_corrupt and io_error need typed failures from the durable recovery
path: tracked as a follow-up issue.

Lock order: the watchdog has its own mutex and calls nothing while
holding it; the master's transition check reads the observation store
before and after ingest and appends to the event ring, holding neither.

Refs #128

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 13:20:13 -08:00
pingqiuandClaude Opus 5.5 4a7e00dc99 volume, master: recovery watchdog declarations and controls (RED)
#128 rule 6 (claude05's rulings 21:07Z): declarations with the decision
stubbed, plus the controls.

- proto: HeartbeatSlot.unhealthy_reason (13); StatusResponse
  .unhealthy_replicas (9) with ReplicaUnhealthy (regenerated with the
  checked-in generator versions; the gRPC file is unchanged).
- authority: SlotFact/HeartbeatSlot.UnhealthyReason (raw fact).
- volume: the recovery watchdog type and Host wiring (primary
  assignment, supporting admission, heartbeat Eligible/UnhealthyReason,
  /status UnhealthyReason and CatchUp), --recover-timeout on blockvolume
  (default 30s, logged at start); its decision is stubbed here.
- controls: a primary-assigned not-ready replica past the timeout
  reports Eligible=false + recovery_timeout; ready clears it and
  disarms the watchdog, a new primary epoch re-arms it; the G1 latch
  reports role_admission_failed; /status shows the reason and a
  supporting replica's catch-up state; the master promotes nobody
  without a qualified peer and shows the reason in volume status and as
  replica_unhealthy / replica_unhealthy_cleared events. Controls that
  pass on both sides: a supporting replica is never flagged; an
  unhealthy primary fails over at once to a qualified peer.

Refs #128

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 13:16:43 -08:00
pingqiu 2427e765e2 test: keep clean move precondition negatives on the same replica 2026-11-15 13:13:50 -08:00