Commit Graph
1135 Commits
Author SHA1 Message Date
Ping Qiu 39b59b6579 Merge pull request #147 from seaweedfs/test/c2-dense-lsn-flake-claude04
transport: make the C2 dense-LSN edge test deterministic
2026-11-15 20:29:38 -08:00
pingqiuandClaude Opus 5.5 90c4fc6cb3 transport: make the C2 dense-LSN edge test deterministic
TestC2_NoGapDenseLSNEdge asserted that a Realtime NotifyAppend at the
dense edge (cursor=10, head=11, lsn=11) emits EmitKindLive, while the
shipper's 2 ms timer drain was running. When a tick landed between
primary.Write and NotifyAppend, the timer shipped lsn 11 from substrate
first (EmitKindBacklog, debt-first per §6.3) and NotifyAppend took the
idempotent skip, so the test saw kind=1. That is correct product
behavior: the entry ships exactly once at the right LSN, and the kind
tag is observability only (WALKindBacklog vs WALKindSessionLive
counters; the LiveTail probe is marker-only).

- TestC2_NoGapDenseLSNEdge now disables the timer drain and drains the
  initial backlog with DrainBacklog, so the Live assertion no longer
  depends on scheduling.
- New TestC2_DenseLSNEdge_TimerWinsRace_ShipsOnce pins the other order
  deterministically: the timer ships the new entry before NotifyAppend
  arrives; NotifyAppend returns nil and does not emit again.

