Commit Graph
1087 Commits
Author SHA1 Message Date
pingqiu fe17169c74 test(gc): retain unbound-needle uncertainty on early mark lookup failure 2026-11-15 14:52:51 -08:00
pingqiu 16a27917ae fix(gc): retain partial effects and unknown write outcomes in CLI failures 2026-11-15 14:35:18 -08:00
pingqiu efe65dbc4e test(gc): expose lost final-mark response and partial-effect reporting gaps 2026-11-15 14:34:31 -08:00
pingqiu 9b2e68b42b test(gc): validate persisted fsync rule as filer JSON 2026-11-15 14:25:52 -08:00
pingqiu 1a9483d08f test(gc): bind real-service loop to durable M4 filer configuration 2026-11-15 14:25:05 -08:00
pingqiu 4517abdd94 test(cli): retain unbound needles and refuse invalid admission before effects 2026-11-15 14:20:02 -08:00
pingqiu 45d5a789e6 test(cli): require actual issued epoch and remote takeover before intent expiry 2026-11-15 14:20:02 -08:00
pingqiu 7d40a0e205 fix(gc): accept SeaweedFS completed-delete status and verify raw needle absence 2026-11-15 14:20:02 -08:00
pingqiu 1fc3d1f45b test(gc): require the SeaweedFS completed-delete HTTP 202 response 2026-11-15 14:20:02 -08:00
pingqiu d88b2966cd docs(gc): describe preview, apply, authority and persistent mark contract 2026-11-15 14:20:02 -08:00
pingqiu 134b6f0d13 test(cli): exercise GC through real blockmaster and SeaweedFS services 2026-11-15 14:20:02 -08:00
pingqiu b4fa177cbd test(gc): cover persistent two-mark admission and non-mutating previews 2026-11-15 14:20:02 -08:00
pingqiu e17b350c7d feat(cli): expose read-only chunk GC preview and explicit apply with persisted marks 2026-11-15 14:20:02 -08:00
pingqiu 6a449a1447 test(cli): require a read-only chunk gc entrypoint and root report 2026-11-15 14:20:02 -08:00
Ping Qiu fd7da7a760 Merge pull request #134 from seaweedfs/feat/recovery-watchdog
volume, master: recovery watchdog reports an explicit unhealthy fact
2026-11-15 14:08:02 -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
Ping Qiu 4f1cb20150 Merge pull request #138 from seaweedfs/fix/testops-backslash-run-id
fix: reject backslash run IDs on Linux
2026-11-15 14:03:25 -08:00
Ping Qiu 95e32afc8a Merge pull request #135 from seaweedfs/feat/blockvolume-workspace-lease
feat: self-fence workspace blockvolume on lease loss
2026-11-15 14:03:17 -08:00
Ping Qiu e93bb40fa2 Merge pull request #132 from seaweedfs/fix/workspace-move-same-replica
workspace: preserve logical replica identity during moves
2026-11-15 14:03:08 -08:00
Ping Qiu 3598e518f8 Merge pull request #131 from seaweedfs/fix/chunk-unknown-path-json-404
volume: answer an unknown /chunk/* path with a typed JSON 404
2026-11-15 14:03:01 -08:00
pingqiu 867b2d8eed fix: reject backslash run IDs on every platform 2026-11-15 13:52:53 -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
pingqiu a42b54235c fix: make workspace host fencing terminal across guard installation 2026-11-15 13:43:46 -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
pingqiu 69e9fbc4fe feat: enforce workspace leases in the blockvolume lifecycle 2026-11-15 13:35:18 -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
pingqiu 38ad04b42f fix: preserve logical replica identity across workspace moves 2026-11-15 13:04:43 -08:00
pingqiuandClaude Opus 5.5 4137710c6b volume: answer an unknown /chunk/* path with a typed JSON 404
Every /chunk error is a typed JSON body (B9 codes plus the 2026-11-15
transport errors), except an unknown path, which fell through to
net/http's plain-text "404 page not found". A catch-all /chunk/ route
now answers 404 {"code":"not_found","retryable":false}. The known routes
are unchanged; with the endpoint disabled, /chunk is still not mounted.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 13:04:05 -08:00
pingqiuandClaude Opus 5.5 1bc9251c0c volume: an unknown /chunk/* path must answer a typed JSON 404 (RED)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 13:03:43 -08:00
Ping Qiu 77ba7a3612 Merge pull request #130 from seaweedfs/fix/primary-boot-grace
authority: keep a restarted primary through one bounded boot grace
2026-11-15 13:01:52 -08:00
Ping Qiu f7ec7b0999 Merge pull request #124 from seaweedfs/blockc/chunk-reconcile-w3b
storage, durable: reconcile an unknown dirty set in the background; no HEAD moves meanwhile
2026-11-15 13:01:44 -08:00
Ping Qiu 71a4d33a02 Merge pull request #118 from seaweedfs/blockc/chunk-cut-scheduler-w3
durable, storage: automatic chunk cuts (timer + dirty threshold) with cut stats
2026-11-15 13:01:31 -08:00
Ping Qiu 46810e1c48 Merge pull request #127 from seaweedfs/test/duallane-pushlive-seal
component: push-live-during-rebuild test accepts the production caller's race outcomes
2026-11-15 13:01:22 -08:00
Ping Qiu 4ba41fe0db Merge pull request #125 from seaweedfs/test/conformance-post-close-ack
conformance: a completed session reaches healthy only after its post-close durable ack
2026-11-15 13:01:14 -08:00
Ping Qiu 1055ba0d91 Merge pull request #129 from seaweedfs/fix/legacy-post-close-durable-ack
transport: legacy catch-up and rebuild send the post-close durable ack
2026-11-15 13:01:05 -08:00
Ping Qiu 74617bdd9a Merge pull request #126 from seaweedfs/fix/gc-composed-head-fixtures
test(gc): preserve HEAD frontier in reachability fixtures
2026-11-15 13:00:56 -08:00
pingqiuandClaude Opus 5.5 e5f0c4728e master: re-probe only on a ready AND placeable newer current fact
Review of #130 r5 (one P2): the recovery re-probe triggered on the
newer heartbeat's ReadyForPrimary bit alone. A newer engine-ready but
ineligible, withdrawn or unreachable heartbeat, with the frontend now
ready, led to a re-probe that returned the current primary ready, so
the gate skipped its placeability check and preserved an excluded
primary.

The trigger is now the whole fresh verdict: the newer fact must be
ready and placeable (reachable, eligible, not withdrawn). An excluded
newer fact causes no re-probe, so the first verdict and the gate's
fresh placeability/grace check decide, and the failover stands.

Refs #128

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 12:42:50 -08:00
pingqiuandClaude Opus 5.5 67dedbe047 master: boot-grace r5 review counter-controls (RED)
Counter-controls for the review of #130 r5 (tests only, on 6989dfd),
through the real workload-plan provider with the peer query held: the
frontend finishes recovery but the newer heartbeat, though engine-ready,
excludes the current primary (ineligible, withdrawn, unreachable). The
failover must stand; frontend readiness must not preserve an excluded
primary. The recovered-placeable positives and the engine-ready /
frontend-unready counter-control are unchanged.

Refs #128

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 12:38:43 -08:00
pingqiuandClaude Opus 5.5 7b7877e16f storage: reconciliation is owned by a generation; a BASE install supersedes a running worker
Every reconciliation start and every BeginBaseInstall bumps a generation.
A worker selects slices, records compare results and certifies the dirty
set only while its own generation is current, so:
- a worker running when a BASE install begins can no longer finish over
  it and clear the install guard (Base=Installing), in memory or on disk;
  finishReconcile also refuses while the guard is set (two independent
  guards);
- a worker that saw its set empty, or compared a chunk, before a BASE
  install restarted reconciliation can neither certify the replacement
  run nor delete from its set.
A replaced run closes its channel, and waitReconciled re-checks against
the current run.

Deterministic schedules (test hook at slice, compare and certify):
- held worker -> BeginBaseInstall -> worker resumes: cuts stay refused
  as base_installing, the persisted header keeps Installing, a restart
  still refuses;
- old worker paused at certify -> Begin/EndBaseInstall -> old resumes:
  the replacement stays reconciling and untouched, cuts refused;
- old worker paused after a compare -> Begin/End -> old resumes: the
  replacement set is untouched.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 12:31:49 -08:00
pingqiuandClaude Opus 5.5 3dfb612a80 storage: Recover holds the capture barrier shared, like a write
Recover republishes the dirty map but did not take captureMu, so it could
run inside a quiesced cut: after the cut's Sync fixed H and before its
copy, a same-open Recover could publish a newer complete record (H+1) and
the cut would copy those bytes into a HEAD labelled H. Recover now holds
captureMu shared (order captureMu -> lifecycleMu -> mu), as Write,
WriteBatch, ApplyEntry and WriteExtentDirect do; nothing calls Recover
under captureMu.

Control: a real partial batch pwrite leaves a complete record at H+1; the
cut parks right after its barrier Sync fixed H and starts a same-open
Recover, which waits for the barrier; HEAD at H holds no post-H bytes and
the next cut publishes the recovered bytes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 12:31:49 -08:00
pingqiuandClaude Opus 5.5 df06318ef9 volume: a /chunk operation refused while reconciling answers 409 reconciling
The typed control codes map every unlisted cause to 500 internal, so a cut
refused while the layer reconciles its dirty set (and a detach whose
deadline ended during reconciliation) reported internal. They now answer
409 with code reconciling, retryable, as ruled for the reconciler.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 12:31:49 -08:00
pingqiuandClaude Opus 5.5 b88e7f6997 storage, durable: reconcile an unknown dirty set in the background; no HEAD moves meanwhile
When a layer's dirty set is unknown, its first cut used to hash-compare
every chunk under the capture barrier, which paused writes for a
whole-volume copy. The unknown case is a lost or mismatched bitmap, or
a BASE install that just finished.

Now the layer reconciles in the background, outside the barrier:
- The reconcile set is every chunk with a local copy (an absent chunk
  never written locally is HEAD's content).
- A layer-owned reconciler, joined on Close, takes bounded slices. Per
  chunk it reads through the normal read path, hashes, and compares
  with HEAD; a mismatch sets the chunk's dirty bit. A write racing the
  comparison marks its chunk dirty anyway.
- When the set is empty, the dirty set is saved first, then a header
  naming HEAD. A crash between the two leaves a mismatching header, so
  the next attach reconciles again rather than trusting an incomplete
  bitmap. Then cuts resume, uploading only dirty chunks.

While reconciling, no HEAD moves:
- Cut, Capture and MakeRemoteDurable return ErrChunkReconciling
  (retryable).
- Detach waits for reconciliation within its deadline, then makes its
  normal cut; otherwise ErrChunkReconciling.
- The automatic cut scheduler skips the tick (not a failure, no
  backoff).

A fresh host (FreshFromHead) starts with an empty dirty set instead of
an unknown one. Its local volume is new and accepts no write before
attach, so a new volume never reconciles.

Stats gains Reconciling and ReconcileDone/ReconcileTotal. DirtyChunks
(the scheduler's threshold) does not count chunks awaiting
reconciliation.

Test changes:
- The storage fixture waits for reconciliation after attach.
- The BASE tests wait after EndBaseInstall.
- The chunkstore source-host fixtures (including the catalog fork test)
  attach as fresh hosts, which is what a new empty volume is.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 12:31:49 -08:00
pingqiuandClaude Opus 5.5 6989dfd838 master: re-probe when the current primary reports ready during the promotion probe
Review of #130 r4 (one P2): the production provider probes the current
primary first, then the peers. If the current primary's frontend
finished recovery and a newer ready heartbeat arrived during the peer
queries, both gates ended its grace but still direct-reassigned from the
probe's outdated Current.Ready=false.

Both gates now go through probePromotionCandidatesCurrent: when the
current primary's own fresh heartbeat advanced to ready (a newer fact or
a new incarnation) while the probe ran and the probe said it was not
ready, the probe is run once more and that fresh result decides. A
heartbeat is never taken as frontend readiness: if the fresh probe still
finds the frontend unready, the failover stands; a heartbeat already
ready before the probe causes no re-probe.

Refs #128

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 12:27:43 -08:00
pingqiuandClaude Opus 5.5 b2e79c8457 master: boot-grace r4 review controls through the production probe (RED)
Controls for the review of #130 r4 (tests only, on bb37750), using the
real workload-plan promotion provider over fake /status servers. The
provider probes the current primary first, then the peers; the peer
query is held while the current primary's frontend finishes recovery
and a newer ready heartbeat arrives. The gate must not direct-reassign
from the probe's outdated current verdict (unsupported and supported
paths). Counter-control: a newer engine-ready heartbeat while the
frontend is still unready still fails over.

Refs #128

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 12:23:32 -08:00
pingqiuandClaude Opus 5.5 81f05c9f08 storage: Recover counts a mutation of every chunk, so no staged pre-copy is reused across it
Recover republishes the dirty map outside the write path: a partial batch
append can leave a complete newer record that same-open Recover publishes.
It only invalidated the WAL-sync coverage generation, so a chunk staged
before it could be reused over the recovered bytes. Recover now tells an
attached chunk layer, which counts a mutation of every chunk (O(chunks),
recovery only), also on a failed or partial scan, before s.mu is released
so no read sees recovered bytes first.

Control: stage chunk 0, then a real partial batch pwrite and same-open
Recover before the barrier: HEAD at the recovered H has the recovered
bytes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 12:11:08 -08:00