Commit Graph
228 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 0c9ca13a29 storage: retain cancellation and complete barrier timing in pre-copy 2026-11-20 04:02:09 -08:00
pingqiu 9faf91a36b test: qualify pre-copy across WAL wrap and fresh-host restore 2026-11-20 03:50:59 -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 b1124f739e test: expose unavailable-pool policy and process-local pacing scope 2026-11-20 02:39:34 -08:00
pingqiu cfd2a8332c fix(volume): retain terminal close precedence for aborted cuts 2026-11-20 00:49:09 -08:00
pingqiu 94aface439 fix(volume): report local cut abort before cancelled upload 2026-11-20 00:33:50 -08:00
pingqiu f87f513bdf test: cover cut abort status and named snapshot failure 2026-11-19 20:16:35 -08:00
pingqiu d3ad5aa87c test: assert retry deadline and intent coverage 2026-11-19 20:16:35 -08:00
pingqiu c9d13e1b6e fix: bound cut intent traffic and batch read scratch 2026-11-19 20:16:35 -08:00
pingqiu 77fc4e5c12 fix(volume): expose the COW read counters in cut responses 2026-11-19 20:16:35 -08:00
pingqiu 5f68c2251b blockvolume: add a soft memory ceiling and process memory status 2026-11-19 20:16:34 -08:00
Ping Qiu 139ff04d1d Merge pull request #253 from seaweedfs/test/227-part2
test: #227 part 2: handshakes and progress conditions instead of wall-clock bounds
2026-11-19 19:56:26 -08:00
Ping Qiu d3316321ee Merge branch 'main' into test/227-part2 2026-11-19 17:29:06 -08:00
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
Ping Qiu ecc1a6ef64 Merge pull request #256 from seaweedfs/feat/chunk-manifest-format3
feat(chunkstore): version chunk manifests with encoding and birth frontiers
2026-11-19 14:34:43 -08:00
pingqiu 2ed15f2c03 storage: distinguish recovery and map generation refusals 2026-11-19 09:38:23 -08:00
Ping Qiu 6644ff78b7 Merge branch 'main' into feat/chunk-manifest-format3 2026-11-19 08:14:06 -08:00
Ping Qiu b7af4c8e8c Merge pull request #260 from seaweedfs/fix/move-refusal-reasons
master: name a refused move's precondition; allow any port on the target host
2026-11-19 07:14:06 -08:00
Ping Qiu 9a0d432b6a Merge branch 'main' into feat/chunk-manifest-format3 2026-11-19 07:10:21 -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
Ping Qiu 59bf6f06b5 Merge branch 'main' into test/227-part2 2026-11-19 03:05:48 -08:00
Ping Qiu fe3fe97489 Merge branch 'main' into fix/chunk-refuses-replication 2026-11-19 03:05:05 -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
pingqiu a8eab7b361 test: prepare versioned manifests for catalog caller fixtures 2026-11-19 01:45:07 -08:00
pingqiuandClaude Opus 5.5 aab451d689 test: #253 review fold: witness the guard's installed 300 ms horizon
The expiry case now waits until the host's own lease guard installed a new
deadline less than 1 s ahead (the 3 s grants install about 3 s ahead), read
under the guard's lock, before it stalls renewals; a blocked renewal then
follows. A completed renewal call is no longer taken as an accepted grant.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 01:45:06 -08:00
Ping Qiu a6ff3002fd Merge pull request #232 from seaweedfs/fix/detach-abort-resume
durable: a failed detach never leaves the guest frozen (MIGRATION E4)
2026-11-19 01:40:46 -08:00
pingqiuandClaude Opus 5.5 61d1f9bc74 test: #253 review fold: always-admissible probe; witnessed short grant and stalled renewal
- g2Refused's probe uses a fixed lineage above every test epoch, so it is
  always admissible (probes are refused only below the active epoch) and
  its answer cannot depend on what the mutation did. The lineage argument
  is dropped. New TestG1_ProbeHandshakeClassifiesByEffect: an accepted ship
  is visible after the answer, a refused lower-epoch ship never is.
