Commit Graph
126 Commits
Author SHA1 Message Date
pingqiu 93d8e6cce9 Merge main and preserve detach fast-poll and urgent cut admission 2026-11-20 05:23:19 -08:00
pingqiuandClaude Opus 5.5 3de728e23d Clear lease stop-pending when a detach aborts and serving resumes
A detach whose final cut provably did not publish resumes serving, but
the stop-pending mark set at the start of the detach stayed latched on
the host and on its lease guard, so a host that kept serving renewed
about four times a second for good instead of once per renewal delay.

The detach hook now returns an attempt token, and the provider calls a
second hook with that token only after it resumed serving on a proven
abort. The host clears stop-pending, on itself and on its guard, only
for the latest attempt, so an older attempt's resume cannot clear a
newer pending detach; an applied, fenced or unknown outcome keeps it.

Tests: the guard's sleep is now observable through a scheduling seam,
so the cadence test asserts the delay chosen after each renewal and the
kick path separately, with no wall-clock window; the detach hook is
witnessed before the drain starts; test workers are joined, bounded and
failing on timeout, before their providers are closed. The invariants
document gains the StopPending mode of the lease guard (scheduling
only, no admission or ACK change) and INV-WS-STOP-PENDING-001. Comments
now say that 250 ms bounds the sleep after a completed renewal, not the
time from a revocation to its ACK.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 04:17:44 -08:00
pingqiuandClaude Opus 5.5 c0297da05a Poll the workspace lease fast once a detach starts
On a graceful stop the chunk layer is detached first and the master marks
the lease revoking right after, but the host's lease guard only learned of
the revocation on its next renewal, up to 10 s later (3-6 s measured), and
the guest's writes were refused all that time.