No product change, no timeout changes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 16:58:10 -08:00
Ping Qiu 9c29ee9c42 Merge pull request #142 from seaweedfs/feat/chunk-retention
chunkstore: snapshot retention and space accounting (part 1)
2026-11-15 16:47:14 -08:00
pingqiuandClaude Opus 5.5 a219a8a75d Merge origin/main (9735219) into feat/chunk-retention
Conflict in cmd/sw-block/chunk.go resolved as the union: the usage
string lists cut|snapshot|snapshots|snapshot-delete|fork|detach|show|
gc|usage|retain, and the switch keeps #140's "gc" case with "usage"
and "retain".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 16:44:51 -08:00
Ping Qiu 9735219581 Merge pull request #144 from seaweedfs/fix/pillar3-samelba-deterministic-claude04
test: make Pillar3 SameLBAArbitration deterministic with a pre-barrier hold
2026-11-15 16:43:05 -08:00
Ping Qiu 25e0dbdb5b Merge pull request #141 from seaweedfs/feat/workspace-volume-bindings
feat: prepare per-volume workspace endpoints and chosen-node placement
2026-11-15 16:42:56 -08:00
Ping Qiu 569def89e1 Merge pull request #140 from seaweedfs/feat/chunk-gc-cli
Expose chunk GC preview and explicit apply with blockmaster authority
2026-11-15 16:42:47 -08:00
Ping Qiu 4e5da657f5 Merge pull request #136 from seaweedfs/blockc/ublk-frontend-m5
ublk frontend: serve a volume as /dev/ublkbN (io_uring command queues)
2026-11-15 16:42:37 -08:00
Ping Qiu 48fae0300d Merge pull request #139 from seaweedfs/feat/typed-recovery-reasons
volume: report wal_corrupt / io_error from a failed durable recovery at once
2026-11-15 16:42:27 -08:00
pingqiuandClaude Opus 5.5 78f56c31d8 test: release the stale-BASE hold with a defer, before executor shutdown
Review follow-up: the release was a t.Cleanup registered before Start, and
cleanups run LIFO, so the executor shutdown Start registers ran first; a
t.Fatal while the base frame was held would deadlock StopAndWait. A defer
inside the scenario runs before every t.Cleanup, including on t.Fatal.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 16:07:23 -08:00
pingqiuandClaude Opus 5.5 1b764f1b3b chunkstore: claim cleanup conditioned on the state it read
dropForkClaim's write is conditioned on {state, claims} as read; a lost
condition re-reads a fresh copy, so delete metadata is never
overwritten. (With the shared mark path a delete also clears the dead
claim first, which changes the condition on its own.)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 16:03:35 -08:00
pingqiuandClaude Opus 5.5 cbe6e8e150 chunkstore: RED control: claim cleanup never undoes a delete
Review of 02d0631 (P2): dropForkClaim conditioned its write on the
claims only, so a completed fork's cleanup that read the parent, paused
while an explicit delete marked it, then wrote back its stale copy,
resurrecting an unnamed active snapshot. TestCatalog_ClaimCleanupNever
UndoesADelete fails against the old cleanup condition and the old
(claim-blind) delete mark, restored as stubs: state "active",
deleted_ns gone.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 16:03:35 -08:00
pingqiuandClaude Opus 5.5 e7fc9a5254 chunkstore: one mark path for retention and explicit delete
markDeleting is the only way an attempt is marked deleting: conditioned
on {state active, gen, no claims}, dead claims cleared first, a lost
condition decided again. Retain keeps a claimed snapshot (fork_held);
DeleteSnapshot refuses it with snapshot_claimed naming the fork
(claude05's ruling, 23:58Z).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 16:01:55 -08:00
pingqiuandClaude Opus 5.5 6db62358fe chunkstore: RED control: delete refuses a fork-claimed parent
claude05's ruling (2026-11-15 23:58Z): an explicit DeleteSnapshot of
a snapshot an incomplete fork claims is refused with snapshot_claimed
(409, not retryable, naming the fork volume); a completed or aborted
fork no longer blocks. Controls, failing against the old mark (blind to
claims) restored as a stub: TestCatalog_DeleteRefusesAClaimedParent, the
409 mapping, the real-filer refusal in TestIntegration_RetainHeldSchedules,
and TestFork_IncompleteRetryBoundToOriginalImage, which now expects the
refusal and drops the claim (as a pre-claim fork) to keep testing the
image binding.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 16:01:54 -08:00
pingqiuandClaude Opus 5.5 02fb0914b4 test: Pillar3 SameLBAArbitration holds a stale BASE frame instead of a pre-barrier hook
Review follow-up. The pre-barrier hold proved in-session delivery and
convergence but no longer the test's point: a newer WAL write for an LBA must
win over an OLDER base frame for that LBA that arrives later.

Drop the production SetPreBarrierHook seam (core/recovery is back to main)
and hold the base lane instead, through the existing WithPrimaryStorageWrap:
staleBaseHold captures the base read of LBA 5 (old value A) and holds it; the
test pushes the same-LBA overwrites (the session cannot seal its recovery cut
while base is held, so they ship in-session: this is also what fixes the
flake), waits until the replica holds B at LBA 5, then releases the stale A
frame. Convergence requires LBA 5 == B: RebuildSession.ApplyBaseBlock must
skip a base frame for an LBA the WAL lane already applied (bitmap).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 15:57:37 -08:00
pingqiuandClaude Opus 5.5 02d06311f9 chunkstore: fork claims on the parent snapshot entry
Replaces the separate hold objects with one conditional write on the
parent attempt's own entry (codex01's design):

- Fork adds its claim (target/request) to the entry before using it,
  conditioned on {state active, claims as read}; a deleting parent is
  refused. It removes its claim once its HEAD exists (or a sweep's
  tombstone settles the target).
- Retain marks deleting only conditioned on {state active, gen, no
  claims}; a lost condition re-reads and decides again. Claims that
  can never matter (target has a HEAD, or its VOLUME is another
  request's) are cleared conditionally first; any other claim keeps the
  snapshot, with no lifetime. No listing, so no paging.
- A dry run lists attempts a stopped pass left deleting, as apply
  frees them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 15:53:04 -08:00
pingqiuandClaude Opus 5.5 6a41bc40bb chunkstore: RED controls for fork claims on the parent entry
Controls for the four fork schedules of the second review, failing
against stubs where Fork writes no claim, the delete mark is not
conditioned on claims, and a dry run omits unfinished deleting
attempts:

- a fork claiming between retention's check and its mark (unit and
  real filer);