- Host lease expiry case: after a 300 ms grant was served and renewals were
  stalled, wait until a renewal arrived blocked; serial renewals make that
  the witness that the client accepted the 300 ms grant and is not renewed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 01:30:59 -08:00
pingqiuandClaude Opus 5.5 a72edc364f test: #227: host lease expiry test sets up under a 3 s lease, expires under 300 ms
TestWorkspaceHostLeaseExpiryAndRevokeCloseRealProvider ran every case under a
300 ms lease, so on a loaded runner the lease could expire before the write,
cut or detach steps (detach-then-revoke failed #248's CI). The setup now runs
under a 3 s lease; the expiry case shortens it to 300 ms, waits until one
300 ms grant was served, and only then stalls renewals.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 01:23:05 -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 b46c31ccea volume: parallel RF1 test releases and joins its workers on every exit path
Review fold (P2 cleanup, test only): an idempotent release and bounded
joins of the started workers are registered with t.Cleanup before any
worker starts, so a Fatal while the replay is parked cannot leave it
running past teardown. A join timeout is reported as an error.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 22:33:33 -08:00
pingqiuandClaude Opus 5.5 08b4e33384 volume: RF1 tests write and read back at the current identity; parallel replay race
Review fold (P2, tests only): the positive RF1@3 steps now write and read
back through a backend at the epoch-3 identity (exact n, nil error); the
stale-RF2 test requires a successful write. New two-worker test: the replay
worker's RF1@2 parks in the peer-set update, the stream worker's RF2@3 is
refused meanwhile, then the replay resumes; bounded by timeouts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 22:27:16 -08:00
pingqiuandClaude Opus 5.5 9859a0c1c5 volume: RF1 admission state under one lock; a clear removes only what it can see
Review fold (P1): the refused epoch and reason were separate atomics, so an
allowed RF1@2 replay could pass the stale check, a stream RF2@3 latch the
refusal, and the replay then clear that newer refusal. The epoch, reason
and the highest admitted RF1 epoch are now one unit under rf1Mu (field
access only). admitRF1 clears and adopts only if no newer refusal was
latched; otherwise the fact is not adopted. P2: a refusal below an
admitted RF1 epoch is stale and does not re-latch. Deterministic test with
a hook between the stale check and the admit; stale RF2 test.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 22:17:46 -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 89f0ca8b30 durable: detach review fold 2: forced failed-drain branch, recorded deadlines, handshakes, mapping order, invariants
- Test-only hooks: DetachVolume's StopIO can be replaced (the repeat and
  retry tests now force and observe the failed-drain branch instead of
  racing a cancelled context against a finished drain); the detach's cut
  and settlement deadlines are traced (the budget test checks 3/4 of the
  freeze, then the bound); the backend signals an I/O passing its
  readiness check right before the I/O lock (the drain test's arrival
  handshake replaces a 100 ms non-completion window, with bounded
  receives).
- The delayed detach CAS worker is joined, bounded, also on failure.
- chunkErrorCode: the detach sentinels decide before a catalog-error
  cause; the table rows now discriminate that order (no storage CAS
  sentinel behind them).
- Invariants: INV-WS-DETACH-ABORT-001 and INV-WS-DETACH-FREEZE-001, and
  the M4 transition Holder (detaching) -> Holder.
- Mutants (declared, 10/10): plus a catalog cause deciding before the
  sentinels; the whole-budget cut is now caught by the deadline check too.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 21:52:14 -08:00
pingqiuandClaude Opus 5.5 f9a8b5daab durable: detach review fold: settle every failure before resuming; one freeze budget
- P1: every failed detach is settled before anything resumes, a failed
  drain included. A repeated detach after a successful one (or with a
  cancelled context) returns the first result and stays stopped, and a
  retry over an unresolved detach CAS stays stopped while the outcome is
  unknown. The StopIO failure path used to resume unconditionally.
- P1: one freeze budget covers the drain, the final cut and the
  settlement (the cut gets three quarters, the settlement the rest); the
  settlement no longer adds 10 s of its own. The bound is cooperative
  (contexts), as documented.