A detach now calls an optional provider hook, OnChunkDetach, which the
blockvolume host connects to its lease guard: the guard renews at once and
then every 250 ms until it fences. The pending mark is never cleared; a
detached host does not serve again under the same guard. The hook fires
only on the detach path, not on the lease-fence StopIO.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 04:17:28 -08:00
pingqiu 6f771c8169 durable: wire opt-in pre-copy into settled detach lifecycle 2026-11-20 03:43:25 -08:00
pingqiu 3eda912af8 fix: scope upload pacing and degraded cut admission honestly 2026-11-20 02:41:45 -08:00
pingqiu b621337dc6 Merge remote-tracking branch 'origin/main' into feat/host-cut-limiter
# Conflicts:
#	docs/design/invariants.md
2026-11-20 02:38:04 -08:00
Ping Qiu e6c74a55bc Merge pull request #285 from seaweedfs/feat/blockvolume-single-filer
blockvolume: refuse to start unless the chunk filer is the only filer
2026-11-20 01:37:09 -08:00
pingqiuandClaude Opus 5.5 961f08f66e chunkstore: the single filer must be the configured one, on every master
A pass now needs a master listing exactly the configured filer (same
gRPC port, same or co-resolving host). Every master is asked: any
master listing another filer or several refuses at once, whichever
answers first. Each master call is bounded within the remaining time,
so a stalled master no longer consumes the whole bound. Startup census
only; invariant INV-WS-SINGLE-FILER-001 and its M6 row record it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 00:53:13 -08:00
pingqiuandClaude Opus 5.5 a5785ff688 blockvolume: refuse to start unless the chunk filer is the only filer
Block metadata needs exactly one filer behind --chunk-filer. At startup
the chunk wiring asks that filer for its masters and filer group
(filer_pb.SeaweedFiler/GetFilerConfiguration), then the masters for the
filers of that group (master_pb.Seaweed/ListClusterNodes). It refuses
unless a master lists exactly one, and when it cannot get that answer
within 15 s. The filer subset gains GetFilerConfiguration and a master
subset carries ListClusterNodes, generated with the committed plugin
versions.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 00:20:10 -08:00
pingqiuandClaude Opus 5.5 26e34b6b9a test: expect the profile dir refused where SIGUSR1 is missing
On platforms without SIGUSR1 a set --cpu-profile-dir is refused in flag
parsing; the default (off) stays common to all platforms.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 23:57:18 -08:00
pingqiuandClaude Opus 5.5 fb939adb8a blockvolume: validate the profile dir before startup; stop joins the worker
parseFlags refuses an unusable --cpu-profile-dir (and a platform without
SIGUSR1) before run() activates anything; the handler is installed at
the top of run(). stop removes the handler, stops and joins the signal
worker, then writes out a running profile, so a buffered SIGUSR1 cannot
start a profile after it. Tests decompress the whole profile and check
that no profile runs after stop.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 23:47:25 -08:00
pingqiuandClaude Opus 5.5 39f011555a blockvolume: opt-in CPU profile toggled by SIGUSR1
--cpu-profile-dir (default $SWBLOCK_CPU_PROFILE_DIR) names an existing
directory; SIGUSR1 then starts a CPU profile written there as
blockvolume-<pid>-<n>.pprof and the next SIGUSR1 stops it. Shutdown
writes out a running profile. Unset (the default), nothing is installed
and blockvolume is unchanged. No port is opened, so a harness can
profile any running volume with kill -USR1.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 23:36:05 -08:00
pingqiu 76445f968e fix: reject ignored or invalid host limiter configuration 2026-11-19 23:04:56 -08:00
pingqiu 7ba1172b9a feat: isolate background fill and idle admission pools 2026-11-19 22:59:13 -08:00
pingqiu b1ecbee969 feat: coordinate host cut budgets with shared file-lock slots 2026-11-19 22:53:20 -08:00
pingqiu 5f68c2251b blockvolume: add a soft memory ceiling and process memory status 2026-11-19 20:16:34 -08:00
pingqiu 39aca2daee storage: expose configurable hydration limits and wait/fetch counters 2026-11-19 16:03:09 -08:00
pingqiu 13281568ef test: require configurable hydration worker and queue limits 2026-11-19 16:02:10 -08:00
Ping Qiu 83b0878864 Merge pull request #229 from seaweedfs/fix/chunk-refuses-replication
blockvolume: refuse replication on a walstore-chunk volume (RF1 only)
2026-11-19 06:34:38 -08:00
pingqiuandClaude Fable 5.2 9853ea8f10 Merge branch 'main' into fix/chunk-dirty-threshold-help
Resolve the conflict in the ProviderConfig comments: keep main's new DetachFreezeTimeout field and the corrected ChunkDirtyThreshold comment.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-19 03:06:52 -08:00
Ping Qiu fe3fe97489 Merge branch 'main' into fix/chunk-refuses-replication 2026-11-19 03:05:05 -08:00
pingqiu 608046e6cb fix: refuse missing open-only volumes before fresh sidecars 2026-11-19 00:33:10 -08:00
pingqiu 4055e403ea test: cover open-only geometry and disappearance race 2026-11-18 23:38:06 -08:00
pingqiu d102a1c1a3 fix: admit geometry only when creating durable storage 2026-11-18 23:37:14 -08:00
pingqiu 1e5fe198e3 test: preserve existing-volume create-geometry compatibility 2026-11-18 23:36:38 -08:00
pingqiuandClaude Fable 5.2 3e6e0c9603 blockvolume: correct the --chunk-dirty-threshold help text and comment
The flag help and the ChunkDirtyThreshold comment still described the
cut as it was before copy-before-write: "bound on one cut's barrier
copy" and "0 = unbounded".

Since the chunk copy moved out of the barrier, the value is the number
of candidate chunks above which a cut pre-copies (stages) chunks before
its barrier, in rounds of that size, and 0 disables pre-copy
(chunk_layer.go, stage: a bound <= 0 returns without staging).

Text only. No behaviour change.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-18 23:13:32 -08:00
pingqiu a9a2cfa936 style: group create-admission imports 2026-11-18 23:10:20 -08:00
pingqiu 9e809120f4 fix: admit original geometry before every durable create 2026-11-18 23:08:47 -08:00
pingqiu c4a37fd4a0 test: cover create admission callers and legacy retry 2026-11-18 23:07:15 -08:00
pingqiuandClaude Opus 5.5 f7e0823fc3 volume: bind the RF1 refusal to its epoch
Review fold (P1): the refusal had no epoch, so RF1@2 -> RF2@3 refused ->
a stale RF1@2 replay cleared it and reopened the old healthy view. The
host now records the highest refused epoch; an RF1 fact below it is stale
(not adopted, refusal kept), and the refusal is cleared only after the
role fence of a current-or-newer RF1 fact succeeds, never by a failed
attempt. Test with a real backend write schedule; ingress rows for legacy
and dual-lane, and no listener after the RF1 primary role.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 22:03:24 -08:00
pingqiuandClaude Opus 5.5 90ecf57c28 blockvolume: install the RF1 rule in the host before any fact is applied
Review fold (P2): SetReplicationVolume replays a retained RF2 fact before
SetSelfFence installs the ingress gate; with no self fence the host could
install the peer set, adopt and emit readiness. The rule now lives in the
host config (RF1Only, from hostConfig at construction): every fact with
replica slots, primary with peers or supporting replica, is refused before
UpdateReplicaSet, adoption or the ready marker, and latched as a role
admission failure; an RF1 fact clears it. The ingress gate stays as the
second layer. Tests: the start schedule (blocked readiness, stored RF2 fact,
replay with no self fence), supporting refusal, RF1 recovery, unset control;
ingress refusal with dual-lane on both ports, classified by
ingressPortReleased; hostConfig wiring.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 21:17:28 -08:00
pingqiuandClaude Opus 5.5 14282cb975 blockvolume: refuse replication on a walstore-chunk volume
A chunk cut takes its LSN from the local WAL head, which no replica is
guaranteed to hold, so a published HEAD could be ahead of every replica.
The master's workspace RPCs enforce RF1; a direct start did not.

