Commit Graph
4683 Commits
Author SHA1 Message Date
pingqiuandClaude Opus 5.5 08562e28d4 storage: pass stop tests let the stop, not a release, free the held compare
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 19:40:50 -08:00
pingqiuandClaude Opus 5.5 68b822649b storage: upgrade pass cursor before the marker, rewind before the publisher
An unseeded upgrade writes the pass's first cursor before the store's
marker, so a crash before the pass's first persist still resumes it. The
attach prepares the pass (and makes a rebuilt page's rewind durable)
before the layer's hooks and the record's due loop start, so a rebuilt
page cannot be republished as valid under the old cursor. The barrier
hook also yields to a stop; the rewind test checks the cursor on disk
while the pass runs; the superseded test checks the published bytes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 19:27:55 -08:00
pingqiuandClaude Opus 5.5 0726214734 storage: the upgrade pass rewinds to the earliest rebuilt page, not any unknown chunk
The open records the first chunk of the earliest page it rebuilt (the
kernel's cursor_back); the pass rewinds there, durably, before any request
is admitted. With no cursor a pass starts only after an unseeded upgrade
by this attach or a rebuilt page: chunks unknown only because they were
written after their page are dirty, and cuts take them, as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 18:37:18 -08:00
pingqiuandClaude Opus 5.5 ead21f46b1 storage: the upgrade pass rewinds below its cursor; a write supersedes a compare
A page rebuilt at open leaves its chunks unknown again behind the pass's
cursor (completed or partial): the attach now rewinds the cursor, durably
and before the layer admits any request, to the first unknown chunk. A
chunk written between the pass's read and its hash is superseded by the
write: not hashed, not counted as compared, reported (Superseded); it is
dirty and the next cut takes it, also after a restart. A failed attach
joins the record writer it started. The pass tests hold the pass at a
barrier inside a compare instead of racing a timed walk.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 18:23:14 -08:00
pingqiuandClaude Opus 5.5 bf548585e0 storage: tests of the upgrade itself attach with no compare pass after it
Tests that assert the record state an upgrade leaves (unknown chunks, a
seed, a crash at each step, a stale page) and the heap measurements now
attach with no compare pass (withoutUpgradePass): the pass would move the
state they read, or only slow a measurement of a large sparse volume.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 17:49:13 -08:00
pingqiuandClaude Opus 5.5 e73f30530e docs: regenerate the status schema for Stats.UpgradePass
The status schema's generated block comes from the code: the hand-written
rows are replaced by the generated ones, with the field comments on
UpgradePassStatus.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 17:35:27 -08:00
pingqiuandClaude Opus 5.5 3ea35a5d5d storage: tests attach after the upgrade compare pass, unless they watch it
An attach after an unclean v1.0 upgrade runs the compare pass and refuses
cuts until it ends, so the attach helper now waits for it as it waits for
reconciliation (its own bound: a 262,144-chunk test volume takes seconds).
Tests that act while the pass runs opt out (withoutPassWait).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 17:33:54 -08:00
pingqiuandClaude Opus 5.5 812fcffb35 storage: the attach runs the upgrade compare pass; sealing requests wait
After a v1.0 store's upgrade with no clean-stop seed every whole local
chunk is unknown. The v1.1 attach now runs the compare pass (resuming at a
persisted cursor, or starting when the record holds an unknown chunk); it
compares each unknown chunk with HEAD by the cut's own transitions. A stop
never waits for it: the pages and cursor of the work done are persisted
and the next attach resumes. Until it ends, a cut, snapshot, backup or
sealing detach is refused typed (ErrUpgradePassInProgress, HTTP code
in_progress) and the pass runs at full rate. Holder status reports
Stats.UpgradePass {State, Compared, Total, Outcome}.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 17:15:16 -08:00
pingqiuandClaude Opus 5.5 ccb9215f75 storage: red test, an unclean-stop upgrade leaves no unknown chunk after the pass
TestV11UncleanUpgradeLeavesNoUnknownAfterThePass: a v1.0.x store attached on
the v1.1 format with no clean-stop proof (an unclean stop) opens with every
whole local chunk unknown; the attach must then run the compare pass, which
leaves none unknown: chunks equal to HEAD end published with HEAD's hash, a
chunk that differs never with HEAD's hash. Fails on main: after 20 s all 16
chunks are still unknown, because the pass has no production caller.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 17:06:48 -08:00
Ping Qiu d14cf47fdf Merge branch 'main' into feat/v4b-pr4 2026-12-01 17:03:06 -08:00
Ping Qiu fb30cd8f80 Merge pull request #887 from seaweedfs/test/v11-format-tag
build: the draft v1.1 store format gets its own tag, apart from the cap lift
2026-12-01 16:52:06 -08:00
Ping Qiu 728ce66160 Merge pull request #901 from seaweedfs/fix/head-version-v11
layout: a v1.1 commit writes HEAD version 1, the manifest size known or not
2026-12-01 16:44:02 -08:00
Ping Qiu 578827ff1e Merge pull request #896 from seaweedfs/feat/v5-restart-grace
authority: renewals write nothing; waits use the master's own deadline; records are version 2
2026-12-01 16:23:10 -08:00
Ping Qiu 061a8cd302 Merge branch 'main' into fix/head-version-v11 2026-12-01 16:10:52 -08:00
pingqiuandClaude Opus 5.5 9c8b30b66f storage: the publication report leaves the generation check to noteSettled
main's HEAD-generation source guard allows a generation comparison only in
conditional updates and noteSettled's deduplication. The two report paths
added here compared generations before calling noteSettled; they now call
it and let it drop a report of an unchanged generation.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 16:07:51 -08:00
Ping Qiu 3798d42bd3 Merge branch 'main' into feat/v5-restart-grace 2026-12-01 15:56:03 -08:00
Ping Qiu c7aad8586d Merge pull request #899 from seaweedfs/fix/newer-version-exit
blockvolume: a newer HEAD or store format exits 78, not a restart loop
2026-12-01 15:54:20 -08:00
pingqiuandClaude Opus 5.5 6c4bd8b231 Merge main into feat/v4b-pr4
Conflict: core/frontend/durable/provider_chunk.go imports only (main
dropped math/rand/v2; this branch's EachSegment fallback uses math).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 15:45:31 -08:00
Ping Qiu 18d80d93e7 Merge branch 'main' into fix/head-version-v11 2026-12-01 15:40:18 -08:00
Ping Qiu 45bee0b7c1 Merge branch 'main' into fix/newer-version-exit 2026-12-01 15:29:51 -08:00
Ping Qiu 4e4039e94e Merge pull request #898 from seaweedfs/fix/store-format-newer
storage: refuse a newer store format with a typed error and change nothing
2026-12-01 15:27:17 -08:00
pingqiuandClaude Opus 5.5 8ad9139fa6 layout: a v1.1 commit writes HEAD version 1, the manifest size known or not
HEAD's version followed the manifest size: a v1.1 commit by change over a
HEAD without a recorded size (an upgraded volume's first cut) left it at
version 0, a HEAD a v1.0 binary would read. A v1.1 commit now writes
version 1 whatever it knows of the size (CommitRequest.V11, set by the
layout remote on the v1.1 format), and a version-0 HEAD carrying a v1.1
manifest size is refused like one carrying ext.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 15:24:33 -08:00
pingqiuandClaude Opus 5.5 bbeb8d98aa authority: comments name the deadline barrier; gofmt
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 15:24:06 -08:00
pingqiuandClaude Opus 5.5 e7380482a8 blockvolume: real-systemd red for the newer-format exits
Under the shipped unit's restart policy, a holder that meets a local store
or a HEAD written by a newer format exits 78 with its reason and is not
started again; the store's bytes and HEAD stay as they were; the control,
a process of the same policy exiting 1, is restarted. Prebuilt binaries
of the same tree can stand in for the build on a host without Go.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 15:17:57 -08:00
pingqiuandClaude Opus 5.5 2e9d6e04a7 authority: tests follow the lease deadline barrier; renewals write nothing
Tests that pinned the removed horizon (barrier at the persisted
issue+1.5*TTL, extension writes and their status counters) now use this
process's deadline (or restart floor) plus skew. The golden wm lost range
is the same file: the master restarts half a lease after the issue, so
both versions' barriers are the same instant.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 15:12:45 -08:00
Ping Qiu d018f1c284 Merge pull request #889 from seaweedfs/feat/hostlimit-yield
hostlimit: a long cut yields its slot to a waiting cut after S
2026-12-01 15:12:16 -08:00
pingqiuandClaude Opus 5.5 55562d718e blockvolume: a master's final exit wins over a newer HEAD version
The newer-HEAD-version exit (78 head_newer_version) is chosen before the
master's final reasons, so a startup that also met a final refusal keeps
its exit: moved and deleted stay 78 with their reason, revoked stays 79.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 14:55:02 -08:00
pingqiuandClaude Opus 5.5 b0433c4bbf blockvolume: a newer HEAD or store format exits 78, not a restart loop
A startup that ends on a HEAD written by a newer version exits 78
head_newer_version instead of the restartable 75 (a restart reads the same
HEAD again), and a fatal open of a store written by a newer format exits 78
store_format_newer instead of 1. The provider latches the newer-version
refusal per recovery, beside the identity refusal.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 14:55:02 -08:00
pingqiuandClaude Opus 5.5 868ee3c595 storage: the newer-format refusal's invariant row; narrow the discard claim
INV-STORE-FORMAT-NEWER-001: an intact descriptor of a newer store format
is refused typed, and an open refused at slot selection removes no file.
The discard's comment names what it covers: a refusal after the select
(a corrupt map) may still follow it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 14:55:01 -08:00
pingqiuandClaude Opus 5.5 495bbf8fe2 docs: status schema carries the cut yield counters
Regenerated with STATUS_SCHEMA_UPDATE=1: Chunk.Stats.CutsYielded and
Chunk.CutSchedule.CutYields.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 14:44:30 -08:00
pingqiuandClaude Opus 5.5 49158029e7 hostlimit, storage, durable: a long cut yields its slot to a waiting cut
- hostlimit: Config.YieldAfter (S, default 5 min). ShouldYield answers yes
  only for a Normal hold at least S old while another cut on the host holds
  a live ticket this process has not judged stalled (dead tickets are
  reaped on the way); the probe runs only once the hold is old enough and
  takes no limiter lock.
- storage: a cut attempt asks at each staging batch boundary and ends with
  ErrCutYielded, keeping what it staged; CutsYielded counts it, never as a
  failed cut.
- durable: a yielded attempt is retried at the next poll with no backoff,
  on a ticket at the back (it was admitted), counted in status (CutYields)
  and not logged as a failure.
- blockvolume: --host-limit-yield-after. Invariants: INV-HOST-CUT-YIELD-001;
  M7 states the rule. v1.1 notes carry it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 14:44:29 -08:00
pingqiuandClaude Opus 5.5 62ee69b0e2 hostlimit, storage, durable: red tests, a long cut yields its slot to a waiter
Seams: Config.YieldAfter (S, default 5 min), Limiter.ShouldYield (never,
for now), storage.ErrCutYielded, storage.BudgetYield, ChunkLayerStats.
CutsYielded and CutScheduleStatus.CutYields.

- TestShouldYieldOnlyAfterSWithALiveWaiter: a Normal hold yields only once
  it is S old and another process holds a live ticket; never a lone hold,
  never before S, never an urgent hold, not for a ticket judged stalled.
  Fails here: no hold ever yields.
- TestCutYieldsAtABatchBoundaryAndKeepsItsStaging: a cut whose budget asks
  it to yield ends at the next staging batch boundary with ErrCutYielded,
  counted as a yield, not a failure, publishes nothing, and its staged
  chunks are kept for the next attempt. Fails here: the cut never yields.
- TestChunkLoop_AYieldIsRetriedAtOnceAndCountedApart: a yielded attempt is
  retried at the next poll, never backed off as a failure, and status counts
  it apart. Fails here: the retry came 1.1 s later.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 14:43:22 -08:00
pingqiuandClaude Opus 5.5 2153edfedb storage: a v1.1 detach cancel is a commit by change with no change
On the v1.1 format a detach settlement whose detach did not land cancels
it with a commit by change carrying no change at the detach's base: HEAD
keeps the base's chunks and returns to this holder's active identity, and
no whole base image is built from the ref table. A cancel that lands is
installed in place; one whose reply is lost after it applied is read back
and adopted, as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 14:43:15 -08:00
pingqiuandClaude Opus 5.5 ddc349abe8 master: refuse a nil decoded volumes map; a null v1.0.x attestation file migrates as {}
The envelope's volumes are checked on the decoded map (a later key of
another case can null it after a key probe), and a v1.0.x file that is
null is read as no attestations, as v1.0.x read it, so its envelope says {}
and the next start reads it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 14:25:54 -08:00
pingqiuandClaude Opus 5.5 43efa2c82a storage: refuse a newer store format with a typed error and change nothing
A store whose descriptor slots are intact but name a chunk-state format
newer than this binary reads is refused with ErrStoreFormatNewer, told
apart before the slot's byte checks, instead of "neither descriptor slot
is valid"; a half-fence still opens on the known slot. Cut COW side files
are discarded only after a slot is selected, so a refused open leaves the
directory as it was.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 14:22:43 -08:00
Ping Qiu 64398e8999 Merge pull request #891 from seaweedfs/feat/v5-line-index
authority: a per-volume line index; a call reconciles only its volume's bindings
2026-12-01 14:21:58 -08:00
pingqiuandClaude Opus 5.5 ac02f34d81 master: the attestation envelope is re-synced at every start; volumes must be an object
An envelope already on disk is fsynced (file and directory) at every start
before the master serves: an earlier start may have renamed it in and
failed its directory fsync. master.New releases the store lock when the
envelope cannot be made durable or the attestations cannot be read. A
format-2 file without an explicit volumes object (missing, null, wrong
type) is refused rather than read as no attestations; v1.0.x files with
volumes named format or volumes are still read as bare maps.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 14:21:37 -08:00
pingqiuandClaude Opus 5.5 518e418fe0 master: a v1.0.x master refuses to start on a store this version opened
Before it serves, under the authority store's lock, the master writes
store-attestations.json as {"format":2,"volumes":{...}}. A v1.0.x master
decodes that file as a bare map of volume records and returns the error
from New before it listens or publishes. This master reads the envelope
and v1.0.x's bare map (rewritten as the envelope at start) and refuses a
later format. The authority record's version 2 alone does not stop a
v1.0.x master (its loader skips such a record); the test is renamed to say
it fails the v1.0.x decoder.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 14:10:41 -08:00
pingqiuandClaude Opus 5.5 da6130636d storage: a v1.1 no-op cut fences a foreign root at its own identity
Commit by change made a v1.1 no-op cut compare only its captured chunks,
so a HEAD read whole that had moved, at this holder's identity, to another
chunk root was installed instead of fenced. A whole read's chunk root must
again be the one the layer holds (the ref table), as the full comparison
required; a HEAD moved with the same root still completes the no-op.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 14:10:23 -08:00
Ping Qiu 06a044d368 Merge pull request #890 from seaweedfs/feat/hostlimit-fetch-cap
hostlimit, storage: cap chunk fetches per host
2026-12-01 14:10:04 -08:00
pingqiuandClaude Opus 5.5 3311545b14 authority: the lease deadline keeps its monotonic reading
A renewal's grant stays a time.Time (now+TTL with its monotonic reading)
for the deadline admission compares; only the reply carries wall
nanoseconds. The revoke ACK checks validity against that deadline the same
way. A missing deadline reports expiry 0 (no host validity), and comments
tell the deadline (restart + TTL) from the barrier (deadline + skew).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 14:03:04 -08:00
pingqiuandClaude Opus 5.5 a8d2a6e6c6 authority: renewals write nothing; waits use the master's own deadline; records are version 2
A renewal grants now+TTL from memory and writes nothing: the persisted
horizon, its clamp, its background extension and its counters are gone.
A forced move, an expired re-grant and a delete's no-live-lease proof wait
for this process's deadline plus skew (its latest grant, or after a
restart the restart floor it already set at load); no lease value an
earlier process wrote is read. An authority record's envelope is now
version 2, which a v1.0.x master refuses (it would trust the record's
stale lease expiry); this master reads versions 1 and 2.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 13:55:23 -08:00
pingqiuandClaude Opus 5.5 774f2ef4a4 storage: v1.1 settlements report the whole previous image; results keep no map
On the v1.1 format the layer's HEAD keeps no chunk map, so a settlement
that installs a HEAD read whole (a lost reply read back, a re-proposal read
back, a detach settled) now reports the previous image built from the ref
table, and every cut, settlement and detach outcome reports and keeps
HEAD's identity only (a no-op cut and a settled detach returned and kept
whole maps).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 13:53:25 -08:00
pingqiuandClaude Opus 5.5 5e1f9d11e4 storage: no flat map on v1.1: HEAD's chunks live in the ref table
On the v1.1 format the layer keeps HEAD's identity and its chunks in the
ref table only: the attach reads HEAD one segment at a time from a
segment reader (ChunkSegmentReader; the layout remote is one), every
install fills the table from a HEAD read whole, and the paths that need
the whole image (adoption, owning, the detach cancel, the publication
report) build it from the table. A cut's result reports HEAD's identity
only; no production code reads its chunks (a scan test guards it), and
tests read the remote's installed HEAD. The held heap at 1 TiB's chunk
count is 174 B/chunk (442 before) and is asserted at most 200.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 13:38:38 -08:00
Ping Qiu 4b96d9940b Merge pull request #892 from seaweedfs/test/hostlimit-window-bound
hostlimit: test, the no-progress window bound starts at the admission
2026-12-01 12:59:54 -08:00
pingqiuandClaude Opus 5.5 204c2132f2 authority: the line index check is exact both ways
Every per-volume read in the package's tests now checks the whole index
against the whole state: every state key indexed, every indexed key in the
state, no empty volume set, and the read equal to the scan. Negative
controls: a stale extra entry, a missing entry, an empty set.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 12:46:08 -08:00
pingqiuandClaude Opus 5.5 975628e853 hostlimit: test, the no-progress window bound starts at the admission
The window's timer starts inside Admit; a first admission publishes and
syncs the host configuration, which a loaded runner can stretch to
hundreds of milliseconds. The upper bound is now measured from Admit's
return; the lower bound still from before it. The failure message prints
the admission's duration.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 12:39:46 -08:00
pingqiuandClaude Opus 5.5 e44aba0ed6 storage: a v1.1 cut copies HEAD's chunks for its candidates only
On the v1.1 format a cut's base is HEAD's identity and its candidates'
references (cutBaseLocked), the commit sends identity plus the change set,
and a landed commit is applied to HEAD in place (applyCommitLocked): O(C)
where the base, the proposal and the install each copied every chunk. A
no-op cut compares its captured chunks with the by-change rule less the
generation. The cut's result still reports the whole installed HEAD (one
copy after the settlement, until the flat map goes).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 12:39:30 -08:00
pingqiuandClaude Opus 5.5 d7377311f2 hostlimit: fetch test ownership and the waiting-path control
- The fetch child keeps its release (and so the slot's file) reachable
  while it lives, with forced collections before it reports HELD.
- The ended-waits test registers every release at once, and its second
  half frees the other slot only once each fetch is already waiting, so
  the waiting path's success is what is checked.
- The competing fetches derive from a cancellable context, and cleanup
  joins them within a bound.
- Comments: one fetch polls per limiter (blockvolume makes one per
  process); a configuration check in progress can add its bounded guard
  wait after the context ends.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 12:32:20 -08:00
pingqiuandClaude Opus 5.5 1febcbcedb authority: a per-volume line index; a call reconciles only its volume's bindings
The publisher indexes its lines by volume, kept by the one writer of its
state, so every per-volume read (the workspace line, the authority line,
the bound replica, the published epoch, the promotion basis) costs the
volume's replicas, not every line. A register, ACK or move reconciles the
bindings of its own volume and of any volume whose reconcile failed before;
the start still reconciles every volume.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 12:24:19 -08:00