- P2: the resume does not restart the periodic cuts after a concurrent
  Close (or a replaced layer); ErrDetachOutcomeUnknown maps to
  outcome_unknown explicitly, before its cause.
- Tests: the two P1 cases and the budget case (red on 26426dd5: resumed a
  detached volume, resumed over an unknown CAS, 10.4 s for a 400 ms bound);
  a detach CAS genuinely delayed until after the cancel then fails its
  precondition; the drain test now checks that the resumed write queues
  behind the admitted one and that recovery succeeds.
- Mutants (declared, 9/9): plus a failed StopIO resuming without the
  settle, the settlement with time of its own, the cut taking the whole
  budget.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 21:30:54 -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 26426dd50e durable: a failed detach never leaves the guest frozen (MIGRATION E4)
DetachVolume stopped guest I/O, then ran the whole final cut; on any
error I/O stayed stopped for the process, even when nothing was
published, and the only bound was the caller's context (up to 5 min).

Now:
- The freeze (drain + final cut) is bounded by DetachFreezeTimeout
  (default 20 s, below the host's 30 s I/O timeout); a freeze past the
  5 s target is logged as an ALARM.
- A detach that provably did not publish (the drain or the cut failed
  before its CAS, the CAS was refused, or an unresolved detach CAS was
  cancelled) resumes serving: periodic cuts restart, the stop is lifted,
  and ErrDetachAborted (HTTP detach_aborted, 409, retryable) is returned.
  The dirty set stays dirty, so the next cut publishes it.
- The new ChunkLayer.SettleDetach decides an unresolved detach CAS: if
  HEAD is still that CAS's base, a CAS at the same base to the
  non-detached base image (this holder, this epoch) cancels it, so the
  detach can never land afterwards; HEAD carrying the detach means it
  applied (the detached result is returned, I/O stays stopped); a newer
  holder means fenced (stays stopped); HEAD unreadable leaves it
  undecided: ErrDetachOutcomeUnknown, I/O stays stopped. Never resume on
  top of a possibly detached HEAD.

Tests: failed upload, refused CAS, lost unapplied CAS (cancelled, HEAD one
generation on, not detached) resume and the next cut publishes the dirty
blocks; an applied CAS whose reply was lost (found by the cut's re-read or
only by the settle) stays detached; undecidable and fenced stay stopped; a
hung CAS ends at the freeze bound, is settled and resumes; the old
drain-timeout test flips (it asserted I/O stays stopped). Six declared
mutants each turn exactly their declared tests red.

Known limit: after an abort whose drain is still pending (an admitted I/O
stuck), new I/O queues behind that admitted I/O (the drain holds a pending
ioMu.Lock); serving resumes once it completes, not instantly.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 21:12:57 -08:00
pingqiuandClaude Opus 5.5 9302f31e48 storage: cut barrier pause counts the lock wait; report LockWaitNs (#216 follow-up P2)
BarrierPauseNs started after captureMu.Lock returned, so the wait for
writers already holding the capture barrier shared (e.g. parked in WAL
admission) was not counted, although a pending Lock already blocks new
writers: the reported guest pause understated it.

The pause is now timed from the Lock request, and LockWaitNs reports the
wait for the shared holders on its own (also in the /chunk/cut body).

Tests: a cut whose barrier is held shared for 300 ms reports a pause that
includes the wait (red on main: about 24 ms) and a LockWaitNs of about the
hold, inside the pause before the sync. Three declared mutants (pause timed
after the Lock, lock wait unset, body drops the field) each turn exactly
their declared tests red.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 19:47:49 -08:00
pingqiu cd6dff4f67 storage: copy native chunk cut images outside the write barrier
Fix H and candidates under the short barrier; save pending chunks before mutation.
Drain owners and waiters before cleanup, recovery, reset and close. Preserve
intent/CAS and local durability contracts. Include native caller controls,
existing model correspondence and a real-mount rehearsal note.
2026-11-18 12:05:39 -08:00
Ping Qiu 4644a3400c Merge pull request #209 from seaweedfs/fix/workspace-lease-horizon
workspace: answer lease renewals from memory under a durable horizon (#205)
2026-11-18 07:46:41 -08:00