- a fork that died before its VOLUME keeps the parent 30 days later;
- a refused same-target request leaves the first request's claim;
- a dry run lists the attempt a lost response left deleting.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 15:53:04 -08:00
pingqiuandClaude Opus 5.5 16f22e903a test: make Pillar3 SameLBAArbitration deterministic with a pre-barrier hold
TestPillar3Slice2_EngineDriven_SameLBAArbitration was flaky (on main baca5fd,
-race -count=40: 25/40 failures at -cpu 1, 6/40 at -cpu 2, 1/40 at -cpu 4).
Root cause is a timing assumption in the test, not a product race: with a
12-LBA backlog, base copy and DrainBacklog finish in microseconds and
Sender.Run seals the recovery cut (SealBeforeBarrier) before the test pushes
its same-LBA overwrites. PushLiveWrite then returns ErrSinkBarrierSealed,
the documented 'retain the WAL entry for replay' outcome that production
FeedLiveWrite maps to LiveWriteRetained, and the test treated it as fatal.
Once in a while the whole session also finished inside waitBridgeLiveReady's
1 ms poll gap.

Tolerating the error would defeat the test (the overwrites would never ship
in-session, so convergence could not be checked), and a larger backlog would
only shift the timing. Instead add a test-only hook,
PrimaryBridge.SetPreBarrierHook: each sender runs it after base + backlog
drain and before SealBeforeBarrier. The test installs it before the probe
that starts the rebuild, waits until the sender reaches it (session live,
cut not made), pushes the overwrites, releases, and asserts convergence.
With no hook installed the sender path is unchanged.

The now-unused waitBridgeLiveReady helper in this package is removed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 15:48:26 -08:00
pingqiuandClaude Opus 5.5 56300cc6c1 chunkstore: attempt-bound retention, fork holds, rolling windows
- Retain deletes the exact attempt it planned: the attempt's entry is
  marked deleting conditionally and the name record is removed only
  while it names that attempt; a replacement is reported as replaced.
- Fork records a hold (forkholds/<name>/<attempt>/<target>) before it
  reads the parent. Retain marks first, then reads the holds: a live
  hold reverts the mark (fork_held); a fork holding after that read
  finds the attempt deleting and refuses before installing anything.
  A hold counts while its target has no HEAD and its VOLUME records the
  fork, or while it is younger than the operation deadline.
- A pass stopped after a mark finishes (or reverts) it on the next run.
- Log-spaced keeps use rolling windows anchored at now.
- Exclusive bytes resolve "@owner/key" refs and count every volume's
  HEAD and live snapshots as holders; documented as eligible for GC
  subject to its grace period and intents.
- Retain reports confirmed deletions, the failing snapshot (uncertain
  or not) and what it never reached; the CLI prints them with the
  error and exits nonzero.
- chunkControl.Snapshot validates the class before any cut;
  invalid_class and invalid_policy map to 400.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 15:36:46 -08:00
pingqiuandClaude Opus 5.5 23d125daa7 chunkstore: RED controls for the retention review
Controls for the six review findings on retention, failing against
stubs that restore each old behaviour:

- a same-name pinned replacement made after planning is deleted
  (retain deletes by name);
- a fork that starts after the scan loses its parent; a stale hold;
  a fork after the hold check;
- log-spaced keeps use calendar periods (10:20 and 09:50 both kept
  at 10:30 with keep-hourly 1);
- exclusive bytes ignore a fork's "@owner/key" holders;
- a failing pass discards its partial result (catalog and CLI);
- an invalid class cuts before it is refused, and maps to 409.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 15:36:46 -08:00
pingqiuandClaude Opus 5.5 4e5ff2cc95 chunkstore: snapshot retention and space accounting
claude05's rulings (2026-11-15 22:53Z).

Retention, policy on the VOLUME entry: keep the newest KeepNewest
unpinned snapshots, every pinned snapshot not yet past its ExpiresAtNs,
every snapshot younger than KeepYounger (a future creation time from
clock skew counts as young), the newest snapshot of each of the last
KeepHourly / KeepDaily / KeepWeekly periods, and every snapshot a fork
still needs (named by a fork whose HEAD is absent or aborted). Everything
else is deleted through DeleteSnapshot (attempt-scoped tombstones; HEAD
untouched; names freed); GC reclaims the chunks. Equal creation times
rank by name. Semantic and labeled snapshots are not exempt; a pinned
snapshot past its expiry is unpinned. Defaults: 10 newest, 1h. A dry run
plans and writes nothing. The policy is stored as extended attributes on
the VOLUME entry, conditional on a revision.

