mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-12-04 10:07:28 +01:00
ede64dea9e8bbf0643d8a36e04285bc657ef4e65
16421
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
ede64dea9e |
storage: bound each delete a retry forwards
A holder that answers the probe deleted but stalls on the delete held the reply and the holders after it. The Rust server already bounds this call at 10 s. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
df6e1d5970 |
seaweed-volume: bound each delete-retry probe with the read-hint timeout
Mirror Go: a stalled holder's probe gives up after EC_READ_HINT_TIMEOUT and the retry moves on to the next holder. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
58ede90bbe |
storage: bound each delete-retry probe with the read-hint timeout
A holder that keeps the stream open without answering held the delete's reply, even after the reporting holder took the delete. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
a3ca4aca09 |
seaweed-volume: re-forward a deleted EC read's delete to the holders that read it deleted
Mirror Go: probe each primary shard holder with a one-byte read and forward the delete to those answering deleted, so the retry cannot stop at another copy and leave the reporting holder's other disk live; with no such holder, fall back to normal routing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
4935d83bdb |
storage: re-forward a deleted EC read's delete to the holders that read it deleted
The retry used first-success routing, which can stop at another copy of the primary shard (a quarantined local one, or a replica that never saw the delete) and leave the reporting holder's other disk live. Probe each primary shard holder with a one-byte read and forward to those answering deleted; with no such holder, fall back to normal routing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
1e98014713 |
volume, seaweed-volume: re-forward an EC delete whose read already sees the needle deleted (#12902)
* storage: forward an EC delete again when its read already sees the needle deleted A delete that journaled a sibling disk's copy but failed on the holder's first copy left the first copy live, and a retry from another server read the needle deleted from the sibling and stopped before forwarding. Forward the delete anyway, best effort, and still answer deleted. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * seaweed-volume: forward an EC delete again when its read already sees the needle deleted Mirrors the Go store: batch delete and HTTP DELETE re-forward the delete, best effort, when a holder reports the needle deleted while this server's index still has it live, so a holder disk the failed attempt missed records it too. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * storage: re-forward an EC delete under the requested needle id A failed header parse inside the read can overwrite n.Id, so the deleted-read branch looks up and forwards the id the caller asked for. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
23e8412e5c | docs: regenerate star history chart | ||
|
|
64a64ca75b |
volume, seaweed-volume: an EC shard copy can require a disk type (#12901)
* volume_server.proto: let an EC shard copy name the target disk type Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * volume: an EC shard copy that names a disk type lands only on that medium With disk_id 0 the copy auto-selects a disk, and the disk that already holds the volume or its index wins regardless of medium. A move onto an empty disk of another medium therefore landed beside the existing copy. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * ec: EC shard moves pass the target disk type to the copy ec.balance and the ec_balance worker plan a move onto disks of one type, but the copy only named a disk id, and the master reports 0 (auto-select) for a disk that holds nothing yet. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * seaweed-volume: an EC shard copy that names a disk type lands only on that medium Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * volume: an EC blob delete records on every local copy of the volume A volume mounted on several disks of one server has one runtime per disk, each with its own deletion set, and a shard read checks the runtime of the disk holding the shard. The delete stopped at the first runtime, so a read of a shard on another disk still returned the deleted needle. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * seaweed-volume: an EC blob delete records on every local copy of the volume Mirrors the Go handler: each disk's runtime of the volume keeps its own deletion set, so the delete is journaled on every runtime, not the first. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * volume: a typed EC shard copy yields to the shard's file on another medium The mount walks disks in order and loads the first file of the shard it finds, so a copy placed on the requested medium while another disk still holds an unmounted file of that shard could leave the old file mounted. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * seaweed-volume: a typed EC shard copy yields to the shard's file on another medium Mirrors the Go selector. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * ec: a typed shard move refused by its pinned disk lets the server pick Balancers pin the destination disk from the medium its mounted shards report, which can differ from the disk's own medium after encoding spilled onto another one. The server refuses such a disk before copying anything, so the move now retries once with the server picking a disk of the type. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * seaweed-volume: name the requested disk type in a pinned-disk refusal Same wording as the Go server, which movers match to retry with a server-picked disk. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * volume: an EC blob delete records on the first local copy last A retry on this server resolves the volume through its first copy, so a delete that fails on another copy left the first one tombstoned and the retry stopped there. Locate the needle on every copy first, then journal the others before the first. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * seaweed-volume: an EC blob delete records on the first local copy last Mirrors the Go handler: a retry on this server resolves the volume through its first runtime, so that runtime journals after the others and a failure on any other leaves it live for the retry. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * seaweed-volume: a local EC delete records on every local copy When this server holds the shard, the distributed delete journals locally instead of calling VolumeEcBlobDelete on itself, and that path journaled only the first runtime. Record on every runtime, the first last, as the handler does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
15488c1af6 |
storage, seaweed-volume: ask every delisted EC shard holder, keep a reinstalled hint (#12900)
* storage: ask every delisted EC shard holder for a delete Any one delisted holder may have journaled the needle's delete, but the hint read stopped at the first holder that answered live. Ask each one under its own deadline and take a deleted answer from any; forget only the holders that failed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * storage: keep an EC read hint a lookup reinstalled during a failed read Comparing addresses cannot tell a hint from one a lookup removed and installed again for the same holder while the read was in flight, and that holder may have journaled a delete in between. Count hint changes and forget failed holders only if none happened. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * seaweed-volume: take a deleted EC shard answer as soon as it arrives A deleted answer was kept only if the stream ended or failed after it; under the read hint's timeout, a holder that stalled after answering deleted lost the answer and the read rebuilt the needle. Return on the deleted message instead. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * seaweed-volume: ask every delisted EC shard holder for a delete Mirror Go's askEcShardReadHints: any one delisted holder may have journaled the needle's delete, but the hint read stopped at the first holder that answered live. Ask each one under its own timeout, take a deleted answer from any, and forget only the holders that failed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * seaweed-volume: keep an EC read hint a lookup reinstalled during a failed read Mirror Go's ShardReadHintsRevision: comparing addresses cannot tell a hint from one a lookup removed and installed again for the same holder while the read was in flight. Count hint changes and forget failed holders only if none happened. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * storage: forget failed EC read hints when another holder answers deleted Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * seaweed-volume: forget failed EC read hints when another holder answers deleted Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * seaweed-volume: keep EC read hint revisions unique across volume remounts Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
c967ba4a7a |
storage, seaweed-volume: ask a delisted EC shard holder before rebuilding the shard (#12899)
* storage: ask a delisted EC shard holder before rebuilding the shard A complete lookup that places a shard nowhere drops its holder from the map deletes route by. That holder may still answer, and may be the one that journaled a needle's delete, which the other shards cannot know. Keep it as a read hint that reads try before reconstructing and drop once it fails. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * seaweed-volume: ask a delisted EC shard holder before rebuilding the shard Mirrors Go: a complete lookup that places a shard nowhere moves its cached holders to read hints, which fetch_one_interval tries before reconstructing and drops once they fail. Deletes and recovery keep using only the placed locations. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * seaweed-volume: test reads asking a delisted EC shard holder Mirrors the Go read-path tests: a delisted holder that journaled the delete answers before the local shards rebuild the needle, and an unreachable one is dropped while the read rebuilds. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * storage: take only a deleted answer from a delisted EC shard holder A delete made after the delisting is journaled on a listed holder, so the delisted one still answers live. Returning its bytes skipped the reconstruction that asks the listed holders and finds that delete. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * seaweed-volume: take only a deleted answer from a delisted EC shard holder Mirrors Go: a live answer from a read hint may predate a delete that went to a listed holder, so fetch_one_interval goes on to the direct read and reconstruction instead of returning it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * storage: bound the read asking a delisted EC shard holder A delisted holder may have stopped answering, and the hint read had no deadline over its stream. Only its deleted answer is used, so ask for one byte under a short deadline; a timeout drops the hint like any other failure. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * storage: drop only the read hint a failed EC read used A lookup can replace a shard's hint while a read of the old one is in flight; that read's failure then dropped the new hint. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * seaweed-volume: bound the read asking a delisted EC shard holder Mirrors Go: ask the hint for one byte under EC_READ_HINT_TIMEOUT, since only its deleted answer is used; a timeout drops the hint like any other failure. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * seaweed-volume: drop only the read hint a failed EC read used Mirrors Go: a lookup can replace a shard's hint while a read of the old one is in flight, and that read's failure dropped the new hint. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * seaweed-volume: keep fetch_one_interval's doc comment on the function Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
c46dea9b6a |
seaweed-volume, storage: a shard the master places nowhere is not a known location (#12898)
* seaweed-volume: a shard the master places nowhere is not a known location The master answers LookupEcVolume with every shard slot it tracks, so a shard whose holders are all down comes back with no locations. The cache kept those entries. They overwrote the cached address of a holder that was only restarting, counted toward the reply's data-shard guard, which therefore always passed, and made the map look neither short nor complete, so it was re-checked only every 7 minutes. Nothing marked it stale meanwhile: a read never tries a shard with no address. A shard with no location is now left out of the reply, as Go's cachedLookupEcShardLocations does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * storage: count only placed shards toward an EC lookup's completeness The master answers every shard slot, so len(ShardIdLocations) is 32 whatever is up, and the guard that should keep a partial reply from replacing a complete cache never fired. A reply placing fewer than the data shards now fails the lookup and leaves the cache as it was, as the Rust server does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * storage: fill a cold EC location cache from a partial lookup A reply placing fewer than the data shards no longer reaches the cache at all, so a cold cache stays empty and a read cannot go straight to a shard whose holder is up, as it could before the guard counted placed shards. Take the holders it names for shards the cache does not know, without touching known shards or the refresh time. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * seaweed-volume: fill a cold EC location cache from a partial lookup write_back_shard_locations refused a reply placing fewer than the data shards before writing anything, so a read on a cold cache kept an empty map and could not fetch a shard directly from a holder the master did name. A partial now fills only the shards the cache does not know, leaves the refresh time alone and marks the map stale, as Go does. The scrub still refuses a partial reply. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * storage: a partial EC lookup puts the holders it names first A partial reply only filled shards the cache did not know, so a shard that moved while the replies stayed partial kept its old address: a failed direct read marked the map stale, the next partial reply skipped the shard again, and the read fell back to a reconstruction that the partial outage could not serve. A partial reply now puts the holders it names ahead of the cached ones, which stay as fallback. Other shards and the refresh time stay as they were. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * seaweed-volume: drop a shard the master places nowhere from the location cache Leaving shards with no location out of the reply let a complete reply keep a former holder's cached address for a shard the master now places nowhere. An EC delete tried that address first: an offline peer failed the delete without the fallback to other shard holders, and a peer that had unmounted the volume acknowledged it without writing a tombstone. The reply now keeps every slot and only located shards count toward its completeness. A complete reply drops a shard it places nowhere, as Go's delete-then-append does, and a partial reply's empty slots add nothing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * seaweed-volume: a partial EC lookup puts the holders it names first fill_shard_location_gaps took a partial reply's holders only for shards the cache did not know, so a shard that moved while the replies stayed partial kept its old address and a read could not reach it directly. merge_partial_shard_locations puts the holders the reply names ahead of the cached ones, which stay as fallback, as Go does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
a2df801e6d |
filer: rename a file over a file in place on a store without transactions (#12894)
* filer: run a file rename again when the store refuses its commit TiKV refuses an optimistic transaction's commit when another writer committed one of its keys after it began. A rename's transaction moves the source key, so a concurrent write of the file, through another filer for instance, failed the rename with "move commit error: write conflict". Standalone writes run again after such a conflict since #12798, but a rename's transaction belongs to the rename, and it gave up. StreamRenameEntry also sent the rename's responses before the commit, so the client had already moved the file locally when the store refused it. - The TiKV store reports such a refusal as filer.ErrTransactionConflict. - A file rename runs its transaction again after it, up to five times; the new run reads what the other writer stored and moves that. A rename that copied or deleted a remote object on the way is not run again. - On a store whose transactions keep their writes to themselves (filer.IsolatingTransaction: SQL, TiKV), a file rename holds its stream responses until the commit: a refused rename sends none, and one that runs again sends them once. A directory rename still streams its children's responses as it moves them, which keeps the client of a long rename from timing out, and is not run again. - Every failed run releases its commit stamps and rolls back, the "is not empty" refusal included. Tests: filer_grpc_server_rename_conflict_test.go, with a store that keeps a transaction's writes until its commit and can refuse it, and tikv_store_commit_test.go (-tags tikv). On master the retry, refused-commit and remote-file tests fail. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: run a rename again only when its transaction covers every write With path-specific stores configured, the writes under their prefixes do not go through the default store's transaction: a parent directory a rename creates at its destination there stays when the commit is refused, and a rename run again finds it and announces only the file's move, so peers replaying the events never learn of the parent. IsolatingTransaction now holds only when no path-specific store is configured, and AtomicRenameEntry checks it too before running a rename again, as StreamRenameEntry does through its held responses. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: finish a committed rename before its held responses go out StreamRenameEntry sent its held responses before the work the commit leaves (metadata events, chunk deletions, remote copies). A client that stops reading without closing the stream blocks Send on flow control, and that work then never ran. It now runs first; the responses still follow the commit. A file with a remote object no longer holds its responses: its remote copy after the commit is part of that work, and the client should not wait for it. It streams as it moves, as before, and is not run again. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: rename a file over a file in place on a store without transactions A rename over an existing file deleted the target, then created the renamed entry. On a store without transactions (the Redis stores, Cassandra, MongoDB, etcd and the like) the delete shows at once, and the rename's path locks fence only the filer running the rename, so a lookup or listing through another filer could find neither name and return ENOENT; POSIX rename keeps the new path resolvable throughout. A target deleted through another filer between the rename's lookup and its delete failed the rename outright ("no entry is found in filer store"). On such a store, a plain file renamed over a plain file is now written over the target in one store write (Filer.ReplaceFileForRename, an InsertEntry, which also lists the entry on Redis and drops the target's hard link after the write). The target's chunks are still deleted after the rename, unless the target's other hard links still use them, and subscribers get the same delete-then-rename events. Stores with transactions keep delete-then-create: no other reader sees the gap, and a target that went meanwhile fails the transaction cleanly. So do setups with path-specific stores, whose stores may take an insert over an existing entry differently (a SQL store inside a transaction aborts it), and directories and entries with a remote object. filer.WithoutTransactions tells the case apart; BeginTransaction marks it next to IsolatingTransaction. Tests: filer_grpc_server_rename_inplace_test.go. On master the target goes missing after the delete, and a target deleted meanwhile fails the rename; the transaction, path-specific store, directory and hard link tests guard what stays as it was. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: let the store say that its transactions isolate a rename Whether a rename's responses wait for the commit, and whether it may run again, was inferred from the context BeginTransaction returned and from whether any path-specific store was configured. Neither holds up: - A store may hand back a transaction context that its writes do not use: YDB begins a table-service transaction, and its statements run through the query service outside it. A store now says so itself, through IsolatingTransactionStore, which the TiKV store implements. Any other store keeps sending a rename's responses as the entries move and does not run it again, as before this PR. - A path-specific store only matters for the paths it holds. Filer.TransactionCovers asks whether the rename's source and destination live in the default store: a rename that stays there holds its responses and may run again, and one that writes into a path-specific store does neither. A rename that may not run again still must not announce changes before its commit, so a file with a remote object holds its responses too. So that its remote copy after the commit does not delay them, the held responses go out while the rename finishes, and the call returns once both are done. A held response checks the stream's context, so a rename whose client went away before its first response is rolled back, as when the responses go out at once, instead of committed unseen. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> * filer: read the target again and keep its parents when a rename writes in place The in-place write skipped what delete-then-create did on its way: - Another filer can turn the target into a directory after the rename looked it up, by storing a child under it. The delete refused a non-empty directory, while the in-place write stored the file over it and stranded the child. The target is now read again right before the write, and a directory is refused. A store without transactions has no conditional write, so this leaves the window the delete-first path has between its own read of the target and its delete. - Another filer can delete the target's directory after the lookup. CreateEntry creates missing parents after its insert, and the rename announces them before the move; the in-place write now does the same. - The in-place write also applies CreateEntry's checks of the name (length, dot segments). Tests: a target that became a directory, and a target whose directory went, both right after the rename's lookup. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> * filer: the SQL stores isolate their transactions too AbstractSqlStore takes the sql.Tx its context carries for every entry call (getTxOrDB) and every KV call (kvDB, also when KV has a pool of its own), so the SQL stores built on it meet what IsolatingTransactionStore asks. A file rename on them holds its responses until the commit again, as it did before the declaration became explicit; it is never run again, since no SQL store reports ErrTransactionConflict. Bucket tables are created and dropped outside the transaction, which a file rename does not do. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> * filer: write a rename in place only on a store that says its insert replaces an entry The in-place write took "the store keeps no transaction" to mean that an insert over an existing entry replaces it. That does not follow: the Tarantool store's insert is an upsert that assigns only the entry's data, so the row keeps the replaced entry's expire_at, and a file renamed over an expiring one would expire with it. A store now says so itself, through OverwritingStore: it keeps no transaction, and its InsertEntry replaces the stored entry at once and whole, with its expiry and its listing. The three Redis stores declare it: their SET replaces value and expiry, and the insert lists the name whether or not it was listed. Every other store keeps delete-then-create, as before this PR. That includes the embedded default store, where each filer has a store of its own and the rename's path locks already hide the gap. This replaces the comparison of the context BeginTransaction returns; BeginTransaction is back to what it was. Tests: for each Redis store, an InsertEntry over an expiring entry leaves the second entry, no expiry and one listing (RUN_REDIS_TESTS=1). A store that does not declare it keeps delete-then-create, with and without transactions. The in-place write over one of two hard links, and over the last one. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> * abstract_sql: check that a transaction's writes take its own handle sqlmock serves a pool and its transactions from one mock, so the write expectations also pass for entry writes made through store.DB. Assert that getTxOrDB and kvDB return the *sql.Tx the context carries. 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> |
||
|
|
907c46fe47 |
mount: answer ESTALE for an inode the kernel holds but whose name is gone (#12887)
* mount: answer ESTALE for an inode the kernel holds but whose name is gone A rename over an existing file drops the replaced inode's path in InodeToPath.MovePath as soon as the rename's response arrives from the filer, which sends it before it commits. Until the RENAME reply reaches the kernel, the kernel still maps the name to the old inode, so an open, stat, access or xattr call resolved in that window reaches maybeReadEntry or AcquireHandle for an inode without a path and fails with ENOENT, although the name exists. A rename made through another mount opens the same window for as long as this kernel keeps the name's dentry. A process polling a file that another one replaces with tmp + rename sees sporadic ENOENT; a slow commit turns the window into a burst. While the kernel has not forgotten the inode, answer ESTALE: the kernel redoes the path walk once with LOOKUP_REVAL and opens the current entry, as on NFS. A forgotten inode keeps ENOENT. One writer replacing a file with tmp + os.replace and four readers opening it in a loop on one mount, for 120 s: each reader got 897k-967k ENOENT before (130k reads succeeded), none after (272k reads). With the readers on a second mount that also lists the directory: 1,277-1,550 errors per reader before, 7-13 after, at about 140 replacements a second. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mount: answer ESTALE for a pathless inode only on Linux Only the Linux VFS redoes a path walk on ESTALE (LOOKUP_REVAL). FUSE on macOS and FreeBSD purges the vnode's name cache when GETATTR or OPEN answers ENOENT, so the next lookup finds the replacing file; ESTALE skips that purge and keeps failing until the entry times out. WinFsp maps the unknown errno to EIO. Keep ENOENT there. 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> |
||
|
|
2037af1a37 |
erasure_coding: report and check the encode run when verifying a shard set (#12893)
* volume: report the encode run in VolumeEcShardsInfo Go and Rust volume servers now fill EcShardConfig.encode_ts_ns from the mounted EC volume's .vif, next to the block layout they already report. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * erasure_coding: keep the source when holders serve different encode runs VerifyShardsAcrossServers records each holder's encode run, and RequireAgreedEncodeRun fails when holders that report one disagree. The encoder checks it before deleting the source volume, so a shard set that only looks complete by shard ids does not replace the source. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * erasure_coding: refuse a holder that reports more than one encode run A holder whose disks serve shards of different encode runs reports MixedEncodeRuns, and RequireAgreedEncodeRun fails on it even when no other holder answers or every other holder agrees on one run. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * volume: report mixed encode runs across local disks in VolumeEcShardsInfo The reply listed shards from every disk under the first disk's encode run. When the shard-bearing disks of a volume hold different nonzero runs, Go and Rust volume servers now report MixedEncodeRuns instead, so the source-deletion check sees the conflict. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * volume: refuse an EC shard copy of another encode run than the mounted one VolumeEcShardsCopy committed the copied .vif and reopened replaced shards without updating the mounted volume's encode run, so the holder kept reporting the old run while serving the new bytes. Go and Rust volume servers now stage the .vif before anything is committed and fail with FailedPrecondition when it names a nonzero run different from a run this server mounts for the volume. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * volume: list only mounted shards of every disk in Rust VolumeEcShardsInfo The Rust reply listed every shard slot of the first disk's runtime, with unmounted slots as size-0 entries, and skipped shards mounted on other disks. Callers build each holder's shard bits from this list, so a Rust holder counted as holding shards it did not have. The reply now lists the mounted shards of every local disk, each id once, as Go does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * volume: check the source encode run of an EC shard copy without a .vif A copy that leaves out the .vif could still replace a mounted shard with another encode run's bytes. Fetch the source .vif for the run check in every copy, and install it only when asked. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * volume: refuse to serve EC files of a volume held from two encode runs CopyFile looks each requested file up on its own, so a server that holds a volume's shards on one disk from one encode run and its .vif on another disk from a different run would hand a copier mismatched files. Refuse the copy when the .vif files of this server disagree on a nonzero run. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * ec: refuse a rebuild whose holders serve different encode runs The rebuild groups holders by volume id and collection only. When they serve two encode runs, the copied shards land beside the first run's .vif and .ecx and the rebuild regenerates from the mixed set. Before copying, ask every holder for its run and refuse unless they agree. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * ec: bound each holder query in the rebuild's encode-run check A holder that accepts the connection but never answers VolumeEcShardsInfo kept the rebuild waiting forever. Give each holder its own deadline; one that times out is skipped like an unreachable holder. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * ec: check only the rebuilder and copy sources for the encode run The rebuild copies each shard from its first listed holder. Extra copies are never read, so asking them for their run only adds servers that can stall the check. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * ec: do not copy from a source whose encode run went unchecked A copy source whose VolumeEcShardsInfo query fails or times out has an unknown run. The copy fence on the rebuilder compares a source's run with the run the rebuilder mounts, so on a rebuilder that holds none of the volume's shards nothing checks it, and its shards could join a rebuild of another run. The rebuild now skips such a source like a failed copy. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * ec: leave holders of shards the rebuilder has out of the run check The rebuild uses a shard the rebuilder already holds and never reads its other listed holders, but the run check still asked the first of them. A stale replica listed first for such a shard refused a rebuild that would not touch it. Pick the holders to check the way prepareDataToRecover picks its copy sources. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
ec87407c0d |
ec balance: don't let leftover shards of an earlier encode win dedup or move (#12888)
* ecbalancer: keep the majority encode run's copy when removing a duplicate shard The dedup kept the copy on the node with the most free slots without comparing copies. When a failed encode left a shard behind and a retry encoded it again elsewhere, it could keep the stale copy and delete the fresh one. Nodes now record each disk's encode identity; when a shard's copies differ, only a copy from the run that holds most of the volume's shards is kept, and the shard is left alone when no run has a clear majority or none of its copies is from that run. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * ec.balance, ec_balance: pass each disk's encode identity to the planner Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * ecbalancer: keep only a complete encode run's copy, freeze conflicted volumes A majority counted over a filtered snapshot can pick the wrong run, and a shard left with conflicting copies could still be moved onto its other copy by a later phase. Mixed-run duplicates are now resolved only in favour of the one reported run that has every shard id, counted per disk, since filters can hide shards but not add them. Otherwise the volume is frozen: no phase of this plan moves its shards. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * ec_balance: freeze EC volumes that still have a plain replica Their shards belong to the encoder until the plain replicas are gone. They stay in the plan's load counts but no phase moves or dedups them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * ecbalancer: refuse dedup when an unreported run is also complete A copy that carries no encode identity may be the newer set, so a second complete run that does report one cannot be kept over it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * ecbalancer: freeze a volume whose shard copies on one node disagree A shard held on two disks of one node at different encode runs has no duplicate on another node, so dedup skipped it, and a later move could take the stale copy and delete the fresh one. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
7cc8a8a445 |
filer: run a file rename again when the store refuses its commit (#12892)
* filer: run a file rename again when the store refuses its commit TiKV refuses an optimistic transaction's commit when another writer committed one of its keys after it began. A rename's transaction moves the source key, so a concurrent write of the file, through another filer for instance, failed the rename with "move commit error: write conflict". Standalone writes run again after such a conflict since #12798, but a rename's transaction belongs to the rename, and it gave up. StreamRenameEntry also sent the rename's responses before the commit, so the client had already moved the file locally when the store refused it. - The TiKV store reports such a refusal as filer.ErrTransactionConflict. - A file rename runs its transaction again after it, up to five times; the new run reads what the other writer stored and moves that. A rename that copied or deleted a remote object on the way is not run again. - On a store whose transactions keep their writes to themselves (filer.IsolatingTransaction: SQL, TiKV), a file rename holds its stream responses until the commit: a refused rename sends none, and one that runs again sends them once. A directory rename still streams its children's responses as it moves them, which keeps the client of a long rename from timing out, and is not run again. - Every failed run releases its commit stamps and rolls back, the "is not empty" refusal included. Tests: filer_grpc_server_rename_conflict_test.go, with a store that keeps a transaction's writes until its commit and can refuse it, and tikv_store_commit_test.go (-tags tikv). On master the retry, refused-commit and remote-file tests fail. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: run a rename again only when its transaction covers every write With path-specific stores configured, the writes under their prefixes do not go through the default store's transaction: a parent directory a rename creates at its destination there stays when the commit is refused, and a rename run again finds it and announces only the file's move, so peers replaying the events never learn of the parent. IsolatingTransaction now holds only when no path-specific store is configured, and AtomicRenameEntry checks it too before running a rename again, as StreamRenameEntry does through its held responses. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: finish a committed rename before its held responses go out StreamRenameEntry sent its held responses before the work the commit leaves (metadata events, chunk deletions, remote copies). A client that stops reading without closing the stream blocks Send on flow control, and that work then never ran. It now runs first; the responses still follow the commit. A file with a remote object no longer holds its responses: its remote copy after the commit is part of that work, and the client should not wait for it. It streams as it moves, as before, and is not run again. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: let the store say that its transactions isolate a rename Whether a rename's responses wait for the commit, and whether it may run again, was inferred from the context BeginTransaction returned and from whether any path-specific store was configured. Neither holds up: - A store may hand back a transaction context that its writes do not use: YDB begins a table-service transaction, and its statements run through the query service outside it. A store now says so itself, through IsolatingTransactionStore, which the TiKV store implements. Any other store keeps sending a rename's responses as the entries move and does not run it again, as before this PR. - A path-specific store only matters for the paths it holds. Filer.TransactionCovers asks whether the rename's source and destination live in the default store: a rename that stays there holds its responses and may run again, and one that writes into a path-specific store does neither. A rename that may not run again still must not announce changes before its commit, so a file with a remote object holds its responses too. So that its remote copy after the commit does not delay them, the held responses go out while the rename finishes, and the call returns once both are done. A held response checks the stream's context, so a rename whose client went away before its first response is rolled back, as when the responses go out at once, instead of committed unseen. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> * filer: the SQL stores isolate their transactions too AbstractSqlStore takes the sql.Tx its context carries for every entry call (getTxOrDB) and every KV call (kvDB, also when KV has a pool of its own), so the SQL stores built on it meet what IsolatingTransactionStore asks. A file rename on them holds its responses until the commit again, as it did before the declaration became explicit; it is never run again, since no SQL store reports ErrTransactionConflict. Bucket tables are created and dropped outside the transaction, which a file rename does not do. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> * abstract_sql: check that a transaction's writes take its own handle sqlmock serves a pool and its transactions from one mock, so the write expectations also pass for entry writes made through store.DB. Assert that getTxOrDB and kvDB return the *sql.Tx the context carries. 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> |
||
|
|
856762b20d |
volume.fix.replication: keep every needle on copyCount survivors when trimming (#12897)
* volume.fix.replication: keep every needle on copyCount survivors when trimming The trim refused only needles that no survivor held. When replicas have diverged, a needle written while one survivor was down could be held only by the doomed replica and one other survivor, so the trim left it on a single copy while the volume still looked healthy. Count the survivors holding each live needle and refuse unless it stays on min(copyCount, survivors) of them; a delete on any survivor still covers it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * balancer: list trim candidates best first PickOneReplicaToDelete and PickOneMisplacedVolume now return the first of ReplicasToDelete and MisplacedVolumesToDelete, which list every replica the pick chooses from in the same order, so a caller that refuses the pick can try the next one. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * volume.fix.replication: trim the next candidate when the pick is short When the preferred replica would leave a needle short of copies, try the next candidate in the same preference order instead of skipping the volume. A replica that missed writes is often the only safe one to trim, and it need not be the smallest. Index and status errors still skip the volume. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * volume.fix.replication: fold survivor indexes into per-needle counts countUncoveredNeedles kept every survivor's filtered index until the check ended. Count the survivors holding each needle of the doomed replica in a byte per needle instead, and release each survivor's index before reading the next. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * volume.fix.replication: test a rewrite after a delete on one survivor Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
8d4ec5252a |
iam: evaluate credential trust policies with the policy engine (#12895)
* iam: evaluate credential trust policies with the policy engine AssumeRoleWithCredentials and the Iceberg credential vending path checked a role's trust policy by scanning for a matching Allow statement only, so an explicit Deny never took effect. Evaluate the trust policy through EvaluateTrustPolicy, as AssumeRole and AssumeRoleWithWebIdentity do, so a matching Deny wins over an Allow. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * iam: keep the Federated provider match for credential trust Allows Matching Allow statements through the shared trust matcher let {"AWS":"*"}, "*" and empty principal objects admit credential-provider users, and made Allow conditions fail closed on keys this path does not supply, such as the vending duration. Keep the exact Federated provider check for Allow and use the policy engine only to find a matching Deny, with the requested session duration in the context. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
04050e781b |
ci: give recursive cosign signing more than the 3m default timeout (#12896)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
040ff9049c |
filer: roll back a stream rename refused for a non-empty target (#12886)
* filer: roll back a stream rename refused for a non-empty target StreamRenameEntry refuses to move a directory onto a non-empty one, but returned without ending the transaction it had begun. On a SQL store (MySQL, Postgres and the stores built on them) that transaction keeps its pooled connection: it was begun under context.Background(), so database/sql never rolls it back by itself. Every such refusal holds one more connection for the life of the filer, and once connection_max_open (50 in the scaffold) are held, store calls wait for a connection that never comes back. Roll the transaction back before returning, as the function's other refusals already do. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: check a stream rename's target directory inside its transaction The not-empty check listed the target under context.Background(), outside the transaction the rename had already begun. The SQLite store's main pool has a single connection, which the transaction holds, so every directory rename onto an existing directory waited for that connection forever and the filer's store stopped answering. On a bounded SQL pool, concurrent renames that each hold a transaction can wedge the same way. List through the transaction's context, as the child move already does. 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> |
||
|
|
78e2a4c2b4 |
mount: check the next inode number before AllocateInode returns it (#12884)
AllocateInode probes from the number a path hashes to while that number is taken, but the loop re-checked the number it had just stepped off and then advanced once more. When the first candidate was taken, it returned the number after the first free one without looking at it, and that number can belong to a live file. The new entry stores the number in its attributes and the mount reports it as st_ino, so the two files stat as the same file. A writer that replaces a file with tmp + rename several times a second runs into it: the next temp file hashes to the number the previous one carried to the target, and GNU mv refuses the replacement with "are the same file". With readers holding the replaced file open, 56 of 3446 such replacements failed that way on our mounts; none did with this change. Lookup's probe already checks the next number; AllocateInode now does the same. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
32d4633298 |
filer: list the metadata log from the scan start, not from midnight (#12885)
* filer: list the metadata log from the scan start, not from midnight A pass over the persisted metadata log lists the start day's directory from its first file, then skips the files before the scan start's minute. Each filer writes up to one log file a minute, so late in the day a pass reads up to 1440 entries per filer from the filer store to find the few after the scan start: with three filers and a scan from 12:29, 2254 entries for 6 files. Every disk pass pays this: SubscribeMetadata and SubscribeLocalMetadata whenever a subscriber reads from disk (filer.sync, filer.meta.tail or an S3 gateway resuming from an earlier position, or catching up), and CollectLogFileRefs for chunk-capable subscribers. List the start day from the scan start's minute, in the log file collector and in CollectLogFileRefs. The files before it were skipped anyway, so a pass reads the same files; later days are still listed from their beginning. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: list the whole log day on a store that does not list by name Elasticsearch pages a directory by a hash of the entry path, not by name, so a listing there cannot start at the scan start's minute: an inclusive start re-reads the first page, and an exclusive one starts at an arbitrary point of the hash order. Stores now say so through UnorderedListingStore, which the Elasticsearch store implements, and the log passes list the whole start day on them, as before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: ask the store of the log day directory whether it lists by name The order check looked at the store of SystemLogDir. A path-specific store can serve a day directory under it, so ask the store that lists the day. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: test a log day served by a path-specific unordered store The stub store now lists the root directory of a path-specific store, which the translator hands it as "/". 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> |
||
|
|
b4f5b1a354 |
mount: hold a rename's names against this mount's own publications (#12889)
* mount: hold a rename's names against this mount's own publications
A rename of an open file can fail with EIO on a filer store with optimistic
transactions (TiKV). Rename publishes the handle's deferred create first. A
FLUSH of the same handle (a forked child closing the inherited fd, say)
that looked at the dirty flag before that publication waits on the locks,
then publishes the identical entry again while the filer moves the file,
and TiKV refuses the rename's commit on the source key ("write conflict
... reason:Optimistic"). safetensors checkpoints hit this: they write
.tmpXXXXXX and rename it while the fd is still open, and our training jobs
fork a subprocess every second.
- flushMetadataToFiler checks dirtyMetadata again under its locks and
publishes nothing for a handle another flush has already published.
- Rename holds the publication locks of both names, in path order, across
the filer call and the local move. A flush, chmod/utimes or xattr change
of either name through this mount waits for it, then publishes under the
name the rename left: lockFlushTarget (content flushes, now also the
periodic flush) and lockNodePublication (attribute changes) resolve the
name again after the wait. A failed rename restores the target's handle
before the locks go.
Tests: weedfs_rename_publish_test.go, with a filer that records every
write made while a rename is in flight. On master six of the seven fail,
the incident among them (the deferred create published twice); the one
that passes guards against deadlock between renames. The chmod stress run
fails on master with ENOENT. TestFlushMergeThroughChunkProxy marks its
handle dirty before it flushes: doFlush only flushes a handle with changes,
and the clean handle it used would now publish nothing.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* mount: give up on an attribute change whose node keeps moving
lockNodePublication went ahead on its fourth wait even when the node had
been renamed again meanwhile, and the change went to a name the node no
longer had, without that name's lock. It now returns EAGAIN then, as the
flush path already refuses after its fourth try. The stress tests accept
EAGAIN from a chmod racing back-to-back renames.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* mount: test the chmod that gives up on a file that keeps moving
The chmod waits for a name's lock that the test holds shared, so a
shared try fails exactly while the chmod is queued for it; the test
moves the file each time, four times, and expects EAGAIN with nothing
written.
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>
|
||
|
|
8046d5c78a |
fix(iceberg): keep concurrent namespace property changes (#12890)
* iceberg: keep concurrent namespace property changes UpdateNamespaceProperties merged the request into a copy read by GetNamespace and wrote the whole map back, so when two requests changed different properties of the same namespace at once, both answered 200 but only one change was kept. Apply the changes inside the compare-checked write instead, and answer 503 with Retry-After when every attempt loses. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3tables: keep stored namespace properties out of a PropertyChanges answer UpdateNamespace does not grant GetNamespace, so answering a PropertyChanges request with the merged map let a caller allowed only to update read every stored property, even with an empty change. Echo only what was sent, as the Properties form does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3tables: describe the PropertyChanges form of UpdateNamespace 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> |
||
|
|
5afeb20ad6 |
s3: enforce BlockPublicPolicy and RestrictPublicBuckets for bucket policies (#12882)
* s3: refuse a public bucket policy when the bucket blocks public policies PutBucketPolicy stored and enforced a policy granting access to every principal even with BlockPublicPolicy set. Check the stored public access block on the bucket entry that the policy write reads, and answer AccessDenied for a public policy. A policy counts as public when an Allow names a wildcard principal (or uses NotPrincipal) and no fixed-value restricting condition such as aws:SourceIp or aws:SourceVpce narrows it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3: keep a public bucket policy from granting anonymous access under RestrictPublicBuckets With RestrictPublicBuckets set, an anonymous request was still allowed by a public bucket policy. The bucket policy engine now treats such an Allow as granting nothing when the bucket restricts public buckets and its policy is public, so the request falls through to the remaining checks instead of reading as an explicit deny. A bucket whose configuration cannot be read is treated as restricted. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3: write a bucket policy only over the extended attributes it checked setBucketPolicy rewrote the whole bucket entry it had read, so a public access block set between the BlockPublicPolicy check and the write was erased and the public policy stored anyway. Send the read extended attributes, including an absent public access block, as the update's expected values, and redo the read and check when they changed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3: count more policy forms as public An empty principal list and a principal holding a policy variable can both match anyone, so they are public. An aws:SourceIp range wider than /8 (IPv4) or /32 (IPv6) no longer restricts a grant. An ARN condition value with a fixed account, such as an access point ARN with a wildcard name, does restrict it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3: deny anonymous callers outright on a restricted bucket with a public policy RestrictPublicBuckets limits a bucket with a public policy to callers of the owning account, so dropping only the policy's own grant left public ACLs able to serve anonymous reads. While the policy is public, the policy engine now answers an anonymous request with a deny. It checks before and after evaluating, so a policy replaced in between cannot let an anonymous grant through. A bucket without a policy, or with a non-public one, is unaffected. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3: count an empty principal string as public A principal of "" compiles to no principal check, so it matches anyone, the same as an empty list. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3: write a bucket policy only over the bucket entry it checked The policy write replaced the whole bucket entry and asserted only the public access block key, so a bucket setting first written between the lookup and the write (versioning, for one) was dropped. Pin the write to the entry it read; any concurrent change fails it and the lookup retries. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3: judge an IPv4-mapped aws:SourceIp range by its IPv4 prefix ::ffff:0.0.0.0/96 parses as a 128-bit network but matches every IPv4 caller, so it passed the /32 IPv6 bound and a public policy slipped past BlockPublicPolicy and RestrictPublicBuckets. Apply the IPv4 /8 bound to mapped ranges. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
8ffce492fd |
s3: time each stage of an object write (#12883)
* s3: time each stage of an object write
SeaweedFS_s3_request_seconds times the whole handler, so a slow PUT tail
cannot be split into client upload time and server time. putToFiler now
records SeaweedFS_s3_put_stage_seconds{operation,stage} per write:
body_read (blocked on the request body), assign (volume assigns),
chunk_upload (upload time apart from body reads: waiting on chunk
uploads), and metadata (from the uploaded chunks to the committed entry).
operation is PutObject or UploadPart; no per-bucket or per-object labels.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* grafana: chart the S3 PUT stage p99
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* s3: count body reads made before putToFiler in body_read
mimeDetect reads the first bytes, and a POST upload parses the whole form,
before putToFiler starts, so a slow client showed little body_read time.
track now times every read of the request body, body_read reports the
request's total, and chunk_upload subtracts only the reads made during
the upload.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* s3: observe body_read once per request
An archive upload writes one object per member, and every write reported
the same request-wide body read time. The first write to finish now
reports it; the other stages stay per write.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* s3: name the non-read upload stage storage
The chunked upload runs volume assigns inside the chunk upload goroutines,
so its time apart from body reads covers assigns and chunk uploads, and
the uploads themselves cannot be timed from outside UploadReaderInChunks.
Call that stage storage; assign stays the summed assign time within it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* s3: record a zero body_read for writes without a body
timeBodyReads attached no timer to bodyless requests, so a zero-byte PUT
or an UploadPartCopy recorded every stage but body_read.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* s3: observe body_read after the handler so it covers every write
An archive request writes several objects from one body. Observing
body_read at the first write's record left out the reads of the later
members. record now only marks the request, and track observes the
request-wide total once the handler returns.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
|
||
|
|
f3b838e234 |
ec: encode past deletes a replica missed while it was down (#12879)
* volume_replica: encode past deletes a replica missed A delete that reaches only some replicas, for example while one is down, leaves that replica holding the needle live. The encoder's idx gate then refused the volume forever. A needle live on one replica and tombstoned on another by a record appended after that write is a delete the first replica missed. MissedDeletes finds them; the gate leaves them out of the live-set comparison and encodes from a replica that holds none of them, so the EC volume does not bring them back. A tombstone older than the live write, a needle absent on the other side, and volumes without AppendAtNs still refuse, as does a volume where every replica missed some delete. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * erasure_coding: test encoding a volume one replica missed a delete on Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * volume_replica: prove a missed delete from one replica's own index AppendAtNs comes from each server's own clock, and vacuum's makeupDiff re-stamps tombstones it carries over with the commit time, so comparing a tombstone's AppendAtNs against another replica's write can order a later rewrite before an older delete. Prove the delete instead from the replica that applied it: its .idx shows the live row the tombstone replaced, and when that record has the same cookie, CRC and last-modified time as the needle still live on the other replica, that very write was deleted. Replicated writes share all three, a rewrite does not. A tombstone with no earlier write row (its write vacuumed away) proves nothing and still refuses. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * volume_replica: test a missed delete with a third replica holding no row Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * volume_replica: never count a needle its own replica deleted as missed A same-content upload with the same ts after both replicas deleted the needle matches the deleted write on cookie, CRC and last-modified. The replica holding it has its own tombstone for the needle before that live row, which a replica that missed the delete never has, so skip it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * volume_replica: count a missed delete only for a needle written once An overwrite that keeps cookie, CRC and last-modified, such as a TTL volume re-append or a client-set ts, also matches the write another replica deleted. A replica whose own index replaced an earlier row for the needle, by an overwrite or by its own delete, may hold a write made after that delete, so it never counts as having missed it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * ec: compare capacity replicas first so a clean one is the encode source When the preferred replica missed a delete, the gate falls back to the first replica that holds none, and that could be one without the free slots RequireCapacitySource needs, failing the encode although another capacity replica was clean. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * volume_replica: keep the row an offset-0 delete removes as an earlier write A remote-tier delete writes an offset-0 row and drops the key, so a later identical rewrite looked written once and could count as a missed delete. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * volume_replica: refuse a missed delete whose live write is not older than the tombstone Compaction keeps only the latest row per needle, so a same-meta rewrite after the delete can lose the earlier row that marked it as rewritten. Its record still carries its own append time, which then is not older than the tombstone. The index proof still decides; the clocks only refuse. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * volume_replica: count a missed delete only when both replicas appended the write together Compaction can drop the rows that show a replica rewrote a needle, and the tombstone stamp is not a reliable delete time: a vacuum commit stamps deletes made during the copy with the commit time, and replicas stamp with their own clocks. A replicated write lands on every replica within the forwarding time plus clock skew, so the live write and the deleted write must also be stamped within a minute of each other. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
dda0a57584 |
filer: announce the directories a rename creates at its destination (#12880)
* filer: let a suppressing caller collect the parents it creates
Under suppressed metadata events, ensureParentDirectoryEntry creates
missing parent directories without announcing them and releases their
stamps, since the caller's own event covers only its entry.
WithCreatedParents keeps the suppression and also collects those
directories, with their stamps, so the caller can announce them once its
change commits.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* filer: announce the directories a rename creates at its destination
A rename into a path whose parents do not exist yet created them without
metadata events. A peer filer with its own store replays events into that
store and never got the new directories: it found the moved entry by path,
but listing its new parent's parent showed nothing. The rename now
publishes a create event for each new parent ahead of its own event, after
the commit, and releases their stamps if it fails.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* filer: announce a parent a rename promotes from a file to a directory
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* filer: announce a promoted parent as replacing the file
A parent promoted from a file to a directory was announced as a create,
so a peer whose store does not upsert refused the insert over the file
row it already held and could not move past the event. Announce the
promotion with the file as the old entry, both from a plain create and
from a rename's collected parents, so a peer replays it as a replacement.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* filer: keep announcing a promoted parent as a create
filer.sync applies a same-path update through FilerSink.UpdateEntry, and
the destination filer refuses to turn its file into a directory, so an
event carrying the file as OldEntry stalls the sync. Ordinary writes have
always published a promotion as a create; the rename publishes the same.
This reverts commit
|
||
|
|
c80bf3afac |
util/http: stop waiting on a response body the server stalls (#12875)
* util/http: stop waiting on a response body the server stalls CloseResponse reads the rest of a response body so that the connection can be reused, and StatusError reads the message a server puts in the body of a failed request. Neither had a time limit. The client's only read deadline covers the response headers, so when a server sent its headers and then stopped sending the body, both blocked until the request's context ended. Most callers pass a context that never ends. A chunk read whose replica answered 404 or 500 this way never returned, so it never got to the next replica. That holds for ReadUrlAsStream and for the replica fallback of S3 copies. Both now close the body once 5 seconds have passed. That fails the blocked read, and the connection is dropped instead of reused. A body that arrives in time is drained as before, and its connection is still reused. StatusError reports the status with whatever part of the message arrived. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> * util/http: bound a body read that closing the body cannot interrupt The limit worked by closing the body, which fails a read blocked on it. That does not hold when the transport decodes gzip for the caller: in Go 1.26 its decoder reads the gzip header under a lock that Close also takes. A server that announced gzip and stalled before the gzip header kept both the read and the Close waiting, so the limit never applied. Such a response is now read on its own goroutine, and the caller stops waiting when the time is up. The read and the Close stay behind until the connection dies. Every other response keeps the cheaper way, with no goroutine. StatusError now returns the status alone when the message did not arrive in time. A partly read message is no longer safe to use, because the read may still be running. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> --------- Co-authored-by: MapleWhiteZZZ <18653045+MapleWhiteZZZ@users.noreply.github.com> Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com> |
||
|
|
3796162ba6 |
erasure_coding: clear stale EC shards on every holder the master lists (#12876)
* plugin/worker: look up a volume's EC shard holders on the master LookupEcVolumeLocations returns every server the master currently lists for any shard of the volume. The master's "ec volume N not found" answer means no holders; any other failure is returned. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * erasure_coding: clear stale EC shards on every holder the master lists The encode preflight and the post-distribute rollback cleared stale shards only on the planned targets and on the EC holders detection saw. A server that was down at detection and came back with a failed attempt's shards was outside both, so its shards survived and ended up beside the new encode: EC balance could later keep that stale copy as a duplicate. The cleanup now also asks the master for the volume's current holders and clears every one of them. A lookup failure counts as a cleanup failure, so the preflight retries later instead of encoding beside shards it cannot see. Without a master address the cleanup behaves as before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * erasure_coding: ask every master for the EC shard holders The execution defaults keep only the first master address, so a follower there failed every holder lookup and with it the encode preflight. The plugin handler now hands the task the whole cluster master list, and the lookup moves on past a master that refuses. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * erasure_coding: refuse the preflight wipe when a regular replica is gone A replayed job whose earlier run already committed the EC copy and deleted the source would wipe those shards, now on every holder the master lists, before failing on the missing source. Check that every regular replica is still there before clearing anything. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
f8d3722143 |
shell: refuse a replica trim that would drop a needle no survivor holds (#12878)
* shell: refuse a replica trim that would drop a needle no survivor holds The -doCheck pass before volume.fix.replication deletes a surplus replica compares it with each survivor in turn without resurrecting absent needles, so a needle live on the doomed replica and missing on every survivor passed the check. Trimming then deleted its only copy if it was a missed write. Count, across all survivors, the live needles none of them holds live or deleted, and skip the trim when there are any. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * shell: count a remote-tier survivor's delete as covering the needle A remote-tier replica records its deletes with offset zero, and the filtered index load drops those keys, so the trim check saw the needle as held by no survivor and refused the trim on every run. Walk survivor indexes unfiltered: any entry for the key covers it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * shell: keep the trim's final survivor check under test The coverage check reads each survivor's index a second time, so the survivor that disappeared after its first index read now failed that read and the final VolumeStatus check was never reached. Make it disappear after the second read and require the status check to run. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
95a4113c1e |
volume(rs): append an EC delete outside the store lock (#12874)
* volume(rs): give the EC deletion journal its own lock The .ecj append handle and its size move behind a per-volume mutex, Go's ecjFileAccessLock, shared through an EcJournalAppender that outlives the store lock that found the volume. Closing or dropping the volume closes the journal under that lock, and the decode takes it for its catch-up passes, so an append in flight is either fully read or not at all. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * volume(rs): append an EC delete outside the store lock VolumeEcBlobDelete and the local EC delete of the HTTP path held the store write lock through the journal append and its fsync, on a runtime worker. On a slow disk a stream of deletes kept the store write-locked, and readers queued behind the waiting writer, heartbeat collection included, until the master dropped the server. They now resolve the volume and its needle under the store read lock, then append and fsync on a blocking thread under the volume's journal lock. The decode tail is checked under that lock, which the decode takes after claiming the tail, so a delete still cannot commit behind the rebuilt index. A volume closed in between is resolved again. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * volume(rs): share a .ecj append lock across disks holding the file Disks can mount runtimes of one volume that journal into the same .ecj, each with its own handle and journal lock. With deletes appending outside the store lock, a delete through one disk could land while another disk's rebuild folded and replaced the file, or while a new mount loaded it, and be lost or cached before its rollback. The ecj registry now hands every holder of a path one append lock. Appends take it before the disk's journal lock, a mount holds it through its tail repair and load, and a rebuild holds it through the fold and every sibling's adoption. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * volume(rs): roll a failed .ecj append back to the file's real length The rollback point was the handle's cached size, which misses records another disk holding the same journal appended since, so a failed sync on one disk could truncate a sibling's committed delete. Take the length from the file itself, under the path's append lock. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * volume(rs): an EC sync does not wait for a journal append in flight CopyFile syncs the EC volume under the store read lock, and the .ecj sync now took the journal lock, so it waited out a delete's fsync with the store guard held. Every committed append already syncs its own record, so skip the journal while one holds its lock. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * volume(rs): repoint sibling .ecj handles when the fold fails after the unlink A rebuild fold that removed the journal and then failed to reopen it returned before the sibling disks sharing the .ecj adopted the new file, and one sibling's failed adoption skipped the rest. A delete parked on the path lock could then append to the removed inode and be acknowledged, then lost at restart. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * volume: reopen sibling .ecj handles even when the folded mount's reopen fails RebuildEcxFile unlinks the shared journal; the sibling reopen loop ran only when the folded mount's own reopen succeeded and stopped at the first sibling error, leaving the remaining handles on the detached inode. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * volume(rs): order the EC delete tail test on the path lock, not sleeps The delete holds the .ecj path lock exactly while it waits on the journal lock the test holds, so the store probe and the tail claim wait for it to be busy, and the commit check waits for it to be free again. A tail check taken before the journal lock now fails the test every run. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * volume: track the fold outcome without rewriting the rebuild call Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * volume(rs): find a folded journal's siblings by the registry's path key The sibling check compared raw .ecj paths, so a runtime reaching the same journal through a differently spelled index directory shared its append lock but was not repointed after the fold. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
8be0837c20 |
s3api: try the next replica when a copied encrypted chunk does not decrypt (#12872)
A copy stores a per-chunk-encrypted chunk's ciphertext as-is, so a replica whose needle is cut short or diverged became the copied chunk unnoticed. Open the GCM tag of a whole-needle read and fail that replica when it does not authenticate; a compressed ciphertext has no expected length to check. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
279d2d2c03 | docs: regenerate star history chart | ||
|
|
88aa5e9ebe |
s3api: validate x-amz-checksum-* headers on DeleteObjects (#12868)
* s3api: validate x-amz-checksum-* headers on DeleteObjects * s3api: reject malformed query escapes, non-canonical signed Content-MD5, and test presigned DeleteObjects * s3api: share canonical Content-MD5 parser and index query keys once |
||
|
|
cbce146a63 |
s3api: keep a long CopyObject/UploadPartCopy alive with whitespace, as AWS does (#12862)
* s3api: keep a long CopyObject/UploadPartCopy alive with whitespace, as AWS does CopyObject and UploadPartCopy copy every chunk and only then write the response. On a slow volume disk (~10 MB/s), or when the source is a remote-only file of a remote-mounted bucket that is fetched first, a copy of tens of MB sends no byte for 20-30 s. Clients with a low-speed check give up while the copy finishes: the AWS SDK for C++ (pyarrow, among others) sets libcurl's CURLOPT_LOW_SPEED_LIMIT to 1 byte/s over a few seconds, and the abandoned copy leaves an orphan. AWS S3's documented behaviour for long copies: answer 200 at once, keep the connection alive with whitespace, then send <CopyObjectResult> (or an <Error> document) in the body. This does the same: - Once every check that refuses with its own status has run (auth, missing source, preconditions, invalid arguments, ACL and lock headers, the remote-cache 503), a copy still running after 1 s commits to 200, application/xml and the XML declaration, then sends one space a second, flushed, until <CopyObjectResult>/<CopyPartResult> (checksum in the body) or an <Error> with the code the handler would have answered. A copy that ends sooner answers byte for byte as before. - Armed before a remote-only source is fetched into the cluster, which is the slow part on a remote-mounted bucket. - Never kept alive: the metadata-only self-copy; a destination with versioning Enabled (x-amz-version-id is known only after the copy); a part copy whose upload or request carries SSE (its response headers are known only after the copy). - One goroutine owns the ResponseWriter from arming until halt() returns; a client that leaves ends it without touching the copy. - s3err gains StartStreamingResponse, ErrorResponseFor and EncodeXMLBody, shared with WriteErrorResponse. Accepted: a slow failure is 200 + <Error>, as on AWS, and the request is counted as 200. Tests: s3api_object_handlers_copy_keepalive_test.go (slow success and failure, fast unchanged, a refusal keeps its status, part copy, versioned destination, SSE-C part, checksum in the body, remote fill covered, client gone under -race, slow lookup then bad tag = 400, self-copy 412 under the lock, part range on a remote-only source). With the keep-alive forced off, the slow-copy tests fail. * s3api: send a block of spaces per copy keep-alive tick libcurl rounds its measured rate down, so one byte a second sits right at the AWS SDK for C++'s 1 byte/s low-speed limit and jitter can trip it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3api: audit a kept-alive copy error at the 200 it was sent with Once the keep-alive has sent 200, the <Error> rides in that response, so the access log records 200 and the error code, as AWS server access logs do. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3api: fill a conditional remote-only copy source before the keep-alive A source condition read the filled entry only after the keep-alive had committed 200, so a slow fill turned its 412 (or the 400 of a malformed date) into an <Error> inside a 200. With any x-amz-copy-source-if-* header the fill runs first, as it did before the keep-alive. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3api: fill a remote-only self-copy that moves data under the keep-alive Only a self-copy that can stay metadata-only needs its source filled before the keep-alive; one that re-encrypts takes the data path, so its fill is the slow part the keep-alive is for. A fill changes no encryption state, so the unfilled entry decides. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3api: test that the copy keep-alive reaches a client mid-copy A ResponseRecorder keeps every write, flushed or not; over a real connection the declaration and the spaces must arrive while the copy is still held. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3api: bound the copy keep-alive streaming test with a request deadline 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> |
||
|
|
40fe40556c |
filer.meta.backup: list large etcd directories without the 3s request deadline, skip excluded subtrees (#12870)
* filer/etcd: list a directory without the request deadline etcd counts every key left in a range even when the request is limited, so one page of a directory costs time that grows with the entries after it: about 0.3 s at the start of a 4 million entry directory on an idle local etcd, against 1.6 ms near its end. The 3 s request_timeout therefore fails listings of large directories, which a long walk such as filer.meta.backup reaches page after page, with "list <dir> : context deadline exceeded". Listings keep the caller's context like DeleteFolderChildren; keepalive still ends a call to a member that stops answering. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer_pb: let a TraverseDfs callback skip a directory's subtree fn returning fs.SkipDir for a directory leaves its subtree unlisted; the directory is still reported as walked, so a resumed walk passes it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer.meta.backup: do not walk directories the path filter leaves out The walk listed every directory and dropped excluded entries one by one, so -excludePrefixes could not keep it out of a directory: a huge or failing excluded directory was still listed page by page. A directory that is not included and has no include prefix under it is now skipped whole. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer.meta.backup: resume outside a directory the path filter leaves out A walk saved before the filter skipped directories, or before the filter changed, can hold a position inside a directory the walk now leaves out. Resuming there entered the directory without asking the filter and listed it. The resume position moves to the topmost such directory, which a resumed walk treats as done. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer.meta.backup: skip the walk when the path filter leaves out its root The root of the walk is never handed to the callback, so a -filerDir the filter leaves out was still listed. Nothing under it would be backed up, so the walk now ends before it starts. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
f6d2a42265 |
s3api: authenticate unsigned requests by a verified client certificate (#12871)
* iam: let an identity name the client certificates it authenticates with An Identity gets a list of CertificateMatch entries: a URI SAN, a DNS SAN and a subject CN, every field set having to equal the certificate's. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3api: authenticate an unsigned request by its verified client certificate With -tlsVerifyClientCert the gateway verifies every client certificate, but the certificate took no part in naming the identity. A request that carries no signature or token now authenticates as the identity whose certificates match the leaf of the chain the gateway verified, and goes through the same authorization as a signed request from that identity. Only a verified chain counts. A signature or token still decides the identity on its own, a certificate matching a disabled identity or more than one identity is refused, and a certificate matching none leaves the request anonymous as before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3api: keep certificate identities off the anonymous read paths AuthWithPublicRead and the deferred anonymous object read classified a request by its headers alone, so an unsigned request authenticated by its client certificate would have been authorized as the anonymous principal: a GET in a private bucket was refused. They now treat a request whose certificate names an identity like a signed one. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * admin: keep a user's certificate mappings when the dashboard edits it UpdateObjectStoreUser and UpdateUserPolicies save a rebuilt identity, which left out the certificates, so editing a user's email or policies ended their certificate authentication. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * credential/postgres: store a user's certificate mappings The PostgreSQL credential store keeps each identity field it knows in its own column, so certificates were dropped on save and a user configured there could not authenticate by certificate. Users get a certificates JSONB column, added to existing tables like policy_names, and every user query reads or writes it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
48f9a1f891 |
s3api: read a copy's source chunk from another replica when one cannot serve it (#12865)
* s3api: read a copy's source chunk from another replica when one cannot serve it CopyObject and UploadPartCopy looked up the source volume and always read from the first location the lookup returned. When that replica could not serve the chunk (it was down, or it was missing a needle the other replicas hold), the copy failed with 500 even though the object was fully readable: GET falls back to the other replicas, copy did not. Keep every location from the lookup and try them in order: - the streaming path opens the source on the first replica that answers with the chunk. It only moves to the next replica before any byte has been forwarded to the destination. - the buffered path (encrypted or rewritten chunks) retries the whole download on the next replica and discards a partial read. When no replica can serve the chunk the error lists what each one answered. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> * s3api: try the next replica when a buffered copy read comes back short A replica holding a shorter needle answers the range clamped, with a clean end, so the download looked complete and the copy kept the short data instead of reading the healthy replica. Plaintext reads now need the full requested length; cipher chunks are still checked by decryption. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3api: skip a replica whose streamed copy source is shorter than the chunk The streaming path checked only the status, so a replica holding a shorter needle had its clamped range forwarded and the destination stored a short chunk. An uncompressed response that declares fewer bytes than requested now moves on to the next replica before anything is written. 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> |
||
|
|
0aca7d1d6c |
ci: install Caddy from the pinned GitHub release (#12864)
caddyserver.com/api/download now answers 401 without a login or API key, so the awscli-over-https job failed in Setup Caddy on every run. Download the v2.11.9 release tarball instead and verify it against the release's SHA-512 checksums. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
cf00eae537 |
filer: end retried deletions of chunks on volumes the master no longer knows (#12860)
* filer: end retried deletions of chunks on volumes the master no longer knows The deletion lookup read volume locations from the client's cache only. A chunk on a volume the cluster no longer has (a dropped collection, a removed bucket) found no location, so no volume server was asked, no deletion result came back, and the retry queue re-queued it "to avoid loss". The durable deletion ledger keeps such ids and reloads them with a fresh retry count on every restart, so MaxRetryAttempts never ends them: on one deployment 2,337 chunks on 159 deleted volumes were retried 2-4 times an hour for days, ~7,000 warnings an hour. The retry loop's lookup now asks the master about the volumes the cache does not know. A location found is used. A "volume id N not found" answer is not proof on its own (a live volume whose server is away answers the same, and so does a follower's cold cache), so it only starts a streak on the retry item: once the master has answered it for VolumeGoneGrace (30 min) over at least VolumeGoneMinAnswers (3) retries in a row, the chunk counts as deleted with its volume and leaves the queue and the ledger. Any other outcome, a failure to ask included, resets the streak and keeps the id retried as before. The hot deletion loop and the remote-cache flush keep the cache-only lookup. * filer: hold a volume-gone deletion for MaxRetryDelay before dropping it A volume server that is down for longer than half an hour gets the same "not found" answer from the master as a deleted volume, so the 30 minute grace dropped pending deletions of chunks that come back with the server. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: test the answer count once the volume-gone grace has passed 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> |
||
|
|
c9fb00a5d2 |
s3api: return NoSuchBucket for conditional requests on a missing bucket (#12861)
* s3api: return NoSuchBucket for conditional requests on a missing bucket * s3api: preserve bucket-name validation for non-If-Match conditional PUTs |
||
|
|
e3946a35ee |
filer: keep a directory created while a nested create fills in its parent (#12858)
* filer: fill in a missing parent only where no directory appeared meanwhile A nested create fills in a missing parent directory by looking it up and then inserting a plain directory row. A directory created at that path in between, such as an S3 directory marker carrying its content type and ETag, was overwritten by the upsert and lost its marker. The parent's insert and a directory create now re-check the path under a per-path lock before inserting, so neither replaces the other. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: test a directory created while its parent is filled in Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: keep writes inside a store transaction out of the directory lock A transaction holds its store connection until it commits, and SQLite has only one. A rename creating its destination directory inside one would wait for the directory lock while a nested create holding that lock waits for the connection, so transactional writes no longer take it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: test a directory create that waits for its parent's insert Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
70ed252dd6 |
shell: mask every remote secret in remote.configure's listing (#12856)
* shell: mask every remote secret in remote.configure's listing remote.configure without arguments lists the configured remotes and replaces their secrets with stars, but the list was incomplete: the Azure account key, the Backblaze application key, the Baidu secret key (the access key was masked in its place) and the Contabo secret key were printed in clear, and so were inline gcs service account credentials (the field holds a file path or the JSON itself, private key included). Move the masking into maskRemoteConfSecrets, which covers every secret field of RemoteConf, and test it. An unset secret stays empty, so an Azure remote that authenticates with Entra ID still lists an empty key; a gcs credentials file path stays listed. * shell: compare each masked remote secret with its full-length mask 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> |
||
|
|
14631d530b |
filer: refuse a forwarded conditional write on a filer that is not its owner (#12857)
* filer: refuse a forwarded conditional write on a non-owner A filer applied any routed write a ring peer forwarded, even when its own ring named another filer as the write owner. While two filers' rings disagree (a cooling-off window closing at different times, or a filer that installed the ring without the prior snapshot), each could apply a conditional write of the same entry under its own path lock, and both callers saw success. The receiver now refuses such a forward with Unavailable carrying a NOT_WRITE_OWNER reason, so the sender can tell nothing was applied. Refusing rather than re-forwarding keeps the one-hop bound. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: re-route a forward the owner refused as not its own A refused forward applied nothing, and the two rings converge once a ring update reaches the lagging filer or a cooling-off window closes. The sender now routes the write again by its own ring, with backoff, until shortly after its latest window ends, and surfaces the refusal only after that. A write whose owner turns out to be this filer is applied locally. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: test forwarded conditional updates between two filers Two filers on one store, each serving gRPC with its own ring: while the receiver's ring names the sender as the owner, the forward is refused and the entry is untouched; once the receiver's cooling-off window closes, the sender's retried forward applies once and a second update with the same expectation fails its condition. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: keep retrying a refused forward through a new ring change The retry deadline was taken from the cooling-off window seen at the first refusal. A ring change arriving during the retries opens a new window, in which the two rings can still disagree, so the deadline is now recomputed after every refusal, capped at 15 s from the first one so a ring that keeps changing cannot hold a request indefinitely. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: surface a refused forward rather than apply it locally A caller can check the entry before routing: an HTTP append verifies its snapshot under its locks and then commits locally without a condition. Once a forward is refused, the retries wait, and if this filer's ring then names itself, a local apply would act on that stale check and could overwrite an entry replaced meanwhile. The refusal now surfaces in that case, and the caller retries the whole request. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
ebd90c3a45 |
fips140=only: SHA-256 in place of MD5 and SHA-1 so the server starts and serves S3 (#12855)
* util: SHA-256 stands in for MD5 and SHA-1 under fips140=only GODEBUG=fips140=only panics on MD5 and SHA-1. NewMd5 and NewSha1 return those hashes as before, and under fips140=only SHA-256 cut to the same size, so digests keep their length. Md5, HashStringToLong and HashToInt32 use NewMd5. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer stores: hash directory keys with NewMd5 and NewSha1 leveldb2, leveldb3, rocksdb and arangodb hash directory keys with MD5, tikv with SHA-1, which GODEBUG=fips140=only refuses, so the filer panicked at startup. They now use util.NewMd5 and util.NewSha1. Keys made under fips140=only differ from MD5 keys, so leveldb2 and leveldb3 mark an empty database opened under fips140=only and refuse a database whose keys are of the other kind instead of showing it empty. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * operation, volume: no Content-MD5 checks under fips140=only Under GODEBUG=fips140=only the uploader's digest is not an MD5, so it is no longer sent as Content-MD5, which volume servers outside that mode would reject; the digest still becomes the chunk ETag. A Go volume server in that mode keeps a client's Content-MD5 unchecked instead of panicking. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3api, filer: ETags and content digests with util.NewMd5 ETags, entry Md5 attributes and chunk digests now use util.Md5 and util.NewMd5, so under GODEBUG=fips140=only they are SHA-256 cut to 16 bytes instead of panicking. That digest cannot check a client's Content-MD5, so in that mode Content-MD5 is accepted unchecked, and the filer stops returning Content-MD5. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3api, iam, master: SHA-1 names with util.NewSha1 Multipart upload ids, IAM policy ids, the OIDC provider, audit and session revocation file names, and the master's read-only copy dir hash names with SHA-1. They now use util.NewSha1, which GODEBUG=fips140=only turns into truncated SHA-256. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * postgres, oidc, update: refuse MD5 and SHA-1 checks under fips140=only PostgreSQL md5 authentication, OIDC TLS thumbprints (SHA-1 by definition) and weed update's MD5 check of the download cannot run under GODEBUG=fips140=only. They now fail with an error saying so instead of panicking. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3api: no empty-body MD5 when Content-MD5 is not checked Under fips140=only a bodyless signed request still reached md5.Sum(nil) before the nil check and panicked. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3api: empty copy part ETag from the digest it stores Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * util: skip the native MD5 test under fips140=only Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3sink: no Content-MD5 under fips140=only The entry's Md5 attribute is truncated SHA-256 there, which an S3 destination checking Content-MD5 would reject. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * iam: move OIDC provider and revocation records to this mode's name The record names hash the ARN or JTI with util.NewSha1, which differs under GODEBUG=fips140=only. On the first use of a filer, each store renames records whose name does not match the one derived from their content, so lookups, revocation checks and deletes find records written in the other mode. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * iam: test the rename with the names each fips140 mode derives Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * iam: rename a record only if it is unchanged, under its new name's lock Two processes renaming after a mode switch could both list a record; if one renamed it and the provider was then deleted, the other wrote it back. The rename is now one filer transaction locked on the new name, like the stores' conditional writes, that requires the old entry to be unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
949952f2b6 |
filer: take a hard link off only after the store dropped the name (#12853)
* filer: take a hard link off only after the store dropped the name Deleting one name of a hard-linked file took the name off the file's link count (DeleteHardLink: the shared record read, its count less one written back, in writes of their own) before the store deleted the name. When the store then refused the delete (a TiKV write conflict, a database timeout), or the filer stopped in between, the name stayed with the count already one short. Each time the delete was sent again it took one more off: a client retrying, or rm run again after the error. At zero the record went, and that delete, having read a count of one, deleted the chunks. The file's other names were left with no record and with their chunks deleted. Without a retry, the next delete of another name of the file did the same. A name now comes off the count once the store no longer holds it (FilerStoreWrapper.dropLink). A refused delete leaves the name and the count as they were, and the delete sent again takes it off once. - DeleteEntry and DeleteOneEntry delete the name, then drop its link. - InsertEntry and UpdateEntry over a name of another hard-linked file write the new entry, then drop the replaced name's link (handleUpdateToHardLinks now returns it instead of dropping it). - A recursive delete drops its hard-linked children's links after DeleteFolderChildren deleted them, not while listing them. - A link that cannot be dropped after the delete or the write is logged and fails neither (a write failed before): the count stays one too high, and the record and the chunks outlive the file's last name instead of going before it. Inside a store transaction (a rename) the order changes nothing. Tests: filer_hardlink_delete_test.go, and through the DeleteEntry handler filer_grpc_server_hardlink_delete_test.go. With the old order the refused delete, write and recursive delete each take a link off, and the delete sent again queues chunk 3,0c03 for deletion while /dir/other.txt reads it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: delete a hard-linked name's chunks only once its file's record is gone DeleteEntryMetaAndData deleted the chunks of a hard-linked name when the link count it read before the delete was one or less. Another filer can link the file under a new name in between: the count misses that name, the record, which counts it, outlives the delete, and the chunks went while the new name read them. Now the count read before must leave no other name and the file's record must be gone after the delete (lastLinkDropped); a recursive delete already asks for the record. The count stays in: one name deleted at once through two filers is taken off twice, and the record goes while another name still holds the file. When both deletes read the count before either took a link off, the count still shows that name and the chunks stay. Where the two disagree the chunks leak rather than go. Tests: TestDeleteEntryKeepsChunksOfLinkAddedMeanwhile fails with the count alone, TestDeleteEntryTwiceAtOnceKeepsChunks with the record alone. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: delete a recursive delete's hard-linked names one by one, as a single delete does A recursive delete listed a folder's hard-linked names, had DeleteFolderChildren delete them with the other children, and then took their links off and asked whether each record was gone. Found in review: - A store that deletes a folder's children in batches (TiKV) can fail after some of them. The names it deleted are gone, their links were never taken off, and the delete run again no longer lists them, so their counts stay high and the file's chunks are never freed. - Two filers deleting the same folder at once both take the link of each hard-linked name off. The second finds the record gone and deletes the chunks while a name outside the folder still reads them (as on master). - The listed entries, chunk lists included, were kept until the folder's children were deleted. A hard-linked child now goes as it is listed, the way a single delete takes a name (deleteLinkedName): its entry read again for the current count, the name deleted by the store, then its link taken off (dropLink), and its chunks queued only when it was the last link (lastLinkDropped: the count read left no other name and the record is gone). DeleteFolderChildren takes the other children. Names of one file in two folders of the tree still free the chunks once, with the last of them. The link of a hard-linked child now comes off whether or not the delete removes data, as it already did for a single delete. OnHardLinkIdsFunc and maybeDeleteHardLinks, which took links off only with the data, are gone. Tests: TestRecursiveDeleteFailingAfterItsLinkedChildTookItsLinkOff and TestRecursiveDeletesAtOnceKeepChunksOfANameOutside fail with the previous commit; the latter also fails when deleteLinkedName asks for the record alone. TestRecursiveDeleteOfEveryNameDeletesChunksOnce covers the names of one file in two folders of the tree. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: delete a recursive delete's last-link chunks as the link goes deleteLinkedName queued the chunks of a file whose last link it took off with the folder's other chunks, which are deleted only once the whole folder delete has succeeded. When a later child, a listing or DeleteFolderChildren failed, the delete returned first and those chunks stayed for good: their name and record were gone, so no retry could find them. Found in review. They are now deleted when the link goes, through DeleteChunks with the child's path, as a single delete deletes them. Test: TestRecursiveDeleteFailingAfterALastLinkWentDeletesItsChunks fails with the previous commit. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: free a swept hard-linked child's chunks only when its last link went The replay sweep freed a hard-linked child's chunks once the shared record was gone. One name deleted at the same time through another filer takes the link off twice, so the record goes while another name still reads the file. Use lastLinkDropped with the count read under the child's lock, as the single and recursive deletes do. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: test store hands out a copy of an entry, as a real store does Returning the stored entry let a later lookup overwrite the link count an earlier lookup handed to its caller. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: look a hard-linked name up again before taking its link off A delete read the name, and another filer deleted the same name and took its link off before this delete read the count. The count then already lacked the name, the second delete took the link off again, the record went with another name left, and the chunks were deleted. A hard-linked name is now deleted through DeleteEntry, which looks the name up after the count was read and skips the link when the name is gone. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: report a failed lookup from a store delete instead of success DeleteEntry took any lookup error for a name already gone, so the delete reported success, the name stayed, and the caller sent a delete event. Only a missing name is a no-op now. 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> |
||
|
|
f7bd0ad802 |
storage: measure the search lock-hold budget in rounds (#12854)
A stall of a loaded host (a goroutine not scheduled for most of a second) made one search and one foreground write go over the 250 ms budget, failing the test though every search held the lock for about 20 ms. Measure in five 500 ms rounds and pass once a round stays within the budget: every search scans the tombstone run, so a slow search still fails every round. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
3bc6161401 |
helm: opt-in HTTPS for the volume servers' data port (#12843)
* helm: render volume server HTTPS in security.toml global.seaweedfs.volumeHttps.enabled sets [https.volume] to the volume certificate and turns on [https.client] with the client certificate and the chart CA, so the volume data port is no longer plaintext under enableSecurity. The option fails without enableSecurity. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * helm: add the volume service names to the volume certificate for HTTPS Volume servers register as <pod>.<volume service>.<namespace>, and HTTPS clients verify that name, which none of the certificate's wildcards cover. With volume HTTPS on, the certificate also lists every volume group's service. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * helm: probe volume servers over HTTPS when they serve it Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * helm: reject volume HTTPS for the all-in-one deployment Its volume server registers by pod IP, so HTTPS clients could not verify the volume certificate. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * helm CI: check the volume server HTTPS rendering and its guards Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * helm: document volume server HTTPS Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: copy chunks for cp.from through the shared HTTP client The copy built a bare client and plain http:// chunk URLs, so with [https.client] on it could not read from or write to HTTPS volume servers ("source returned status 400"). Use the global client's transport and redirect policy, and normalize the source and destination URLs to its scheme. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * helm: restart every security.toml reader when volume HTTPS is toggled security.toml is mounted with subPath and read once at startup, so on an upgrade that turns volume HTTPS on, the volume servers restarted with TLS while filer, S3 and the other clients kept speaking plain HTTP. A checksum/volume-https pod annotation, rendered only while the option is on, rolls them all. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * helm CI: check the volume HTTPS rollout annotation Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * master: forward to the leader with the masters' own HTTP scheme A follower took the scheme from [https.client], so with HTTPS clients toward volume servers and plain-HTTP masters every forwarded request (/dir/assign, /dir/status, the UI) failed with 502 "first record does not look like a TLS handshake". Masters share one [https.master] setting, so use HTTPS exactly when this master serves it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * helm: update the volume HTTPS caveats now that masters forward correctly Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: send a read token on the cp.from source chunk GET With jwt.signing.read set, volume servers refuse unsigned reads, so cp.from of a chunked file failed with "source returned status 401". Mint a read token for the chunk on each source attempt, the same way the filer's own reads do. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * volume (rust): look up volume locations over the master's gRPC port The lookup used the master's HTTP /dir/lookup with the [https.client] scheme, so with HTTPS volume servers and plain-HTTP masters every replicated write, proxied read, remote chunk read and batch delete failed. Go asks the master's LookupVolume over gRPC; do the same, over one reused channel. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * volume (rust): bound the whole master dial in lookup_volume connect_channel's connect timeout covers only the TCP connect, so a master that accepted the connection and stalled in the TLS handshake held every replicated write, proxied read and remote chunk read that needed a lookup. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
afdb32d228 | docs: regenerate star history chart |