- start: --durable-impl=walstore-chunk with --replication-ack sync-quorum or
  sync-all is refused at flag parse.
- assignment: the replication factor arrives with the assignment, so the
  ingress role gate of a walstore-chunk volume refuses every role with replica
  slots (replica, primary with peers) without opening a socket; the host's
  existing role-admission latch keeps the role unadopted and not Healthy. A
  primary without peers (RF1) is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 21:00:32 -08:00
Ping Qiu 56af794492 Merge pull request #197 from seaweedfs/feat/walstore-format-v3
storage: walstore format bump v3 (#51, #189)
2026-11-18 08:07:17 -08:00
pingqiuandClaude Opus 5.5 6896463a44 volume: name the cause when the workspace lease guard fences
The guard fenced silently: when renewals kept failing until the lease
expired, it drained the volume through blockvolume's lease-stop path, which
logged nothing, and returned the raw RPC error (issue #205).

- Every fence records its first cause: lease expired without a successful
  renewal, expired after a failed renewal (with the renewal's latency and
  error), an invalid reply, a reply that arrived after the deadline,
  revocation by the master, or shutdown. The guard logs it once as
  "workspace lease: fenced ...", FenceCause() returns it, and the non-ACK
  drain error carries it.
- Every failed renewal is logged with its latency and the lease deadline,
  also when the lease is still valid: a run of them is the warning before
  an expiry fence.
- An expiry after a failed renewal returns "workspace lease expired:
  renewal failed after <d>: <err>", wrapping the RPC error.
- blockvolume logs when it stops because the guard requested the drain.

The fence behaviour itself is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 03:50:08 -08:00
pingqiu a81bca4926 feat(storage): activate mapped v3 through the production storage callers 2026-11-18 03:49:47 -08:00
Ping Qiu 72eefdbe28 Merge pull request #174 from seaweedfs/feat/walstore-default-smartwal-experimental
blockvolume: walstore is the default for new volumes; smartwal is experimental
2026-11-16 13:41:15 -08:00
Ping Qiu 248f17017e Merge pull request #162 from seaweedfs/chore/scrub-reviewer-names-in-comments
chore: drop reviewer names and ruling timestamps from code comments
2026-11-16 12:47:54 -08:00
pingqiuandClaude Opus 5.5 ba5eeec356 blockvolume: help and README say auto refuses a walstore-chunk root
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-16 12:47:04 -08:00
pingqiuandClaude Opus 5.5 1f10755b0e blockvolume: walstore is the default for new volumes; smartwal is experimental
--durable-impl now defaults to empty (auto). A new volume is created as
walstore. An existing volume opens with the implementation its on-disk
superblock names, so volumes created under the old smartwal default keep
opening (no ImplKindMismatch on upgrade). An explicit selector keeps the
exact ErrImplKindMismatch refusal, and an unrecognized on-disk format is
still refused.

- core/frontend/durable: ImplAuto (the zero value) is resolved per volume
  in openOrCreate; openExisting/createFresh take the resolved
  implementation, and each volume handle records it, so DurableStatuses
  reports the on-disk implementation. ImplSmartWAL is documented as
  experimental; the 'production default' comments are removed.
- cmd/blockvolume: --durable-impl default '' with help text 'auto';
  smartwal (experimental). The walstore-only options still require an
  explicit --durable-impl=walstore.
- README: smartwal listed under 'Not claimed yet' with its open issues.

Tests: auto creates walstore; auto opens existing smartwal, walstore and
parallel-walstore volumes by their on-disk format; auto refuses an
unrecognized file; the flag default is empty; explicit values accepted.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-16 12:31:27 -08:00
pingqiuandClaude Opus 5.5 48db2739ec ci: add a test workflow (build, vet, go test -short) and harden dead-port tests
- .github/workflows/test.yml, job 'go test (linux)': on pull_request and on
  push to main; Go from go.mod; go build ./..., go vet ./..., and
  go test -short -count=1 -timeout 10m ./... with CGO_ENABLED=0. Actions are
  pinned by commit SHA, permissions are contents: read, and a new push to a
  PR cancels the older run.
- core/ops/surface_test.go: fix the two go vet warnings (resp used before
  the error check), so vet covers the whole module.
- cmd/blockvolume: a withdrawn port no longer has to answer ECONNREFUSED.
  A successful connect still fails; any other dial error passes only if the
  address can be bound again.
- core/host/volume: probe tests dial a listener they opened and closed,
  not the fixed 127.0.0.1:1.
- core/replication/component: on failure, the G5-5C and G9A catch-up tests
  log frontiers, peer status and the engine trace. Assertions and timeouts
  are unchanged.

Test files and the workflow only; no product code.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-16 11:47:44 -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 1bad5dccec Merge main 11f3afe6 into fix/issue51-walstore-midhistory 2026-11-15 23:17:47 -08:00
pingqiuandClaude Opus 5.5 e910449f70 storage: RED controls for the #155 review (detection only)
codex01's review of f8d43653 (V:/share/rdma/codex01-block155-review-
20261116T0644Z/REVIEW.md) and claude05's ruling (A), 06:47Z. Against the
reviewed production code (its replay cutoff and positional smartwal
fail-closed; smartwal warning accessors stubbed so the tests build):

- a damaged STALE record in a released range drops retained, synced
  LSN 3 (TestWALStoreRecoverStaleReleasedGarbageKeepsRetainedData);
- a torn smartwal slot accepted by one recovery becomes wal_corrupt
  after a frontier jump and a new sync
  (TestSmartWALTornSlotSurvivesAFrontierJump);
- a smartwal mid-history hole is an outage instead of a warning
  (TestDurableStartup_Issue51_SmartWALHoleIsAWarningNotAnOutage);
- plus codex01's advisory: a healthy primary stays healthy with a
  warning (TestStatusServer_StatusCarriesRecoveryWarnings..., which
  passes either way: the plumbing never forced health).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 23:04:18 -08:00
pingqiuandClaude Opus 5.5 d2a6a3b02c storage: RED controls for issue #51 (WAL holes)
claude05's rulings (2026-11-16 06:10Z, 06:14Z). Controls with real
corrupted WALs, failing against stubs that restore today's behaviour:

walstore (interim: a power loss must never become an outage):
- (a) a corrupted mid-history synced entry: recovery succeeds to the
  prefix, but no wal_hole_suspected warning, no count
  (TestWALStoreRecoverWarnsOnMidHistoryHole);
- (c) the newer batch wrapped to offset 0 is replayed past a corrupted
  older entry (TestWALStoreRecoverNoReplayPastAHoleAcrossWrappedRanges);
- the durable status and /status carry no warning
  (TestDurableStartup_Issue51_WALStoreHoleIsAWarningNotAnOutage,
  TestStatusServer_StatusCarriesRecoveryWarningsWithoutChangingHealth).
- controls that pass either way: (b) an out-of-order unsynced tail
  recovers, a torn tail recovers.

smartwal (fail closed on a mid-history hole):
- a corrupted committed slot with later valid records starts Ready
  (TestDurableStartup_Issue51_SmartWALMidHistoryHoleIsWALCorrupt);
- controls: the issue's exact mutation is wal_corrupt (ea1faf6a), a
  torn tail recovers.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 22:29:41 -08:00
pingqiu 469edccd04 test: qualify replication exchanges and admitted-operation withdrawal 2026-11-15 22:02:36 -08:00
pingqiu 79b3ee78d5 test: qualify replication exchanges and admitted-operation withdrawal 2026-11-15 21:50:32 -08:00
pingqiu 243f73633f fix: gate replication listeners on assigned replica slots 2026-11-15 21:29:56 -08:00
pingqiu 24cad21474 fix: retain manifest capability and exact root identity through provider cuts 2026-11-15 18:37:33 -08:00
pingqiu ce6e4449d8 feat: expose upload concurrency and retain manifest-aware contract checks 2026-11-15 18:27:57 -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