Accounting, from manifests and filer listings (no data reads; a chunk is
ChunkBlocks x BlockSize, the last clipped): live bytes from HEAD;
per-snapshot exclusive bytes (referenced by no other holder); stored
bytes from the volume's chunk-key bindings, exact for referenced keys
and a full chunk (an upper bound, flagged) for the rest. The
unreferenced-not-yet-collected bytes come from GC's preview once #140
merges; bytes uploaded since creation need a counter (follow-up).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 15:08:17 -08:00
pingqiuandClaude Opus 5.5 81e0ea7392 chunkstore, volume, sw-block: snapshot retention and space accounting surfaces (RED)
claude05's rulings (2026-11-15 22:53Z): the surfaces and the controls,
with the behavior stubbed (the planner keeps everything, the policy is
not stored, usage reports nothing, no fork needs a parent, the class is
neither validated nor stored).

- chunkstore: snapshot class (semantic / pinned) on the snapshot;
  RetentionPolicy stored on the VOLUME entry (extended attributes, CAS on
  a revision); planRetention / Retain [dry run]; Usage (live, per-snapshot
  exclusive, stored bytes).
- volume: GET /status/chunk?volume= (usage and policy); the snapshot
  route carries "class".
- sw-block: ops chunk usage, ops chunk retain [--dry-run | --set-policy
  --keep-*], snapshot --class / --pin / --expires.
- controls: policy edges (newest N with name tie-break; pinned never
  expired by count or age but unpinned past its expiry; semantic and
  labeled snapshots not exempt; younger than T and clock skew; hourly
  buckets; fork parent), an agent checkpointing every step stays bounded,
  dry run writes nothing, retain keeps N + pinned and frees names, the
  policy CAS, class validation, an incomplete fork's parent kept, usage
  from manifests; CLI usage/retain; and a real-service test against
  SeaweedFS (chunkstore_integration, CHUNKSTORE_WEED): N+5 snapshots plus
  pinned ones -> retain leaves N + pinned, accounting follows.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 15:08:17 -08:00
pingqiu 28e8b293d3 fix: validate workspace ownership through authority publication 2026-11-15 15:07:19 -08:00
pingqiu 74707a62a6 test(gc): separate master configuration from unrelated chunk upload callers 2026-11-15 15:03:25 -08:00
pingqiu bc76074646 fix(gc): initialize unbound-needle uncertainty before early errors 2026-11-15 14:53:04 -08:00
pingqiu fe17169c74 test(gc): retain unbound-needle uncertainty on early mark lookup failure 2026-11-15 14:52:51 -08:00
pingqiu a42401ef6a fix: close workspace binding admission and retirement schedules 2026-11-15 14:45:35 -08:00
pingqiuandClaude Opus 5.5 32f02ebbd8 ublk: Start after Close refuses; delete the device unless a queue is still running; report unexpected completions
- Close marks the target closed before its once-only close; a later
  Start refuses before creating anything (a Start in progress holds the
  target lock, so Close waits for it and then closes its device).
- teardown skips DEL_DEV only when settleQueues reports a queue whose
  thread is still running (leaked); a stopped queue's error is reported
  and the device is still deleted.
- A FETCH/COMMIT completion that is neither a new request nor the abort
  of a stopping device ends the tag and is joined into the queue's error.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 14:42:14 -08:00
pingqiuandClaude Opus 5.5 783a5d7a05 ublk: controls for Start after Close, the DEL_DEV decision and unexpected completions (RED)
Review r3 (6afa34ac), actual-caller controls with the old behaviour kept:
- a Start after Close must refuse (Close before Start consumed the once);
- the Close path (teardownWith, driven with a recording controller) must
  delete the device when every queue thread exited, even one that ended
  with an error; only a queue whose thread still runs keeps its mappings
  and suppresses DEL_DEV;
- a completion that is neither a new request nor the expected abort must
  be reported as the queue's error (onCQE, the loop's per-CQE path).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 14:41:57 -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
pingqiuandClaude Opus 5.5 184f755feb blockvolume, volume: report classifiable open failures too; document io_error
Review of #139 (codex01 AMEND):

1. #133 covers open AND replay. A classifiable EnsureStorage failure now
   takes the same fail-closed path as a replay failure: local readiness
   blocked (frontend I/O refused), the typed reason recorded through
   ReportLocalRecoveryFailure, and the process kept up serving status and
   heartbeats, so a primary assignment reports it at once. An open
   failure that cannot be classified exits as before.
2. io_error is documented as deliberately broad: the volume's local
   storage could not be opened or read at startup. A path error such as
   ENOENT, EACCES or EISDIR is io_error too, which says the storage is
   unusable, not that the disk is physically damaged. The underlying
   error stays in the readiness evidence and is now in the log line.

Refs #133

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 14:26:36 -08:00
pingqiuandClaude Opus 5.5 1e0e79e236 blockvolume: startup open-and-replay controls through the actual caller (RED)
Review of #139 (codex01 AMEND):

- main's durable open and replay move into openAndRecoverDurable (the
  function main now runs), with the open-path behavior unchanged here:
  any EnsureStorage failure still exits unreported.
- controls driving that function: a classifiable open failure (EIO path
  error; and a real provider whose volume file is truncated, so the magic
  read hits io.ErrUnexpectedEOF) must fault fail-closed and report
  io_error; an unclassified open failure stays fatal with no report; a
  replay failure faults and reports (a real provider's corrupted smartwal
  volume reports wal_corrupt); a clean recovery clears the block.
- classifier controls: ENOENT and EACCES path errors are io_error by
  contract (local storage unusable, not proof of disk damage); a WAL
  integrity fault wrapping a path error stays wal_corrupt.

Refs #133

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 14:26:36 -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 52cd6debc5 feat: register per-volume workspace endpoints and chosen-node intent 2026-11-15 14:24:53 -08:00
Ping Qiu baca5fd3a9 Merge pull request #137 from seaweedfs/fix/nvme-listener-readiness
fix: report frontend ready only after NVMe listener starts
2026-11-15 14:23:16 -08:00
pingqiuandClaude Opus 5.5 ae5f774b72 ublk: refuse any pre-existing device id; idempotent Target.Close; surface queue thread errors
- No automatic reclaim: Start refuses a /dev/ublkcN already present at
  the requested id, with an error naming it, before sending any command
  (the device-info read, pid probe and pid-namespace questions are gone).
  A device created by another starter between the check and ADD_DEV makes
  ADD_DEV itself fail (EEXIST); nothing is deleted. Removing a leftover
  device is a documented operator step (package doc).
- Target.Close runs the device close once; every caller, concurrent or
  later, gets that result.
- A queue thread's abnormal error, including a failed ring close, is kept
  and returned through the shutdown (settleQueues joins it).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 14:22:33 -08:00
pingqiuandClaude Opus 5.5 6d95280296 ublk: controls for refuse-on-pre-existing-id, idempotent Target.Close, surfaced queue errors (RED)
Review r2 (6afa2fe0): a pre-existing ublk id must be refused with zero
commands of any kind (no automatic reclaim: GET_DEV_INFO + pid probe +
numeric STOP/DEL races a replacement device, and ESRCH across PID
namespaces is no proof of death); concurrent and repeated Target.Close
callers must all get the first close's result; a queue thread's abnormal
error (failed ring, failed ring close) must reach the shutdown result.
The old behaviour fails all four.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 14:21:43 -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
pingqiuandClaude Opus 5.5 d990c86c70 volume: gofmt host.go (the comment above localRecoveryReason starts a new alignment group)
da2ad04 aligned the field to the wrong group; this is gofmt's own output.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 14:14:24 -08:00
pingqiuandClaude Opus 5.5 da2ad043ca volume: gofmt the localRecoveryReason field alignment
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 14:13:50 -08:00