mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-12-05 02:27:26 +01:00
413fdf196883eda31f16d517bc66cd2d5537e732
1164
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
1f8ad7016f |
filer: compare garbage chunks by needle identity (#12992)
* Normalize chunk identities during garbage comparison * Keep replication chunk respellings observable * filer: skip the needle identity index when nothing is subtracted Every compaction subtracted its retained chunks from an often empty covered list, parsing and re-formatting each retained file ID first. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: skip the identity subtraction at the compaction call site Returning early from doMinusChunks on an empty minuend stopped MinusChunks from calling GetFileIdString on the new entry's chunks. After CreateEntry of a new file, the caller's chunks then kept the FileId that BeforeEntrySerialization cleared, so tus completion built its still-referenced set from empty IDs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: match needle spellings through DoMinusChunks instead of a new function Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: DoMinusChunks always matches chunks by needle Drop the byNeedle parameter so DoMinusChunks keeps its two-argument signature and every caller, including ones added on master since, compares equivalent file ID spellings as the same needle. The needle normalization moves from the server scope checks to filer.ChunkIdentity so both share it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filersink: match replicated source file IDs by needle compareChunks no longer reports a respelled source chunk, so the replica keeps the SourceFileId it was copied under. Removing chunks the source dropped and judging stale backup chunks now compare that ID by needle, otherwise a later removal in the other spelling would leave the replica's chunk behind. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
39675b2faf |
filer: hide remote rename source paths from scoped responses (#13010)
* filer: redact remote rename source from scoped responses * Preserve scoped remote rename markers * Consolidate scoped marker replacement coverage * Refuse scoped whole-entry guards during remote rename * Keep coded create refusals for guarded scoped writes * Make scoped subscription batch coverage deterministic * filer: refuse scoped conditions that compare the remote rename source IF_EXTENDED_NOT_EQUAL clauses and ExpectedExtended on Create, Update and DeleteEntry could still compare a guess against the hidden marker, so a scoped client could confirm the source path it redacts. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: refuse scoped condition gates on the remote rename source An IF_EXTENDED_TIME_ELAPSED gate applies its time check only when the gate value matches, so a gate on the marker also confirms a guess. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: keep a pending rename source out of remote copy errors A failed copy of a pending remote-only rename named the marker's source location, which the backend error repeats, and rename RPCs return that error to scoped callers. Log the full error and return one naming only the paths the caller supplied. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: let a scoped local overwrite end a pending remote rename Scoped replacements kept the hidden rename source marker even though a scoped entry can never stay remote-only, so the marker was stale on the local copy and every later scoped IF_ENTRY_EQUAL write was refused. Drop the preservation and let the overwrite clear the marker as other local writes do. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * codespell: ignore poligon only inside URLs Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
35caf2542c |
operation: report a delete result for volumes the lookup cannot locate (#12488)
* weed/filer: retry deletes when volume replicas are offline or missing Signed-off-by: Tyagiquamar <mohdquamartyagi@gmail.com> * operation: assert one delete result per file id in the no-location test Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Signed-off-by: Tyagiquamar <mohdquamartyagi@gmail.com> Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
d2276f531e |
master: apply the whitelist to management gRPC RPCs (#13022)
* master: gate operator-only management RPCs on the whitelist CollectionDelete, DisableVacuum, EnableVacuum, VolumeGrow, ResumeVolumeGrowth, LeaseAdminToken and ReleaseAdminToken now call checkGrpcAdminAuth, matching the whitelist their HTTP counterparts already enforce. VolumeGrow stays open to the in-process growth loop, and callers on the local gRPC socket of weed server/mini are local. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * master: admit unknown masters over KeepConnected only from the whitelist A KeepConnected registration as a master pulls that address into the raft quorum. Accept it from any caller only for this master and its -peers; any other master address now needs a whitelisted caller, the same check RaftAddServer applies. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * master: test that every RPC is gated or listed with a reason Port the volume server's coverage test so a new master RPC cannot skip checkGrpcAdminAuth without an explicit exemption. The proto and AST helpers now take the proto file and receiver name. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * volume: admit callers on the local gRPC socket weed server and weed mini route same-host gRPC dials through a unix socket, whose peer address carries no IP. With -whiteList set the volume server refused the in-process master's AllocateVolume, so no volume could be grown. The Rust volume server serves gRPC over TCP only. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * master: match a KeepConnected master against configured peers by gRPC endpoint Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * pb: bind the local gRPC socket for the owner only Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: warn when a deleted bucket's collection is left on the master Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * pb: bind the local gRPC socket in a private directory before moving it into place Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: report an unconfirmed bucket collection delete as such Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
f079b68f2b |
filer: grpc_require_token with authenticated filer-to-filer peer calls (#13011)
* filer: require bearer tokens for configured gRPC calls * filer: authenticate owned peer RPCs with per-call admin tokens * filer: retain scoped forwarding refusals with required authentication * filer: preserve tokenless HTTP forwarding outside require mode * filer: honor clock tolerance for gRPC admin fallback * filer: preserve caller token on lock owner forwards * filer: forward caller auth on target ping * filer: authenticate startup peer digest checks * filer: verify required subscription bearers independently of mTLS * filer: assert exact caller bearer on forwarded ping * filer: sign peer tokens with the gRPC verification key peerContext signed filer-owned RPCs with jwt.filer_signing.key only. With grpc_key as the only key and require-mode on, peer calls went out tokenless and were refused. With both keys set, peers that verify with grpc_key and lack the shared-key admin fallback refused the shared-key token even with require-mode off. Sign with the key filesystem gRPC verifies, and keep the shared key for metadata subscriptions, whose verifier accepts admin tokens signed only with it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: keep a subscription token's scope over mTLS in require-mode Require-mode admitted a dedicated subscription bearer without the mTLS shortcut, but the handler re-checked it with the certificate, which granted the full stream past the token's prefixes and expiry. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: delete uploaded chunks when the write owner refuses authentication A forwarded HTTP append or offset write that the owner refused as Unauthenticated kept its new chunks as if the outcome were unknown, orphaning them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: hand the admitted subscription scope to the handler The handler re-verified a dedicated subscription token after reading the request. If the token expired in between, an mTLS peer fell back to the certificate and got an unrestricted stream. The interceptor now passes the scope it admitted, and the handler refuses it once expired. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: accept grpc_key admin tokens on metadata subscriptions A filer with only grpc_key signs peer subscriptions with it, but the subscription verifier checked admin tokens against the shared key only, so with a subscribe key set the aggregator's peer streams were refused. An unscoped grpc_key token already has full filer gRPC access. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: delete the generated manifest when the write owner refuses authentication A forwarded HTTP append that crossed the manifest threshold left the manifest blob it had uploaded orphaned when the owner refused the call as Unauthenticated. The blob alone is deleted, since the manifest also lists committed chunks. 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> |
||
|
|
a1764358cf |
filer, mount: keep a hard-linked file to one link id and count its names on the filer (#13006)
* filer, mount: keep a hard-linked file to one link id and count its names on the filer A hard link's bookkeeping was done by the client. To link a file a mount reads its entry and sends two writes, an update of the source and a create of the new name, both with a link id and a count of the file's names. Two clients that link one file at the same moment each worked from the entry as it was before the other's writes: - With no link id on the entry yet, each made one up. The second update moved the source to its id, the store took the name off the first, and the first client's new name was left alone on it: one file's chunks under two link ids. - With a link id there, both read the same count and sent it plus one. The record counted one name fewer than the file had. Any write through a name carried the client's copy of the count and replaced the record the same way. Either way the delete of the last counted name deleted the record and the chunks while another name still read them. The filer's own store now counts the names of a hard-linked file itself (countLink): one more when the name written did not hold the link before, the same when it did or when a rename moves it there (WithMovedLink), one for a record that starts. The count sent is not used, and the entry gets the count stored, so the response and the event carry it. The lookup of the name, the count, the record and the name are stored as one change of the record (changeLinkRecord), which DeleteHardLink goes through as well: under a lock per link id, and in a transaction where the store refuses a commit over a change made since it began, run again when it does. A wrapper around a copy of some entries, such as a mount's metadata cache, sees only some of the names and stores the count it is given. UpdateEntry refuses to give a name that holds a hard link another link id that no file has yet (refuseSecondHardLink). The mount sends a file's first link's update as a unary RPC, which keeps that refusal apart from an I/O failure, reads the entry again and links under the id the file has by now. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> * filer: take a replicated update's link id without refusing it Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: look a path-specific name up outside the record's transaction Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: check the leveldb open and close it in the hard link test Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mount: send a refused first link again from the entry as stored Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mount: keep a first link's refusal over the next filer's error Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: count a hard link's names next to the clients' count instead of in its place The filer's count replaced the one clients send, which lost two things that count did by being worked out ahead: - A link's first write, the update of the source, carries the count with the new name in it already. While the second write is on its way that kept a delete of the source from being taken for the delete of the file's last name (lastLinkDropped goes by the count it read), and the chunks from being deleted under the name about to come. Counted only when it arrived, the new name was stored with chunks that were gone: 104 of 300 rounds of a mount linking a file while another deletes it. - A write of a name the store refused had counted the name already, and sent again counted it once more. The filer now keeps its count of the names in a key of its own next to the record (linkNames), written once the name is stored, and the record gets whichever is higher: the count the client sent or the names counted. It is never lower than what the client alone would have left, and never lower than the names the file has. A record from before has its count recorded as the names when it is first written again. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> * mount: send a refused first link again with the file's inline content The second attempt builds the new name's create from the entry as the filer has it by now: attributes, chunks and extended attributes. A file the filer keeps inside its entry has its bytes in Content, and the create is what the filer writes the link's shared record from, so without them the record lost the file's content. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> * filer: store a path-specific name before the record's lock is let go A second create of the same new name on this filer took the lock between the first one's count and its name write, missed the name, and counted it again: the file's record and chunks then outlived its last name. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: keep a link's names key out of the keys of a directory's entries The key began with the link's random id. One that began as the root's entry keys do in a store keyed by path put the names' 4 bytes in the root's listing, and it failed to decode: listing / and the etcd scan under fsck failed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: record a hard link's name before it is stored, and take it off if it is not The names counted for a hard link were recorded once the name was stored. On a store without transactions a failure of that write left the name stored and not counted, and the write sent again found the name there and did not count it either: the names recorded stayed one below the names stored, the side a file is deleted under a name from. They are recorded first now, inside the change of the record that counted them, and a name the store then does not take is counted off again (storeCountedName). A failure halfway leaves them one above the names stored, and the file leaked. A name in a path-specific store is recorded with the record as well, and counted off in a change of its own. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> * filer: keep a hard link's name counted when a failed write stored it A write whose deadline passes after the store took the name returns an error, and counting the name off then left the names one below the names stored. A later write with the count from before the link lowered the record to them, and the file was deleted under a name it still had. Read the name back first, and keep it counted where that cannot be told. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mount: carry the stored RemoteEntry into the name a retried first link adds The retry rebuilds the new name from the entry the file has once another client linked it, but kept the RemoteEntry of the entry first read. 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> |
||
|
|
e13f36275b | filer: rename a directory that holds a hard link on SQL stores (#13001) | ||
|
|
432826f1b2 | filer: allocate the interval points of readResolvedChunks at once (#12995) | ||
|
|
37c0b2f162 |
webdav: store a real md5 for each uploaded chunk (#12988)
* webdav: store a real md5 for each uploaded chunk Chunks written through the shared gateway uploader had no md5, so the file ETag was built from empty digests: every overwrite of a multi-chunk file kept the same ETag (If-None-Match answered 304 for new content) and single-chunk files had no ETag at all. Ask the uploader for Content-MD5, as mount and filer.copy already do. * webdav: quote the ETag it serves DAV:getetag and the ETag header must be entity-tags. A bare digest never matches a client's quoted If-None-Match or If-Match in http.ServeContent, and single-chunk files now carry a digest instead of webdav's quoted fallback. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * webdav: serve no filer ETag built from chunks without digests Files written before chunks carried an md5 all hash to the md5 of empty digests plus their chunk count, so unrelated files with as many chunks share one tag and a conditional GET can answer 304 for changed content. Leave the tag to webdav's modtime and size fallback for those. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * webdav: answer a PUT with the ETag of the content it committed webdav.Handler stats the file before Close uploads the last chunk and updates the entry, so every PUT answered the empty created entry's tag and an If-Match with it failed against the stored file. Close now records the committed entry's tag on the PUT outcome and the response writer sends it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * webdav: serve no filer ETag for inline content without an md5 filer.ETag hashes only the chunk list, so every inline entry without Attributes.Md5 gets the empty-list tag. Fall back to webdav's own tag. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * webdav: upload the PUT test's chunk during Close Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * webdav: tag inline content without an md5 by its bytes The modtime+size ETag webdav derives matches two equal-size contents stored in one second, so a replace could answer 304. util.Md5 follows the cluster's digest, which fips140=only keeps off MD5. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * webdav: tag chunks stored without digests by their file ids The modtime+size ETag webdav derives matches two equal-size files stored in one second. A rewrite stores new chunks, so their file ids and placement tell contents apart. 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> |
||
|
|
a5e52b68f1 |
server, filer, s3: log downloads the client hung up on below error level (#12991)
* server: log a response the client hung up on below error level A client that closes a download early (a video player seeking, a browser cancel) fails the next response write with a broken pipe, a connection reset, or an HTTP/2 stream close, and ProcessRangeRequest logged each one as an ERROR. net/http cancels the request context once a write to the client fails, so a canceled context now logs at V(3); a failure under a live request still logs as an error. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: log a stream the client hung up on below error level The filer logged "failed to stream content" as an ERROR for every download a client closed early, next to ProcessRangeRequest's own line. It now goes through the same check, so only a failure under a live request reaches the error log. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3: log a GET the client hung up on below error level A client closing a download early made GetObject log two ERROR lines, from streamFromVolumeServers and from GetObjectHandler, and the SSE copy paths logged a third. The write fails with a broken pipe or connection reset rather than context.Canceled, so the canceled-stream check missed it. net/http cancels the request context once a write to the client fails, so streamCanceled also treats a canceled request as the client leaving. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: log a canceled chunk read below error level A ranged S3 GET reads through ChunkReadAt with the request context, so a client hanging up cancels the chunk fetch and the reader logged "fetching chunk ...: context canceled" (and, when the lookup was the step canceled, "operation LookupFileId ... failed") as an ERROR. A read whose caller canceled it now logs at V(3). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
9ffb5fe185 |
filer, s3, filer.sync: one digest per cluster, set by the filer's -digest and followed by its clients (#12913)
* util, filer: choose the digest at filer startup with -digest
NewMd5 and NewSha1 returned SHA-256 cut to size whenever the process ran
under GODEBUG=fips140=only, so the kind of digest a cluster stores followed
each process's own environment. They now follow a digest mode set once at
startup: util.SetDigest("md5"|"sha256"), or "" to keep following
fips140.Enforced(). The default is unchanged.
weed filer -digest, weed server -filer.digest and weed mini -filer.digest
set it; fips140=only refuses md5 at startup. The leveldb2/leveldb3
directory-key marker follows the mode, as do the places that compare a
NewMd5 digest with Content-MD5 or pass it on as one: S3 PutObject, filer
HTTP uploads, the Content-MD5 the filer returns, and the uploader's
Content-MD5 to volume servers. Places that verify Content-MD5 with a real
MD5 (volume servers, S3 request bodies and archive uploads) keep keying on
fips140.Enforced(), since they can check it whenever MD5 is available.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* filer, command: report the filer's digest and make its clients use it
GetFilerConfigurationResponse carries the filer's digest mode in a new
field 16, digest. weed s3, mount, webdav, sftp, iam and filer.copy adopt
it before they serve or write, so a gateway started with a different
GODEBUG writes the same kind of ETag and chunk digest as the rest of the
cluster. A process under fips140=only refuses a filer that reports md5. A
filer that reports no digest predates the field; the client then keeps
its own mode and logs a warning.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* filer.sync, s3 sink: keep digests within one kind
filer.sync copies entry digests and ETags as they are, so syncing a filer
with digest sha256 into one with md5 left SHA-256 ETags in the md5
cluster. It now reads both filers' digests and refuses to start when they
differ, with a warning when either filer does not report one.
The S3 sink sent the entry digest as Content-MD5 unless its own process
ran under fips140=only. From a sha256 source into a target that checks
Content-MD5 every single-part upload failed with BadDigest and the backup
retried it forever. It now asks the source filer for its digest once and
forwards the entry digest only when that is md5.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* filer.meta.backup, filer.backup, filer.replicate: keep digests within one kind
filer.meta.backup opened its backup store in its own digest mode, so a copy
of a sha256 filer made by a process outside fips140=only got MD5 directory
keys and could not be opened as that filer's store. It now adopts the source
filer's digest before the store opens.
filer.backup and filer.replicate with a filer sink copied entry digests into
the target filer without comparing digests, as filer.sync did before. Both
now refuse, and exit, when the source and target filers report different
digests. replication.CheckDigestsMatch is the shared check; filer.sync uses
it too.
weed server and weed mini apply -filer.digest before they start the master
and volume server, so every part of the process hashes with one digest.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* filer, filer.sync: refuse a peer filer with another digest; exit on mismatch
Filers peering through the meta aggregator now compare digests. A peer with
a store of its own would replay entries holding the other kind of digest
into this filer's store, so its changes are refused and the reason logged
on every reconnect. A fresh filer bootstrapping from such a peer refuses the
copy, so a new filer whose digest differs from the existing filers' exits at
startup. A peer on the same store writes into it directly, and refusing its
stream would only starve this filer's subscribers, so that mismatch is
logged as an error and the stream kept.
filer.sync exits with status 1 when the two filers use different digests,
as filer.backup and filer.replicate do: it is a configuration error a
restart cannot fix.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* filer: -digest help says a store keeps the digest it was created with
The help text said existing data keeps the digest it was written with,
which reads as if the flag could be changed on a store with data. Stores
that hash keys stop finding existing entries under another digest, so the
text now says to set it when the store is created, and that switching means
copying the metadata into a new store with fs.meta.save and fs.meta.load.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* filer, s3, replication, admin, iceberg: address review of the digest checks
- A filer checks its peers' digests on every start, not only at the fresh-store
bootstrap: the store signature is written when the store opens, so a fresh
filer refused at bootstrap restarted as an initialized store and served
without its peers' files.
- Under digest sha256 with MD5 available (not fips140=only), a client's
Content-MD5 is checked against a separate real MD5 of the body, in S3 object,
part and directory-marker uploads and in filer HTTP uploads. It goes
unchecked only when no MD5 can be computed.
- filer.backup and filer.replicate exit only on a DigestMismatchError; a filer
that cannot be reached is retried, so a backup started before its target is
up resumes once the target answers.
- The admin file browser and Iceberg compaction write chunks into a filer they
do not follow at process level. They read that filer's digest and pass it to
the chunk upload (ChunkedUploadOption.Digest), so their content and chunk
digests match the filer's.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* filer, s3 sink: retire digest-refused peers; no Content-MD5 for an unknown digest
- A peer refused for its digest counts as unreachable: the check now runs
before notePeerReachable and its error wraps errPeerUnreachable, so the
subscribe loop retires the peer from the low watermarks after the usual
grace instead of keeping its zero watermark, which held every aggregated
subscriber at the settled horizon.
- When the source filer's digest cannot be read, the S3 sink no longer sends
the entry digest as Content-MD5: it may be a SHA-256 digest the target
would reject.
- TestCheckPeerDigest skips the cases that need MD5 locally under
GODEBUG=fips140=only.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* iceberg, util: tests for the per-filer digest
The Iceberg tests' fake filer serves GetFilerConfiguration, which uploads now
call to read the target filer's digest; it reports none, as a filer that
predates the setting does. TestNewContentMd5 computes a real MD5, so it skips
under GODEBUG=fips140=only.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* filer: bound each startup peer digest read with a timeout
CheckPeerDigests read each peer's configuration with the caller's context,
which at startup has no deadline, so a peer that accepted the connection but
never answered held the filer's startup. Each read now has its own
peerDigestReadTimeout (10s, inside the one-minute announce cap), after which
the peer is logged and skipped like an unreachable one.
setDigestForTest restores the previous digest setting instead of the default.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* util, s3, filer: one-shot digests for data held in memory
Md5For hashes with md5.Sum or sha256.Sum256 instead of writing into a
hash.Hash, and the Content-MD5 checks of S3 directory markers and of filer
uploads saved inside the filer use BodyMd5Of on the bytes they already hold.
Streaming uploads keep their io.TeeReader.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* filer: hash Content-MD5 on the upload's digest hash, not on its body
teeContentMd5 wrapped the request body in a TeeReader before
uploadRequestToChunks. CodeQL's go/reflected-xss query follows the body
from r.Body through the chunk upload to upload_content.go's
w.Write(prepared.data), which it resolves to the response-writer
wrappers in s3vectors, s3tables, webdav and server/common.go. Those
flows exist on master from other sources (extract, tagging, the
multipart POST); the wrapped body put them through lines this PR
changed, so CodeQL reported six of them as new.
newUploadHash now builds the digest hash that uploadReaderToChunks and
the inline-append paths already tee the body into, and adds the
separate MD5 there; uploadBodyMd5 reads it back for the check. The body
reaches uploadRequestToChunks as on master. Behaviour is unchanged:
under digest sha256 with MD5 available, Content-MD5 is checked against
the body's MD5, including empty and inline appends.
Checked with CodeQL 2.27.6 (go-queries 1.6.16, ReflectedXss.ql) on this
tree: no flow of the nine reflected-XSS results passes a changed line.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* replication: keep the ReadFilerSignature name and return the digest with it
Renaming it to ReadFilerSignatureAndDigest left its other callers with an
undefined function. Keep the name and add the digest to what it returns.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* util: keep HashToInt32 off the digest mode
HashToInt32 names things that processes derive on their own, such as a
mount's local socket path and MQ partition key hashes. weed mount adopts
a -digest=sha256 filer's digest before it names its socket, while
weed shell mount.configure keeps md5 and dialed a different socket.
Follow GODEBUG only, as before the digest setting.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* filer.meta.backup: wait for the source filer's digest instead of exiting
A backup with a saved offset used to start its stream loop and retry
until the source filer answered. Reading the digest first made it exit
when started before the filer. Retry the read; exit only when the
digest is refused.
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>
|
||
|
|
79ddcb49e6 |
filer: send a delete that misses locally to the write owner (#12967)
* filer: record which peers share this filer's store Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: send a delete that misses locally to the write owner Exclusive and conditional creates are stored on the path's write owner. With separate filer stores, a delete sent to another filer before it has replayed the create found nothing, reported success, and left the entry on the owner, from where it replicated back. Such a delete now goes to the owner, unless the owner runs on this filer's store. A forwarded delete is applied only by the filer its own ring names as the owner. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3api: delete a directory marker on its write owner The marker is read on the key's write owner, but the delete went through the connected filer. When the marker still has children, the filer refuses the delete and the marker is demoted by a lookup and an update on that same client. A connected filer that has not caught up with the owner misses the marker there and reports success, so the owner keeps listing the key. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3api: also delete a directory marker on its prior owner While a ring change is in its cooling-off window, the routed read can find the marker on the key's prior owner before it reaches the new one. The delete went only to the new owner, so a nonempty marker was demoted on a filer that did not have it, and the prior owner kept listing the key. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3api: check a directory marker on the prior owner before deleting it there The prior owner's delete ran unchecked and through the failover walk. When the new owner held an empty marker and the prior owner already held the object without the slash, the delete removed that object's data. And when the prior owner could not be reached, another filer reported the delete done while the marker stayed on the prior owner. The prior owner's entry is now read on that filer and judged like the routed one before anything is deleted, and its delete runs on that filer only. A prior owner that cannot be read fails the delete for the client to retry, which lasts at most the ring's cooling-off window. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3api: probe a marker's prior owner when its write owner misses A miss on the write owner returned success before the prior owner was checked, so an unreachable prior owner that still held the marker left it in place behind a reported delete. The miss now falls through to the prior-owner probe, which fails the delete when that filer cannot be read. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3api: check the entry a marker delete removes on the filer it runs on The read that decides the delete can be answered by another filer than the delete: the owner write walk fails over when the owner's channel does not come up. Each delete now reads its filer's own entry first and leaves an entry holding uploaded data alone, as the routed read already does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3api: send no marker delete to a filer that misses the marker A filer that misses passes the delete on to the key's write owner, which applies it without the marker checks and may hold uploaded data under the key. The delete now runs only where the entry was checked; a miss on an entry the read found fails the delete for the client to retry. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3api: leave the object without the slash alone when deleting its marker A marker delete removed the entry unless it carried chunks or remote data, so the object "dir" stored inline, or empty and known only by its promotion mark, went with a delete of "dir/". A plain file or a prefix object holds the key without the slash, as reads already treat it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
64cc7f5142 |
filer: break two reader cache budget deadlocks that wedge mount reads (#12950)
* filer: free a closed file's chunks for a download waiting on the budget A weed mount stopped answering reads for three days. Its goroutine dump: 351 downloads waited in ReaderCacheBudget.reserve, all 31 releases sat in SingleChunkCacher.destroy waiting for one of them, all 100 reads waited for one of them as well, and a few goroutines spun in reserve's eviction loop. The stuck reads filled the 128 FUSE background slots, so every read of the mount blocked. Closing a file runs ReaderCache.destroy, which takes the file's chunks out of the map and then destroys them one at a time. When it reaches a download waiting for budget first, it waits for that download, and the budget the download needs can be held by the file's other chunks, which are out of the map as well: - Eviction skips a finished chunk that is out of the map. removeUnpinned refuses it, so reserve puts it back on the idle list and retries at once. When a stream is positioned in it, remove() does nothing, so reserve only takes it off the idle list. - A download that fails is never evictable, and a download destroy() cancels fails too. remove() does nothing for one that is out of the map, so its reservation stays until destroy() reaches it. Since #12616, destroy() cancels the waiting download when nothing reads it. It does not when a stream is positioned in the download because the read that started it gave up, for example because its process was killed: closing a ChunkGroup does not release the streams. Eviction now destroys a chunk that is out of its file's map instead of skipping it. Whoever took it out destroys it too, and destroy() is safe to run twice. A download that fails gives its reservation back at once, also when it is out of the map. TestReaderCacheDestroyWhileDownloadWaitsForBudget closes a file while one of its downloads waits for budget, 30 rounds per case. When the waiting download is a prefetch nobody read, the test passes on master. When a stream is positioned in it, it hangs on master, both when the downloads holding the budget are prefetches the close cancels (the release fixes this) and when streams are positioned in them too (the eviction fixes this). TestReaderCacheBudgetStress runs reads (some given up midway), prefetches, failing downloads and close/reopen on four files that share a budget of four chunks; it hangs in 10 of 10 -race runs on master. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: do not wait for a dropped download while holding another chunk A read registers on its new chunk and only then drops the chunk its stream left (unpin, removeConsumed). When that chunk's download had not finished, removeConsumed cancelled it and then waited for it in destroy(), still holding the new chunk. The download could be evicting that very chunk for budget: reserve falls back to a chunk a stream is positioned in, and destroying it waits for its reads, this one included. Neither went on. A dropped chunk whose download has ended is still destroyed at once. One still downloading, cancelled when it was dropped, is destroyed by a goroutine once the download gives up, so the read goes on. TestReaderCacheBudgetStreamsStress moves eight streams between four chunks under a budget of two and gives up a third of the reads midway. In 20 -race runs it hangs 4 times on master and 8 times with only the previous commit, in this cycle; with this change it does not hang. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
fe816eaac8 |
mount, filer: stamp merged and manifest chunks instead of leaving them at 0 (#12962)
* filer: stamp a manifest chunk with the newest chunk it folds mergeIntoManifest saved the manifest with tsNs 0, so manifest chunks carried no modification time. Give it the newest ModifiedTsNs of the chunks it holds. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mount: stamp merged chunks with the newest chunk they replace maybeMergeChunks uploaded the rewritten chunks with tsNs 0, so any older chunk that overlaps them later, like a covered chunk sent with the commit, outranked the merge. Give them the newest ModifiedTsNs of the chunks they replace. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mount: stamp a merged chunk with the oldest data it holds The newest stamp of the whole merge outranked a peer's pending write that is newer than the bytes the merge carries for its range but older than the newest of them. Stamp each merged chunk with the oldest visible data in its range, or 0 over a hole, so such a write still shows while chunks older than all of its data lose to it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mount: find a merged chunk's range by binary search Each uploaded chunk scanned the visible intervals from the front. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
928c744977 |
filer: ask the master for log chunks the volume map lacks (#12937)
* filer: ask the master for log chunks the volume map lacks loadLogFileEntries reads the log chunks that SubscribeMetadata and SubscribeLocalMetadata replay from the persisted log, and it looked each chunk's volume up only in the filer's cached volume map. A volume missing there fails with "volume N not found", which isChunkNotFoundError takes for a deleted volume, so the replay skips the rest of the log file. Once the same pass reads a later entry from a file whose volume the map does hold, for any path, the subscriber's position moves past the skipped file, and filer.sync, filer.backup, filer.meta.tail or an S3 gateway never receive its events. A live volume is missing from the map in two cases: - A starting filer serves subscriptions once its gRPC port is up, but gets its volume map only when it registers with the master, and AnnounceOnceCaughtUp holds that until the peers found at startup have caught up (at most a minute). Until then the map holds only volumes the filer has looked up through the master for other reads. - A failed chunk read sets the volume's cached locations aside and looks the volume up again, which a cache-only lookup answers with "not found", as #11964 found for NewChunkStreamReaderFromFiler. Use GetLookupFileIdFunction, which asks the master on a miss, like the streaming reader since #11964 and the replay's other lookups. Asking the master adds one more way to fail: no answer, when the master cannot be reached before the client's retries run out. That error still reads "volume N not found", since no locations are known, but it says nothing about the volume, and skipping would lose the file's events for good. wdclient now marks it with ErrLookupUnanswered, and isChunkNotFoundError does not count a marked error as not found: the replay returns it, and the subscriber resumes from there once the master answers. A volume the master says does not exist is still skipped. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: trim the replay lookup comments 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> |
||
|
|
dbbf2907a6 |
webdav: refuse to delete, move or overwrite entries under Object Lock or WORM (#12959)
* webdav: refuse to delete entries under Object Lock or WORM DELETE removed versions under legal hold or retention and WORM files that the S3 API and the filer HTTP API refuse to delete. Check the entry, and for a collection everything below it, then pin the delete to the Object Lock state that was checked. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * webdav: refuse to move entries under Object Lock or WORM MOVE could rename a locked version or WORM file away, move a directory holding them, or replace a protected target. Check the source, a source directory's contents and the target before the rename. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * webdav: refuse to overwrite entries under Object Lock or WORM PUT and COPY replaced a locked or WORM file with a fresh entry, dropping its content and its lock. Check an existing file before creating over it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * webdav: pin an upload's final update to the Object Lock state it read An upload writes the whole entry back when it closes. A hold or retention set on the new object while the upload was buffering would be dropped, so the filer now refuses the update if that state changed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * webdav: recheck an upload's target when it commits instead of pinning it The precondition on the final update sent it to the path's write owner, while the placeholder create stayed on the connected filer. With separate filer stores the owner could miss the placeholder and refuse the update, leaving an empty file. The upload now rechecks the target right before the update, as the SFTP upload does, and the update stays local. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: share the WORM retention and subtree checks FilerConf.WormEnforced and IntersectsWorm replace the copies in the filer server and mount; ReadFilerConfFromClient reads filer.conf over a filer client. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * sftp, webdav: use the shared Object Lock and WORM helpers Both servers now call FilerConf.WormEnforced, IntersectsWorm, ReadFilerConfFromClient and s3_objectlock.ObjectLockState instead of keeping their own copies. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
493348e759 |
filer: retry a chunk delete that a replica in maintenance mode refused (#12935)
* filer: retry a chunk delete that a replica in maintenance mode refused
The filer sends BatchDelete to every replica on its own, and BatchDelete does
not replicate. A volume server in maintenance mode refuses it with "volume
server X is in maintenance mode", which the deletion pipeline took for a
permanent error, so the delete was dropped while the other replicas had
already applied it. That replica then kept the needle live for good, which
breaks EC encode ("no union") until volume.check.disk -syncDeleted repairs it.
Maintenance mode is what a rolling upgrade puts each volume server into, so
every filer delete in that window was lost on one replica.
Treat the maintenance-mode refusal as retryable. The retry runs after the
server leaves maintenance mode; the replicas that already deleted the needle
answer it as not modified.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* seaweed-volume: refuse in maintenance mode with Unknown, as the Go server does
The Go server refuses with a plain error, which arrives as Unknown. The
Rust server sent Unavailable with no details, which Go clients take for
a dead channel: each refused BatchDelete closed the filer's shared
connection to the server and cancelled the other RPCs on it. The message
is unchanged, so the filer still retries the refused delete.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* ec: stop describing a Rust maintenance refusal as Unavailable
Both volume servers now refuse in maintenance mode with Unknown, so the
orphan sweep's Ping disambiguation comments no longer name Rust.
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>
|
||
|
|
975d79d57f |
filer: keep chunk coverage when timestamps tie in readResolvedChunks (#12940)
* filer: keep chunk coverage when timestamps tie in readResolvedChunks When an overlapping chunk started with the same ModifiedTsNs as the currently visible one, it was never inserted into the sweep queue, and an END point removed whichever queued chunk had a matching ts rather than the chunk that actually ended. Either way part of the file was dropped from the visible intervals, and SeparateGarbageChunks could then treat the still-live chunk as garbage. Insert tied starts ahead of the existing tail so the visible chunk keeps winning, and remove the queued entry for the chunk that is ending. Fixes #12934 * filer: break readResolvedChunks timestamp ties by chunk order On a tie the sweep let the chunk that started first keep the overlap, while MergeIntoVisibles, which a section uses when a chunk is added after its first read, lets the later chunk win. A later write that got the same timestamp lost its overlap, and the two paths disagreed on which chunk's bytes a read returns and which chunk is garbage. Ties now go to the later chunk in the list, which also makes the order total. 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> |
||
|
|
89d5192831 |
filer: guard entry updates against rename/delete races (TiKV, FoundationDB) (#12918)
* filer: run an entry update again when a rename or delete of it commits meanwhile
UpdateEntry reads the entry, checks its preconditions against it, then
writes. The path lock keeps the two together only against writers of that
path on that filer. A rename or a delete sent to another filer does not
take it, and on any filer a rename or recursive delete of a directory above
the entry moves and removes what is below it unlocked. One that committed
between the read and the write had the write store the entry again at the
path it had left, and the update returned success: the entry back under a
directory that is gone, two names sharing chunks, or a file back after its
unlink returned.
Where the store refuses a conflicting commit, the read, the checks and the
write now run in one store transaction. The rename or delete wrote the
entry's key after it began, so the commit is refused with
ErrTransactionConflict and the update runs again, up to five times with
the rename's back-off, and answers from what is there now.
- filer.ConflictRefusingStore is how a store says so. TiKV does. Other
stores, and entries in a path-specific store, run once without a
transaction, as before.
- A refused run gives up its commit stamp and deletes the manifest chunks
it folded the request's chunks into.
- Chunk deletion and the metadata event come after the commit, in the
order they had.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
* filer: commit what an update's lookup removed, give up a failed run's manifests
From the review of
|
||
|
|
9a98047e2a |
util/http: hedge a chunk read whose location goes quiet (#12917)
* util/http: hedge a chunk read whose location goes quiet A chunk read tried its locations one at a time and read each answer to the end. A response that stops arriving holds the read for as long as TCP takes to recover: on a lossy path a lost segment costs at least the 200 ms retransmission timeout, doubled for every further loss, and nothing gives up on the connection meanwhile. A sequential reader waits for its chunks in order, so one stalled chunk stops it, although a replica could send the chunk in milliseconds. A location that never answers holds the read for the transport's response header timeout. In production this showed up as 13 GB checkpoint verifications, read back serially with O_DIRECT through weed mount, crawling at 25-65 MB/s instead of 300 MB/s and more, while the hosts of the volume servers saw 2-5% TCP retransmissions. The volume servers' own GET latency stayed at a few milliseconds: the stall is on the wire, after the handler has written the chunk into the socket buffer. hedgedChunkPass keeps the order and the move-on-at-failure of the old loops. In addition, once every request in flight has been quiet for longer than it may be, the read is asked of the next location as well, or, once every location has been asked, again over a new connection of a location whose server answered. A request may be quiet for 200 ms before its response headers, while the server may still be reading the needle from a busy disk, and for 100 ms in the body, which a healthy server sends without pauses: half the minimum retransmission timeout, ahead of every wait for a retransmission, while shorter pauses that recover on their own go by. The first complete answer wins, and the other requests are cancelled. A read hedges at most twice. The first request reads straight into the caller's buffer, as before. Hedges read into pooled buffers, and a winning hedge is copied over only after the request writing the caller's buffer has ended, so the buffer has one writer at a time and is not written after the call returns. Hedging is budgeted: every read earns a tenth of a token, a hedge spends one, and at most ten are saved up, so hedges stay below about a tenth of the reads when the whole cluster is slow. A location that had sent no response headers when another one delivered the chunk is recorded as unreachable, which leaves it to the background probe of #12776 to put it first again, and counts as a failure for the location refresh. A body that stalled after its headers does neither. Measured with two volume servers whose outgoing links drop packets (netem, MTU 1500, 0.2 ms delay), reading a 1 GiB file of 2 MiB chunks through weed mount with dd iflag=direct bs=4M, before and after: bursty loss ~2.3% on both replicas 26-76 MB/s 162-193 MB/s random loss 3% on both replicas 106-119 MB/s 147-170 MB/s random loss 5% on one replica only 71-81 MB/s 157-158 MB/s no loss no change, 0-2 hedges per 512 reads Under loss 4-8% of the chunk reads were hedged. A 50 ms body limit did better on random loss (179-220 MB/s with 3% on both) but worse and less steadily on bursty loss (108-206 MB/s), where it spent the hedge budget on pauses that recover by themselves. Callers: RetriedFetchChunkData on the streaming and the direct path, which weed mount, the S3 gateway and the WebDAV server read chunks through. Readers that stream a chunk to a writer as it arrives are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * util/http: account hedge buffers, go past a throttled hedge, cap hedges per read Three review findings: - A hedge reads into a buffer of its own, which weed mount's reader cache budget did not see, so stalled downloads could hold twice the configured memory. The reader cache now passes its budget in the context (WithScratchBudget), and a hedge first takes room for its buffer with ReaderCacheBudget.TryReserveScratch. Like a download, that evicts idle chunks no stream is positioned in, but it never waits and never evicts a pinned chunk or a download in flight: a hedge that does not fit is not sent. The room is returned when the buffer is freed, also for requests abandoned in the background. - A hedge answered with 429 ended the asking, so the read waited out the stalled request although a third location was idle. The download limit behind a 429 is local to that server, so a throttled hedge now moves on to the next location; the 429 is still returned when nothing else delivers. - Each retry pass earned a new budget share and started a new count of two hedges. Both now belong to the read (readHedges) and carry over its passes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * util/http: note an error's headers as an answer, take a hedge token before room Second round of review findings: - A location that sent the headers of an error response (a 500, say) and then stalled its body was still taken for one that had not answered while StatusError waited for that body. Had another location delivered the chunk meanwhile, it was recorded as unreachable and the location list refreshed. The response headers are now noted as soon as Do returns, before the status is looked at. - A hedge took room for its buffer before its token, and room can evict cached chunks. With no token left the room was given back, but the chunks were gone. The token now comes first, and is given back when there is no room. - TestReaderCacheBudgetLendsScratchToHedges opens the gate of the download it holds in a defer, so a failed assertion cannot leave the cache's teardown waiting on it. TestChunkReadHedgeCapCoversRetries also checks that the read earned its budget share once. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * util/http: do not take a location asked again for unreachable A location whose response stalled is asked again over a new connection. When the first request then recovered and delivered the chunk, the new request had not answered yet, so the host that just served the chunk was recorded as unreachable and the location list refreshed. A location any request of the read heard from is no longer counted. 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> |
||
|
|
6adc9f0a21 |
mount: read chunks with filer-issued exact-file read tokens (#12800)
* mount: read chunks with filer-issued exact-file read tokens * mount: preserve read authorization across delayed lookups and hard links * mount: retain response tokens across read cache eviction * mount: keep a shared read-token lookup alive when its first caller is cancelled Token refreshes for one entry share a singleflight lookup that ran under the first caller's context. An interrupted read cancelled that lookup, so every other read of the entry waiting on it got no token, went out unauthenticated, and failed with EIO on a volume server enforcing read JWTs. Run the lookup detached from the caller (each attempt stays bounded by the filer RPC wait) and let a cancelled caller stop waiting at once. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: serve a cached chunk past the cache cutoff instead of fetching it The full-chunk read path consulted the chunk cache only for chunks below the cache size cutoff. Read-auth and peer-sharing mounts cache every chunk they upload, so a read-after-write of a high-offset chunk went to the volume, where a read-auth mount has no token before the entry is published. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mount: re-track read tokens when this mount renames an open file Writeback mounts skip their own rename event, so only the subscriber path re-tracked an open handle's chunks. After a local rename a token refresh looked up the vacated name and the read failed. The rename response, the subscriber rename and the surviving hard link now share ReadAuth.TrackHandle. 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> |
||
|
|
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> |
||
|
|
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> |
||
|
|
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> |
||
|
|
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
|
||
|
|
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> |
||
|
|
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> |
||
|
|
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> |
||
|
|
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> |
||
|
|
0de9a82dd9 |
filer: make the stub-backed remote storage tests re-runnable (#12852)
filer: drop cached remote clients when a test registers a stub maker The remote client cache is keyed by the configuration, so rerunning a stub-backed test (go test -count>1) got the previous run's stub from the cache and its counters never moved. Nineteen tests failed on a rerun. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
037c27582f |
redis2: let Redis hash the Lua scripts (no SHA-1 at package init) (#12848)
* redis2: let Redis hash the Lua scripts (no SHA-1 at package init) redis.NewScript computes the script's SHA-1 in Go when the package-level vars are initialized. redis2 is linked into every weed binary, so under GODEBUG=fips140=only every subcommand, including `weed version`, panics before main. NewScriptServerSHA leaves the digest to Redis (SCRIPT LOAD on first use) and keeps Run's EVALSHA-then-EVAL behaviour. weed/fips140_only_test.go runs the weed main package's test binary with fips140=only, so any package init that uses an unapproved algorithm fails `go test ./weed/...`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * redis2: run the Lua scripts by a pinned digest (no SCRIPT LOAD, no lock) NewScriptServerSHA gets the digest with SCRIPT LOAD inside ensureHash, which holds the Script's write lock across the round trip and does not remember a failed load. Where an ACL denies SCRIPT but allows EVAL, every call retried SCRIPT LOAD under that lock before falling back to EVAL. The two scripts are now constants next to their SHA-1 digests, and runScript sends EVALSHA and falls back to EVAL on NOSCRIPT, the same commands Script.Run sent on master. No SHA-1 is computed in Go, at init or at run time. TestScriptDigests checks each pinned digest against its source. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * redis2: hash the script digests in the test without FIPS enforcement TestScriptDigests panicked under GODEBUG=fips140=only, the mode this change is for, because sha1.Sum is not approved 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> |
||
|
|
2382f07788 |
filer: keep a hard-linked file's chunks when one of its names is replaced (#12812)
* filer: keep a hard-linked file's chunks when one of its names is replaced Replacing one name of a hard-linked file deleted the file's chunks while its other names still pointed at them. Reads through those names then return EIO once the volumes are vacuumed; until then they only work through readDeleted. Two everyday ways to get there through a mount: - conda links an environment's files to its package cache with hard links. Python saves a __pycache__/*.pyc by writing a temporary file and renaming it over the old name, so the cache's copy loses its data. - A training script saves model.pt, hard-links it into an epoch directory and saves the next epoch by renaming a new file over model.pt. Each archived epoch loses its data. Three write paths deleted the chunks of the entry they replaced without asking whether that entry was one of several hard links: - a rename over a file: moveSelfEntry drops the target's link, then queues all of the target's chunks for deletion; - CreateEntry over an existing path (an S3 PUT, for one): the update drops the old entry's link, then deleteChunksIfNotNew deletes its chunks, and the CreateEntry handler deletes chunks its own list covers; - UpdateEntry with an entry that no longer carries the old one's link. A plain delete already keeps the chunks while HardLinkCounter > 1, and a folder delete asks hardLinkIsOrphaned. The three paths now go through Filer.KeepHardLinkedChunks, which asks after the write, once the replaced name's link is gone: the chunks stay unless the file's shared record went with it, that is, unless the replaced name was the last link. Writing the file through one of its names (an entry with the same hard link id) still deletes the chunks the write replaced, since every name reads the new content. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: keep hard-linked chunks from the shared record, not the replaced row A lookup that cannot read the hard link record returns the name's own row, which can lag the file. Read the record when filtering the garbage, and keep everything when it cannot be read. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: test the manifest reads behind KeepHardLinkedChunks The manifest resolution moves into withoutChunksOf, which takes the lookup function, so tests can serve manifests. Chunks behind nested manifests and the manifests themselves stay, unrelated garbage is still deleted, and an unreadable manifest returns an error, on which KeepHardLinkedChunks deletes nothing. Behavior is unchanged. 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> |
||
|
|
ac7d949c61 |
filer: keep a manifest needle until its data chunks are queued for deletion (#12810)
* filer: resolve deleted manifests through the master on a volume cache miss Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: keep a manifest needle until its sub-chunks are queued for deletion When a manifest could not be read during chunk deletion, the manifest needle was deleted anyway and the data chunks it listed were orphaned. Retry the resolve with the deletion retry backoff and delete the manifest alone only after MaxRetryAttempts. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: keep a durable delete that joins a pending manifest retry Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: bound each manifest retry read with a deadline Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: requeue resolved manifest ids on an fsync upgrade instead of rereading A durable delete that joins a manifest retry in flight used to resolve the manifest a second time, but the first pass had already queued the manifest needle, so the reread could fail and the sub-chunks never got the durable mark. Resolve nested manifests up front and queue the same ids again with fsync. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: bound each manifest retry pass and stop it on shutdown A pass takes ready manifests one at a time and stops after manifestRetryTimeout, leaving the rest queued for the next tick, so a run of stalled reads cannot keep the shared retry loop from ordinary deletion retries or from noticing shutdown. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
261c534c19 |
filer: retry TiKV store writes on a write conflict (#12798)
* filer: retry TiKV store writes on a write conflict TiKV transactions are optimistic. A commit fails with a write conflict when another transaction committed one of its keys after it began, even for a blind Set or Delete. Outside a filer transaction the TiKV store runs each save and delete in a transaction of its own and returned that error to the caller, so of two requests writing the same entry at the same moment one failed, and a mount reported EIO. A write the store commits itself (InsertEntry, UpdateEntry, DeleteEntry, one batch of DeleteFolderChildren, KvPut, KvDelete) now runs again in a new transaction after a write conflict, up to 5 times, waiting 1-2ms, 2-4ms, ... 16-32ms in between. The failed transaction stored nothing, and the retry lands after the other writer, as if the two had not overlapped. The retries stop when the context is done. A write inside a transaction from BeginTransaction is not retried: the conflict is reported when the caller commits, as before. deleteBatch now goes through RunInTxn like the other writes. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> * filer: stop TiKV write retries once the context is done When the context was cancelled while the retry wait was running, the timer case could still win the select and start one more transaction. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: keep a TiKV entry that is no longer expired when listing deletes it The listing decides an entry has expired from its own read, and the delete ran later as a blind delete. Once the delete retries after a write conflict, a live replacement committed in between was removed. Read the entry again in the deleting transaction and delete it only if it is still expired. 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> |
||
|
|
c9f3a02b94 |
filer: recover a leveldb store whose table a power loss damaged (#12780)
* filer: recover leveldb without rebuilding broken tables leveldb.Recover rebuilds a table with damaged blocks using the user comparer and filter on internal keys. The shortened index keys it writes are not valid internal keys, so a Get on the rebuilt table panics, and the bloom filter it writes misses every lookup. Recover with a comparer that keeps full index keys (same name, so the manifest still matches) and no filter. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: recover a leveldb store when a compaction finds a corrupted table When a compaction reads a damaged table block, as a power loss can leave one, goleveldb latches the corruption error and returns it for every later write until the database is reopened. A plain reopen loads the same table and the next compaction fails again, so the store kept rejecting inserts even across restarts. Treat a corruption error from a write like a storage error, and reopen through leveldb.Recover, which rebuilds the table without the damaged blocks, then retry the write. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: rebuild damaged leveldb tables before Recover leveldb.Recover's own table rebuild orders internal keys with the user comparer, so a damaged table holding several versions of one key fails with "keys are not in increasing order" and the recovery gives up. Overriding the comparer cannot fix that, because the same comparer also serves the recovered database's user keys. Rebuild every table that has corrupted blocks first, using an internal key comparer and full index keys, then let Recover rebuild the manifest from tables it no longer needs to rewrite. Seed the test tables from a journal flush so they keep several versions of a key, and check keys the write test does not rewrite. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: leave unreadable leveldb tables for Recover to drop table.NewReader reports a truncated table or a damaged footer through the reader, not its error, so rebuildDamagedTables never stopped on one, but it rewrote it as an empty table first. Skip tables with nothing readable and let Recover drop them, and test an unreadable table next to a healthy one. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: let StrictRecovery drop damaged leveldb tables With StrictRecovery set, leveldb.Recover drops a table that has corrupted blocks. Salvaging the readable blocks first would hide the damage from it, so skip the rebuild under that option. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: hold the leveldb storage lock while rebuilding tables The table rebuild ran after the failed open released the storage lock and before Recover took it, so it could rewrite the tables of a database another caller had open on the same storage. Take the lock for the rebuild; Recover takes it again afterwards. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
ed7324611c |
filer: metrics for metadata subscription delivery (lag, holds, ring fall-offs, claim and watermark ages) (#12773)
* filer: metrics for metadata subscription delivery (lag, holds, ring fall-offs, claim and watermark ages) * filer: measure subscribe delivery lag after the real send using the mutation stamp, and record a watermark hold once per hold * filer: skip empty progress markers when sampling subscribe delivery lag * filer: assert subscribe delivery lag is sampled only after the stream send succeeds * grafana: panels for the metadata subscription delivery metrics Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: record a watermark hold when the read passes the held entry, not when the next hold starts * filer: use a monotonic clock for the subscribe hold duration --------- Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
c1c95e127f |
filer: scoped read-only tokens for metadata subscriptions (#12767)
* security: scoped read-only token for filer metadata subscriptions A token signed with jwt.filer_signing.subscribe.key names the subscribe methods and the path prefixes its holder may see. mTLS peers and admin tokens stay unrestricted. Internal subscribers attach an admin token when both keys are configured. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: enforce subscription token scope on metadata streams With jwt.filer_signing.subscribe.key set, SubscribeMetadata and SubscribeLocalMetadata authorize the caller first. A scoped caller gets a stream that sends only events whose paths are all under its prefixes, filters batches, and never carries log file refs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: send an admin token on internal metadata subscriptions Peer filers, metadata followers and the lifecycle reader attach an admin token when the subscribe key is configured, so they keep the full stream without mTLS. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * shell: add fs.meta.token to mint metadata subscription tokens Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: end scoped metadata subscriptions at token expiry The scope now carries the token's exp. The scoped stream's context ends at that time and the call returns Unauthenticated, so an open stream no longer outlives its token. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer.sync: sign metadata subscriptions with the source cluster's key MetadataFollowOption takes a FilerJwtProvider; filer.sync passes the one loaded from -a.security or -b.security, so clusters with different admin keys both accept the subscription. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * shell: report fs.meta.token flag errors Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: give scoped metadata subscribers their own client id A scoped caller could reuse another subscriber's ClientId with a higher epoch and replace that registration, disconnecting it. Scoped streams now register under a server-chosen id that no other subscriber holds. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * security: accept only HS256 metadata subscription tokens Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * security: test HS384 metadata subscription token rejection Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: never let a scoped subscriber replace another registration The server-chosen id can be taken by another subscriber between choosing and registering it. Registering scoped streams with the lowest epoch makes addClient refuse them rather than replace the other registration. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: send position markers for events a scoped token withholds Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: test a scoped stream withholding a whole event batch Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: filter SendMsg on scoped metadata streams The scoped wrappers only overrode Send, so a SendMsg on the embedded stream would reach the client unfiltered. Route it through the same filter and refuse any other message type. Ported from #12790. Co-authored-by: mindaeon <30555587+mindaeon@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: test a scoped subscription through the real subscribe loop Run SubscribeLocalMetadata with a scoped token over a flushed backlog, the in-memory tail and live events: only in-scope events arrive, sibling, "..", encoded and cross-boundary rename paths are dropped, and no log file references are sent although the client asks for them. Without the subscribe key every event still arrives. Ported from #12790. Co-authored-by: mindaeon <30555587+mindaeon@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: test that the HTTP API refuses metadata subscription tokens GET, HEAD, PUT, POST and DELETE all refuse a subscription token, also when the subscribe key equals the read or write key. Ported from #12790. Co-authored-by: mindaeon <30555587+mindaeon@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: mindaeon <30555587+mindaeon@users.noreply.github.com> |
||
|
|
e012fca9a2 |
mount: keep lookups from stalling behind directory cache rebuilds (#12754)
* mount: release the meta cache lock between batches of a rebuild wipe deleteFolderChildrenForRebuild held mc's write lock while it listed every cached child of the directory and deleted them. Every metadata read in the mount (FindEntry, IsNameFresh, isOversized) takes the read lock, and a waiting writer blocks new readers, so while a large directory was wiped, lookups and getattrs in unrelated directories queued behind the scan. The scan gets slower as leveldb accumulates the deletion markers of earlier wipes of the same directory, which happens quickly once lookups rebuild expired directories. Wipe rebuildWipeBatchSize (1024) children per lock hold and drop the lock between batches. A child is judged pinned under the same lock that deletes it, so a local-only create is kept whether it was pinned before the wipe started or between batches. The listing that refills the directory already ran outside the lock, so batching adds no interleaving the build did not allow. Add LevelDBStore.BatchDeleteEntries, the counterpart of BatchInsertEntries. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> * mount: bound how long a lookup waits on the directory rebuild it starts Since #11268 a lookup whose parent's cache expired rebuilds the parent and every expired ancestor up to the mount root before it answers, and every lookup beneath them joins the same builds. With a slow listing (a large directory, a busy filer, or the meta cache lock held by another rebuild) a plain stat, an ls -l, or the parent touch after mkdir waited for all of it. Wait at most lookupRebuildTimeout (2s), then fall back to one LookupEntry RPC. Since #12206 the shared build does not run on the requester's context, so it keeps going after the waiter gives up and later lookups find the directory cached. A timed-out wait records a rebuild attempt, so lookups during the cooldown do not queue on a build that is already known to be slow. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> * mount: wait for the rebuild's listing in TestLookupDoesNotWaitOutSlowRebuild The build runs on its own goroutine, so the lookup that stopped waiting for it can return before the build's ListEntries reaches the filer. The test read `started` without waiting right after the lookup returned, which relied on an ordering nothing guarantees, and the ListEntries count taken afterwards assumed the same. Wait for the listing to arrive, bounded by the test's deadline. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> * mount: keep children inserted while a rebuild wipe runs A deferred create inserts its placeholder before Create registers the handle that pins it. The single-lock wipe made such an insert wait until it finished, so the placeholder survived; a batch that runs in that gap judged it unpinned and dropped it, and the rebuilt listing then omitted the file until its flush. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mount: drop a cached path that an event vacates during a rebuild wipe A build replays only the events later than its listing's snapshot and leaves the earlier ones to the listing, which starts after the wipe. With the wipe in batches a file's whole life fits inside it: created, flushed, then unlinked or renamed away. Both events are earlier than the snapshot and are skipped, the listing has no such file, and the placeholder the wipe kept stays in the published directory until the next rebuild. While a directory's wipe runs, an event buffered for it now takes the path it vacates out of the store at once, fenced by versions like any other event. After the wipe the store holds what the listing put there, and a removal earlier than the snapshot may still arrive, so from then on the event is left to the replay as before. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> * mount: check which file a removal took away during a rebuild wipe Two things the removal applied during a rebuild wipe got wrong. A placeholder is unversioned, so the version gate lets every removal through. One that arrived late, for an earlier file of the same name, took out the placeholder of a file created since. The entry the event took away is now compared with the cached one, by inode or, with no inode to compare, by creation time. An event that only names the file cannot tell and is taken at its word. The entry was deleted without OP=MV, so taking one name of a hard-linked file out of the cache also took one off the count its other names share. A replayed event that vacates a path already deletes with OP=MV. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> * mount: keep a removal the rebuild wipe declined out of the replay The wipe declines a removal when what is cached there is newer than the event or is another file than the one it took away. The event stayed buffered anyway. An unversioned listing clears the children's version records and replays every buffered event, so the declined removal then deleted the entry the wipe kept and the directory was published without it. A declined removal now buffers only the name it puts in place, so a rename still lands on replay. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mount: check a declined removal again when the build replays it The previous commit dropped the removal half of an event the wipe declined, judged by the file cached when the event arrived. Earlier buffered events can replace that file during the replay: a listing attempt that failed leaves its events buffered, so the retry's wipe may see the first attempt's file while the replay puts a later one in place first. The dropped delete then left that later file published. The wipe now records which removals it declined, and the replay checks each against the entry it finds at that point, replaying only the name the event puts in place when that entry is still another file. A removal declined by version is replayed as before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mount: keep a declined removal's invalidation off the placeholder's handle After the replay the build invalidates every buffered event again, raised to the snapshot, and it still sent the original of a removal the replay rejected. A late delete of an earlier file then reached the handle of the placeholder at that name: the placeholder is unversioned, so the raised timestamp got past it and the handle was marked deleted. The replay's decision on a declined removal now replaces the event in the buffer, and the invalidations use what was replayed. It is made before the snapshot check, so a removal the listing covered is judged the same way. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mount: keep an event's signatures on the halves a rename is split into A declined removal replays as its rename's create half, and a rename across a building directory is split in two. Both dropped the event's filer signatures, so a handle stamped by that filer no longer fenced the replayed invalidation by timestamp and could take older listed contents over newer ones it had read. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mount: drain invalidations around the declined-removal build check Invalidations run on a background worker, so the baseline could miss the removal's own and the final read could run before the build's arrived. 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> |
||
|
|
3159b8408c |
filer, volume: fsync chunk deletes under an fsync path rule (#12759)
* volume: fsync a batch delete that asks for it BatchDeleteRequest gets an fsync field, and the Go and Rust volume servers pass it to the needle delete, which already orders the tombstone, .dat sync, publish and .idx sync for a durable delete. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * operation: pass an fsync flag to batch deletes DeleteFileIdsWithLookupVolumeId and DeleteFileIdsAtOneVolumeServer take an fsync argument and send it in the BatchDeleteRequest. Every caller passes false for now. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: fsync chunk deletes under an fsync path rule DeleteChunks passes the path rule's fsync flag to the deletion queue. The flag is kept with the pending record until the delete is confirmed, so retries and re-queues keep it, and the batch and retry loops send marked ids in a durable BatchDelete. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: keep fsync marks in the deletion ledger Marked ids go into the trailing parts of a manifest ledger, counted by fsyncParts. Older filers read those parts as plain ids and still delete them; a reload or a claimed foreign ledger restores the marks. A ledger without marks keeps the single array form. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: record a queued deletion before the delete loop can see it queueDeletions published the ids to the hot queue before taking the ledger lock, so a concurrent flush could delete an id before its fsync mark landed and then forget the mark with the record. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: fsync a folder delete's chunks by each child's path rule A recursive delete collected its file children's chunks and resolved the rule once for the folder, which misses a trailing-slash rule on the folder itself and file-prefix rules. Each file child's own rule now decides fsync; the folder rule still decides chunk deletion. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: keep a newer fsync request when a plain delete finishes An id re-queued with fsync while a plain delete of it was in flight lost its mark when that delete succeeded, so the queued copy also ran without fsync. A plain attempt now leaves a marked record for its queued copy; a durable delete of an already-deleted needle still syncs the tombstone. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: delete a folder's plain child chunks without fsync Children whose own rule turns fsync off were still deleted durably when the folder's rule asked for fsync. Only the children marked by their own rule now go out with fsync. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: retry a durable chunk delete the volume server failed A volume server rolls back a durable delete it cannot sync and answers with a 5xx carrying the I/O error text, which the classifier took as permanent, so the record and its fsync mark were dropped while the needle stayed live. A 5xx answer to a durable delete is now retryable, within the usual attempt limit. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
b64895ed0a |
filer: stop following a peer that stays unreachable (#12725)
* filer: stop following a peer that stays unreachable * filer: re-track an answering peer only while it is still followed A signature read that succeeds just before the master removes the peer called initPeerWatermark after the removal, clearing its mark. The loop then exits, so the watermark it re-tracked never advances or drops and pins aggregated readers at the settled horizon. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: forget a peer's unreachable clock when the master removes it Only a successful connection cleared the clock, so every departed address that once failed stayed in the map for the filer's lifetime, and a re-added peer inherited the old outage. The removal now drops it, and the clock is guarded by peerChansLock so the removed peer's exiting loop cannot start a new one. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: report the unreachable mark only when it is set Once peerResumeRetention forgets the mark of a peer that stays unreachable, markPeerWatermarkRemoved no longer marks it (its watermarks are gone), but notePeerUnreachable still saw no mark and logged "treating it as removed" on every retry. markPeerWatermarkRemoved now reports whether it set a new mark. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test: fix the unreachable-peer subscriber's start before the baseline write The subscriber goroutine picked its start time itself, so a baseline write that finished first fell before the subscription and the test failed after 20 seconds with correct delivery. 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> |
||
|
|
eb1dca8088 |
filer: release the stamps of parent directories a rename creates (#12711)
* filer: release the stamps of parent directories a rename creates * filer: test that a suppressed create keeps the moved entry's stamp in flight 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> |
||
|
|
95f46c8fff |
admin: manage filer webhook targets from the UI with live reload (#12690)
* webhook: share the default target settings Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * webhook: managed webhook targets with a drainable queue Targets kept as JSON (name, endpoint, token, filters, retry and worker settings) build their own queue; Close waits for queued and in-flight deliveries before stopping it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: run webhook targets stored in /etc/seaweedfs when notification.webhook.managed is set The targets in /etc/seaweedfs/notification_webhooks.json start with the filer and are rebuilt from the store whenever the file changes on any filer, alongside notification.toml. The previous queue drains before it stops. Events for the file itself, which holds bearer tokens, are not sent to notification queues. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * admin: manage filer webhook targets A Webhooks page under Management lists, adds, edits and deletes the targets kept in /etc/seaweedfs/notification_webhooks.json. Bearer tokens are write-only: the API reports whether one is set, and an empty token on edit keeps the stored one. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: keep the webhook queue when the stored targets did not change Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: keep a replaced webhook queue open until its senders hand over Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * admin: read chunk-backed webhook targets before editing them Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * shell: keep the stored webhook targets out of fs.meta.notify Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * webhook: reject negative managed target settings Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * webhook: no signal handler on queues that reloads replace Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: swap the webhook queue without waiting behind blocked senders The read lock held across SendMessage made a reload wait for any sender blocked on a saturated target, and the waiting writer stalled every other filer write with it, which is when an operator disables that target. Close now refuses new sends and waits for the senders already inside SendMessage, and a send that hits the closing queue retries on its replacement. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * webhook: release blocked test handlers before the server shuts down Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: always run the webhook targets managed in the admin UI Drop the notification.webhook.managed switch: every filer loads and live reloads the stored targets. Without stored targets no queue is created. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * scaffold: place the admin-managed webhook note above enabled Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * scaffold: separate the admin-managed webhook note Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * scaffold: note that admin-managed webhooks follow the notification queue Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: retry loading webhook targets after a failed read Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: retire the admin-managed webhook queue on shutdown Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
0f0f3811bf |
filer: serve caught-up aggregated subscribers from memory, not a held disk pass (#12674)
* filer: serve caught-up aggregated subscribers from memory, not a held disk pass An aggregated SubscribeMetadata stream that does not take metadata chunks (filer.sync, filer.backup, filer.meta.backup, filer.meta.tail, the filer.remote.* syncs, the S3 gateway's subscriptions, and mounts that predate chunk support) re-ran the persisted-log pass whenever its cursor moved: after every memory hold at the delivery watermark and on every 2 s re-probe. The pass holds at the peers' flush low-watermark. Peers flush on their own one-minute schedules, so on a cluster that keeps writing some peer has always flushed past a caught-up cursor while the slowest has not: the pass held at its first entry, the loop came back to it, and memory was never read. The stream got each change only once the slowest peer's flush covered it, in bursts up to a flush interval late, and every pass listed and re-read the newest log files. When the aggregated ring was already filling at the cursor and evicted nothing after it, memory holds everything the persisted logs could add, since every peer's log reaches the ring through the aggregator. Skip the pass and read memory, held at the delivery watermark as before. The skipped pass proves nothing past the cursor, and the next-day scan for an empty pass does not apply. An empty ring, a ring that starts past the cursor, and a cursor memory just refused still take the pass. Chunk subscribers already skip it for a caught-up cursor: their ref listing stops below the flush hold. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: keep a new peer's pre-start history on the disk pass The ring only receives a peer's events from the start of its subscription. A peer followed for the first time after this filer started (a filer added to the cluster, a restarted pod with a new address, or the late-arriving peers bootstrap) starts at its notice time, so what it logged before then is only in the persisted logs. A cursor below that start passed the ring check and skipped the disk pass, losing those events for subscribers that do not take metadata chunks. Record the newest start of a peer subscription that had no resume point and send cursors below it through the disk pass as before. Peers that rejoin with a resume point (a restart under the same address) do not move it. 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> |
||
|
|
8e15110b4f |
filer: wake metadata subscribers only for directories they can match (#12669)
* log_buffer: let a subscriber skip wake-ups for unwanted partition keys Every append woke every registered subscriber. SetSubscriberWakeFilter lets a reader sleep through appends whose partition key it would filter out; it still reads them on its next poll. Flushes and keyless appends wake everyone. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer_pb: decide subscription matches from an event's directories MetadataDirectoryMayMatchSubscription rules out events whose directory no child path of can match the subscription, and ScanMetadataEventDirectories reads an event's directory and new parent path without allocating. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: wake subscribers of a move's destination directory Appends are keyed by the source directory, so a filtered subscriber of the destination would otherwise only see the move on its next poll. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: wake metadata subscribers only for directories they can match Every metadata event woke and was scanned by every subscriber, so filer CPU grew with the number of subscribers watching other paths. Readers now register a directory wake filter, and the per-entry prefilter rules entries out from their directories before the skeleton scan. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: test that moves into a subscribed prefix pass the prefilter Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
b3a58506aa |
filer: report a SQL listing that fails partway through (#12654)
* filer: report a SQL listing that fails partway through ListDirectoryPrefixedEntries never checked rows.Err() after its rows.Next() loop. When the result set failed partway, for example on a lost connection, rows.Next() returned false and the listing returned the entries read so far with a nil error, so callers saw a shorter directory instead of an error. Check rows.Err() once the loop has run to the end, as the scan in abstract_sql_store_scan.go already does. A listing the callback stopped on purpose is left alone: rows.Err() would return a canceled request context's error there. This covers every store built on AbstractSqlStore (mysql, mysql2, postgres, postgres2, sqlite). Signed-off-by: anant <170962632+antcybersec@users.noreply.github.com> * filer: wait for the canceled SQL listing to release its rows in the test A fixed sleep let the callback return before database/sql closed the rows, so a listing that always consulted rows.Err could still pass. Wait, bounded, until the connection is back in the pool instead. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Signed-off-by: anant <170962632+antcybersec@users.noreply.github.com> Co-authored-by: anant <170962632+antcybersec@users.noreply.github.com> Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
0a38738076 |
filer: keep the listing snapshot below later and unfinished event stamps (#12642)
filer: take the listing snapshot as a claim below later and unfinished stamps A ListEntries snapshot tells the client that every event at or below it is already in the listing, so the mount drops those events from a directory build and fences them with the directory floor. The snapshot was a raw time.Now(), which an event stamp can tie on a coarse clock: on Windows a mkdir right after a listing of its parent was stamped with the snapshot's own timestamp, the mount took it as listed, and the new directory stayed missing from a parent marked cached. A create stamped before the snapshot but not yet in the store was dropped the same way. Take the snapshot through the same in-flight claim the idle heartbeat uses: it stays below every unfinished stamp, and every later stamp lands above it. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
d695d101b5 |
Fix/s3 abandoned chunk download (#12616)
* filer: cancel a chunk download that no reader waits for * filer: stop waiting for reader cache budget once cancelled * filer: keep a cancelled download's re-lookups off its context The refresh and retry lookups took the download's context. FilerClient coalesces concurrent lookups of a volume, so a cancelled download leading one failed the other readers waiting on it. Fetches still stop on cancel. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: test that cancelling a download leaves its re-lookup running Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: cancel unheld downloads when the reader cache is destroyed ReaderCache.destroy waited for every downloader, so closing a reader waited for a stalled prefetch nobody read. Downloads with no reader or stream on them are now cancelled first; ones still in use keep running. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: test that destroying the reader cache cancels an unread prefetch Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: cancel a destroyed download once its last holder leaves destroy skipped downloads a reader or stream still held, and once they were out of the map nothing cancelled them, so destroy waited for a fetch nobody used. removeConsumedLocked now cancels any consumable download, whether or not it is still in the map. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: test a destroyed download cancelled after its last stream leaves Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: release the stream only after destroy dropped the download Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: test a cancelled stream leaving a waiting reader's download running 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> |
||
|
|
5a54009439 |
filer/etcd: client keepalive and per-request deadlines (#12621)
* filer/etcd: client keepalive and per-request deadlines An etcd member that goes silent with its connections open (a dead or hung node, a network partition, a frozen process) keeps the store's requests balanced onto it waiting forever, because the client has no keepalive and the calls have no deadline. Writes through the filer stop although the other members keep quorum. keepalive_timeout (default 3s, "0s" turns keepalive off) enables gRPC keepalive with the ping interval fixed at gRPC's 10s minimum. gRPC also sets TCP_USER_TIMEOUT to it on Linux, so a connection whose sent data goes unacknowledged that long is closed by the kernel. request_timeout (default 3s) bounds every Get, Put and Delete unless the caller set a deadline; timeout keeps its meaning as the dial timeout. DeleteFolderChildren gets no request deadline: its DeleteRange grows with the directory, and keepalive still ends it if the member goes silent. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Update weed/filer/etcd/etcd_store.go Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com> * Update weed/filer/etcd/etcd_store_test.go Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com> * Update weed/command/scaffold/filer.toml Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com> * filer/etcd: no request deadline on entry writes A Put whose client deadline expires may still have been committed. The filer's upload handler treats the error as a failed write and deletes the uploaded chunks, which the saved entry may then point at. InsertEntry and UpdateEntry therefore keep the caller's context: etcd's own request timeout ends a Put a live member cannot commit, and keepalive ends one on a member that goes silent. Reads and deletes keep request_timeout; a timed-out store delete returns before the filer deletes any chunks. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer/etcd: no request deadline on KvPut The filer wrapper stores a hard-linked file's attributes and chunk list through KvPut. An HTTP append to a hard-linked file whose KvPut times out after etcd saved it returns an error, and the upload handler deletes the appended chunks the saved hard link now points at. KvPut keeps the caller's context like InsertEntry and UpdateEntry. 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> |
||
|
|
8581151376 |
filer: gzip metadata log pieces before uploading them (#12580)
* filer: let the fake-master test helper serve any master Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: gzip metadata log pieces before uploading them Every metadata event carries the old and new entry with their whole chunk lists, so a file grown by small fsynced appends logs the same chunk records again and again: 2000 appends of 256 bytes through weed mount wrote 34.8 MB of log. The uploader only compresses when the first 128 bytes compress, and a log piece starts with fresh file ids and ETags, so it stored the log as is. The filer now gzips each piece itself and keeps the compressed bytes when they save at least 10%. After the same workload the volumes hold 3.05 MB instead of 35.2 MB, file data included. Readers already honor the chunk's IsCompressed flag on every path (filer-side decode, log file refs read straight from volume servers), and the assign request sizes the bytes actually stored. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |