mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-12-04 18:17:16 +01:00
9da4e8656cdc79dfc896a2d8709c3b46d76b5b4e
2327
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
9da4e8656c |
filer: reproduce overwritten bytes lost by server-side copy
Signed-off-by: Perfloop Agent <agent@perfloop.ai> |
||
|
|
a89971ff66 |
filer: delete the chunks a failed copy wrote (#13316)
* filer: delete the chunks a failed copy wrote A copy through the filer (POST dst?cp.from=src) writes the destination's chunks first and its entry last. When it ended before the entry was written (the client gave up, a chunk failed to copy, the entry write failed), the chunks already on the volume servers stayed there, with no entry to reference them and nothing to delete them. The fan-out now waits for the copies it started, starts no further one after a failure or once the request has ended, and deletes what the completed ones wrote. A chunk copy that fails deletes the file id it was assigned, as a failed write can still have stored the needle. A failed entry write deletes only the chunks the destination does not hold, since CreateEntry can fail after storing the entry. #13217 did the same for the S3 copy paths. * filer: keep the copied chunks when the entry write fails CreateEntry can fail after it stored the entry: the entry stays when only its parent folders could not be created. Reading the destination afterwards does not settle whether the chunks are live, since an entry that was stored may have been renamed by then, and deleting on a miss would take its data. So a failed entry write keeps the chunks, as it did before. Only the failures that come before the entry write delete what the copy wrote. * filer: fail a copy whose request ended after its last chunk A request cancelled once every chunk copy had returned still handed the chunks on, to an entry write that the cancelled context then fails, and that write keeps them. The end of the request now fails the fan-out whether or not a copy was left to start, so the chunks are deleted there. --------- Co-authored-by: MapleWhiteZZZ <18653045+MapleWhiteZZZ@users.noreply.github.com> |
||
|
|
2938037cae |
filer: end a subscriber's stall when memory serves its cursor (#13310)
* filer: end a subscriber's stall when memory serves its cursor
A metadata subscriber that finds nothing in the ring yet parks until data
arrives ("no readable in-memory entries yet"), which starts its stall
clock. When data arrives the ring serves the cursor and the read goes on,
but nothing stopped the clock: only the paths that leave a gap do.
The clock is what bounds the wait on a gap. With it still running from
that first park, the first real gap the subscriber meets, hours later,
looks older than maxGapStall the moment it parks: the park gives up at
once and skips to the eviction watermark, and the events a peer would have
flushed within the flush interval are never delivered. The log shows a
subscriber "parked" for hours at a cursor a few seconds old, and the gap
skipped in the same millisecond. A mount keeps the stale listing it has
for those events, and filer.sync loses them.
resolve now ends the stall when it sends the read to memory.
* filer: age the first stall in the memory-serves test instead of shrinking maxGapStall
With maxGapStall at 50ms, a scheduler pause between the fresh park and its
give-up check expired the new stall and failed the test against the fixed
code. Keep the real bound and backdate the first park's clock.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* filer: shorten the comment on ending the stall in resolve
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: MapleWhiteZZZ <18653045+MapleWhiteZZZ@users.noreply.github.com>
Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
|
||
|
|
5c36ee70ee |
master: sign a LookupVolume token for the file id asked for (#13300)
* master: sign a LookupVolume token for the file id asked for LookupVolume signed the token with the bare volume id, and the volume server checks the token's fid against vid,key, so every token it handed out was refused. /dir/lookup signs the file id. operation.LookupJwt goes through LookupVolume, so the expired-token renewals of the S3 PutObject and copy cleanup deletes, the admin file browser and weed benchmark all got a token the volume server refused. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * master: sign lookup tokens for the base file id The volume server checks a token's fid against the file id with its _<delta> suffix stripped, so a token minted for vid,key_N, over gRPC or /dir/lookup, was refused. Sign baseFid of the file id in both paths. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
acb7728915 |
filer: ListEntriesRecursive RPC (#13262)
* filer: name the check that a listing expires an entry Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011UpvafvK8JpagF94MHWqwK * filer: StreamListRecursiveEntries lists a subtree in path order It pages through the store's RecursiveLister until the limit, leaves out and deletes expired entries as a directory listing does, and declines a subtree in or holding a remote mount. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011UpvafvK8JpagF94MHWqwK * filer.proto: ListEntriesRecursive A new RPC rather than a field on ListEntries: a filer that predates it answers Unimplemented instead of listing one directory. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011UpvafvK8JpagF94MHWqwK * filer: serve ListEntriesRecursive Unimplemented when the store cannot list the subtree in path order. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011UpvafvK8JpagF94MHWqwK * filer: a scoped token is refused ListEntriesRecursive Classified with TraverseBfsMetadata: it lists a whole subtree, past the per-directory checks a scoped ListEntries gets. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011UpvafvK8JpagF94MHWqwK * filer: trim a trailing slash before checking a recursive listing for remote mounts An empty directory lists from the root. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: keep the recursive listing cursor when a page comes back empty Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
acff807879 |
filer: postgres_flat store keyed by the full path (#13253)
* filer/store_test: conformance suite for filer stores Entries in and out of buckets, byte-ordered and prefixed listings, key-value records, transactions, bucket tables and the snapshot scan. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011UpvafvK8JpagF94MHWqwK * filer: run postgres2 and mysql2 through the conformance suite RUN_POSTGRES_TESTS and RUN_MYSQL_TESTS enable them, as RUN_REDIS_TESTS does the Redis stores; each test gets a schema or database of its own. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011UpvafvK8JpagF94MHWqwK * ci: give the go test job Postgres and MySQL services Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011UpvafvK8JpagF94MHWqwK * filer/sql: generators bind the arguments of row statements Insert, update, find and delete now take the row key and return their arguments with the query, so a generator decides how a key maps to its columns. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011UpvafvK8JpagF94MHWqwK * filer/sql: generators bind the arguments of directory statements Listing and deleting a directory's children take the directory and return their arguments with the query. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011UpvafvK8JpagF94MHWqwK * filer/sql: batch lookup takes row keys and matches rows by name and directory A key-value key's directory column already determines its dirhash, so the batch read no longer selects dirhash to match its rows. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011UpvafvK8JpagF94MHWqwK * filer/postgres: build the connection string with pgxutil.BuildDSN The credential store already does; it quotes values per libpq, so a password or certificate path with spaces or quotes no longer breaks the connection string. The OpenPGXDB alias has no callers left. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011UpvafvK8JpagF94MHWqwK * filer/sql: scan pages take the row key of the last row as their cursor Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011UpvafvK8JpagF94MHWqwK * filer/postgres: postgres and postgres2 share their connection setup ReadConnection reads the settings and their defaults, Connection.Open opens the store's pools. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011UpvafvK8JpagF94MHWqwK * filer/sql: key-value records may live in a table of their own A store whose entry tables have another layout keeps its key-value records in KvTable, written by KvSqlGenerator; its scans then read only entries and need not tell the records apart. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011UpvafvK8JpagF94MHWqwK * filer/postgres: SQL generator keyed by the full path Rows have path as their primary key; a (directory, name) unique constraint serves the directory listings. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011UpvafvK8JpagF94MHWqwK * filer: postgres_flat store Entries are keyed by their full path, the object key inside a bucket's table; buckets get tables of their own as in postgres2. Key-value records keep the postgres2 layout in filemeta_kv. The store refuses a filemeta table of another layout, so it needs a schema of its own. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011UpvafvK8JpagF94MHWqwK * filer: register postgres_flat and add it to the filer.toml scaffold Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011UpvafvK8JpagF94MHWqwK * filer/sql: test the arguments each generator binds Each statement's arguments must match its placeholders in count and column. Check them for every generator method, including the Postgres UPDATE whose parameters are now numbered key first. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer/postgres_flat: name a missing filemeta table instead of a foreign layout With createTable = false and no filemeta table, the layout check said the table had no path column and blamed a postgres2 layout. Report the missing table and the key-value table that also has to be created. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer/postgres: postgres_flat escapes the table name inside its quotes A double quote in it is doubled, as PostgreSQL reads a quoted identifier. Bucket names cannot hold one, but the statements no longer rely on that. Reported by CodeQL (go/unsafe-quoting). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011UpvafvK8JpagF94MHWqwK * filer/postgres: escape the table name inside its quotes A double quote in it is doubled, as PostgreSQL reads a quoted identifier. Bucket names cannot hold one; the statements no longer rely on that. Reported by CodeQL (go/unsafe-quoting) on the lines this branch changed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011UpvafvK8JpagF94MHWqwK * filer/postgres: postgres_flat shares the generator's tableIdent Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011UpvafvK8JpagF94MHWqwK * filer/postgres: keep the nameExpr doc comment on nameExpr Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer/postgres_flat: find filemeta along the search path when checking its layout The store's queries name filemeta unqualified, so with schema = "a,b" they reach a table in b; the layout check looked in current_schema() only and refused it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011UpvafvK8JpagF94MHWqwK * filer/postgres_flat: force byte order when the path column is locale-ordered Directory listings order and bound rows by path, but only the name column's collation was checked. A createTable with a locale-ordered path column listed in locale order, and byte-order bounds missed entries. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer/postgres: read the ordered columns' collation along the search path The collation check looked for filemeta in current_schema() only. With the tables in a later schema of the search path it found no column and took the database's order, so a locale-ordered path column next to a C database went unforced, and byte-ordered columns in a locale database got a needless sort. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011UpvafvK8JpagF94MHWqwK * filer/postgres_flat: list a directory from its path range A directory's children are the rows of its path range whose directory is the listed one. The listing reads that range in growing batches and skips the rows of the children's subtrees in Go, so a versioned object's .versions rows cost no query of their own. Past 64 rows of one subtree it queries again from that subtree's end. A name prefix narrows the range. Listing no longer reads the (directory, name) index. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer/postgres_flat: find a folder's children in its path range Deleting a folder's children looked them up by directory alone, which only the (directory, name) index serves. Bound the delete by the folder's path range as well. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer/postgres_flat: key the table by path alone Listing and deleting a folder's children both read the path range now, so the (directory, name) unique index only cost writes and storage: flatPath already makes the path unique per (directory, name). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer/postgres: read the ICU or builtin database locale before datcollate An ICU-default database can report datcollate 'C' while its default collation orders by the ICU locale, so a name column on the database default looked byte-ordered and the listing kept locale order. Read datlocprovider and the provider locale (via to_jsonb, so servers before Postgres 15 still answer) and treat an ICU default as locale-ordered. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer/postgres_flat: list a folder's children from its path range The bucket enumeration listed /buckets by directory and ordered by name, a sequential scan and sort now that path is the only index. Read the folder's path range in path order instead. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer/postgres_flat: only the path column needs byte order Listings now order and range by path alone, and directory and name are only compared for equality, which no deterministic collation changes. Drop their COLLATE "C" and check only the path column's order. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
6a67fe503e |
vacuum: compact copies held read-only by a readonlyCanDelete mark (#13283)
* vacuum: compact copies held read-only by a readonlyCanDelete mark A volume marked with volume.mark -readonlyCanDelete takes no new writes but keeps taking deletes, so it can drain instead of holding a volume slot (#10688). The automatic vacuum never reclaims those deletes: it skips every read-only copy unless low disk space is the only cause, and a mark clears that exception (#11519). The space comes back only once the last needle is deleted (deleteEmpty) or through volume.vacuum -volumeId, one volume at a time, so a volume that never drains completely keeps its garbage. VacuumVolumeCheck now also reports can_delete_mark: the copy is read-only through a readonlyCanDelete mark and nothing that refuses deletes (no plain read-only mark, no I/O quarantine, not tiered to remote storage). The sweep compacts such a copy like a writable one, except when the master pushed the mark itself to quarantine a duplicate volume id. The mark survives the compaction, so the copy stays read-only, keeps taking deletes and stays out of the writables. A read-only volume reserves no headroom, so the space it gives back becomes free volume slots. The Rust volume server reports the same field. In volume.vacuum, the help text and the list of read-only volumes the sweep skips leave out copies that still take deletes. For the unnamed collection, which the shell vacuums volume by volume, such volumes are left to the sweep: an explicit request would also compact a quarantined copy. An older volume server does not set the field and an older master ignores it, so a mixed cluster keeps skipping these copies. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * shell: say which marked volumes volume.vacuum leaves to the sweep For the unnamed collection, volume.vacuum sends one request per volume and skips a volume held by a readonlyCanDelete mark, while the "skipped by the sweep" hint leaves such volumes out because the sweep compacts them. With a filter matching only those volumes, the command returned without a request and without a word. It now lists the marked volumes over the threshold that it leaves to the automatic sweep. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * storage: drop the compacted needle map a read-only commit leaves unused CommitCompact reloads a read-only volume into a sorted map, so the compacted map built for the reload is never consumed: it stays in v.tmpNm with every needle of the volume, and with a leveldb index its .cpldb stays on disk. The next compaction reopens that .cpldb as is, so needles deleted between the two compactions come back in the leveldb map with stale offsets once the volume is writable again, and reads of them fail with EOF instead of not found. The sweep now compacts readonlyCanDelete volumes, so this path is no longer limited to an explicit volume.vacuum -volumeId. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * storage: do not tie the canDelete compaction test to random needle sizes newRandomNeedle sizes its data at random, so three deleted needles out of six left under 30% garbage about once in twenty runs and failed the precondition. The test only needs the deletes to leave some garbage. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * shell: say the sweep skips quarantined copies in the left-to-sweep note The note named unnamed-collection volumes as left to the automatic sweep, but the sweep skips a copy the master holds for a duplicate volume id under the same mark, and the topology does not show that quarantine. The note now says so. It also describes the copies by what the topology shows, read-only but still taking deletes, since a copy read-only only for low disk space looks the same when its probe fails. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com> |
||
|
|
c96636ecd0 |
filer: fold chunk lists for scoped commits (#13281)
* filer: fold chunk lists for scoped commits A filer serving a keep-only scoped token never folded chunk lists, and refused any new chunk for an entry holding manifests, so scoped clients kept their lists flat. On a store with a value size limit, such as FoundationDB, a scoped file stopped fitting at about 1000 chunks. The filer now folds scoped commits and reuses stored manifests as it does for unscoped ones. Folding runs after the retained-data check, so the only manifests a scoped commit stores are ones the filer wrote: - a scoped request may keep a manifest stored at the target, sent as stored; any other manifest is refused, with or without a proof, and a stored manifest cannot be kept as a data chunk; - the chunks held by the stored manifests count as stored at the target and join the identity map, so they may be retained flat but not under another spelling of their file id; - those chunks are read under the handler's path lock, not at admission; admission still refuses a manifest the target does not store and leaves the checks that depend on the held chunks to the locked check. A manifest that cannot be read refuses the write as Unavailable. An update rechecking inside its store transaction reuses the chunks it already read, so it does no volume I/O there. Appends to a folded entry are allowed under the same rules: an append keeps every stored chunk, and the locked check refuses aliases of the chunks the stored manifests hold. * mount: explain why a scoped mount keeps chunk lists flat A filer serving a scoped token now folds scoped commits itself and keeps only the manifests it wrote. The mount's flat rule is unchanged; only the reason given for it was out of date. * filer: test a scoped truncate through a stored manifest * filer: refuse manifest chunks in a scoped append An append moves each chunk it carries to the end of the file. A manifest cannot be moved that way: the chunks it holds keep their own offsets, so the appended range would read no data and the manifest's bytes would still read at their old place. Before this series a scoped request could carry no manifest at all; now that a scoped commit may keep a stored manifest, an append still takes data chunks only. * filer: read only the stored manifests a scoped commit drops The locked retained-data check read every stored manifest whenever a scoped request had chunks, so each flush of a folded file and each append cost one volume read per manifest under the path lock. The unscoped path reads only the manifests a commit drops. Read the same way for a keep-only scope: only the stored manifests the request does not keep unchanged, and none for an append, which keeps every stored chunk. A kept manifest keeps its chunks referenced, and garbage comparisons match chunk identities, so another spelling of one of its chunks cannot get the needle deleted; such a chunk now needs its own proof like any new chunk. Truncating through a manifest and listing its chunks flat still work, since both drop it. * filer: find the dropped manifests of a scoped commit in one pass Index the manifests the request keeps by file id instead of scanning the request for each stored manifest, which compared and cloned chunks quadratically in the number of manifests. * filer: rewrap the scopeManifestReader comment Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
081218bf8a | test: reword misspelled fixtures that trip codespell (#13290) | ||
|
|
284d491587 |
s3: forward notification topics to webhook targets (#13245)
* util: move the guarded dialer out of the volume server The deny list and the dialer that re-checks every resolved address at connect time move into weed/util/netguard, with the allow-private knob as a policy, so other outbound clients can dial through the same guard. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mq: fence consumer group position saves by generation A position saved with a generation is written only while the stored one carries no newer generation, or the same generation from another writer: the save reads the stored position and writes on the condition that it is unchanged, routed to the entry's owner filer, and re-reads when another writer got there first. A single consumer that elects itself can then store its offsets without a deposed predecessor overwriting them. Saves without a generation keep overwriting as before. Loading a missing position now reports ErrNotFound instead of trying every filer and marking each one failed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3: post bucket event batches to a webhook target A webhook destination renders a batch of records as one {"Records":[...]} body, posts it with the target's bearer token, and takes any 2xx as delivered. The renderer is a function the destination holds, a stand-in that refuses until the record renderer lands. It dials through the guarded dialer under a new Local policy, which refuses metadata-service, link-local and unspecified addresses at connect time but lets an operator point a target at a private host or a sidecar on loopback. Redirects are followed only to the endpoint's own host and never down from https. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3: forward each target's topic to its destination A Forwarder runs beside the Publisher on every gateway. Each enabled target with a destination gets a lock, s3.notify.<target>, held through LockClient.StartLongLivedLock, so one gateway forwards a target and targets spread across gateways; a topic target has none. The holder runs one loop per partition of the target's topic: fetch from the stored offset at the partition's leader, decode the records, deliver them as one batch, store the next offset. A fetch that stops short at a segment boundary just continues from its next offset. A failed send, a rejected one included, blocks the partition and is retried with capped backoff, and the offset is stored only after the destination took the batch. An offset that retention removed skips to the earliest one and counts the gap. Offsets go to the consumer group offset storage under group forwarder, fenced by the lock generation. On taking the lock a forwarder stores each partition's offset back under its generation, so an older holder's saves are refused and it stops. A stored generation at or above its own means the lock was lost, unless the forwarder has since held the lock through a full renewal, which happens only when the lock server's counter restarted; it then fences above the stored generation. Metrics per target: records delivered, send retries, retention gaps, and lag from the forwarding gateway. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3api: run notification forwarders beside the publisher Every gateway with filers starts a Forwarder with the publisher. It elects itself per target through the gateway's object-write lock client, stores offsets in the filer, reads through the same brokers the publisher uses, follows the target registry as the publisher does, and releases its locks on shutdown. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3: post a test event to a webhook on its own The renderer refuses an s3:TestEvent that shares a body with other records, so a webhook splits a batch around each one and posts them in order, the test event as its own body. The test is a stand-in until the renderer's lands. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3: skip a bucket event record that can never be delivered A record that does not decode, or that the renderer refuses, used to be retried like a failed send and would block its partition for good. The webhook now renders a whole batch before posting any of it and names the records that cannot render; the forwarder drops those, counts them per target and reason in notification_skipped_records_total, logs each offset once, and sends the rest. Only transport and HTTP failures are retried. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mq: read a fenced position save at the filer that applies it The fenced save read the stored position from whichever filer answered and then sent its conditional write to the key's owner, so with filers that keep their own stores the condition could be checked against an entry other than the one read, failing until replication caught up or judging a stale copy. The storage now takes the ring's owner lookup, the one route-by-key writes already use, and sends both the read and the write to that filer. The gateway hands its object-write lock client's PrimaryForKey to the forwarder offsets. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3: follow a repartitioned notification topic A forwarder listed its topic's partitions once, when it took the lock, so a repartition left the new partitions unforwarded until the lock moved. It now lists them again every 30 seconds, starts a loop for each new partition, and marks the loops of partitions no longer listed as replaced; such a loop keeps delivering what its partition holds and ends once it has caught up. A failed fetch now looks up the leader of that exact partition, not of any partition with the same range. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3: let the first forwarder take the lock before the second asks The election test synced both gateways at once, and each forwarder asks for its lock from its own goroutine, so the second could ask first and store the offsets the test expected from the first. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3: warn when a partition returns nothing below its high-water mark A fetch that returned no records and kept its next offset below the high-water mark looked like an idle partition, so the forwarder waited without a word while its lag stayed up. It still waits, since skipping would lose the records, but now warns at most once a minute with the topic, partition, offset and high-water mark, so the lag has an explanation. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3: render webhook bodies with the bucket event renderer The webhook now renders through Render and posts each s3:TestEvent alone by IsTestEvent, replacing the stand-ins it held until the renderer landed. The tests send real records and read the object keys and test request ids back out of the bodies. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * netguard: refuse the IPv6 and Alibaba metadata service addresses AWS's IPv6 metadata address fd00:ec2::254 is unique-local and Alibaba's 100.100.100.200 sits in the CGNAT range, so the Private and Local policies let a webhook or remote endpoint reach them. Refuse both under every policy, like 169.254.169.254. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * grafana: chart the notification forwarder metrics Add an S3 Notifications row with delivered records, lag, send retries, and records skipped or lost to retention per target. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3: follow only webhook redirects that keep the POST On a 301, 302 or 303 Go resends the request as a GET without a body, so an endpoint that redirected and then answered 2xx counted as delivered while it received no records. Only 307 and 308, which keep the method and resend the body, are followed now; any other redirect fails the send and is retried. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3: keep webhook endpoint secrets out of errors and logs The guarded dialer names its endpoint in every refusal, and the forwarder logs that error, so a webhook endpoint carrying credentials in its userinfo or a token in its query had them written to the log. The dialer now gets the endpoint as scheme, host and path only, and the parse and request errors no longer echo the URL. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mq: load a consumer group position from its owner filer A forwarder taking over read its start offset from whichever filer answered, while its fenced saves read and write at the key's owner. With filers that keep their own stores, a replica still holding an older offset handed the new holder that offset, which it then stored under its higher generation at the owner, replaying everything delivered since. Loads now go to the owner too when the storage knows it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mq: bound consumer group position loads and saves by the caller LoadConsumerGroupPosition and SaveConsumerGroupPosition ran their filer calls under context.Background(), so a filer whose store stalled held a forwarder's save forever: ending the lead waited on it, the lock was never released, and Close hung while the lock kept renewing. Both now take the caller's context; the forwarder gives each call its RPC deadline under the lead's context, so stopping returns and the lock is released. The offset wrappers the broker uses keep their signatures. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mq: list a consumer group's positions across partition generations ListConsumerGroupPositions walks every generation and range directory of a topic and returns the group's stored position in each, keyed by partition directory, so a consumer can tell which ranges it holds offsets for that the topic no longer lists. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3: stop forwarding ranges a repartition removed A repartition drops the old assignments, and the broker serves only assigned ranges, so the loop draining a removed range retried a refused fetch forever, and after a restart nothing looked at it at all. Reading a removed range's flushed data would need a read-only path in the broker. Until then a removed range's loop delivers the batch it holds and ends, and the forwarder logs an error naming each range it stops and, when it takes the lock, each partition directory holding a stored offset the topic no longer lists. The fake broker now refuses unassigned ranges as the real one does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3: deliver what a repartition left in the retired ranges The lookup now offers the sealed ranges a repartition retired, and any broker serves them from their files, so the forwarder no longer drops them. On taking the lock and on each re-list it asks for the retired ranges too and runs a loop for each, from its stored offset up to its high-water mark, after which the loop ends; a range it was forwarding as current and that is now retired gets the same end. A read below a retired range's log start counts as a retention gap, as for a live one. A key's records in a retired range precede its records in the ranges that replaced it, and loops running side by side would not keep that order. So the retired ranges go first, one generation at a time, oldest first, and the current ranges start only once none is left. A range listed neither as assigned nor as retired, as while a drained range is not sealed yet, pauses until it is offered again. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3: match a retired range to its forwarding loop by directory The broker lists a retired range at the second its generation directory is named for, while the assignment the forwarder started its loop from carried nanoseconds. After a repartition the retired entry missed the running loop, so a second loop started on the same stored offset and delivered the batch the first was still retrying. Key the loops by partition directory; the fake broker now lists retired ranges and the fake positions store offsets at that resolution, like the real ones. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3: replace a paused forwarding loop only once it ended A range drained but not sealed yet is listed neither as assigned nor as retired, so its loop is paused and dropped from the lead's loops while it may still be retrying a batch. Once the range was offered as retired a new loop started at the stored offset and sent that batch again. Keep a paused loop until it ends, and start the range again only then. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3: hold the new ranges while a drained one is not sealed yet A repartition saves the new ranges before it drains and seals the old ones, so for a while an old range is offered neither as assigned nor as retired, and the forwarder started the new ranges at once: a key's new records could go out before its records still waiting in the old range. On each look at the topic the forwarder now lists the directories holding a stored offset that the topic does not offer, and probes each at its offset; one that may still hold records past it, refused because it is not sealed, holds the new ranges until it is offered as retired and drained. One that answers with nothing past the stored offset is settled, sealed and empty or already delivered, and stays so for the lead. While holding, the forwarder logs at most once a minute and keeps looking even with no loop running. Claude-Session: https://claude.ai/code/session_011Upvai5AjLiNE5B1HCAn34 * s3: have the fake broker serve only the generation a fetch names The broker now refuses a fetch naming a generation other than the one it assigns for the range, unless that generation is sealed and read as retired. The forwarder tests' fake broker matched an assigned range by its range alone, so it served the live generation to a fetch for an older, unsealed one; it now matches the generation too, as the broker does. Claude-Session: https://claude.ai/code/session_011Upvai5AjLiNE5B1HCAn34 * s3: hold the current ranges until the stored offsets can be listed A lead whose first look at the stored offsets failed took that as no old range left unsettled and started the current ranges, delivering a key's newer records ahead of the ones still in a drained range that is not sealed yet. A failed look now holds the current ranges as an unsettled range does, and is retried with backoff and on each partition refresh; the current ranges start only after a look succeeds. Retired ranges and loops already running carry on meanwhile. Claude-Session: https://claude.ai/code/session_011Upvai5AjLiNE5B1HCAn34 * s3api: leave forwarding off on an unusable broker TLS config The forwarder loaded the grpc.msg_broker client TLS config with LoadClientTLS, which exits the process on a bad one, and every gateway with filers builds a forwarder whether or not it has webhook targets. It now loads it as the publisher does: an unusable config is logged and leaves forwarding off while the gateway keeps serving. Claude-Session: https://claude.ai/code/session_011Upvai5AjLiNE5B1HCAn34 * s3: hold the new ranges for an unsealed old range with no stored offset The check for old ranges still unsealed looked only at ranges holding a forwarder offset. A forwarder starting for the first time while a drained range was not sealed yet had stored none in it, so it started the new ranges and delivered a key's newer records ahead of its older ones. The consumer group listing now names every partition directory of the topic, with no position where the group stored none, and such a range is probed from offset 0. A range with nothing left past that offset, including one whose records retention already removed, is settled. Claude-Session: https://claude.ai/code/session_011Upvai5AjLiNE5B1HCAn34 * mq: check the load in the fenced save race test The test read the stored position back ignoring the load's error, so a failed load panicked on a nil position instead of reporting the error. Claude-Session: https://claude.ai/code/session_011Upvai5AjLiNE5B1HCAn34 * mq: take a partition over at the offset its last holder committed A new forwarder generation claimed a partition by writing the offset it had loaded. When the old generation committed again in between, the claim rewound the stored offset and the new lead replayed what had been delivered since. A fenced save that takes over from an older generation now keeps the offset that generation committed last, rereading it on a conditional write miss, and hands it back in the position, and the forwarder starts from it. Claude-Session: https://claude.ai/code/session_011Upvai5AjLiNE5B1HCAn34 * mq: wait for a position's owner filer instead of asking another A position store routed by owner fell back to any filer while the owner of a key was not known yet, as before the lock ring is learned. That filer's not-found ended the load there, though it may only not have caught up, and a claim on it would start the partition over. Loads and fenced saves now fail until the owner is known, and the forwarder retries them; a store without an owner routing still uses any filer. Claude-Session: https://claude.ai/code/session_011Upvai5AjLiNE5B1HCAn34 * s3: wait for the last checkpoint before a forwarder handoff in tests The resume, repartition and election tests stopped the first forwarder once its records were delivered but possibly before their offsets were stored, so they could pass on a replay rather than on a committed handoff. They now wait for the final offsets first. Claude-Session: https://claude.ai/code/session_011Upvai5AjLiNE5B1HCAn34 * s3: have Close wait for removed targets to release their locks A target removed from the registry had its forwarder cancelled and dropped from the targets, so a Close soon after did not wait for it and returned with that target's lock possibly still held. Removed forwarders are now kept until they are done, and Close waits for them as well. Claude-Session: https://claude.ai/code/session_011Upvai5AjLiNE5B1HCAn34 * s3: hold newer retired generations behind an unsealed older one A range of an old generation still unsealed held back only the current ranges. A generation retired after it was offered and delivered right away, ahead of the older generation's records of the same keys. The unsealed range's generation now counts as the oldest one left, so only that generation's own sealed ranges are forwarded until it is sealed. Claude-Session: https://claude.ai/code/session_011Upvai5AjLiNE5B1HCAn34 * s3: check the forwarder lock right before each send A lead checked its lock at the top of each fetch and after a failed send's backoff, so a lead that lost the lock while it fetched a batch still sent it, and the next holder sent it again. The lock is now checked right before each send. Delivery stays at-least-once: a lock lost during a send cancels that send once the lead notices, which may be after the endpoint took the batch. Claude-Session: https://claude.ai/code/session_011Upvai5AjLiNE5B1HCAn34 * s3: read a retired range past a broker that answers with an error Any broker serves a retired range from its files, but a fetch took the first broker's answer even when it was a storage error, and each retry asked that broker first again, so one broker that could not read the files held the range up for good. A retired fetch answered with an error other than an offset out of range now goes on to the next broker, and returns the error only when none could read it. Claude-Session: https://claude.ai/code/session_011Upvai5AjLiNE5B1HCAn34 * s3: count ranges held back behind an older generation in the lag The lag gauge summed what each running loop reported, so the current ranges held back while an older generation was still unsealed, and the retired generations waiting their turn, showed no lag however much piled up in them. On each partition refresh the lead now reports their lag from the stored offset to the high-water mark, read from the range's leader or the retired listing, and drops the lag of ranges it no longer has. Claude-Session: https://claude.ai/code/session_011Upvai5AjLiNE5B1HCAn34 * s3: hold retired generations too while stored offsets cannot be listed A lead whose look at the stored offsets failed held only the current ranges and went on forwarding retired generations, though an older generation it could not see might still be unsealed and hold earlier records of the same keys. A failed look now holds every range not yet running until a look succeeds; loops already running carry on. Claude-Session: https://claude.ai/code/session_011Upvai5AjLiNE5B1HCAn34 * s3: read stored offsets only of the ranges a lead does not know yet The check for unsettled ranges listed every partition directory and read every stored offset in it one by one under one deadline, before dropping the ranges the topic offers and those already found settled. A topic with many past generations could take longer than the deadline on every refresh and hold a new lead for good. The listing now takes the directories to skip and reads only the remaining offsets, a few at a time, and the lead skips the offered ranges and those it found settled. Claude-Session: https://claude.ai/code/session_011Upvai5AjLiNE5B1HCAn34 * s3: test the failed-listing hold with no unsealed range The failed-listing test also had an older generation unsealed, which holds the newer ranges on its own once a listing succeeds, so it did not show the listing guard by itself. A second case has no unsealed range: nothing goes out while the listing fails, and both the retired and the current range do once it succeeds. Claude-Session: https://claude.ai/code/session_011Upvai5AjLiNE5B1HCAn34 * s3: stop the lead before marking a failed loop ended A forwarding loop that failed, as on being deposed, was marked ended before it cancelled its lead. A partition refresh in between saw a retired range's loop ended, took the range as delivered, and started the next generation's ranges on the lead that was about to stop. The lead is now cancelled first, so no refresh acts on the failed loop. Claude-Session: https://claude.ai/code/session_011Upvai5AjLiNE5B1HCAn34 * s3: count no retention gap below an offset only claimed A lead claiming a partition with no stored offset wrote offset 0 to fence it before reading anything. A lead that stopped there left 0 behind, and the next one, finding the log start past it, counted those offsets as lost though no forwarder had ever been at them. A claim made before any read is now marked as such, a takeover keeps the marker of the entry it replaces, and only an offset a lead read from counts a gap. Claude-Session: https://claude.ai/code/session_011Upvai5AjLiNE5B1HCAn34 * s3: retry a takeover save at the offset it kept A claim's save that took a partition over from an older generation kept that generation's last offset, but when its reply was lost the retry went out with the offset the claim had loaded. The stored entry was by then the claim's own, so the retry kept nothing and rewound the partition, replaying what had been delivered since. A failed save now retries with the offset and marker the attempt settled on. Claude-Session: https://claude.ai/code/session_011Upvai5AjLiNE5B1HCAn34 * s3: store an offset as read from once the first fetch succeeds A claimed offset lost its claimed marker only when a later save moved it, so a lead that read an empty partition and stopped left it marked as never read. Records published and then removed by retention while no gateway forwarded the target were skipped without a gap counted or logged. The first successful fetch now stores the offset as read from, once per claim, even when it has not moved. Claude-Session: https://claude.ai/code/session_011Upvai5AjLiNE5B1HCAn34 * s3: wait for the stalled topic's publisher before reading it in a test The worker sets the topic publisher up on its own goroutine, which on a loaded host can start after Publish has stopped waiting. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3: keep what a timed-out offset check settled for the next one A check for unsettled ranges that could not read every stored offset within its deadline returned nothing, so each retry read the same ranges again and a long enough history kept the new ranges held for good. The listing now returns the positions it read along with the error and goes on past one that fails, and the check probes those and keeps the ranges it finds settled before reporting the failure, so the next check reads only the rest. The ranges stay held until a check covers them all. Claude-Session: https://claude.ai/code/session_011Upvai5AjLiNE5B1HCAn34 * s3: say which records the notification lag counts The lag gauge's help, and the dashboard panel with none, read as every undelivered record, but the records of an old range still being sealed after a repartition cannot be read and are not counted. Both now say the gauge covers the current ranges, the ranges held back behind an older generation, and the sealed retired ranges. Claude-Session: https://claude.ai/code/session_011Upvai5AjLiNE5B1HCAn34 --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
a8f13e7db2 |
filer: keep a PUT under /etc inline like a POST (#13241)
* filer: keep a PUT under /etc inline like a POST The write handler marks /etc paths (and saveInside=true) to be stored as inline content, but only the multipart POST path honoured it. A plain PUT went through the chunk uploader, which keeps content inline only below saveToFilerLimit, 0 by default, so `curl -T x.json http://filer/etc/...` stored chunks and the loaders that read /etc files from inline content saw nothing. Both paths now share one saveInside write: read the body, check Content-Md5, store it as the entry's content. An append to a chunked file is refused for PUT as it already was for POST, and an offset write is refused for both instead of being treated as a whole-file write. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: skip the saveInside PUT digest checks under fips140=only GODEBUG=fips140=only refuses MD5: the filer neither checks Content-Md5 nor reports Content-MD5, and crypto/md5 panics. The bad-digest test is skipped there, and the inline-store test checks the digest only when MD5 is available while always checking the content is inline with no chunks. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: answer a malformed write offset with 400 A negative, non-numeric or overflowing ?offset, and an offset with op=append, were plain errors that the write handler answered with 500, while a positive offset to inline content got 400. Both the inline and the chunk path now parse it through one helper whose error carries the ErrMsgInvalidOffset prefix, mapped to 400. offset=0 stays a whole write. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: charge a saveInside PUT its whole body like a POST A PUT stored inside the entry is now buffered whole by saveInsideEntry, but uploadCharge still charged it by chunks, so -concurrentUploadLimitMB no longer bounded the memory it holds. It is charged as the POST is: its declared length, at most the whole budget, or the whole budget when the length is unknown. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: bound a body stored inside the entry at 16 MiB A saveInside or /etc upload is read into memory whole, and nothing capped it: one PUT or POST could grow the filer's memory without bound, as the upload charge limits concurrency rather than bytes. The read now stops at 16 MiB, far above any config file, and a larger body is answered 413 with nothing stored, whether or not its length was declared. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: keep inline storage to entries inside /etc/ The /etc check was a bare string prefix, so a PUT to /etcd-backup/snap.db or /etcetera took the saveInside path and a large body was refused with 413 instead of chunked. Match /etc/ as a directory for the write, upload charge and zip extract paths. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: bound a zip member kept inline like a saveInside upload A zip member extracted under /etc/ (or with saveInside=true) is read into memory whole, but was bounded only by the 1 TiB archive limit. Refuse a member over saveInsideMaxBytes, as a PUT or POST body is. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: keep a multipart POST to the bare /etc directory inline A POST to /etc with a file name lands the file inside the /etc directory, but the /etc/ prefix check missed the bare path and stored it as chunks. Match /etc itself as well as entries under it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
3ea924d39f |
filer: take every log fence from the event stamp sequence (#13239)
* filer: take the log fence without registering an in-flight stamp LogFenceTsNs stamped and released at once, so each fence briefly sat in the in-flight registry, where a concurrent claim could be capped below it, and took the registry mutex twice. Draw the fence from the same sequence under one lock acquisition without registering it. Lookups are about to take one per read. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: fence CreateEntry and UpdateEntry from the event stamp sequence Both stamped their pre-write fence from the raw wall clock, so after a backwards clock step the fence could sit below events the acknowledged state already reflects, including the previous write's event on the same key. A mount that versions a no-op ack by that fence would then accept an older event over it. Take the fence from the same sequence the events use, so it lands above every earlier event and below the write's own. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: fence a remote-object cache commit from the event stamp sequence CacheRemoteObjectToLocalCluster stamped its commit fence from the raw wall clock under the path lock. After a backwards clock step that fence fell below events the cached entry already reflects, the same as the old CreateEntry and UpdateEntry fences. Take it from the event stamp sequence. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: fence lookups from the event stamp sequence fencedFindEntry, behind LookupDirectoryEntry and LookupDirectoryEntries, stamped its read fence from the raw wall clock under the shared path lock. After a backwards clock step the fence fell below events the returned entry already reflects, so a client versioning the entry by it could take an older event as newer. Draw it from the event stamp sequence instead. The fence registers nothing in flight, so it never caps flush or delivery claims; it costs one short critical section on the stamp registry's mutex per lookup. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: keep the stamp sequence above renumbered log positions The meta log buffer renumbers an event appended out of stamp order past the last position it holds, and that position is what subscribers see. Concurrent writers append in whatever order their notify work finishes, and with the wall clock behind the sequence every renumbered position lands past the last stamp, so a later fence could sit below an event the fenced state already reflects. Feed each delivered position back into the sequence stamps and fences draw from. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: draw a lookup's fence after the read FindEntry can log an event of its own on the path it reads: importing a remote object under a mount creates the entry, and an expired entry is deleted. Both stamp above a fence drawn before the read, while the returned state reflects them. Draw the fence after the read with the shared path lock still held; a locked writer on the path cannot land in between. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: draw the remote cache commit's fence after its re-read The re-read can import the object from the remote and log that event; an entry changed during the download is returned with this fence, which has to cover the import. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: take the exclusive path lock for a lookup that writes Fenced lookups share the path lock, and FindEntry can write under it: it deletes an expired S3 object and imports an object from a remote mount, logging an event either way. A lookup that read the old state just before could then draw its fence above that event and return the old state, so a client skipped the event as already reflected. A fenced lookup now reads with FindEntry reporting such a write instead of making it, and redoes the read under the exclusive path lock when it does. The shared lock is released first, so nothing holding it waits on the exclusive one. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: escalate a fenced lookup only when the remote has the object Refusing the lazy fetch before the remote stat sent every fenced lookup that missed under a remote mount to the exclusive lock, so concurrent lookups of one missing key ran their stats one after another instead of sharing one. A lookup that may not write now stats in a flight of its own and asks for the exclusive lock only when there is an object to import. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: require the live object from the first lookup in the expiry race test The fence check was skipped when the first lookup errored or found nothing, so a run that took either path passed without checking anything. The store hands that lookup its copy before the hook expires the object, so it always returns the live object; require that, then compare its fence against the delete. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: release the shared remote stat only after every lookup joined it The test let the stat sleep and assumed all eight lookups joined within that window, so a lookup scheduled late could start a second, correct flight and fail the count. The stat now waits on a gate the test opens once the other seven lookups wait on the in-flight call. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
185cefc652 |
filer: keep the server digest tests passing under fips140=only (#13243)
GODEBUG=fips140=only refuses MD5, and the filer then digests with SHA-256 cut to MD5's size. Tests that compared stored or reported digests against crypto/md5 or hard-coded MD5 hex panicked or failed there; they now compute the expected digest with util.Md5, which follows the process mode. Tests that exercise a client's Content-Md5, which only exists with MD5, are skipped under fips140=only as the digest test already is. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
a1f3f9aaa1 |
filer: return the commit stamp from ObjectTransaction (#13234)
* filer: add log_ts_ns to ObjectTransactionResponse CreateEntry and UpdateEntry return the filer log position stamped under the path lock; a conditional write through ObjectTransaction had no such field. Add it as field 4 so callers can order one key's commits the same way regardless of which RPC applied them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: return the commit's log position from ObjectTransaction A committed transaction now stamps log_ts_ns under its lock_key lock after its last mutation, the same wall-clock source CreateEntry and UpdateEntry use. All mutations of one transaction sit between that stamp and the next writer's, so one stamp orders the transaction against every other write of the key. A refused or failed transaction leaves it 0, and a replayed request returns the stamp recorded with its first outcome. A non-owner forwards the owner's response unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: stamp ObjectTransaction's log_ts_ns from the meta-log clock The wall clock can step back between two transactions on one key, or sit below stamps already bumped past it, giving a later transaction a smaller stamp than an earlier one or than its own event. Take the response stamp from the same monotonic allocator the events use, released at once. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
e84c3f9ada |
mount, filer: a content change clears the stored content MD5 (#13238)
* mount: a content change clears the stored content MD5 Attributes.Md5 is the whole content's MD5: the S3 and WebDAV ETags and WebDAV's oc:checksums report it. A write, a size change, a grown fallocate, an O_TRUNC open or a copy_file_range into the file kept it, so those reported the old content's MD5 and an ETag that did not change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: AppendToEntry clears the stored content MD5 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mount: copy_file_range clears the MD5 once it buffers bytes A cancelled copy or a later read error returned before the clear, leaving the bytes already buffered under the old MD5. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: an empty AppendToEntry keeps the content MD5 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
484e16e30c |
webdav: keep X-OC-Mtime and report oc:checksums (#13226)
* webdav: keep X-OC-Mtime and report oc:checksums
ownCloud and Nextcloud sync clients, and rclone's webdav backend in those
vendor modes, send a file's modification time in X-OC-Mtime and read its
hash from the oc:checksums property. Without them every upload gets the
upload time as mtime and clients can only compare sizes, so syncs re-upload
unchanged files.
- PUT stores X-OC-Mtime (Unix seconds, fractions dropped) as the entry's
mtime, at create and at commit, and answers "X-OC-Mtime: accepted"
- a file created and written front to back stores its content MD5; any
other write clears it, so no stale MD5 outlives a partial rewrite
- PROPFIND reports oc:checksums ("MD5:<hex>") for files whose MD5 is known;
PROPPATCH is still refused
Checked with rclone (vendor=owncloud): sync keeps mtimes, md5sum matches
local files, including an 8-chunk file.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* webdav: only report an inline MD5 for whole inline content; test commits
- contentMd5 hashes inline content only when it is the whole file
(filer.ETagOfInlineContent): content next to chunks, or shorter than the
file size, is only part of it and must not be advertised as its checksum
- test a PUT that crosses a buffer flush end to end: the committed entry
carries the X-OC-Mtime and the MD5 of the whole body
- test that writing into an existing file clears its stored MD5
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* webdav: ignore a NaN X-OC-Mtime
int64 of NaN is implementation-specific (the most negative value on amd64,
the largest on riscv64), so a NaN header could store an arbitrary mtime.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* webdav: group the oc test imports
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Denis Maier <denis@dAir.lab>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com>
|
||
|
|
c8cd1a7d77 |
volume: refuse a batch delete while a replica is offline (#12311)
* volume: refuse a batch delete while a replica is offline BatchDelete now applies the replica check the HTTP delete path already uses: when the master lists fewer replicas than the volume's copy count, the delete is refused with 503 instead of applied to the replicas that remain. The caller retries, so the replica that was offline still gets the delete once it returns. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: retry deletes refused for an offline replica Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * volume(rust): refuse a batch delete while a replica is offline Mirrors the Go volume server: batch_delete checks that the master lists every replica of a replicated volume before deleting, and answers 503 with the replica count error otherwise. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: move exhausted deletion retries to dead letter queues A deletion that still fails after the backed-off retries is no longer dropped. It moves to a dead letter queue retried after 24 hours, then to a second one retried after 48 hours, and is dropped only if that fails too. The id stays in the durable deletion ledger the whole time, so a restart replays it instead of losing it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * volume: report a low-disk volume as read-only but deletable A volume is read-only while its disk is low on space, but it still applies deletes; only noWriteOrDelete refuses them. The heartbeat set readOnlyCanDelete from the operator mark alone, so the master listed a low-disk replica as refusing deletes and the replica count check rejected every delete on its volumes, on the healthy replicas too. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * volume(rust): report a low-disk volume as read-only but deletable Mirrors the Go heartbeat: readOnlyCanDelete is set whenever the volume is read-only without no_write_or_delete, which includes low disk space. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: retry deletes a low-disk replica could not record A low-disk volume now counts as deletable, but appending the tombstone can still fail with no space left on device. Treat that as retryable so the deletion stays queued instead of being dropped after the other replicas applied it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * master: keep under-replicated volumes out of empty-volume cleanup The cleanup only looked at the copies the master lists. With a replica offline the listed copies can be empty and quiet while the missing one still holds data, and deleting them would leave that copy as the only one when it returns. Low-disk replicas now report readOnlyCanDelete and pass the eligibility check, which made this reachable for more volumes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * master: finish a partly deleted empty volume in the next sweep When one copy's VolumeDelete succeeded and another failed, the vid was left with fewer copies than its replica placement, so every later sweep skipped it as under-replicated and the empty copy kept its slot. The vid now stays marked deleting after a partial delete, and the next sweep finishes it. The mark is cleared once the vid is gone or stops being an empty, quiet candidate. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * master: keep the cleanup mark while a survivor is only read-only A partly deleted empty volume lost its deleting mark when the next sweep found a surviving copy read-only. Later sweeps then skipped the vid as under-replicated, so the empty copy kept its slot after it became deletable again. Only a copy that gained data or was written recently clears the mark now; a read-only or missing copy just postpones the cleanup. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * shell: delete an empty volume only when every copy is empty volume.deleteEmpty judged each copy on its own, so it removed an empty copy while another copy still held data or was offline, leaving that one as the volume's only copy. Low-disk copies now report readOnlyCanDelete and passed the check as well. Apply the master sweep's rule: every copy is listed and every copy is empty. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * shell: name the copies a partial empty-volume delete leaves behind Once some copies of a volume are deleted, a rerun of volume.deleteEmpty skips the rest as under-replicated, and the shell keeps no state to finish them. Log each copy whose delete failed with the volume.delete command that removes it once it is empty. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * shell: keep the gRPC port in the printed volume.delete command ServerAddress.String() drops a custom gRPC port, so the printed -node would dial the HTTP port plus 10000. Print the full address. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: let manifest retries pass through the dead letter queues The manifest retry queue reuses DeletionRetryQueue, so a manifest that does not resolve now waits through both dead letter queues before it is deleted alone. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * volume(rust): look up a batch delete's replicas over the master's gRPC port lookup_volume now dials the master's gRPC port, as Go's LookupVolumeIds does; the replica check and its test follow. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * volume: let a batch delete through on a volume grown degraded A volume the master grew with fewer copies than its placement reports min_writable_copies in the lookup. Go's replica check already uses it; Rust now does too, so deletes on such a volume are not refused forever. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * volume, shell: let volume.merge write deletes into its merged copy volume.merge marks the source copies read-only and writes the merged records, deletes included, into a temporary copy that replaces them. The batch delete replica check counts only the temporary copy there and refused every delete, so the merge stopped at its first tombstone. BatchDeleteRequest.skip_replica_check lets a caller that updates the other copies itself skip the check; volume.merge sets it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
139c1d6d04 |
mq broker: survive startup, non-balancer brokers, and restarts (#13181)
* mq broker: turn a panic in an RPC into an error The broker's gRPC servers had no recovery, so a nil dereference in any handler took the whole process down. Once the broker runs inside another server, that process is the host. * mq broker: guard the filer set The master's peer updates and the startup peer listing both write the filers map and currentFiler from different goroutines, and every filer call reads currentFiler. Two writers on the map at startup is a fatal concurrent map write. * mq broker: answer balancer requests before the balancer lock exists The balancer lock is created only once the broker has found a filer, while the gRPC server already serves. Every lookup, configure, publish and balance request dereferenced it, so an early request crashed the broker. Those requests now answer Unavailable until a balancer is elected. Ownership is the lock's unexpired lease instead of the owner name it last saw, so a broker whose renewals have failed stops acting as balancer once the lease runs out. A lapsed lease can still name this broker, so proxying refuses to send a request to itself. * mq broker: follow the filer lock ring The balancer lock client was seeded with the first filer the broker found and never given the ring, so it kept dialing that filer after it left and no broker could become balancer. The broker now takes the master's lock ring updates the way S3 gateways and mounts do, and the master sends brokers the ring snapshot on connect. * mq: never pick a partition's leader as its follower pickBrokersExcluded ignored the leader it was told to exclude. With one broker, the first assignment repair made that broker its own follower, and it then replicated every publish to itself. A dead follower that has no replacement is now dropped and counted as a change, so the cleared name is saved; picking the leader had hidden that. * mq: keep a partition's leader unless a live broker replaces it The repair cleared the leader of any partition whose leader it did not see, even with no broker to take over, and the cleared assignment was cached. With an empty broker set every leader went blank. A leader now moves only to a live broker, the only live follower is promoted when it is all that is left, and a follower that names its own leader is replaced. * mq broker: only a settled balancer repairs assignments Every broker repaired topic assignments on a cache miss, but only the balancer tracks which brokers are live. Any other broker saw an empty set, cleared the topic's leaders, and could not load a partition it did own, so a publish to it dereferenced a nil partition. A newly elected balancer also waits 30 seconds, long enough for every broker to notice the change and reconnect, before it treats a broker it has not heard from as gone. * mq broker: refuse a publish for a partition not assigned here When the balancer named this broker as leader but its own copy of the topic config did not, the partition lookup returned nil and the publish dereferenced it. It now answers not-leader, and the publisher looks the partition up again. * mq broker: compare the publish leader as an address The leader check built "ip:port" with Sprintf and compared strings, while broker addresses are joined with JoinHostPort. On IPv6 the brackets never matched and every publish was refused as not-leader. * mq broker: flush partitions on stop The broker had no Stop. Its loops ran on context.Background, and the standalone command registered nothing for SIGTERM, so every restart dropped the publishes still in the open flush window. Stop now cancels the broker's loops, releases the balancer lock, and waits until every partition has flushed. The command calls it on interrupt before stopping its gRPC servers. The startup peer listing, which blocked the constructor until a master answered, now runs in the background with the balancer election. * mq topic: flush partitions added or retired while stopping Shutdown took one snapshot of the partition list, so a partition a publish created after the snapshot was never flushed, and one that idle cleanup had just retired was not waited on. Adding a partition now fails once Shutdown starts, Shutdown waits out an idle cleanup pass in progress, and every retired partition is waited on until its last flush. * mq broker: release the balancer lock once on stop Stop and the balancer election could both release the lock when a stop landed just as the lock was published, and a second LiveLock.Stop closes its channel again and panics. Each path now takes the lock out with Swap, so only one releases it. * mq broker: forget the buffered ring version on a master change Before the balancer lock client exists, the broker keeps the last ring it got. A master change then reset nothing, so the client attached with the old master's version and refused the new master's lower one. * mq broker: restart the settle window when the balancer lease is regained The window started when the lock owner's name changed. A balancer that lost a renewal and got the lease back still had the same name, so it skipped the wait and could repair assignments before brokers reconnected. The window now counts from the first sight of the lease's generation, which changes on every fresh acquisition and stays put on renewal. * mq broker: expire configs cached while the balancer settles A balancer reading a topic during its settle window skipped the repair and then cached the config for the full 30 seconds, so a dead leader was served well past the window. Those entries now expire at the settle deadline. * mq topic: wait for drained partitions on shutdown A partition removed by a drain or by its last client leaving was shut down but not tracked, so a stop right after a resize could exit before its final flush. Every removal now retires the partition through the manager, and Shutdown waits on the set of retiring partitions instead of a WaitGroup that a late removal could Add to while Wait ran. * mq broker: update the settle window's lease and start together The lease generation and its start were two atomics written one after the other, so a concurrent reader could pair a regained lease's new generation with the old start and see the window as already over. They are now read and written under one lock. * mq broker: refuse an assignment while stopping A partition assigned after shutdown started was shut down, but the handler still answered success, so the balancer recorded an assignment this broker never installed. It now answers Unavailable. * mq topic: signal a subscriber to stop only once Shutdown leaves partitions registered, so a drain that arrives while the broker flushes shuts the same partition down again, and closing a still registered subscriber's stop channel a second time panicked. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mq broker: bound flush retries once stopping Stop waits for every partition's last flush, and a flush retried a failing write forever, so a broker whose filer or volumes were unreachable never exited on SIGTERM. In weed server it also held back the filer and volume shutdown hooks, which run after it. Like the filer's metadata log, a flush now gives up 15s into Stop and drops the window instead. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mq.broker: flush before closing the localhost listener too The localhost server's stop hook was registered after the broker's, so it ran first and cut loopback clients before the partitions flushed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mq topic: gofmt local_manager.go Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mq broker: end a shutdown flush stalled in a filer call The shutdown budget was checked only after a failed append returned, and the entry lookup and update ran under context.Background(), so a filer that accepted the call and never answered still held Stop open. Flushes now append under a context that Stop cancels once the budget runs out, as the filer does for its metadata log. Every window after a dropped one then drops too, so a later success cannot advance the watermark or tell the follower to discard a window that never reached the filer. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mq topic: leave a partition to Shutdown once it starts RemoveLocalPartition detached a partition before registering it as retiring, so a Shutdown snapshot taken in between missed it and returned before its last flush. Once Shutdown starts, removal now reports false and the partition stays registered for Shutdown to retire, as idle cleanup already does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mq broker: refuse an assignment for a hosted partition while stopping Only a new partition was refused once Shutdown started. A partition the broker already hosted stays registered after Shutdown retires it, so its assignment was acknowledged although the broker no longer serves it. Both paths now answer Unavailable. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mq broker: expire a settling balancer's config from when it was validated The expiry was computed when the config was cached. A lookup that skipped validation just before the settle deadline and cached the config just after it kept the unrepaired assignments for the full TTL. The expiry now counts from the time of validation, so such a config expires at the deadline. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mq broker: stop waiting on an upload once the flush budget ends Cancelling the flush context ended retries and the filer metadata calls, but not a volume assignment or upload already in flight. Those ran on their own timeouts and retries, so a filer or volume server that never answered held Stop past the budget, for minutes in the worst case. The upload now runs on its own copy of the window, and the flush stops waiting for it when the context ends. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
aeca7a9a8a |
master: keep writes available when the replica placement cannot be satisfied (#13178)
* master: keep writes available when the replica placement cannot be satisfied With a placement such as 200 on exactly three data centers, losing one data center stops all writes: every volume misses a copy and leaves the writable list, and volume growth cannot find three data centers. Add master.replication.degraded_growth_min_copies (0 = off). When the topology no longer has enough data centers, racks or servers for a placement, the master grows volumes with fewer copies, never below that number. A lack of free space never triggers it. These volumes keep the requested placement in their super block and are writable while the master flags them as degraded; lookups report the copies they need, so volume servers accept writes to them. Once the topology can hold the placement again the flag is cleared: they turn read-only until volume.fix.replication adds the missing copies. The flag is in memory only, so a master restart has the same safe effect. Refs #13177 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * master: tighten degraded volume growth after review - A degraded volume is writable only with exactly the copies it was grown with: losing one turns it read-only, so a copy that comes back has missed no write, and it is not writable before all its copies are registered. - Use the first relaxed placement the topology can hold and stop there when it lacks free slots, so full disks never drop more copies. - Try every relaxed placement, ordered by copies, then data centers, then racks (011 can fall back to 010, not only 001). - Data nodes in maintenance mode do not count when checking the topology. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * master: tie degraded writability to the original servers - A degraded volume is writable only on exactly the servers it was grown on: a replacement copy no longer stands in for a missing original one. - Lookups report the degraded copy count only in that exact state, so a volume server never relaxes its check when the layout would not. - When a relaxed placement fails to find slots, try the other placements with as many copies (for example in the requested data center) before giving up, still never dropping copies for lack of space. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * seaweed-volume: copy min_writable_copies into the master.proto copy Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * seaweed-volume: let a degraded volume replicate with the master's min_writable_copies Mirrors getRemoteReplications: lookup_volume also returns the lookup's min_writable_copies, and do_replicated_request uses it instead of the placement's copy count when it is lower. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * seaweed-volume: test the degraded replicated write through the admin router Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * master: grow degraded volumes without a setting Degraded growth no longer needs master.replication.degraded_growth_min_copies: it always applies when the topology cannot hold a placement, never below two copies. Lookups skip the degraded scan until a volume was grown degraded. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * master: leave refused servers out of the degraded slot search findDegradedSlots cleared option.refused, so a retry could pick the server that just refused the allocation. Search without the refused servers first and fall back to them only when nothing else fits, as findAndGrow does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * master: document that a degraded volume losing every copy stays read-only Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * admin: warn about under-replicated and misplaced volumes on the dashboard The dashboard health line now counts the volumes volume.fix.replication would repair, using the same placement checks, so volumes grown degraded while a data center is down show up until they are repaired. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * master: spread degraded copies over racks and servers when data centers are missing A 200 volume with a single data center left found no degraded placement: only per-dimension reductions were tried, and 100 needs two data centers. Try every placement with fewer copies and no more data centers, so the remaining copies go to other racks or servers. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * master: report min_writable_copies only for the locations it is returned with LookupVolume read the locations and the degraded minimum in two steps, so a replica set change in between could pair the minimum with locations it does not hold for. Count the minimum only when the returned locations are exactly the servers the volume was grown on. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com> |
||
|
|
68072eff8a |
webdav: set mtime when a file is created (#13144)
* webdav: set mtime when a file is created OpenFile created the entry with Mtime 0 and only Close after a Write set the real time, so an empty PUT, or one truncating a file to empty, left it at 1970. The "new entry" marker for a failed first upload is now a field on the file. * webdav: keep a failed upload from removing another writer's version With every new entry carrying an mtime, a failed first upload removed whatever the path held at the first Write, including a version another writer stored after this open created it. The open now records the commit stamp of the entry it created, and the first Write keeps the removal only when the loaded entry still has that stamp. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * webdav: check the entry's commit stamp when the upload fails The first Write's lookup left a gap: a version another writer stored after it was still removed by a later failed flush. Flushes only append chunks locally, so the stored entry keeps the create's stamp until Close; the failed flush now reads it then and removes it only while it still has that stamp. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
576eb98ce9 |
mount: leave -cacheMinFreeSpace free on the chunk cache's disk (#13124)
* mount: leave -cacheMinFreeSpace free on the chunk cache's disk weed mount sizes its on-disk chunk cache by -cacheCapacityMB alone and preallocates each cache file in full when it creates it. With a capacity larger than the free space of the disk holding -cacheDir, the cache takes that disk down to nothing: the preallocations run until fallocate fails, and chunk writes fill the rest. The mount's metadata cache (a leveldb store under -cacheDir) and the swap files of dirty pages (-cacheDirWrite, which defaults to -cacheDir) live on the same disk, so once it is full their writes fail with ENOSPC, and writes whose dirty pages spill to swap return EIO to the application. The same happens when several mounts share a cache disk and together are configured beyond it. -cacheMinFreeSpace is the free space the cache leaves on that disk, written like the volume server's -minFreeSpace: a percentage like 1 or a size like 10GiB, 1 by default, as for volume servers. - When the cache opens, its disk layers shrink to the space above the floor, counting the cache files already in the directory as the cache's own. With no room the disk tier keeps no files. - Each new cache file preallocates only what the disk holds above the floor at that moment, so the files of one cache, or the caches of several mounts opening together, stop reserving at the floor. - A chunk write that lands in blocks its file already holds, preallocated or written, goes ahead as before, even with the disk under the floor. A write that takes new disk space, into a file a rotation truncated or where nothing could be preallocated, goes ahead only while the space above the floor covers it. The disk is read at most once a second, and the cache counts what it takes in between, so it cannot run past the floor between readings. A rotation gives the truncated file's blocks back, so the write after it reads the disk again. A chunk the cache cannot place is not cached, like any other miss. The webdav server's cache passes no floor and behaves as before. * mount: read the cache disk on every write that takes space, leave the index files room Review follow-ups. - take reads the disk each time, instead of once a second less what the cache took since, so a write sees what other mounts sharing the disk wrote, and what a rotation gave back. It runs only for writes past the blocks a file already holds, and a statfs costs little next to the write. - The index files (.idx and the leveldb maps) grow by a few dozen bytes a chunk beside the data files that the cache size counts. Sizing leaves them a sixteenth of the room above the floor. - The cache's own files count as room by the blocks they hold, so a file that was preallocated but not yet written when the mount exited counts in full when the cache reopens. - weed fuse checks -o cacheMinFreeSpace in the parent as well: the parent waits for the child's signal, and a child that rejects the value never sends it. * mount: keep the resolveCacheDirs doc comment on resolveCacheDirs Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mount: say -cacheMinFreeSpace stops new disk space, not every chunk Under the floor the cache still fills the blocks its files already hold. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
df59c81a8c |
master: record when the cluster started (#13121)
* topology: record when the cluster started StartedAt rides on MaxVolumeIdCommand; the first non-zero value wins so replayed or racing entries cannot move it, and the max volume id mirror file keeps it across raft state loss. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * master: carry StartedAt through raft apply and snapshots Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * master: leader records StartedAt once per cluster The leader records it right after the topology id. A cluster that predates the record gets the time its first upgraded leader runs. /dir/status shows it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test: use current StartedAt values Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * topology: never lower the mirrored max volume id A mirror rewrite for a StartedAt change could carry a bound older than one already persisted. Keep the highest bound, and read StartedAt under the file lock. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * topology: let the latest applied StartedAt win With first-wins, a master that restored an older-version snapshot without the field could record a second value while the others kept the first. Following the raft order makes every master converge on the same value. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
d49876a7aa |
filer: every filer store reads KV keys in batches (#13119)
* filer: read KV keys a few at a time for a store without batch reads Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * abstract_sql: read KV keys with one query Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * redis: read KV keys in one pipeline Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * etcd: read KV keys in read-only transactions Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mongodb: read KV keys with one query Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * cassandra: read KV keys concurrently Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * hbase: read KV keys concurrently Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * elastic: read KV keys concurrently Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * arangodb: read KV keys with one request Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * foundationdb: read KV keys in one transaction Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * ydb: read KV keys with one query Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * tarantool: send KV reads before waiting for any Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: every filer store reads KV keys in batches KvBatchGet moves from the optional KvBatchReader onto FilerStore. A listing now reads the hard link records of its waiting entries together from any store, a path-specific one included. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * tikv: count only the record reads of a listing in its test Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: return every batched key that pads to the same stored row SQL, MongoDB and YDB pad a short KV key with zero bytes, so "short" and "short\x00" read the same row. KvBatchGet kept only the last such key. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: read keys in a plain loop when KvGetEach runs one at a time Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
3d076dfcdf |
filer: aggregated metadata stream reads the log files of peers with their own store (#13116)
* filer: pass the reader's context to persisted metadata log listings The day and minute listings behind ReadPersistedLogBuffer used context.Background(), so nothing scoped to the subscription reached them. List through one helper that takes the caller's context. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: aggregated metadata stream reads the log files of peers with their own store A filer with its own store never holds another filer's persisted metadata log: log file writes emit no events and the bootstrap traverse skips the log directory. The aggregated stream read history from the local log directory and the in-memory aggregate ring only, and the ring restarts empty, refilled from each peer's saved offset. A subscriber whose cursor was older than that missed every event a peer recorded before it, for example the S3 lifecycle worker replaying expirations. Aggregated reads now also list the log directories of followed peers not known to share this filer's store, merged by file name, so the existing ordered reader and chunk-ref path serve their history. Local streams, which peers aggregate from, stay local. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: bound peer log listings and fail the read when one fails Each peer listing gets its own deadline, so a peer that stalls mid-listing cannot hold the read. A failed listing now fails the read instead of silently hiding that peer's persisted files; peers already retired as unreachable are left out. Peers are asked from the same start name the caller uses for its own store instead of the whole directory. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: keep a still-unreachable peer out of log listings after its mark expires A followed peer that keeps refusing connections is marked removed once, and the mark is dropped with its resume point an hour later. It was then listed again and its failing listing ended every aggregated persisted-log read. Leave out any peer refusing connections for peerUnreachableRemovalAfter, marked or not. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: subscribe tests track their peers on the test filer's store Aggregated reads now list the log files of followed peers with their own store. The subscribe tests' peers have no server and share the test filer's store, so record that instead of dialing them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
760f88e294 |
filer: bind scoped POSIX locks to the verified token id (#13047)
* filer/posixlock: key lock owners and leases by principal A lock's owner becomes (Principal, Sid, Owner). The principal is server-side state, empty for unscoped callers, so owners with equal client-chosen sid and owner under different principals conflict and never match on unlock, release, reassertion or coalescing. The session index and leases key on (Principal, Sid). Scoped sessions are leased per key from their first acquisition: the lease ends at the earlier of TTL after the last acquisition or renewal on that key and Lease.NotAfter. Expired scoped locks are dropped before any operation on their key as well as by ReapExpired. Unscoped sessions keep their current whole-session lease, started by the first keepalive. The handler passes the unscoped session for now, so behaviour is unchanged. NewManagerWithClock lets tests drive lease boundaries. * filer: bind scoped POSIX locks to the verified token id PosixLock trusted the client-supplied sid. GET_LK reports a conflicting lock's sid and owner, so a scoped caller with a write grant on the same path could reuse them to unlock or release another holder's lock, keep it alive, or replace it through a KEEP_ALIVE reassertion. A tokenless request with the same identity could do the same. A request admitted for a scoped token now acts for that token's verified jti, derived in posixLockAuthority from the interceptor's authority. It controls only the locks it took, whatever sid or owner it names. Its lease on each key ends at the earlier of the 15s TTL after its last acquisition or renewal and the token's expiry plus the clock leeway. Each renewal passes admission for its key, so a narrower token cannot extend keys outside its grant. Tokenless and unscoped calls keep the unscoped namespace and behaviour, and can no longer match a scoped lock. Scoped TRY_LOCK and reassertion ranges must be well-formed read or write ranges, checked before any state changes. GET_LK, the protobuf and forwarding are unchanged; the principal is never returned or logged. A renewed token with a new jti is a new owner: the old locks expire and are reacquired. * filer/posixlock: release an expired session once, however many ranges it holds * posix locks: report a lock lost on re-assertion to the mount A mount whose lease lapsed, for example when its scoped token expired or was replaced by one with a new id, kept re-asserting locks that another session had since taken. The filer logged the loss but returned success, and the mount discarded the reply, so nothing on the mount side showed it. KEEP_ALIVE now returns the first conflicting lock in the existing has_conflict and conflict fields, which older mounts ignore. The mount warns once per key when it learns of a loss and forgets it once a re-assertion succeeds or the key is no longer held. Writes are not fenced. * filer/posixlock: drop every expired session's ranges in one pass * filer/posixlock: renew a scoped session's same-grant leases together Scoped leases expire per key and a keepalive renewed only the key it named. A mount renews its keys one keepalive at a time, so with many keys and slow keepalives a round could outlast the 15s lease and a healthy mount lost locks; unscoped sessions never had this problem because any keepalive renews the whole session. Each scoped lease now records a fingerprint of the verified grants it was acquired or re-asserted under: a SHA-256 over the sorted, deduplicated (access level, path) entries. A keepalive, bare or re-assertion, extends every live lease of the same session (principal and sid) held under the same fingerprint, each to the request's lease (the earlier of the TTL and the token's expiry plus leeway). Leases taken under other grants, such as a narrower token reusing the jti, are still renewed only by name, and a lease that already ended is not revived before the sweep drops it. No extra filer lookups; unscoped sessions are unchanged. * filer/posixlock: bound same-grant renewal and refuse ended-lease grants A scoped keepalive scanned every key of its session to renew those held under the same grant, so a mount renewing N keys one by one did N^2 lease visits per round under the manager's mutex. The scan now runs at most once per quarter lease TTL per grant; every key under the grant still ends no earlier than three quarters of a TTL after the latest renewal, and the named key is always renewed in full. TryLock now refuses a scoped grant whose lease has already ended, such as a request admitted just before its token expired that then waited on the manager, instead of granting a lock the next operation would drop. The filer returns Unauthenticated, which the mount reports as EIO. * filer/posixlock: skip same-grant scans by deadline floor, not by time The scan throttle remembered when a grant was last renewed, not how long that renewal made its keys last. A replacement token with the same id and grants but a later expiry could then renew one key while the others kept ending at the old token's expiry. Each session now keeps, per grant, the deadline the last scan gave every live key under it, lowered whenever a key is leased for less. A renewal skips the scan only while that floor already reaches the earlier of its own deadline and three quarters of a TTL from now, so a mount renewing keys one by one still costs linear work. A keepalive from a session holding no leases records nothing, and a session's floors go with its last lease, so lock-less keepalives with changing session ids no longer accumulate state the sweeper never sees. * filer/posixlock: never move a scoped lease's deadline earlier Renew, a re-assertion, a same-grant scan and a re-lock all set the key's deadline to the request's own bound. A request under the old token of a principal that already renews under a replacement (same id and grants, later expiry) can land after the replacement's renewal, for example one of the 32 concurrent keepalives in flight when the mount switched credentials. It then cut the key back to the old token's expiry, and the lock was dropped before the next round although the replacement had renewed it. Keep the later of the current and the requested deadline: every deadline still comes from an admitted request of the same principal, so a lease never outlives the latest of its tokens. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer/posixlock: keep each session's index and leases in one map bySession, lastSeen, leases and floors were four maps keyed by Session that had to be created and pruned together. They become one sessions map whose sessionState holds the session's keys (with each key's lease), its last keepalive and its grant floors, so a session's state is dropped in one place. The release loop shared by ReapExpired and ReleaseSession becomes releaseOn. ReleaseSession now also forgets an unscoped session's last keepalive, so a session it released is not reported again by the next sweep. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
3836311f8f |
filer: end a listing at a short page, and make every store fill its pages (#13105)
* filer: end a listing at a short page from a store that fills its pages ListEntries read a directory a page at a time and stopped at the first empty page, so every listing the caller's limit did not cut ended with one more scan of the store, from the last name on, that returned nothing: two scans for a directory smaller than a page. A page that comes back short of its limit now ends the listing when the store says it fills its pages (the new optional FullPageListingStore). leveldb, leveldb2, leveldb3 and TiKV do: they iterate the directory's keys until the limit is handed over or the keys end. A store that cuts a page of names to the limit and then drops some (the Redis stores, for a name whose entry is gone or expired) can end a page short with names behind it; it does not declare the interface and is asked until a page comes back empty, as before. TiKV's listing swallowed an iterator error while it skipped the start name or an expired entry, and ended the page there. It returns the error now: a page that ends short must mean the keys ended. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> * filer: see through the path translator for a store that fills its pages A path-specific store is wrapped in FilerStorePathTranslator, which does not implement FullPageListingStore, so its directories kept the extra empty scan. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: keep the last listed name when a refill lists nothing A page that lost entries to expiry is refilled from its last name. A refill that found nothing returned an empty last name, so the next page of a store that does not fill its pages started over at the top of the directory and listed every entry again. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: name the stores that fill their pages instead of an interface A short list of store names in Filer.ListsFullPages replaces the FullPageListingStore interface, the wrapper method and the per-store declarations. A path translator reports its backend's name, so it needs no unwrapping. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * foundationdb: read a listing in batches until it fills the page Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * redis: fill a listing page past orphaned and expired members Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * redis2: fill a listing page past orphaned and expired members Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mongodb: report a cursor error that ends a listing Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * tarantool: fail a listing on a malformed reply Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: test the last listed name after a refill that lists nothing Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: end a listing at a short page from any store Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * rocksdb: build the tests against the current NewFiler Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * rocksdb: count only listed entries toward the page limit Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * rocksdb: return the decode error instead of ending the listing Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: MapleWhiteZZZ <18653045+MapleWhiteZZZ@users.noreply.github.com> Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com> Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com> |
||
|
|
5a9287642f |
filer: cap list snapshots at the peers' delivery watermark (#13109)
A listing's snapshot only accounted for this filer's in-flight writes. A peer on the same store can have stamped a write below it that is not committed yet; the listing misses it and the client drops its event as already listed, leaving a stale entry (a mount reads a just-closed file as empty) until the next listing. |
||
|
|
f9b494c576 |
filer, s3: give an entry without chunks the ETag of its inline content (#13106)
* filer, s3: give an entry without chunks the ETag of its inline content A file written through a mount stores no MD5. With no chunks either (an empty file, or a small one kept inline) S3 answered HEAD, GET and listings with an empty ETag, and the filer's HTTP API with the chunk form for zero chunks, "d41d8cd98f00b204e9800998ecf8427e-0". Both now answer with the MD5 of the inline content, which for an empty file is what AWS gives an empty object and what the same file gets once it is written through S3. An entry whose size reaches past its inline content (a hole that no chunk covers) keeps the ETag it had. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> * filer: match If-Match on an entry without chunks against its inline-content ETag The gateway now answers the MD5 of the inline bytes for an entry with no stored MD5 and no chunks; the filer's conditional check still saw an empty ETag, so a PUT with If-Match set to the ETag HEAD returned failed with 412. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: MapleWhiteZZZ <18653045+MapleWhiteZZZ@users.noreply.github.com> Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com> Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com> |
||
|
|
db0ec9e9b3 |
filer: count and time the gRPC requests by method (#13107)
* filer: count and time the gRPC requests by method
The filer's request metrics cover its HTTP API. The mounts and the S3
gateway reach it over gRPC, so on a cluster used through them the filer
reported its store operations and nothing about the requests behind
them: how many lookups, creates, renames or listings arrive, how long
each kind takes, how many end in an error.
Two metrics for the gRPC port, filled by a unary and a stream
interceptor: SeaweedFS_filer_grpc_request_total{method, code} and
SeaweedFS_filer_grpc_request_seconds{method}. A stream is counted when
it ends, and timed unless the client holds it open (a subscription, a
client stream). A lookup that finds nothing returns ErrNotFound without
a status; it is labelled NotFound rather than Unknown.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
* filer: label a call ending in its context's error as gRPC reports it
A handler that returns ctx.Err() reaches the client as Canceled or
DeadlineExceeded; status.Code labelled it Unknown.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* filer: count a health watch without timing it
grpc.health.v1.Health/Watch stays open until the client leaves, so its
duration is the connection's lifetime, like a subscription's.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* metrics: dashboard panels for the filer's gRPC requests
Calls, errors by code, and p99/p50 durations by method, in the Filer row.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: MapleWhiteZZZ <18653045+MapleWhiteZZZ@users.noreply.github.com>
Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>
Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com>
|
||
|
|
ef0967bead |
filer: read the entry path once per write (#13090)
* filer: read the entry path once per write A create looks the path up to decide what it makes of the entry: the inode and crtime to keep, the chunks the write leaves behind, the old side of the metadata event. The store wrapper looked the same path up again, in handleUpdateToHardLinks, to learn the hard link the name carried before. Both reads happen under the same per-path lock, a moment apart, and for a file written without a hard link the second one decides nothing at all: its result is discarded. An overwrite pays for it twice over, because that read decodes the row being replaced -- gunzip included above CountEntryChunksForGzip -- and it is the row the create already holds. Neither read shows up as a second find in the store metrics: the wrapper's goes to the actual store, and FilerStoreCounter counts only FilerStoreWrapper.FindEntry. The wrapper now takes the caller's word. InsertEntryReplaces and UpdateEntryReplaces carry the entry a caller read to handleUpdateToHardLinks, which keeps to it instead of reading the path again. An insert whose lookup found the path empty goes the way #13006 opened with InsertEntryKnownAbsent, which rename alone used. Which word may be taken is the delicate part, so Filer.findEntry reports whether its answer is what the store holds at the path: - a lazy fetch from a remote mount serves an object the store does not have and writes nothing to it, so it says nothing about the row there; - inside a store transaction a lookup hides an expired S3 entry whose row the transaction keeps until the commit, and a write replacing it still owes that entry its hard link -- which is why FindEntryForOverwrite exists; - where the expiry check deleted the row, the delete dropped its link already, so an answer of "empty" is honest. The write also reads the path itself whenever there is a link to take off, for two reasons. A file with a hard link has its record changed again when the store refused a commit (changeLinkRecord runs its change up to linkRecordAttempts times), and each run must judge the name as the store holds it by then. And a row that carries a link is the row whose link this write drops: plain creates are not routed to the write owner, so another filer may have replaced the same name already and dropped that link, and dropping it twice deletes the record under the file's remaining names. What is trusted is the case with nothing to decide -- no link on either side -- which is an ordinary file write, since a mount makes a link id only when a file is linked or copied. The HTTP append path read the entry three times: once to merge with it, once to prove it had not changed while the chunks were uploaded, and once in the create. The create takes the recheck's entry now. A 20-chunk entry on leveldb2 goes from 343 to 286 allocs/op and from 44.6 to 38.3 KiB/op per overwrite, the difference being the decode of the replaced row. Where the store is reached over the network, the read saved is a round trip per write. Tests count the reads one write makes at the store, pin that a dropped link is dropped once against a row another filer has already replaced, and keep the create using the entry it is handed. #9645's own guard expected the create's lookup to be what separates passing existing from passing nil; both are one read now, so it requires one read either way and checks the crtime came from the entry passed in. Issue #5067. Review of the first version caught one more case. The known-absent shortcut must not take an entry that carries a link: InsertEntryKnownAbsent counts the name as joining without reading it, so another filer storing that name for the same link between this lookup and the write would have it counted twice, and the count would run one above the names. The regular insert reads the name inside the change of the record. CreateEntry and ReplaceFileForRename keep the write's own read for a linked entry; TestNewLinkedNameStillReadsThePath pins it. * filer: drop issue numbers from the write-read test comments Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: say a plain-over-plain write can miss a link stored after the read Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: whitefox <whitefox@mayflower.work> Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
5b7e2d9e9e |
fix: retain released lock version watermarks (#13083)
* fix: retain released lock version watermarks * fix(lock_manager): scope release records to lease identities Keep a stable acquisition ID in opaque renewal tokens so release history cannot reject a valid lease from a different primary when generation counters overlap. Preserve earlier releases across new acquisitions and ownership eviction. Carry the maximum lease expiry with releases, prevent renewals from shortening that bound, reject expired inserts, and reclaim release records after expiry. Track replication and handoff before sending copies so local-only leases need no release records. Add regressions for fresh-primary failover, equal and lower generation counters, reordered releases and renewals, bounded retention, local-only workloads, ownership eviction, legacy release metadata, and gRPC release handling. * lock_manager: name the release replay tests after the behavior they check Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(lock_manager): serialize lease handoff with local mutations Hold per-key mutation admission through a fresh lease snapshot, the transfer RPC, and source demotion or removal. A release that wins first suppresses the transfer; a release arriving during handoff waits and is forwarded to the new primary afterward. Keep incoming replication outside the gate to avoid callback cycles. Retain source authority on transfer errors and apply transfer completion only to the lease that was sent. Add real gRPC regressions for releases during both handoff branches and replay after release, plus coverage for fresh snapshots, transfer errors, unrelated keys, and replacement leases. * fix(lock_manager): retry handoffs without retaining renewal authority Deliver a source-held lease to the current owner before forwarding renewal or unlock. Freeze local authority before sending a transfer, including when the receiver may have committed despite an RPC error. Retry without requiring a membership change, with backoff and shutdown cancellation. Recheck ownership after a background handoff and preserve the copy until the latest owner receives it. Replicate the effective installed expiry instead of a shorter transfer input. Replace timing assumptions with a same-key admission contention hook. Cover pre-handoff releases, lost acknowledgements, retry cleanup, owner changes, and effective expiry. Document why identityless legacy releases cannot safely delete slash-format leases with overlapping generation counters. * test(filer): set up DLM handoff before the peer lock transfer check Ring-change transfers now go through Dlm.TransferFn, which SetupDlmReplication installs; without it the lock stays pending on the old filer and the peer-auth transfer test cannot see it move. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test(lock_manager): bound the handoff and unlock completion waits Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test(filer): give the handoff retry expiry subtest a one-second lease Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(lock_manager): serve lock and unlock here when a handoff ends with this node as primary transferToOwnerLocked now returns the primary it observed after the handoff. LockWithTimeout and Unlock redirected to the primary read before the transfer, so a ring that moved back during the handoff sent the client away from the node that holds the lease. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test(lock_manager): bound the admission probes in the handoff tests Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(filer): keep the holder's renew token while its lock handoff is pending A failed transfer RPC or a frozen lease answered the lock request with an error and an empty RenewToken. The client treats that as a rejection and drops its token, so it can no longer renew the lease once the handoff completes. Report transfer failures as LockHandoffPending and echo the caller's token for that error. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * refactor(lock_manager): return lease expiry from Lock, Unlock and InsertLock The DLM was the only production caller of these methods and used private twins (lockWithExpiry, unlock, insertLock) to get the effective expiry. Return it from the public methods instead and drop the twins. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * refactor(lock_manager): share the copy acceptance checks between InsertLock and InsertBackupLock Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * refactor(lock_manager): drive handoff tests through TransferLockToOwner TransferLock and its helpers were only reachable from tests. Remove them so the tests exercise the production handoff path. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * refactor(lock_manager): share the routing and handoff prologue of LockWithTimeout and Unlock Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Master <Master@node0.8m510.lpad-pg0.utah.cloudlab.us> Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
6b2ad112a8 |
volume: check the collection name in handlers that build file paths from it (#13087)
* volume: check the collection name in handlers that build file paths from it AllocateVolume, VolumeMount, VolumeCopy and the EC rebuild, copy, delete, mount and to-volume handlers joined the request collection into volume file paths, so a collection such as "../x" reached files outside the volume directory. They now apply checkVolumeCollection, as CopyFile and ReceiveFile already do. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * seaweed-volume: check the collection name in handlers that build file paths from it Mirrors the Go volume server: allocate_volume, volume_mount, volume_copy and the EC rebuild, copy, delete, mount and to-volume handlers apply check_volume_collection, as copy_file and receive_file already do. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * volume: check the source's collection before VolumeCopy builds paths from it VolumeCopy names the destination files after the collection the source reports in ReadVolumeFileStatus, so that value needs the same check as the request's collection. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * seaweed-volume: check the source's collection before volume_copy builds paths from it Mirrors the Go VolumeCopy: the collection the source reports in ReadVolumeFileStatus names the destination files, so it gets check_volume_collection too. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * volume: stub the source in the VolumeCopy source collection test Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * seaweed-volume: keep check_volume_collection's doc comment as on master Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
16412c374a |
test(filer): wait for the fake master's volume location in the manifest reuse tests (#13086)
The master client marks a master current as soon as the stream opens and applies the first VolumeLocation afterwards, so GetLocations right after GetMaster can miss volume 1 on a loaded runner. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
e6aed012f8 |
filer: pass cutToSpan in the manifest reuse test (#13082)
ResolveChunkManifest gained a cutToSpan argument while this test was in flight, so master stopped compiling weed/server. The test compares chunk lists, so it resolves every referenced chunk. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
a9fda6b50f |
filer clients: authenticate filer gRPC calls with per-call admin tokens (#13039)
* Add per-call filer authentication sources and pooled client wrappers * Authenticate gateway filer calls with per-call admin tokens * Authenticate shell admin and synchronization filer calls * Authenticate workers MQ and remaining filer client paths * Cache filer client signing keys and sign subscriptions with the shared key Re-reading security.toml on every filer RPC cost about 125us against 8us for signing. Keep the keys for up to a second, re-reading at once when a WEED_ override or the configuration directory changes. When the file exists but cannot be read, keep the last keys read, else the startup keys, as FilerAdminKeys does, so a process without a key stays tokenless. Metadata subscriptions prefer the shared key, as filer peers do, because older filers verify subscription admin tokens only with it. * Authenticate admin-script, maintenance and filer.conf shell paths Plugin worker admin scripts and master maintenance scripts build their own shell options and carried no filer token source; fs.configure and s3.bucket.quota.check read filer.conf without it. * filer.cat: report a failed read; isolate key overrides in the admin-script test filer.cat ignored the error from its filer call and exited successfully, leaving a truncated -output file. Report the error and exit with failure. The admin-script token test now clears the WEED_ signing-key overrides, which take precedence over security.toml. * security: refuse gRPC keys too short to sign; query engine uses client TLS Under GODEBUG=fips140=only, hmac.New panics on keys under 14 bytes. The startup check now covers jwt.filer_signing.grpc_key and grpc_previous_key, and filer client token sources check the keys they read, so a reloaded or per-endpoint security file with a short key is refused instead of panicking when the next RPC signs. The query engine's broker client dialed every master, filer and broker in plaintext, so the admin token it now sends could cross the network in the clear. It dials with the grpc.client TLS settings instead, and weed-sql loads security.toml as weed-db does. * security: per-endpoint admin tokens ignore WEED_ key overrides FilerAdminTokenFromFile honored WEED_JWT_FILER_SIGNING_GRPC_KEY and WEED_JWT_FILER_SIGNING_KEY. Those are process-wide, so filer.sync with -a.security and -b.security signed both clusters' admin tokens with the one key, handing each cluster a token valid on the other. A per-endpoint file now supplies its own keys only. * weed-sql, weed-db: refuse to start on an unreadable security.toml Both only warned when security.toml was present but could not be read or parsed. They then dialed without the grpc.client TLS settings while the filer token source could still sign admin tokens from WEED_ environment keys, so the tokens could travel in plaintext. They now exit with an error that does not quote the file; a missing file is still fine. * pb: take the filer token source in WithGrpcFilerClient and WithOneOfGrpcFilerClients Fold WithGrpcFilerClientAuth and WithOneOfGrpcFilerClientsAuth into the existing helpers instead of keeping two names for each. Callers without a token source pass nil. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * util: return the read error from ReadConfiguration Fold ReadConfigurationWithError into ReadConfiguration. The error is returned and not logged, since parser errors can quote values; the existing reload callers already warn when no file was read. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * security: keep the test-only filerAdminToken helper in the test It had no production caller. The test helper now resolves keys through filerClientKeysFrom, as the token sources do. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * util: read security.toml once in LoadSecurityConfigurationOrError It validated the file, then merged it with a second read whose failure was ignored and whose parser error was logged. It now merges with one read and logs nothing from the parser. Viper's search also treats a directory the process cannot search as holding no file; a candidate that cannot be checked for lack of permission is now refused too. * security: verify admin subscription tokens with the gRPC clock leeway CheckGrpcMetadataSubscription checked admin tokens strictly, while unary filer calls allow jwt.filer_signing.clock_leeway_seconds. With ten-second client admin tokens, a subscriber whose clock trailed the filer's by more than ten seconds was refused with a matching key. It now takes the leeway, and the filer passes its configured one. The leeway check moves from the server package to security.IsFilerAdminTokenWithLeeway so both use it. * util: start without security.toml only when every candidate is confirmed absent A candidate whose check fails for any reason other than not existing, such as a symlink loop, is refused like one the process cannot search. --------- Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
f6b130f61c |
filer: keep a stored manifest when a commit lists its chunks flat (#13051)
* filer: keep a stored manifest when a commit lists its chunks flat Since #12462 the filer folds a commit's small chunks into manifests 256 at a time, whichever client sent them. A client that keeps its own chunk list sends every chunk it wrote on each flush and does not take the folded list back. The Hadoop client is one: SeaweedOutputStream's hflush and hsync send CreateEntry with the whole list, which the client folds itself only past 1000 chunks. Once 256 small chunks have piled up, each flush makes the filer fold the same chunks again into a new manifest blob, and the manifest of the entry it replaces is deleted: up to three manifests written and three deleted per flush. cleanupChunks now puts back, after compacting the list and before folding it, each manifest of the replaced entry whose chunks the list holds flat and unchanged (filer.ReuseStoredManifests). The manifest must span exactly the chunks it holds. A manifest the commit lists itself, one that cannot be read, one with a chunk changed or missing, and a hard-linked file's are left alone. MinusChunks counts the kept manifests as listed, so the commit does not delete them. That entry has to be the one the commit replaces and deletes against. UpdateEntry already prepares its chunks under the path lock from the entry it read there. CreateEntry folded before taking the lock; it now prepares the chunks under the lock, after its precondition checks, and reads the replaced entry there when the request has at least 256 chunks. filer.CreateEntry still deletes the chunks of the replaced entry that the new list drops, which no longer include the kept manifests. TestCommitKeepsTheStoredManifestOfChunksListedFlat (create and update): the second commit of the same list plus one chunk keeps the manifest, writes no blob and queues nothing for deletion. It fails on master. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: take the replaced entry in cleanupChunks instead of a cleanupChunksReplacing twin Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: reuse a stored manifest only for its chunks listed in its order Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: keep the stored entry's manifests out of a refused update's cleanup Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: do not reuse a manifest whose chunk ties with a chunk outside it Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: drop a pull request number from a reuse test comment Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: look up same-timestamp chunks by index in the manifest reuse overlap check The tie check rescanned the whole commit for every candidate manifest, so a 102,400-chunk commit with 400 matching manifests ran 40M map lookups under the path lock. Index the commit's positions by ModifiedTsNs once and check only the positions sharing a held chunk's timestamp. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com> |
||
|
|
c7fc40c76c |
filer, mount: read a manifest's chunks only within its span (#13048)
* filer, mount: read a manifest's chunks only within its span Until #13042, a truncate through a manifest only shortened the manifest chunk; the chunks it holds stayed whole. Reads resolve those chunks at their own offsets and sizes, so once such a file grows over the cut again without writing it, by an extending truncate or a write past the end, the cut bytes come back where zeros belong. #13042 keeps new truncates from leaving such manifests, but files a mount truncated between #12462 and #13042 still have them. Reproduced with weed mount on a local cluster: a mount from before #13042 appends 700 lines with one close() each, so the first 256 fold into a manifest, and truncates the file to 100 lines; a mount from current master then extends it past its old end with ftruncate. The extended range read 8,580 bytes of the cut lines instead of zeros, through that mount and through the filer. Reads now cut each manifest's chunks to the manifest's span: ResolveChunkManifestForRead, used by NonOverlappingVisibleIntervals (filer and S3 streaming, WebDAV, the mount's merge reads), the S3 ranged reads and the mount's peer reads, and ChunkGroup for the mount's reads. A manifest made by MaybeManifestize spans its chunks exactly, so only shortened ones change. ResolveChunkManifest still returns the chunks whole: MinusChunks, deletions and the other chunk-list comparisons need every chunk a manifest references, or the chunks past the cut would never be deleted. * sw-client: read a manifest's chunks only within its span Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * java client: read a manifest's chunks only within its span Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: drop PR numbers from the manifest span comments Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: fold ResolveChunkManifestForRead into ResolveChunkManifest ResolveChunkManifest takes cutToSpan: the read paths pass true, the deletion and chunk-list comparison paths pass false. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3api: cut manifests to their span when flattening an object's chunks A full-object SSE GET, CopyObject and UploadPartCopy flatten the source's manifests into a plain chunk list, which drops each manifest's span, so the chunks a truncate left past a shortened manifest came back as object data. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * shell: purge a volume.fsck path only for chunks within a manifest's span A chunk past a shortened manifest's span is still referenced but never read, so a missing volume under it loses nothing. The purge decision now uses the span-cut chunks while the inventory keeps every reference. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * shell: cut manifests to their span in fs.distribute_chunks The entry is rewritten with the resolved chunks as a flat list or a new manifest that spans them, so chunks past a shortened manifest's span became readable again. The filer's update still deletes them, since it compares against the old entry's uncut chunks. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * shell: verify only the chunks within a manifest's span in fs.verify A chunk past a shortened manifest's span is never read, so a missing needle under it failed the entry and, with -pruneEntries, deleted a file whose readable bytes were intact. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * shell: mark the chunks past a manifest's span instead of allowing the visible ones The purge gate now skips only the resolved chunks that the span cut drops, so chunks that come from outside the manifests keep their purge behavior. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * shell: skip the purge for a missing past-span chunk on a listed volume volume.fsck -findMissingChunksInFiler queued a path for deletion when a listed volume's index lacked any chunk the uncut inventory recorded, including a chunk past a shortened manifest's span that no read reaches. Record those chunks per path during the filer walk and let only a missing chunk within the span queue the purge. The path is still reported. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
ec34160a1a |
master, admin: report the real last heartbeat time of volume servers (#13074)
* master: report each volume server's last heartbeat time DataNode.LastSeen only moves when a volume server registers, so nothing recorded when the master last heard from it. Stamp every processed heartbeat and carry it in DataNodeInfo.last_heartbeat_ns. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * admin: show the master's last heartbeat time for volume servers The volume server details reported the admin's own clock as the last heartbeat. Use the time the master reports, and show unknown when the master does not report one. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * admin: carry the last heartbeat time into the volume servers page GetClusterVolumeServers builds its records from the master's volume list without the topology conversion, so the details dialog showed unknown. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
2e81c0b7c0 |
filer: route a rename whose source misses locally to the write owner (#13064)
* filer.proto: mark a forwarded StreamRenameEntry with is_moved Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: send a rename whose source misses locally to the write owner Exclusive and conditional creates are stored on the path's write owner. With separate filer stores, a rename sent to another filer before it has replayed the create found no source and failed, so a mount that flushed a deferred create and renamed the file right after got EIO. Such a rename now goes to the source's write owner, which moves the entry and whose events are relayed to the caller, unless the owner runs on this filer's store. A forwarded rename is applied only by the filer its own ring names as the owner. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: send an AtomicRenameEntry whose source misses locally to the write owner The same race reaches the unary rename that S3, WebDAV, SFTP and fs.mv use: an object or file created through the owner and renamed through another filer before replication found no source. It is forwarded like the stream rename, with is_moved bounding it to one hop. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * rename: report a missing source as ENOENT A rename whose source is absent fails with the store's "no entry is found" error, which neither the filer's errno mapping nor the mount's message mapping recognized, so the client got EIO instead of ENOENT. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer.proto: report a forwarded AtomicRenameEntry's last event position Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: answer a forwarded rename once the owner's events are replayed here The rename's target is stored on the owner only until this filer replays it, so an unlink of that name sent here right after the rename would miss it and report success. The owner now reports the log position of the rename's last event, and the forwarding filer holds its answer (bounded) until its stream from the owner has delivered that far. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: refuse a forwarded no-replace rename over a target this filer has Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: wait for an owner this filer no longer follows before answering a forwarded rename PeersCaughtUpTo counts an untracked peer as caught up. An owner whose stream was down long enough to be dropped has replayed nothing here, so a forwarded rename answered then could leave a follow-up unlink through this filer missing the target. Require the owner to be tracked with a watermark at or past the rename, still bounded by ownerEventsCatchUpCap. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
96fd7fe6e2 |
volume: report mounted EC shards whose file on disk is gone, replaced or resized (#13069)
* volume: report mounted EC shards whose file on disk is gone, replaced or resized
Each EC heartbeat tick stats every mounted shard file and compares it with the
open descriptor: a missing path or a different file is a ghost, a size other
than the mounted one is stale_size. Mismatches are logged per shard and counted
in SeaweedFS_volumeServer_ec_shard_disk_mismatch{reason}.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* volume(rs): report mounted EC shards whose file on disk is gone, replaced or resized
Mirror of the Go check: each EC heartbeat tick compares every mounted shard
with its file (missing or another inode = ghost, other size = stale_size),
warns per shard and sets SeaweedFS_volumeServer_ec_shard_disk_mismatch{reason}.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* metrics: chart EC shards that disagree with their file on disk
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* volume(rs): tell a replaced EC shard file apart on non-unix hosts
Without inode numbers, compare the creation and modification times of the
path and of the open handle.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* volume: check mounted EC shards off the heartbeat loop
A stat stuck on a stalled disk no longer holds up heartbeats or shutdown; at
most one check runs at a time.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* volume(rs): check mounted EC shards off the heartbeat loop
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* volume(rs): compare file ids to tell a replaced EC shard file apart on Windows
Timestamps can match on a replacement file. Use the volume serial and
file index from GetFileInformationByHandle there, and dev/inode on
unix, the same identity Go's os.SameFile compares.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* volume(rs): copy mounted EC shard state out before checking the disk
The check held the store read guard across its file system calls, so a
stalled disk kept the guard and a waiting writer could then stall the
heartbeat's own read. Copy each shard's path, size and file id under
the guard and check them after it is released. The id is recorded when
the shard opens, so no extra handle is held for the check.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* volume(rs): run the EC shard disk check on a detached thread
Dropping the runtime waits for spawn_blocking tasks, so a stat stuck on
a hung disk could hold up shutdown. A plain thread is not waited on.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* volume(rs): stat the EC shard path instead of opening it
A replacement the server cannot read failed the open and was never
counted as a ghost. Compare device, inode and length from the path's
metadata, as the Go side does with os.Stat; on Windows open it with no
access rights.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* volume(rs): test the EC tick past a stalled disk check
The check thread start takes the check to run, so a test can stall one
after its snapshot and show that a writer still gets the store, the tick
still reports, and no second check starts.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* volume: keep VolumeServer int64 counters 8-byte aligned on 32-bit
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
|
||
|
|
46fe0f10da |
volume: count failed EC shard copies by reason (#13068)
* volume: count failed EC shard copies by reason
Each failed VolumeEcShardsCopy now increments
SeaweedFS_volumeServer_ec_shard_copy_failures_total{collection,reason} and
logs the volume, shards, source and reason. Reasons: source_not_found,
empty_index, no_space, timeout, io_error, other.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* grafana: chart EC shard copy failures by reason
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* volume(rs): count failed EC shard copies by reason
Mirrors the Go volume server: each failed VolumeEcShardsCopy increments
SeaweedFS_volumeServer_ec_shard_copy_failures_total{collection,reason}
with the same reasons and logs the volume, shards, source and reason.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* volume: classify wrapped gRPC NotFound and DeadlineExceeded copy errors
A source status that the destination wraps as text keeps its code only as
"code = NotFound" (Go) or the code's description (Rust), so match those
too.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* volume(rs): record EC copy failures inside the copy task
The copy keeps running after the caller cancels, so its failure is
reported from the spawned task; a join error is reported by the handler.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
|
||
|
|
b6237dd8b1 |
master, admin, shell: warn about volume servers left in the default data center or rack (#13066)
* master: warn when a volume server registers in the default data center or rack A volume server started without -dataCenter or -rack lands in DefaultDataCenter/DefaultRack. Next to servers with explicit placement it becomes its own failure domain for placement and balancing. Log a warning when such a server registers while other servers name their data center, or other racks of the same data center are named. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * admin: warn about volume servers left in the default data center or rack The Volume Servers page lists the servers that fell back to DefaultDataCenter or DefaultRack while other servers name theirs, with their volume and EC shard counts, so the stray failure domain shows up before placement and balancing act on it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * shell: cluster.check warns about volume servers in the default data center or rack Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * shell: cluster.check prints placement warnings before the capacity checks A disk type with no free slots made cluster.check return before the default data center/rack warnings were printed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * admin: list each data center's rack once in the default placement check Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
7bbb65fa80 |
master: /col/delete requires an explicit collection name (#13055)
* master: /col/delete requires an explicit collection name A /col/delete request without a collection parameter, or with an empty one, read as the empty-named default collection and deleted it. Return 400 instead, and accept collection=_default (the keyword weed shell uses) to delete the default collection deliberately. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * master: keep a collection literally named _default addressable by /col/delete collection=_default now names the empty-named collection. A collection created with that literal name would have been unreachable, and a request meant for it would have deleted the default collection instead. Resolve the keyword to the literal collection when one exists, and refuse the request when both exist. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * master: /col/delete accepts only the DELETE method A GET is expected to be safe, yet a bare GET or a link prefetch deleted the named collection. Any other method now gets 405 with an Allow header, and the docs, benchmark help and test helpers send DELETE. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * master: /col/delete accepts _default_ for the default collection When a collection literally named _default exists next to the default collection, collection=_default is refused, which left the default collection with no way to be named. Accept the _default_ spelling that weed shell collection.delete already takes; it always means the default collection. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * master: /col/delete keeps a literal _default_ collection addressable _default_ now resolves like _default: to the literal collection when one exists, to the default collection otherwise, and refuses the request when both exist. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * REST_API: /col/delete when both keyword names are literal collections Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com> |
||
|
|
f2e9e49842 |
master: stop volume growth from leaking volumes into a just-deleted collection (#13035)
* topology: stop a grow once a delete fences its collection A grow request creates its volumes one after another and resolves the collection by name for each, so once the collection was deleted the rest of the request recreated it. The request now keeps the collection it started in and holds a per-collection fence shared while it creates each volume. A delete can raise the fence exclusively, which waits out the volume in flight, and the request stops at its next volume. A collection dropped only because its last layout emptied is followed to the one published under its name. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * master: fence volume growth before deleting a collection The delete listed the collection's servers, fanned out DeleteCollection, and only then dropped the collection from the topology. A grow still running created its next volumes during or after the fan-out, on servers that had already been cleaned or were not in the list, and those volumes registered a new layout for the deleted collection that nothing removed. A bucket deleted right after its first write leaked most of its initial volumes this way. The delete now raises the collection's growth fence first, so the volume in flight registers and is deleted with the rest, and the grow stops. A failed fan-out lifts the fence, since the collection stays in place. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * topology: refuse assigns from a collection being deleted The delete waits for the volume a grow is creating before it lists the collection's servers, and the collection's writable volumes stayed assignable meanwhile, so a write could land in a volume about to be deleted. The delete now raises the fence before it waits, and assigns check it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * topology: list only collections that hold a volume layout A grow request publishes its collection before its first volume registers, so one that created nothing left a collection with no volume in the list. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * topology: queue no grow for a collection being deleted PickForWrite returned the layout's shouldGrow before it checked the fence, so an assign on an empty layout of a collection being deleted still queued a grow. That grow could run after the delete finished and recreate the collection. Check the fence right after the pick, before any early return. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * topology: keep an emptied collection published while growth holds it DeleteLayout unpublished a collection as soon as its last layout emptied, even while a grow held it or a delete had fenced it. The volume in flight then registered by name into a new collection that the delete never listed servers for, and the delete's final DeleteCollection dropped it from the topology while it stayed on disk. Unpublish an empty collection only when no grow or delete holds it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * topology: fence the collection still published under the name An emptied-layout cleanup that passed its fence check could unpublish the collection while the delete waited to fence it. The delete then fenced and listed an orphaned object, while growth published a new collection under the name that no fence held. Topology.FenceGrowth re-checks publication once the fence is up and moves to the collection published since. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * topology: run one delete of a collection at a time Two deletes of one collection both fenced it and fanned out by name. Once the first removed it, a write could recreate the collection, and the second delete removed the new one's volumes and topology entry. FenceGrowth now waits for a delete already running on the collection and finds nothing once that delete removed it; a delete that failed hands the collection to the one waiting. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * topology: stop a delete another delete beat to the collection A delete that fenced the collection but had not yet checked that it was still published retried when it was not, for the collection an emptied layout drops. A delete that removed it in between also left it unpublished, so the retry fenced and returned the collection a write had recreated under the name since. finish(true) now marks the collection deleted before it unpublishes it, and the retry stops at that mark. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * master: keep the name fenced through the EC pass of a delete The normal pass unpublished the collection and let growth back in before the EC pass ran. The EC pass deletes by name on every server holding the collection's shards, and DeleteCollection on a server also drops its normal volumes, so a write recreating the bucket in between could land a volume that the EC pass then deleted. A second delete of the name, finding no collection, also ran its own EC pass by name. deleteCollection now fences the name once, before either pass, and lifts or ends the fence after both. finish(true) unpublishes the collection then. A name with EC shards only gets an empty collection to fence, so an assign under it is refused too, and a delete that finds nothing skips both passes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * topology: wait for the second delete's lock instead of sleeping The overlapping-delete tests slept before acting on the first delete. A second delete scheduled late started after the collection was replaced, or after the first delete was already over, so the tests could fail or pass without the overlap they check. They now wait until the second delete is blocked on the delete lock, read from the goroutine stacks. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * topology: empty the layout through UnRegisterVolumeLayout in the test The test called DeleteLayout, whose signature differs in builds that key layouts by more than replication, TTL and disk type. UnRegisterVolumeLayout reaches the same cleanup from a VolumeInfo and has one signature everywhere. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
1f8ad7016f |
filer: compare garbage chunks by needle identity (#12992)
* Normalize chunk identities during garbage comparison * Keep replication chunk respellings observable * filer: skip the needle identity index when nothing is subtracted Every compaction subtracted its retained chunks from an often empty covered list, parsing and re-formatting each retained file ID first. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: skip the identity subtraction at the compaction call site Returning early from doMinusChunks on an empty minuend stopped MinusChunks from calling GetFileIdString on the new entry's chunks. After CreateEntry of a new file, the caller's chunks then kept the FileId that BeforeEntrySerialization cleared, so tus completion built its still-referenced set from empty IDs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: match needle spellings through DoMinusChunks instead of a new function Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: DoMinusChunks always matches chunks by needle Drop the byNeedle parameter so DoMinusChunks keeps its two-argument signature and every caller, including ones added on master since, compares equivalent file ID spellings as the same needle. The needle normalization moves from the server scope checks to filer.ChunkIdentity so both share it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filersink: match replicated source file IDs by needle compareChunks no longer reports a respelled source chunk, so the replica keeps the SourceFileId it was copied under. Removing chunks the source dropped and judging stale backup chunks now compare that ID by needle, otherwise a later removal in the other spelling would leave the replica's chunk behind. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
39675b2faf |
filer: hide remote rename source paths from scoped responses (#13010)
* filer: redact remote rename source from scoped responses * Preserve scoped remote rename markers * Consolidate scoped marker replacement coverage * Refuse scoped whole-entry guards during remote rename * Keep coded create refusals for guarded scoped writes * Make scoped subscription batch coverage deterministic * filer: refuse scoped conditions that compare the remote rename source IF_EXTENDED_NOT_EQUAL clauses and ExpectedExtended on Create, Update and DeleteEntry could still compare a guess against the hidden marker, so a scoped client could confirm the source path it redacts. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: refuse scoped condition gates on the remote rename source An IF_EXTENDED_TIME_ELAPSED gate applies its time check only when the gate value matches, so a gate on the marker also confirms a guess. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: keep a pending rename source out of remote copy errors A failed copy of a pending remote-only rename named the marker's source location, which the backend error repeats, and rename RPCs return that error to scoped callers. Log the full error and return one naming only the paths the caller supplied. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: let a scoped local overwrite end a pending remote rename Scoped replacements kept the hidden rename source marker even though a scoped entry can never stay remote-only, so the marker was stale on the local copy and every later scoped IF_ENTRY_EQUAL write was refused. Drop the preservation and let the overwrite clear the marker as other local writes do. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * codespell: ignore poligon only inside URLs Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
0fb1387226 |
s3: compare If-None-Match weakly, as the filer and volume servers do (#13033)
* s3: compare If-None-Match weakly, as the filer and volume servers do The S3 gateway matched conditional ETags by trimming quotes, so a weak tag such as W/"etag" in If-None-Match never matched and a revalidating GET got 200 instead of 304. Move the filer's RFC 9110 matcher to weed/util and use it in the gateway: weak comparison for If-None-Match, strong for If-Match. The routed write condition now sets AllowWeak on IF_ETAG_NOT_MATCH so the check under the object lock agrees with the gateway's pre-check. * s3: split write-condition ETag lists the way the gateway matches them etagList split on every comma and kept empty elements, so the filer's locked If-None-Match check (now a weak comparison) could match a fragment of one quoted tag, or an empty element, that the gateway's pre-check ignores. A PUT with If-None-Match: W/"<etag>,x" passed the pre-check and then got 412 under the lock. Reuse the gateway's quote-aware splitter and drop empty elements. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Mansur Akhmadi <10739460+mansur-akhmadi@users.noreply.github.com> Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
a409877b8f |
volume, operation: refresh the write JWT for replica forwards and filer-proxy retries (#13028)
* volume, operation: refresh the write JWT for replica forwards and filer-proxy retries A write JWT is checked when a request arrives, but a slow chunk can take longer to stream in than the JWT lives. The volume server then forwarded the already expired JWT to its replicas, which rejected it with wrong jwt, and the client retried through the filer with its own filer JWT, which by then had expired too. Only a 401 marked as an expired volume JWT re-minted the filer JWT, so the 500 from the failed replica forward led to retries that could never succeed. The volume server holds the signing key and has already authorized the request for this file ID, so it signs a fresh JWT for the forward; without a signing key it forwards the incoming one as before. A filer-proxy upload re-mints its filer JWT before every retry, whatever the previous failure was. Refs #6220 * volume: mint the replica forward JWT right before each forward A JWT minted before the uncached master lookup spends part of its lifetime on that lookup, so the replica can still see it expire; minting inside the forward path gives each replica request its full lifetime. Minting stays unconditional rather than forwarding a still-valid incoming JWT, which could expire in flight and reintroduce the failure. The cost is a key rotation constraint: a new write signing key must be verify-only on every volume server before any server makes it current. The base file ID trim moves into one helper so the authorization check, the expiry classification and the mint cannot disagree on which file ID a write JWT covers. |
||
|
|
e9a5d733b1 |
weed: report host THP policy; build: declare Go 1.27.4 to match the releases (#13025)
* weed: report the host transparent huge page policy at startup Go maps the heap with MADV_HUGEPAGE, so the host THP policy applies to a SeaweedFS process whether or not the operator asked for it, and the advice in the Go GC guide depends on the heap size. Operators had no way to see which mode a node actually runs in. Log enabled/defrag/khugepaged.max_ptes_none once at startup from the long-running commands, and print the Go toolchain in `weed version` so a support bundle identifies the runtime that produced the binary. Nothing changes the policy: THP is host-wide, and GODEBUG=disablethp=1 remains the only per-process control. Refs #5437 * build: declare Go 1.27.4, the toolchain the releases already use The 4.55 release binaries report go1.27.4 (`go version -m` on the published tarball), while go.mod still said 1.26.6, the Dockerfiles pinned golang:1.26, and the release workflows left the Go version to the action default of "the latest stable at build time". A source build, a container and a downloaded tarball therefore ran different toolchains from the same tag, and the next release could silently pick up another one. Set the go directive to 1.27.4 in the root module and in the four modules that build in CI, bump the 16 Dockerfiles, and pin goversion: 1.27.4 in the 16 release and dev action steps. `go mod tidy` now emits the two require blocks Go 1.27 expects; no dependency version changed. Go 1.27's gofmt realigns 8 files. * weed mini: report the THP policy after quieting stderr The startup line ran from the dispatch point before runMini applied quietMiniLogs, so every weed mini start on Linux printed it to stderr, which mini keeps for the welcome banner, warnings and errors. Log it from runMini after quietMiniLogs so it lands in the log file only. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * util: report whether the Go heap can use huge pages The runtime advises only GC metadata with MADV_HUGEPAGE and leaves the heap arenas to the host default, so under enabled=madvise the heap stays on small pages. The log still printed go_heap_disabled=false there, which reads as "the heap uses THP". Report go_heap_thp, true only under enabled=always without GODEBUG=disablethp, and drop the struct comment that said the heap is mapped with MADV_HUGEPAGE. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * util: count an inherited PR_SET_THP_DISABLE in go_heap_thp A launcher can disable THP for the process with prctl, and children inherit it, so enabled=always alone does not mean the heap gets huge pages. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * util: read GODEBUG disablethp the way the runtime does The runtime applies GODEBUG left to right, so with disablethp=1,disablethp=0 the heap keeps THP, while the helper stopped at the first disablethp=1. The helper also missed other nonzero values such as disablethp=2, which the runtime treats as disabled, and trimmed spaces around keys, which the runtime keeps. Take the last disablethp with an integer value, treat any nonzero value as disabled, and match keys exactly. The parser now takes the GODEBUG string, so it is tested without changing the environment. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * util: honor per-size THP policies in go_heap_thp Since Linux 6.8 each anonymous huge page size has its own policy in hugepages-<size>kB/enabled, and only "inherit" follows the top-level knob. A 64kB size set to "always" gives the unadvised heap huge pages under a top-level "madvise" or "never", and a 2048kB size set to "never" takes them away under "always", but the log judged only the top-level value. Read the per-size policies and report go_heap_thp=true when any size reaches the heap. Under a top-level "never", the "disabled by the host" line is now printed only when no size reaches the heap. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * util: report go_heap_thp=unknown when the process setting is unreadable If PR_GET_THP_DISABLE fails, for example because a seccomp profile rejects it, the process THP setting is not known, but the log treated it as allowed and could print go_heap_thp=true. Print go_heap_thp=unknown in that case. It stays false when the host or GODEBUG already rules out heap huge pages. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * util: report go_heap_thp=unknown when a per-size THP policy is unreadable An unreadable hugepages-<size>kB/enabled was skipped, so the log could say the host disabled THP while that size allowed it. Keep it as an empty mode and report unknown unless a readable size already allows huge pages. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * ci: take the Go version from go.mod in tests and releases posix-compliance pinned GO_VERSION 1.26 and built go 1.27.4 modules only through the GOTOOLCHAIN auto-switch; nine workflows used go-version ^1.26 and the kafka jobs ran in golang:1.26-alpine. Read the version from go.mod with go-version-file, as the other setup-go steps already do, moving checkout ahead of setup-go where it came after so the file exists. The posix report takes the version from the setup-go output. The release and dev builds pinned goversion 1.27.4 in 16 places. The pinned go-release-action reads the go directive when goversion is go.mod, so the binaries now follow go.mod without a second copy of the version. * weed: report the THP policy from every long-running command mount, worker, iam, master.follower, the filer sync/backup/remote/replicate daemons and the mq agent and kafka gateway keep serving after startup like the commands already listed; mount is likely where heap size matters most. fuse is not listed: its first process starts a child with the same arguments and waits, so logging at dispatch would print the line twice. It logs in runFuse just before handing over to runMount, which only the child reaches. --------- Co-authored-by: Konstantin Lebedev <whitefox@mayflower.work> Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
77a6787335 |
Bound upload memory: admission by size, gateway holder writes, 503/SlowDown back-pressure, body deadline (#13021)
* util: one admission rule for upload limits * operation: mark gateway fan-out holder writes as client traffic * volume: bound upload admission, limit gateway holder writes, 503 on timeout * volume: charge unknown-length uploads half the budget, document client wait cap * s3, filer: admit uploads by inFlight+size and charge unknown lengths a chunk * s3: answer a volume overload as SlowDown with Retry-After * operation: cut an upload whose body crawls below the minimum rate on any host * operation: make the slow-commit deadline test honour the request context * s3: stop chunk uploads when the client goes away * operation: treat a body deadline cut as back-pressure, not a same-holder retry A body that crawls past the body deadline returns from retriedUploadData at once, like an overload, and counts toward the single reassign the chunk loop and the filer retry gate give back-pressure. A watchdog cut keeps its retry on a fresh conn. Both still match ErrUploadStalled and stay reassignable. * operation: apply the body deadline only to uploads that opt in UploadOption.BodyDeadline and ChunkedUploadOption.BodyDeadline turn the body deadline on; S3 chunk uploads (relay and fan-out) and the filer's chunk loop set it. Mount, filer.sync, filer.copy and UploadWithRetry keep the stall watchdog only, as before the deadline existed. * s3, operation: check a chunk cancelled with its client is deleted from every holder A volume commits on a context that ignores the cancel, so a chunk whose caller went away after sending the body may still land. The chunk loop already deletes the fid from every holder after a failed attempt; pin that for the relay and fan-out paths and for an S3 PUT whose client goes away. * s3: count a request's declared bytes in the circuit breaker byte limits The per-bucket and global byte counters go back to the declared length (an unknown length counts one chunk), so a bucket bytes limit still rejects a single PUT larger than it. Only the upload budget uses the capped gateway charge. * s3: answer copy chunk overloads as SlowDown, tidy the client-gone checks CopyObject and UploadPartCopy map a volume overload or an exhausted stall to SlowDown, as PutObject does. The client-gone log check matches the mapper's context.Canceled test, the truncated-body case drops a check the first case already makes, and the Retry-After test reads the headers actually sent. * filer, volume: clamp the filer charge chunk, set the upload gauge under the lock A filer with -maxMB 0 charges its default chunk size instead of nothing. The volume server sets its in-flight upload gauge inside the critical section. The upload limit tests wait until the waiter is parked before releasing, check handleUploadRequest gives its charge back, and use CI-safe bounds. * volume: cap the Rust server's client upload-slot wait at 5s Same cap as the Go volume server's volumeClientUploadWaitCap, so a gateway's body deadline never fires before the 503. * operation: reflow the body deadline comment * volume(rs): count a gateway's src=client holder write against the upload limit Mirrors operation.IsReplicaForward: only a primary-to-replica forward skips the upload budget; a gateway's ?type=replicate&src=client fan-out waits like any client write. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * volume(rs): admit uploads by inFlight+size, reserved atomically Mirrors the Go volume server's waitForUploadSlot: an upload is admitted by util.UploadAdmits (idle server, or inFlight + size within the limit) and reserves its bytes in the same step, so concurrent waiters cannot all pass one check. Primary-to-replica forwards and unlimited servers are counted but never refused. UploadLimitCond counts once per waiting upload, and the wake-up is armed before each check so a release in between is not missed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * volume(rs): charge an unknown-length upload against the upload limit Mirrors the Go volume server's uploadCharge: a chunked upload without Content-Length reserves one file's worth of budget, at most half the limit and at least 1 byte, instead of 0. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * volume(rs): a zero -inflightUploadDataTimeout waits the 5s client cap The Go volume server now reads 0 as the 5s cap (its flag help says so); the Rust server used a 2s wait. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * volume(rs): close a rejected large or unknown-length HTTP/1 upload Mirrors the Go volume server's uploadRejectCloseThreshold: the 503 for a body over 256 KiB, or one without a length, carries Connection: close instead of keeping the connection for a body nobody reads. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * volume(rs): drop src from a primary's replica forward A client upload carrying src=client kept it on the forward, so replicas treated the forward as gateway fan-out and could refuse it after the primary had already appended. Go's ReplicatedWrite builds a fresh query. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * volume(rs): keep the upload admission CAS buildable on rust 1.91.1 Atomic try_update is stable only since 1.95. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * volume(rs): refuse an upload the in-flight counter cannot hold A replica forward added its charge with fetch_add, so a Content-Length near i64::MAX wrapped the shared counter negative and let later client uploads past admission. The forward now reserves with a checked add and answers 503 when the size does not fit; the client CAS adds only after admission passes. With no upload limit the counter only feeds the gauge, so it keeps wrapping arithmetic. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * volume: refuse an upload the in-flight counter cannot hold A replica forward added its charge unchecked, so a Content-Length near math.MaxInt64 wrapped inFlightUploadDataSize negative and let later client uploads past admission. Under the lock the reservation now checks that the counter can hold the charge and answers 503 otherwise, matching the Rust volume server. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * volume: keep the request body on a rejected upload Replacing r.Body with http.NoBody hid the server's early close of the unread body from net/http before Go 1.27, so it skipped the FIN-then-wait close and reset the connection under a client still sending. Go 1.26.6, the version go.mod declares, then failed TestUploadLimit503ReachesGoClientForLargeBody with a write error instead of the 503. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * util: compare upload admission without forming inFlight+size * operation: reassign a chunk after a 429 as after a 503 * s3: do not count a chunk assignment the client cancelled as a filer failure * filer: charge an upload by its request chunk size, and an inline upload by its whole body * s3: hold an aws-chunked body to its X-Amz-Decoded-Content-Length * volume: answer a rejected small-body upload without waiting for its body * s3: fill the upload budget before testing that a release wakes every waiter --------- Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |