mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-12-05 02:27:26 +01:00
2bbb50fe7cf1f9a68d233a135663a80db6e234a3
21865
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
2bbb50fe7c |
codespell: accept 'lits' (Go AST literals in seaweed-block tests) (#13412)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
d84235e74f |
s3api: encrypt SSE-KMS requests that name no key with alias/aws/s3 (#13378)
* s3api: encrypt SSE-KMS requests that name no key with alias/aws/s3 AWS encrypts an SSE-KMS request that sends no key ID with the aws/s3 managed key. PutObject, UploadPart and CreateMultipartUpload passed the empty key ID on, and the KMS call rejected it, so the request failed with 500. A bucket default of aws:kms without a key failed the same way for multipart uploads. CopyObject was worse: its copy paths read an empty key ID as no SSE-KMS, stored the data unencrypted or under the source key, and marked the object as SSE-KMS, so reading it back returned garbage. Resolve an empty key ID to alias/aws/s3 wherever a request or a bucket default is read, with the helper the bucket default uploads and copies already had inline. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3api: re-encrypt an in-place SSE-KMS copy that changes the key The key-rotation strategy handed back the source chunks for an in-place SSE-KMS copy, so an object copied onto itself under another key, or under alias/aws/s3 when the request names none, stayed encrypted under the old key. Route it through the re-encrypt copy, which already keeps the same-key case direct. 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> |
||
|
|
56e95e5ebd |
filer: keep chunk encryption on server-side copy (#13392)
* filer: reproduce overwritten bytes lost by server-side copy Signed-off-by: Perfloop Agent <agent@perfloop.ai> * filer: retain chunk modification time during server-side copy Signed-off-by: Perfloop Agent <agent@perfloop.ai> * filer: isolate the copy regression volume-location cache Signed-off-by: Perfloop Agent <agent@perfloop.ai> * filer: reuse fake master in chunk copy regression Signed-off-by: Perfloop Agent <agent@perfloop.ai> * filer: share the chunk copy test fixture Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: keep chunk encryption on server-side copy The copy sent each needle with the chunk's clear size as its length, so a chunk encrypted by the filer (ciphertext is longer) failed to copy. Chunks also lost their cipher key, compression flag and S3 SSE metadata, which a reader needs to decode the copied bytes. The upload now takes the stored length and the copied chunk keeps those fields. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Signed-off-by: Perfloop Agent <agent@perfloop.ai> Co-authored-by: Perfloop Agent <agent@perfloop.ai> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
e9ea21340b |
filer: a lookup removes what a redis-expired entry left behind (#13397)
* filer: a lookup removes what a redis-expired entry left behind Redis expires an entry's value on its own and leaves the name in the parent directory's list. A listing drops such a member when it meets it, but a lookup finds nothing and returns, so the names of entries nobody lists stay, and so do the directories they leave empty. The filer_ttl job expires entries by looking them up and cannot reach them either. A lookup that finds nothing under a filer.conf TTL rule now asks the store for what expiry left of that name. The redis stores remove the list member, guarded against a concurrent recreate as on a listing, and when there was one the filer removes the directories this leaves empty, as a listing that meets an expired entry does. A miss with no member to remove costs one command, and only under a TTL rule. * filer: keep a directory that holds an object when removing empty parents A file promoted to a directory by a child write keeps its own object data. Once its last child expires the directory is empty, and the cleanup deleted it along with that object. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: report a failed removal of a redis-expired leftover RemoveExpiredLeftover returned a nil error even when the redis SREM or ZREM failed, so the filer could not log why an expired name stayed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: check a redis orphan repair's keys on the master With useReadOnly or routeByLatency the cluster client sends EXISTS to a replica. A lagging replica misreads a just-written value as absent, and the repair then drops a live entry from its directory list. A lookup miss now reaches this repair, so check the keys with a script, which runs on the master, as the redis2 store already does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: a lookup's cleanup leaves directories alone and asks the master first Removing the directory a redis-expired entry left empty from the lookup went through DeleteEmptyParentDirectories, which makes none of the empty folder cleaner's checks. With a leftover as the trigger it removed a multipart upload's staging directory together with .uploads, a directory of a bucket that keeps empty folders, an S3 Tables catalog directory, and the directory of a file written between its emptiness check and its delete, which strands that file. The lookup now only has the store remove the name; the directory stays. The redis stores also check the master for the value before they touch the list. A lookup that missed on a lagging replica used to remove a live entry's member and put it back, and a failure in between lost it. * redis: a lookup's cleanup looks for the member before it asks the master Most lookups that find nothing are of a name that was never written. Those now cost one read of the directory list instead of a script and a removal; only a name the list still holds is checked on the master. * redis: retry the restore of a directory list member, and report a failure The orphan repair removes a member and puts it back when the value turns out to be stored, because an insert got in between. Nothing else puts that member back, and a failed restore was only logged, so the entry stayed out of its directory's listing until it was written again. The restore is now retried a few times, and a restore that still fails is returned as an error. * redis: keep restoring a directory list member until redis takes it A restore that failed every attempt left a live entry out of its directory list for good, since nothing else puts the member back. Retry it in the background until it lands or the store closes; the repair still reports the failure. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: MapleWhiteZZZ <18653045+MapleWhiteZZZ@users.noreply.github.com> Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
3afc4e30bf |
worker: filer_ttl expires S3 objects in buckets without lifecycle rules (#13396)
* worker: filer_ttl expires S3 objects in buckets without lifecycle rules The job skipped every entry carrying the S3 expiry flag, to leave lifecycle expiry to s3_lifecycle. The filer puts that flag on any S3 object it gives a TTL, a filer.conf path rule's TTL as well, and s3_lifecycle only evaluates buckets that have lifecycle rules. So the rows of objects uploaded through S3 under a plain path TTL were never removed unless something looked them up or listed their directory. A flagged entry is now left to s3_lifecycle only in a bucket with lifecycle rules, read with the loader that job uses. Elsewhere the job expires it at the time the filer's lookups do, which for an S3 object counts from its mtime. * worker: filer_ttl leaves S3 objects to s3_lifecycle only where rules stamp TTLs Lifecycle rules put a TTL on an object only in a bucket with the lifecycle TTL fast path on. In any other bucket the TTL of a flagged object came from a path rule, and s3_lifecycle, which expires by its rules, never removes it: a bucket whose only rule aborts multipart uploads, or expires another prefix, kept such objects. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * worker: filer_ttl leaves a bucket to s3_lifecycle only for a rule the fast path stamps A fast-path bucket whose configuration is empty, or holds only rules that expire nothing after days (abort multipart uploads, noncurrent versions, tag filters), stamps no TTL, so its flagged objects carry the path rule's TTL like any other bucket's. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * worker: filer_ttl defers only the objects a stamping rule matches A fast-path rule stamps its TTL only on keys under its prefix and within its size filters, so another object in the same bucket got its TTL from the path rule. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * worker: filer_ttl lists each rule once more for the S3 objects its cursor passed The cursors saved so far moved past every S3 object, which the replay skipped, and nothing lists a rule that has a cursor. They are now saved under a new name, so after the upgrade each rule is new once: it is listed, which removes the expired objects, and replayed from a fresh cursor. * worker: filer_ttl defers only a TTL the fast path stamped A flagged object whose TTL differs from the one its matching fast-path rules stamp got it from a path rule (a multipart upload, or an object written before the rule), so filer_ttl expires it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * worker: filer_ttl lists a rule again when its buckets' fast-path rules change The replay moves past an object it leaves to s3_lifecycle. Each cursor now keeps a signature of the fast-path rules of the buckets its rule covers, and a different signature has the rule listed, which removes the objects whose lifecycle rule was removed or changed once they are due. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * worker: filer_ttl quotes the prefixes it hashes into a lifecycle signature A prefix holding a tab or newline could make two rule lists hash alike. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: MapleWhiteZZZ <18653045+MapleWhiteZZZ@users.noreply.github.com> Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
69c2cff0d8 |
admin: show the configured S3 endpoint in the service account CLI example (#13395)
* admin: show the configured S3 endpoint in the service account CLI example The credentials modal always printed AWS_ENDPOINT_URL=http://localhost:8333. Use s3.public_endpoint from admin.toml (or weed mini's own S3 address) when it is set, and keep localhost:8333 only as the fallback. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * admin: test the service account CLI example endpoint Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * admin: shell-quote the S3 endpoint in the service account CLI example A configured endpoint may contain characters such as ';' in its path, which would split the copied export command. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
25e0c6080a |
filer: resume chunk reads where the last one ended (#13393)
* filer: resume chunk reads where the last one ended ChunkReadAt walked the chunk views from the front on every ReadAt, so reading a file of n chunks front to back took time proportional to n squared. S3 GETs (256 KiB reads) and WebDAV downloads (32 KiB reads) both read whole files through it: a 32 KiB read near the end of a file of 100,000 chunks took 164 µs instead of 8 µs. Keep where the last read ended and start the next walk there when it is at or before the new offset. The mount merges new chunks into a live reader's views, so the interval list now counts its edits and a kept position is only used while the count is unchanged. * filer: benchmark ChunkReadAt reads Whole-file sequential reads at 1 to 100,000 chunks, one-chunk files read with a new reader, and random reads, all served by mockChunkCache so they measure the reader itself. * filer: trim the resume-point comments Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Denis Maier <denis@dAir.lab> Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
e16d6c7b11 |
test: write failover read files until every volume server backs one (#13391)
TestReadWithVolumeServerDown wrote three files and required each volume server to hold a chunk of one of them. When the mount starts before the master is elected, the first writes can all land on the volumes one server lacks, and the test stopped before stopping anything. Write three more at a time, up to twelve, until every server backs a file. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
5f252ef863 |
filer: preserve chunk timestamps during server-side copy (#13387)
* filer: reproduce overwritten bytes lost by server-side copy Signed-off-by: Perfloop Agent <agent@perfloop.ai> * filer: retain chunk modification time during server-side copy Signed-off-by: Perfloop Agent <agent@perfloop.ai> * filer: isolate the copy regression volume-location cache Signed-off-by: Perfloop Agent <agent@perfloop.ai> * filer: reuse fake master in chunk copy regression Signed-off-by: Perfloop Agent <agent@perfloop.ai> --------- Signed-off-by: Perfloop Agent <agent@perfloop.ai> |
||
|
|
7bfb5b6784 |
mount: take a live mount over without unmounting it (#13382)
* go.mod: take seaweedfs/go-fuse from #5 until it is released The handover builds on the server API of seaweedfs/go-fuse#5: Server.Stop, Start and Shutdown, Server.Dev and NewServerFromDev. Until that pull request is merged and tagged, go-fuse is replaced by its branch; the replace goes with the release. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mount: quiesce the background writers, pause and resume the metadata subscription, and give a takeover its own cache directories The periodic metadata flush, the proactive chunk flush and the idle directory eviction check a gate before each tick, so a handover can stop them and wait for the work they run. PauseMetadataFollow and ResumeMetadataFollow end the subscription and start it again from the position of the last event it handled, with the filer.conf follower it had. A successor keeps the subscription's client id (the signature crosses), so it subscribes at an epoch above its predecessor's: the filer then replaces the old subscription instead of refusing the new one as a duplicate and making it wait for a retry. A process that takes a mount over (Option.Takeover) uses <id>.t<pid> for its read and swap directories, as the predecessor still uses <id>. A normal start removes the stale <id>.t* siblings. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mount: the handover protocol, old side and new side A running mount listens on a unix socket (0600; the peer's uid is checked with SO_PEERCRED on both ends, ours or root). A successor connects, says hello, receives the FUSE fd with the INIT negotiation and the exported state, answers ready, and is told go. The hello carries the mount directory, the filer path and the options the state depends on (writeback cache, routed locks, nfs export): the running mount refuses a mismatch, a blocked lock request and a peer chunk server before it flushes or pauses. A connection closed before its hello is a probe (HandoverAnswers), logged at V(1). Until go the old side rolls back at every step (pre-flush, quiesce, stop, final flush, pause of the subscription, export, ready) and keeps serving: the subscription restarts from its position, the background writers and the nfs export writer resume, the server reads again. After go it closes its server without unmounting and marks itself committed, so its exit leaves the mount and the successor's sockets alone. The fd is carried by a fixed-size header written with one sendmsg and read with one recvmsg; control messages are length-prefixed JSON, and the state stream and the go frame are read through one bufio.Reader. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mount: a new mount on a live mount directory takes it over A weed mount started on a directory that is mounted already, whose weed mount answers on the handover socket, takes that mount over instead of replacing it: open files, locks and working directories inside it carry on. - Every Linux mount listens on a socket next to its local gRPC socket, <localSocket without .sock>.handover.sock, /tmp/seaweedfs-mount-<hash>.handover.sock by default; a deployment that keeps the local socket where the next mount process can reach it gets the same for this one. Not with -peer.enable, whose listen port has a single owner, nor with -filer.tokenFile, as read tokens and chunk proofs do not cross. - Those mounts read /dev/fuse in the stoppable way. - A new mount takes over when its directory is in the mount table and a process answers on the socket. When none answers (none runs, it crashed, it is an older weed), the mount proceeds as before. - A takeover skips the pre-mount unmount and the mount point check, binds the local gRPC socket and the handover socket only after the old process said go, and uses cache directories of its own. One that does not go through exits non-zero and leaves the running mount serving; to mount anew, stop that weed mount or unmount first, as for a busy mount today. - After go, a socket the new process cannot bind is logged, not fatal: the mount goes on without mount.configure or without a next handover, rather than going down. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test: end-to-end handover test test/fuse_handover starts a real weed mini and weed mount processes with the same arguments, and lets each new one take the live mount over, twice in a row and once more after a refusal. An appending writer, a streaming reader, an mmap, an unlinked temp file, an unclosed new file, a directory walk and a listing in progress, a held flock and POSIX lock, a process working inside the mount and a renamed open file run through it. It checks that the mount was never unmounted (mount id and st_dev), that the old processes exit 0, that a takeover refused because a SETLKW is blocked, or because the options differ, leaves the mount serving without a pause, and prints the pause. With HANDOVER_SCALE_FILES=<n> a second test creates n files, takes the mount over, and logs the pause and the size of the state. On a 2-vCPU VM: 10k files 18 ms and 360 KB, 100k files 134 ms and 2.9 MB, 300k files 410 ms and 7.1 MB. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mount: answer the first review of the handover The checks before anything pauses: - The hello carries the filer addresses, sorted, and -defaultPermissions: the running mount refuses a successor of other filers (its open files and inode table name entries and chunks of this filer) or of another default_permissions (without it the kernel leaves the permission checks to the mount, and a successor that counts on the kernel would make none). - A successor finds the live mount for a relative -dir and for a path with a space: the mount table is read with the absolute path, and its octal escapes (\040 ...) are undone, which checkMountPointAvailable gets too. The local socket keeps its name. Rollback and commitment: - A rolled back handover starts the FUSE server first. A subscription that did not end in time may wait for a request to be served, and the rollback waited for it before the server read again. The subscription now starts again in the background once the old one has ended; until then a new handover is refused before anything pauses. - A successor reads the filer configuration (PrepareBackgroundTasks) before it connects, since a failure there after go would end the process with nobody serving the mount, and it does not create the mount root, which the running mount serves. - A reconnecting subscription publishes its epoch, so that a later one with the same client id starts above it instead of being refused as a duplicate. - A takeover's cache directories are <id>.t<pid>-<random>: two processes that each run as pid 1 of a container sharing the cache base got the same directory. Tests: - The protocol tests run on Linux only, as the protocol does; those of the background gate and of the cache directories run everywhere. - The end-to-end harness bounds the probes that go into the mount, waits until the SETLKW helper sleeps in FUSE before it asks for a takeover, counts only complete reader passes, closes the retained files on failure, rechecks a log after its process exited, and cleans up only mounts below its own directory. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mount: read the filer configuration again after a takeover A successor reads the filer configuration before it connects, so that nothing that can fail is left for after go. A change that the predecessor applied in between does not come again with the subscription, which starts where the predecessor stopped, and the successor kept the configuration it had read. It now reads it once more when it starts its background tasks; on failure the one read before stays. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mount: build the moved handover tests where their helpers are handover_quiesce_test.go uses newHandoverWFS, which is defined in a test file built everywhere but on Windows; it gets the same constraint. The mount readiness probe of the end-to-end test is also capped at the remaining deadline. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mount: renew the routed lock leases before the background tasks wait on the filer A successor with -dlm holds the routed locks its predecessor took, and the filer drops their leases 15 s after the last renewal. StartBackgroundTasks began renewing only after it had read the filer configuration again, a filer call that can take longer than that. The renewal now starts first. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mount: compare -readOnly and -allowOthers in the hello, and drop a filer configuration that is gone - -readOnly and -allowOthers are kernel mount options, fixed when the mount was made: a successor started with others would run with the old ones without knowing. The hello carries them and the running mount refuses a mismatch before anything pauses. - The filer configuration read again after a takeover clears the one read before when the file is gone. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test: close the held lock files of the handover workload on failure The flock and POSIX lock files are opened before the takeovers and closed in finish(); an assertion that fails in between left them open. They get a cleanup right after they open, like the other retained files. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mount: compare the kernel's mount options as -o sets them too, and retry the filer configuration read after a takeover - allow_other, ro and default_permissions can come from -o as well as from their flags. The hello compared the flags only, so a successor started with -allowOthers=false could take over a mount made with -o allow_other. The mount now records the kernel's options from both (KernelReadOnly, KernelAllowOther, KernelDefaultPermissions), and the hello compares those. - The read of the filer configuration after a takeover is tried three times before the subscription starts, which can wait: it starts where the predecessor stopped. Only if all fail does the configuration read before the takeover stay until its next change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mount: drop the WEED_MOUNT_HANDOVER_STOP_TIMEOUT test hook The drain bound stays at its 10 s default; the end-to-end tests wait well over that for a refusal, so they do not need a setting of their own. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mount: close a descriptor that comes with a refused handover Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mount: take a mount over when the new process shares a filer with it The hello required the sorted -filer list to match exactly, so a successor started after filers were added to the cluster or taken out of it was refused, and the old mount kept serving. A filer serves one filer store: one filer in common means the store that the open files, the inode table and the chunks belong to. Compare the filers as host:port, as ServerAddress.Equals does, so that an address written with its gRPC port counts as the same filer, and refuse only lists with no filer in common. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * ci: run the FUSE mount handover end-to-end tests test/fuse_handover starts a real weed mini and weed mount processes and lets each new mount take the live one over; no workflow ran it, so only the unit tests guarded the handover in CI. The job follows the FUSE DLM one: it repairs the fusermount3 setuid bit, builds weed and runs the tests with WEED_BINARY. The tests mount as the runner user without allow_other, so fuse.conf is left alone. A failed run uploads the weed logs, which the harness keeps in /tmp/fuse_handover_*. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mount: compare the kernel's mount flags in the hello, resolved in order The hello compared ro as "-readOnly or -o ro", and no other mount flag. -readOnly puts ro before the -o options, and both fusermount3 and go-fuse's direct mount apply the options in order, so -readOnly with -o rw mounts read-write while the hello said ro. A successor started with -o noexec, nosuid or nodev also got the old mount's flags without knowing. Resolve the generic flags from the option list go-fuse mounts with, in order, from nosuid and nodev as both mount paths start, and refuse a successor whose flags differ before anything pauses. relatime is left out: the kernel uses it unless noatime or strictatime is set. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mount: do not send a handover control frame the peer would refuse writeControl sized its buffer from the encoded message without a bound, while readControl refuses a frame over maxControlFrame. Refuse the larger frame before allocating, as the reading side does (CodeQL go/allocation-size-overflow). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test: unmount the handover e2e mounts with fusermount when fusermount3 is missing The harness detached leftover mounts with fusermount3 only. A fuse2 host, such as CentOS 7 or an Alpine image with the fuse package, has only fusermount, so the last step of TestHandoverEndToEnd failed there after every handover had passed. Try fusermount3, then fusermount. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * go.mod: use go-fuse v2.9.6 instead of the branch of seaweedfs/go-fuse#5 seaweedfs/go-fuse#5 is merged and tagged v2.9.6, whose tree is the one this pull request was tested with (1eec9a8). Drop the replace with the fork and require the release. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: whitebear009 <whitebear009@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com> |
||
|
|
91caa97b8e |
filer: answer forwarded creates, updates and deletes after replaying them (#13406)
* filer: answer a forwarded create or update after replaying it A conditional or exclusive create, or a conditional update, is forwarded to the entry's write owner and stored there first. When the owner keeps a store of its own, the forwarding filer sees the write only once it replays the owner's event, so the caller's next lookup through it could find the file missing or stale: a mount reopening the file it just closed got ENOENT. Wait for that replay before answering, as a forwarded rename already does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: answer a forwarded delete after replaying it A delete forwarded to the write owner removes the entry there first; until this filer replays the owner's event, a lookup through it still finds the entry. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: skip the replay wait for an owner on this filer's store An owner that runs on this filer's store wrote the entry there already, so waiting for its event to replay only delays the answer. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
c3e284a45c |
s3api: return SSE headers from CompleteMultipartUpload (#13389)
* s3api: return the object's SSE headers from CompleteMultipartUpload AWS answers CompleteMultipartUpload for an encrypted object with x-amz-server-side-encryption, the KMS key id and bucket-key-enabled. Read them from the committed entry the way HEAD does, on both the first answer and a retry answered from the committed object. SSE-C customer headers are not echoed, as AWS does not send them on Complete. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3api: test CompleteMultipartUpload SSE response headers Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3api: answer CompleteMultipartUpload SSE headers from the entry only setSSEResponseHeaders falls back to the request's KMS key id and bucket-key headers, so a Complete request carrying them could report a bucket key the object does not use. Complete's own headers say nothing about the object; pass none. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3api: test that Complete does not echo request SSE-KMS headers Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
da62513b3e |
s3api: return SSE headers from CreateMultipartUpload and honor its encryption context (#13388)
* s3api: return the upload's SSE headers from CreateMultipartUpload CreateMultipartUpload now answers with the encryption the upload was initiated with, as AWS does: x-amz-server-side-encryption for SSE-S3 and SSE-KMS, the KMS key id, encryption context and bucket-key flag, and the SSE-C algorithm and key MD5. Bucket-default encryption is reported the same way, from the config stored on the upload entry. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3api: validate the SSE-C key and KMS context on CreateMultipartUpload Initiate accepted an SSE-C key whose MD5 did not match, an incomplete SSE-C header set, and a KMS encryption context that was not base64 JSON, then created the upload. Reject them before creating the upload with the same codes PutObject returns, so the headers the response echoes are ones the parts can use. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3api: encrypt multipart parts with the context given at initiate CreateMultipartUpload stores the x-amz-server-side-encryption-context header as received, base64 JSON, but UploadPart and UploadPartCopy parsed it as raw JSON, failed, and fell back to the default context. Every part's data key was wrapped without the context the client asked for. Parse the stored value the way the header is parsed on PutObject. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3api: reject KMS encryption contexts the key service refuses up front CreateMultipartUpload accepted a context with control characters, a whitespace-only key or too many pairs, so every part then failed; PutObject answered the same input with a 500. Both now build the merged context once and apply the KMS checks, answering InvalidRequest. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3api: keep the derived aws:s3:arn in a client's KMS encryption context A context header naming aws:s3:arn replaced the object or bucket ARN sent to the key service, on PutObject and, through the context stored at initiate, on every multipart part, so a key policy conditioned on aws:s3:arn could be met with another bucket's ARN. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
7ead5e4e23 |
filer: persist the metadata log as soon as shutdown starts (#13386)
The shutdown leaves the lock ring and drains gRPC and HTTP before Filer.Shutdown runs the final metadata log flush. Those steps can take longer than a container's termination grace period, and a kill before the final flush drops every local event since the last periodic flush. On a shared store peers keep those events only in memory, so they vanish from every filer's aggregated stream. Start a flush of the local metadata log first, in the background, so the events accepted before the signal are persisted within seconds. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
ac12fc4683 |
helm: bump COSI driver to v0.5.0 (#13375)
The chart default was still v0.1.2 from September 2024. Co-authored-by: Claude Mythos 5.2 <noreply@anthropic.com> |
||
|
|
0b7bd23647 |
s3api: stop at startup when the -s3.config KMS block doesn't load (#13380)
* s3api: stop at startup when the -s3.config KMS block doesn't load A kms block in the -s3.config file that failed to load was only logged, so S3 came up healthy with SSE-KMS off. Every SSE-KMS write and every read of an SSE-KMS object then failed with 500, and nothing at startup pointed at the config. loadS3ApiConfigurationFromFile now returns the KMS error once it has applied the identities, and startup already stops on any error it returns. A SIGHUP reload still applies the identities, so a revoked key stops working, keeps the previous KMS providers and logs the error. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3api: shorten the KMS load-order comment 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> |
||
|
|
b69076476b |
s3api: return KMS errors on SSE-KMS writes as their S3 error codes (#13379)
* s3api: return KMS errors on SSE-KMS writes as their S3 error codes An SSE-KMS PutObject, UploadPart, UploadPartCopy or CopyObject naming a key the KMS doesn't have failed with 500 InternalError, and so did a plain upload to a bucket whose default encryption names one. MapKMSErrorToS3Error never saw these errors. The put path returned InternalError for every encryption failure. The copy path compared the mapper's result against InvalidRequest, which it never returns, so it answered InternalError for every error and its SSE-C check after it never ran. And the KMS calls wrapped the provider's error with %v, so its type was gone before any of them looked. Wrap the provider errors with %w, find the KMS error with errors.As, and map encryption failures on the put path, the bucket default put and the inline copy path. A missing key is now 400 KMSKeyNotFoundException, a disabled one 400 KMSKeyDisabledException, and errors that don't come from KMS stay 500. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3api: map wrapped SSE-C errors to their S3 codes A destination SSE-C parse error reaches the copy error mapper wrapped with %w, so the exact-match switch missed it and the copy answered 500. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3err: answer KMS key errors with the codes AWS S3 uses AWS S3 reports a missing SSE-KMS key as KMS.NotFoundException, a disabled one as KMS.DisabledException, and a denied KMS call as AccessDenied. 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> |
||
|
|
731431af72 |
export: fail tar exports on unreadable live needle bodies (#13377)
* export: fail the tar export on an unreadable live needle * export: honor -newer after needle body read errors Skip a damaged record when its decoded modification time excludes it from the tar. Publish the date flag only after decoding the timestamp so incomplete metadata still fails the export. * needle: keep reading a record whose fields end before its timestamp The last-modified field was decoded without the length check the other optional fields keep, so a record whose bytes end right after its flags, name or mime now failed as corrupted. Older reads, and the Rust volume server, read it without a timestamp. Keep the check; the flag stays off until the timestamp is decoded. 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> |
||
|
|
d6c2662da5 |
filer.copy: continue after a failed file and return a nonzero batch status (#13381)
* filer.copy: finish the batch and report failed copies * filer.copy: test cleanup after mixed chunk upload outcomes * filer.copy: check the refused uploads reach the volume in the batch test Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer.copy: drop the trailing newline from entry creation errors Each copy error is now printed on its own line, so the embedded newline left a blank line after it. 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> |
||
|
|
940ecedbfb |
perf(iceberg): list each catalog dir once per scan (#13383)
* iceberg: list each catalog dir once per scan The maintenance scan already lists every namespace of a bucket; it now gathers the catalog roots from those entries instead of listing them all again through CatalogRecordRoots (3 listings per directory -> 1). Live stage-creates are still read, only when a table needs the check. A namespace filter, or a bucket over 10000 table entries, keeps the old path. A namespace that cannot be listed skips the bucket for the pass; removeOrphans still rechecks before deleting. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * iceberg: reuse listed namespaces past the gather cap Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * iceberg: keep no stages from a failed read Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3tables: describe the moving root as the one a record moves to ExtendedKeyMoving holds the metadata an update is about to write, so the extra root is the destination, not the one the record leaves. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * iceberg: trim the scan's 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> |
||
|
|
0860fa3f07 |
volume: skip the full .idx walk on restart for leveldb and redb indexes (#13384)
* volume: count leveldb writes only once the .idx row lands A Put or Delete whose .idx append failed still bumped the file and deletion counters, so they drifted from what a recount of .idx gives. The redb map already counts after the write succeeds. * volume: track the largest needle end on leveldb and redb writes Only the load walk set it, so it went stale as soon as a volume took writes. Keep it current so it can be carried across a restart. * volume: save needle counters on close instead of recounting .idx on load Every load walked the whole .idx to rebuild the file and deletion counters, which dominates restart time on servers with large indexes. A clean close now stores them in the .ldb / .rdb tagged with the .idx size (and mtime on Go) they describe; the next load takes them and deletes them, so a crash or an .idx changed while closed falls back to the full walk. * volume: save no counters while .idx holds a partial row A failed append can leave bytes past the last whole row that the counters never saw. Tagging the counters with that size let the next open take them and append from a misaligned offset. * volume: prove reopen takes the saved counters, not a recount A recount gives the same numbers, so the tests passed even when close saved nothing. Skew the saved file count and expect it back. * volume: test saved counters dropped when only the .idx mtime changed Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
24529a3c8b |
sftp: keep a grown file's hole out of the temp file and the upload (#13374)
* sftp: copy only the stored bytes on a non-truncating open A size set by a truncate that grows a file stores nothing, but opening the file for writing without O_TRUNC copied its whole logical size into the temp file as zeros. Copy up to the last stored byte and extend the temp file to the size, which leaves the rest sparse. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * sftp: upload only up to the written data on close Close streamed the whole temp file, so a hole after the data, from a truncate that grew the file before or during the open, was read back and uploaded as zeros. Track where the copied and written bytes end, upload up to there, and keep the rest as the file's size. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * sftp: leave the data end alone on an empty write A zero-length WRITE far past the data moved the data end there, so Close uploaded the hole before it as zeros. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * sftp: cap what the test filer reads from an upload An upload that wrongly carries a large hole now fails the test instead of filling memory. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * sftp: hash nothing past an out-of-range size A stored size past the largest file offset turned negative and sliced the inline content out of range. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * sftp: refuse a setstat size past the largest file offset Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * sftp: fail the hash of an out-of-range size Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * sftp: check the size before returning a stored md5 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
bb697650b4 |
mount: flush open files before shutdown (#13373)
* mount: flush open files before shutdown On SIGTERM the mount unmounted and exited without uploading the buffered writes of files still open, so a pod deletion dropped data the kernel had already acknowledged. The interrupt hook now flushes every dirty open handle like fsync, inside the existing 30s shutdown bound. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mount: refuse writes once the shutdown flush starts A write admitted after its handle was flushed was acknowledged and then lost when the process exited. The shutdown flush now sets a flag that Write checks under the handle lock, takes every handle lock once to wait out the writes already admitted, and reports whether every flush succeeded. The test now buffers real bytes and checks they are uploaded and committed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mount: wait for each handle inside the shutdown flush workers Waiting for every handle lock before flushing any file let one slow handle use up the shutdown bound for all the others. Each worker now waits for its own handle and flushes it if dirty. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mount: refuse copy, fallocate and handle attribute changes during the shutdown flush copy_file_range, fallocate, and setattr/xattr on an open handle also leave their result only in the handle. One that lands after the shutdown flush has passed its handle was acknowledged and then lost at exit, as writes were before. Like Write, they now return EIO once the flush starts. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mount: leave the meta cache open when the shutdown flush times out A flush still running after the 30s bound holds its handle's lock. Closing the meta cache drains queued invalidations, and one for that handle waits on the same lock, so the hook blocked past its bound until the flush gave up. Skip the close in that case, as the write cache removal already is; the process exits right after the hooks. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mount: keep the read cache dir when the shutdown flush times out By default the write cache lives inside the read cache dir, so removing the read cache on the timeout path deleted the swap files that the still running flushes read, along with the meta store left open for them. Remove both dirs only after the flushes drain. The meta store is recreated on the next start. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mount: keep a close's writeback deferral through the shutdown flush A writeback close marks the handle for the background drain. If the shutdown flush started on that handle between the close's flush and its release, it cleared the mark, so the release took the immediate path: it fenced the handle's publication and destroyed its pages while the shutdown flush still uploaded them. Once shutdown starts, a synchronous flush leaves the mark, and the release drains as usual. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
d9eaf85cd7 |
perf(lance): skip unused _versions lookups (#13371)
* lance: skip unused _versions lookups Read _versions/ only for include_declared=false, check_declared or a new-name register: listings now do one lookup per table instead of two (about 45% faster at 100-500 tables). A failed _versions lookup no longer hides a table that never needed it. Adds visibility regression tests, lookup-count tests and a benchmark. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * lance: read the deregistered marker through datasetState Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * lance: trim the dataset-state 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> |
||
|
|
a4269d6b51 |
mount: export and import the in-memory state of a mount for a handover (#13370)
* pb: add mount_handover.proto, the state a mount hands to its successor Messages for the in-memory state a new `weed mount` process needs to take over a live FUSE connection. The stream is a small header followed by length-delimited HandoverFrame messages, one record per frame, so a table of millions of inodes is neither encoded nor decoded as a whole. Protobuf keeps the state readable across builds: fields are only added, and a reader ignores fields and frame bodies it does not know, so a newer build imports what an older one exported. File entries reuse filer_pb.Entry. Generated with protoc 33.4 and protoc-gen-go 1.36.6, as mount.pb.go is. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> * mount: export and import the in-memory state of a mount for a handover ExportHandoverState / ImportHandoverState carry what a new weed mount process needs to serve the kernel's existing node and handle ids: the inode table (paths, hard-link names, lookup counts, which inodes are directories), open file handles under their fh ids with entry, base entry, entry version and the flags that change later operations, directory handles with the window of entries the kernel is inside, held POSIX/flock locks and the routed (-dlm) session id with its mirror, the mount signature, the sticky per-inode write errors, atime/dir-mtime overlays, removed-directory entries, the -nfsExport records, and the metadata subscription position. Nothing is carried that cannot be: the export is refused, naming every cause, for dirty pages, uploads or deferred flushes, an unpublished create, a handle busy under its lock, a blocked lock waiter (never answered with EINTR, which the kernel turns into a restart only for a caller with a signal pending), a background create, or a filer token. The handle of an unlinked file crosses dirty, as its entry exists only there. Encoding: protobuf (weed/pb/mount_handover.proto), one length-delimited frame per record behind a header with a format version, ending in a frame with the CRC-32. Frames stream, so a million-inode table is neither encoded nor decoded as a whole, and the importer builds the final maps directly. Import verifies the checksum before it changes anything, refuses another mount root, cache mode or a WFS that already holds state, and makes no filer call: a manifest chunk is resolved lazily on the first read, as after a failed resolution. A caller's *bufio.Reader is used as it is and left right behind the state, so more can follow on the same connection. Every structure documents next to its type what crosses, what is rebuilt and what must be empty; a test fails when a field is added without a place in it. Three hooks in existing code, none of which changes behaviour: - MetaCache.SubscribedTsNs is the log position of the last subscribed event handled, applied or skipped as the mount's own. The subscription's start is its first position, so a mount that hands over before its first event still passes one on. WFS.handoverMetaTsNs, which only an import sets, is where StartBackgroundTasks starts the subscription instead of at the start time. - WFS.asyncCreates and WFS.routedLockWaiters count the writeback Mknod create goroutines and the SETLKW calls polling a routed lock. Neither has a handle or a table entry to inspect, and a handover must not drop either. No caller yet: the handover itself follows. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> * mount: flush everything a handover would refuse to carry FlushForHandover flushes every open handle that has dirty pages, dirty metadata (this publishes deferred creates, whose only copy is a placeholder in the meta cache that does not cross) or a deferred close flush, through doFlush as fsync does, and waits for the closed files draining in the background and the creates still being sent, all bounded by a context. No new flush logic. It is safe while requests are served, like an fsync of every open file from another thread, which keeps the bulk of the uploads out of the pause. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> * mount: measure the handover of a million-inode table Skipped with -short. Logs encode and decode time and bytes for 1M inodes: 1.3 s to export, 1.6 s to import and 39 MB on a 2-vCPU VM. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> * mount: hand over a file whose first open was closed Each open of a file has its own fh id over one shared handle. The handle's own id is that of the first open, and stays so when that open is closed: it keys the handle's lock. The import required it to be among the live opens, so a file opened twice and then closed through its first descriptor was exported, and refused by the successor before anything was installed. The import now only requires the handle ids to be distinct, as the lock table does. Tested for both close orders. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> * mount: export the subscription position only with its events applied The metadata subscription moves its position on as soon as an event is in the meta cache. What the event does to the inode table and to the open handles, a rename by another mount or a newer entry, is queued for the invalidation worker and happens later. An export in between carried the position of the event without its change, and the successor, resuming behind the event, never applied it: an open file kept its old entry and a renamed inode its old path. The export now refuses while the subscription runs, since it would keep feeding the worker, and waits for the worker to be through what it holds before it takes the handle locks, which the worker needs. The wait is bounded at 5 s and ends in a refusal: the worker can sit in a kernel notification that needs a request served, which nobody does while the FUSE server is stopped. Hooks: WFS.metaFollowers counts the subscription goroutines, and MetaCache.WaitForEntryInvalidationsWithin is the bounded drain. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> * mount: an imported subscription position survives another handover The import kept the position for StartBackgroundTasks only, and the export reads the meta cache's, which stayed zero until the subscription started. A mount that handed over again before that passed on no position, and its successor would have followed from its own start time, missing the events in between. The import now also records the position in the meta cache. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> * mount: refuse a handover between different lock modes The advisory locks an application holds are either in the mount's own table or, with -dlm and no writeback cache, on the filer, and each mode only asks its own place. The import installed whatever it was given: a successor started with -dlm kept the predecessor's local locks in a table it no longer consults, so a second lock on the same range was granted; one started without it kept routed locks whose leases nothing renews. The mode now crosses in the identity (Identity.routed_locks) and the import refuses another one before it changes anything, as for the cache mode. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> * mount: read a handle's dirty state under its lock in the handover flush FlushForHandover runs once while requests are served, and looked for the handles to flush by reading their dirty flags and page state under the handle map's lock only. Writes, truncates and flushes change those under the handle's flush lock, so the read raced with them. Each handle is now examined under its own flush lock, in the worker that flushes it, with the map's lock held only to list the handles: a handle's lock is never taken under the map's. A handle closed since it was listed is left to its release or to the background drain. asyncFlushPending is still read under the map's lock, as RELEASE reads it. The new test runs the flush next to writers and to opens and closes; with the handle lock taken out again the race detector reports the read. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> * mount: hand over the nfs export records not yet written to the filer With -nfsExport one background writer keeps the filer's record of every open file. The export listed the inodes that have a path or an open count and marked those still queued for the writer. Two kinds of pending work were missing: - a record to remove. When the removal timer of a closed file fires, the inode has no path and no open left, only its place in the writer's queue, so it was not listed and the registration stayed on the filer; - a write the writer had taken from its queue: in flight, or failed and waiting a second for its retry. It is lost with the process, and the record crossed as clean. The writer now counts what it has taken and not finished (exportedHandles.unwritten), and the export lists queued and unfinished inodes too and marks both dirty. Writes in flight are not waited for: the successor writes the record again under the same owner, with the same result. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> * mount: keep followMetadataUpdates' doc comment on its function Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mount: hand over the owner of the nfs export registrations The owner is a hash of the hostname and mount directory, so a successor in a replaced pod has another one: the records it rewrites or removes would sit next to the exporter's instead of replacing them. The importer takes the exporter's owner. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mount: bound the wait for the held nfs record write in the handover test Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mount: stop the nfs export writer once a handover export starts The successor registers under the exporter's owner, so a record write of the exporter landing after one of the successor's took the record back, and a removal timer firing in the exporter dropped the successor's entry. The export now stops the writer before it captures the records: a write not yet at its put drops it and stays dirty, a put already sent is waited for (the export refuses if it does not return in time), and the writer starts again when the export fails. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mount: let the drain test's events through only once the export waits TestHandoverExportWaitsForEventsToReachTheState released the held invalidations 100 ms after it started the export goroutine. A goroutine that started later found the events applied already, and the test passed without testing the wait. The export now calls a test hook, handoverEventSettleStarted, when it starts that wait, with the subscription's position already taken. The test lets the events through only after the hook, and after checking that the export did not finish while they were held. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mount: wait for the exporter's removal timer instead of a fixed sleep Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mount: confirm the stopped writer took the removal's wake in the handover test Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: whitebear009 <whitebear009@users.noreply.github.com> Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com> Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com> |
||
|
|
8760e2778b |
worker: dir_usage takes off what a TTL expires (#13369)
* worker: dir_usage takes off what a TTL expires A plain TTL removes an expired row without an event, so a record kept counting it until its bucket was seeded again. An entry's attributes say when listings start leaving it out (Entry.ExpiresAt, which listingExpired now uses), so a record keeps what each directory has still to expire, grouped by the step it expires in, and each run takes off what came off by its position. A step is an hour, or for a TTL of 200 hours or more the largest power of two hours up to 1% of it, so a record stays bounded. An event counts an entry only if the record has not taken it off yet, so an S3 expiry, which logs a delete, comes off once. Record version 2 seeds the records made before again. Part of #13257. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * dir_usage: decide a seeded directory's share after what expired The seed took off what had expired by its position only after the final share check, so a directory the walk kept could be dropped against a total that still counted those entries. Take them off first, and hand what a dropped directory has still to expire to the directory above. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * dir_usage: drop a seeded directory below its share with dropTracked A directory below its share has none above its share below it, so dropping it with what is below, its entries staying counted above, is what untrack did. 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> |
||
|
|
f796077361 |
s3: keep a shared STS signing key on the filer when no IAM config is given (#13368)
* s3: keep a shared STS signing key on the filer when no IAM config is given Without an IAM config file, jwt.filer_signing.key, or an SSE-S3 KEK, the IAM loader had no STS signing key and STS stayed off. The KEK used to be created automatically, which made STS work out of the box; it no longer is. In that zero-config case, read the key from /etc/iam/sts_signing_key on the filer, creating it once with an exclusive create, so every gateway sharing the filer signs and validates session tokens with the same key across restarts. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3: wait for the winning gateway's STS key after a refused create With per-filer stores the exclusive create is decided by the write owner, so the key another gateway created may reach this filer a little after the create is refused. Keep reading until it shows up instead of leaving STS off on the losing gateway. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3: refuse the filer STS key while an SSE-S3 key goes unloaded A gateway whose SSE-S3 setup failed (a KEK it cannot unwrap, or a configured key that was rejected) has no master key, so it fell through to the STS key kept on the filer while the other gateways signed with the KEK. Leave STS off on such a gateway instead. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
81f673a8d9 |
master: start a margin past the file ids handed out without a record (#13366)
* master: start a margin past the file ids handed out without a record A master records how far it hands file ids out, and the one that takes over starts from the record. A master from before the record existed leaves none: the first master that has it, taking over from one that does not, counts on from the largest id written and hands out again the ids that had not landed. That is every cluster on the day it is upgraded. The largest needle id a volume server reports shows it. Under masters that record, every id in use is below the recorded ceiling; one at or past it, or any at all with no ceiling recorded, was handed out without a record, and so may others above it. The sequence then goes on a margin of 2^24 past it. Three masters of the previous version, the two followers restarted with this one, then the leader killed while ids are assigned: 510 of 1228 ids were handed out twice, and none of 1252 with the margin. Three masters of this version alone never take it: the ranges stay a step apart. * master: margin a late server's ids past only other masters' ceilings A volume server that first reports after the master that took over has handed out ids holds none of them, yet its ids can sit under the ceiling this master recorded since and so miss the margin, though they were handed out without a record. Compare a server's first report to this master against the ceilings other masters recorded. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * master: give up its own file id ceiling when the leader changes A master that leads again, having stayed up, counted on from where it stopped under the ceiling it had recorded. A master that records nothing may have led in between, as one of the previous version can during a rolling upgrade, going on from the servers' reports below that ceiling: the ids it handed out that had not landed were handed out again. The margin does not catch it, as the reports stay under the ceiling and the servers are known. On a leader change a master now gives up its own ceiling and moves its sequence to the highest one recorded, so its next assignment records a new ceiling past all of them. goraft calls the leader change listener from its loop, so this takes no lock a raft command is held under. * master: drop a file id drawn before a leader change gave its ceiling up nextFileId read its own ceiling before the draw and checked that copy after it. A leader change that gave the ceiling up between the two left the stale copy passing, so an id drawn below the old ceiling could be handed out after a master in between had handed it out too. Read the own ceiling again after the draw. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * master: pin leading again to the ceiling recorded before The test checked the id against a bound far below the recorded ceiling, so a drop that moved the sequence only a little would still pass. Check the id and the new ceiling against the ceiling recorded before the leader changed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * master: count a server's first report after a leader change as its first The servers that reported to a master were kept for the life of the process. When the master led again after one that records nothing, a server it knew from before was compared against the ceiling it had just recorded, which may already be past the ids the master in between handed out, so a late report took no margin. Forget the reporters on a leader change, so their next report is compared against the other masters' ceilings. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: MapleWhiteZZZ <18653045+MapleWhiteZZZ@users.noreply.github.com> Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
bc2291c64b |
Merge pull request #13358 from seaweedfs/import/seaweed-block-v1.1.0
Import seaweed-block v1.1.0 with history into seaweed-block/ |
||
|
|
b0d12a71af |
volume: keep the heartbeat moving while a compaction commit holds a volume (#13365)
* volume: report the commit-start status while a compaction commit holds the volume CommitCompact holds dataFileAccessLock across makeupDiff and the reload, which on a large volume takes longer than the master's heartbeat timeout. The heartbeat reads every volume of the server through collectStatus, so it waited out the commit and the master unregistered the whole server. The commit now pins the status it starts from, and status reads answer with it until the commit is done, instead of queueing behind its exclusive lock. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * volume(rs): report the commit-start status while a compaction commit holds the volume The Rust commit closes the needle map and .dat and reloads the compacted files under the io write lock. The heartbeat read each volume's counts through that lock, so it waited out the reload, and between the close and the reload it reported the volume as empty. Mirror the Go change: the commit pins the status it starts from, and collect_status answers with it until the commit is done. The heartbeat reads all of a volume's counts through one collect_status call. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * volume: report the compaction revision with the commit-start status The commit reloads the superblock before it lets status reads see the live volume again, so a heartbeat in between paired the new compaction revision with the pinned counts, and the changed hash sent that mixed report. The revision is now part of the status the commit pins, in Go and in Rust. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * volume: size auto-sized disks from the commit-start footprint MaybeAdjustVolumeMax runs just before every heartbeat and, for a disk without a fixed -max, reads each writable volume's .dat and .idx sizes through the data lock, so it still waited out a compaction commit. UnUsedSpace now reads the footprint the commit pinned while one holds the volume, in Go and in Rust. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * volume(rs): recheck expiry from the commit-start status The heartbeat's expiry recheck runs under the store write lock and read the .dat size through the io lock, so a TTL volume that came due while a compaction commit reloaded it held the heartbeat until the reload ended. It now reads the size from collect_status, and delete_volume keeps refusing the committing volume until a later pulse. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * volume: refuse to delete a committing volume without waiting for it Destroy takes the data locks a compaction commit holds across its reload, and the heartbeat deletes expired TTL volumes under the location's volumes lock, so a volume that came due mid-commit stalled the heartbeat. deleteVolumeById now refuses a compacting volume up front, as the Rust volume server's delete_volume does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * volume: claim the volume before Destroy takes its data locks deleteVolumeById checked the compaction flag and only then let Destroy take the data locks, so a commit that claimed the volume in between still made the delete wait out its reload under the volumes lock. CommitCompact claims before it locks, so Destroy now does the same and refuses a claimed volume without waiting; the separate check in deleteVolumeById is no longer needed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * volume(rs): refuse to destroy a volume whose sync lock is held Every destroy runs under the store write guard, and the vacuum-commit RPC takes the sync lock and waits out leased readers before it marks the volume compacting, so an expiry deletion in that window passed the compacting check and then stalled the heartbeat behind the commit. destroy now try-locks the sync lock, as commit_compact does, and a refused deletion keeps the volume mounted for a later pulse. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * volume(rs): keep the CompactionClaim doc on CompactionClaim Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * volume(rs): report a volume a collection delete could not destroy The collection delete logged a refused destroy, kept the volume mounted and still answered success, so the caller never retried. Return the first error after the loop, as the Go store does, while the other volumes of the collection are still deleted. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * volume(rs): claim a volume before the commit and destroy take its locks destroy try-locked the sync lock so a delete under the store write guard would not wait out a commit's reader drain, but every write holds that lock across its fsync, so a volume or collection delete racing an upload was refused. Claim the volume first, as Go's CommitCompact and Destroy do: the commit RPC claims before it takes the sync lock and waits for readers, and destroy claims, waits for the locks only behind writes, and refuses a claimed volume without waiting. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * volume: skip the missing-.dat check while a volume is compacting A status read no longer waits out a commit, and on Windows the commit removes the .dat before it renames the compacted one in, so a heartbeat in that gap took the volume for one whose .dat was unlinked and left it out of the report. The commit-start status already stands in for the volume until the commit ends. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * volume(rs): skip the missing-.dat check while a volume is compacting Mirrors the Go change: the heartbeat reads the commit-start status without waiting for the commit, and a Windows commit removes the .dat before it renames the compacted one in, so the check dropped the volume from a heartbeat taken in that gap. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * volume(rs): keep the new delete and heartbeat tests beside related ones Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * volume: report a compacting volume a collection delete left mounted Destroy refuses a volume a commit has claimed, so the collection delete no longer filters compacting volumes out silently; the refusal is returned and the master keeps the collection to retry. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * volume(rs): report a compacting volume a collection delete left mounted Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * volume: confirm a missing .dat under the compaction claim The compaction flag was read before the stat, so a commit starting in between could have its Windows swap taken for a phantom. Stat first and recheck a missing .dat while holding the claim; a held claim defers the verdict to a later heartbeat. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * volume(rs): confirm a missing .dat under the compaction claim Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * volume(rs): expect a collection delete to refuse an in-flight compaction Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
0660a27506 |
filer: give each read on a reader its own stream position (#13363)
Concurrent ReadAt calls on one ChunkReadAt (mount issues them) shared a single stream slot, so one read could unpin the chunk another read had moved the stream to: by leaving it for another chunk, or by finishing a chunk that a later read had entered without a pin of its own. The chunk was then dropped and the next read downloaded it again. Each read now takes the reader's position, moves it on its own stream and parks it back when it ends. When overlapping reads both stop inside a chunk, the one that stopped further into the file keeps its pin and the other releases it. A read that starts while another holds the position starts in no chunk. With one read per stream, chunkStream no longer needs a mutex or a conditional detach. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
9c214d0ff5 |
kms: close replaced providers after a grace period (#13359)
* kms: close replaced providers after a grace period A reload closed each provider it replaced or removed right away, while S3 requests that had fetched it just before could still be using it. Those requests failed. A replaced or removed provider now stays open for a grace period of a minute and is then closed once, however often it was retired. The manager's Close closes the ones still waiting. The global provider is now the manager's default one, looked up on each use, so a reload can't leave it pointing at a closed instance. A provider set with SetGlobalKMSProvider still takes its place until the next load, which clears it. Passing nil hands it back to the manager's default, where before it turned KMS off until the next load. While a retired provider is global, its retirement is held with no timer, and it starts again once it isn't. SetGlobalKMSProvider no longer closes the provider it replaces, since the caller owns what it passes. A provider InitializeGlobalKMS created belongs to the package, so it's closed once another global provider replaces it. The manager's Close clears the global provider if it's one the manager closes, so it isn't used closed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * kms: read the global override and the default provider under one lock Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * kms: check the replaced global instance is held before unsetting it Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * kms/openbao: close the reload test's providers through the manager 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> |
||
|
|
66262d8e94 |
codespell: accept seaweed-block's protocol terms and identifiers
AAS (iSCSI ALUA Access State), Data-Out (dout), plus a few identifiers and fixture literals in the imported module. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
b20fcb92b0 |
seaweed-block: refuse a CSI replicationFactor beyond int32
Same change as the module's upstream commit b9ee7f1c (#1011), applied under seaweed-block/: an oversized StorageClass replicationFactor is refused as InvalidArgument instead of wrapping on conversion. Ships in seaweed-block v1.1.1; a later sync carries the identical change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
87d52c6840 |
codespell: skip TLA+ specs and accept the NVMe term AER
The imported seaweed-block tree has TLA+ models (\notin is TLA+ syntax) and NVMe docs that use AER (Asynchronous Event Request). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
cd0f60a2f0 |
seaweed-block: bump google.golang.org/grpc to v1.83.2
Same go.mod/go.sum change as the module's own upstream commit 8051b18e, applied under seaweed-block/. Clears the dependency review of the imported v1.1.0 tree (grpc 1.80.0 advisories); a later sync of the module carries the identical change, so it merges cleanly. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
dbf0f3bb35 | docs: regenerate star history chart | ||
|
|
e9b51cb242 |
mount: stop the filer walk at a live filer's "not found" (#13357)
* mount: stop the filer walk at a live filer's "not found" With several filers listed and some of them down, a lookup that the live filer answered with "not found" went on to the dead filers. Their dial error replaced the answer, so the walk retried it as a transient failure: the mount failed to start when filer.conf did not exist, and looking up a missing file or creating a new one failed with an I/O error after about 40 seconds. Stop at a missing entry the way a filer verdict already stops the walk, and keep the walk on the filer that answered. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mount: test a live filer's "not found" next to dead filers Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
c46567084f |
sftp: read downloads as the file's logical content (#13355)
* sftp: read downloads as the file's logical content Downloads read through filer.NewFileReader, which stops at the last stored byte: holes between chunks, a tail no chunk stores and the zeros after partial inline content came back missing, so sparse files downloaded short or with later bytes shifted. Read chunked files through filer.ChunkReadAt with one shared ReaderCache, set up as WebDAV's: it serves FileSize bytes, zero-fills what no chunk stores, resolves manifests, prefetches and re-looks-up moved volumes. Closing a handle only releases its stream, as S3 does. Inline content is read up to the file's size, then zeros. This replaces sftpd's own block cache, whose LRU helper is now unused. * sftp: read large downloads in sections, as the FUSE mount does ChunkReadAt walks the file's chunk views from the start on every read, so a sequential download of a file with many chunks costs time quadratic in its chunk count. Read through filer.ChunkGroup instead, the reader of a mount's file handle: it keeps chunks in 64 MiB sections, returns EOF at the file size for any offset, and holds every open file's buffers to one shared budget (the mount's default 256 MiB). * sftp: cache remote-only content on open instead of refusing it A file whose content only a remote store holds is copied into the cluster with CacheRemoteObjectToLocalCluster when it is opened for reading, as a mount's read and the filer's HTTP read do, and then read from the cached chunks. It is still refused when the remote store cannot be read. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Denis Maier <denis@dAir.lab> Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
9290e6d69e |
sftp: honor the CREATE, EXCL and APPEND open flags (#13354)
* sftp: honor the CREATE, EXCL and APPEND open flags An upload open ignored three of its flags: - Without CREATE, opening a missing file created it on close. It now fails with NO_SUCH_FILE, as OpenSSH's sftp-server and SFTPGo do. - CREATE|EXCL on an existing file succeeded and overwrote it. The open now creates the empty file with an exclusive filer create, so it fails when the name is taken, also while another exclusive upload of it buffers. - APPEND wrote at the client's offset, usually 0, over the start of the file. A write below the size the file had at open is now refused, as SFTPGo does. Writes keep their offsets rather than going to the current end, because pkg/sftp may run a client's pipelined writes in any order. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * sftp: leave a file alone when an open of it changes nothing An APPEND open whose writes were all refused still uploaded the copied bytes on close, which rewrote the file and handed it to the session's user. Any open that copied the existing file now uploads only once the handle writes or sets attributes, not only read-write opens. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Denis Maier <denis@dAir.lab> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com> |
||
|
|
7c4b39bee1 |
s3api: list object metadata with ListObjectsV2 metadata=true (#13351)
* s3api: list object metadata with ListObjectsV2 metadata=true A client that needs the type or user metadata of the objects it lists has to HEAD each key. MinIO answers ListObjectsV2 with metadata=true by adding each object's metadata to the page as <UserMetadata>, one element per field, and its clients ask for it: minio-go ListObjectsOptions.WithMetadata, minio-java ListObjectsArgs.includeUserMetadata, minio-py list_objects(include_user_meta=True), and mc find --metadata. With metadata=true each listed object carries the Content-Type and the x-amz-meta-* fields GET and HEAD send for it, keyed as MinIO keys them (content-type, X-Amz-Meta-Name). A symlink made through a mount lists with inode/symlink and X-Amz-Meta-Seaweedfs-Symlink-Target, so links can be told apart in a listing without a HEAD per key. As in MinIO, a key's metadata is listed only for a caller allowed to read that key, through the per-key check CopyObject uses for its source, so a List grant alone shows no more than before and an anonymous caller gets none. Without the parameter, and on ListObjects V1, nothing changes. HEAD and the listing share one Content-Type rule. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3api: hide listed metadata a tag-conditioned policy denies GET decides the bucket policy again on the object's entry, so a Deny on s3:ExistingObjectTag refuses the read. The metadata=true listing only ran the key check, which sees no tags, and listed the metadata of an object GET refuses. Decide it on the listed entry too. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3api: keep setResponseHeaders' doc comment on it Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3api: list a versioned object's metadata from its version file The pointer cached on a .versions folder keeps an object's size, mtime, ETag, owner and storage class, but not its type, user metadata or tags. A metadata=true listing built from it showed a content type guessed from the name and no x-amz-meta-* fields, and decided tag-conditioned policies without the version's tags. Such a listing now reads the current version's file, as GET and HEAD do; other listings keep using the pointer. Reading the file also needed its path fixed: the fallback looked for it under "<key>/.versions/", while versions live in "<key>.versions/", so a pointer without the cached fields dropped the object from a listing or failed it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3api: fold latestVersionEntryFromDirectoryEntry into getLatestVersionEntryFromDirectoryEntry Every caller passes useCached, so the flag goes on the existing name rather than a second function beside it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3api: fail a listing on a version file that cannot be read With metadata=true every versioned key reads its version file in the walk's .versions branch, which skipped the key on any error. A failed read then answered a page that silently lacked the key, and a client paging on could step past it. Skip only a version file that is gone, as settlePendingNull and the version resolution do, and fail the listing on any other error so the client retries it. The fallback now wraps the lookup error with %w, so a removed version file still reads as not found there. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3api: list the remaining version when the pointer names a removed file A .versions pointer can name a version file that has since been removed, as when a delete lands while a listing reads it; with metadata=true every versioned key reads its file. GET rescans .versions/ and self-heals the pointer, but the listing skipped the key, which left a null object listed just before its .versions sibling as the key's current version even when a newer version remains. The listing now recovers read-only by the rescan it already uses for a missing pointer: it lists the version that remains, or the null object when that is newer. When nothing current remains, it retracts a null object listed just before the folder, as settlePendingNull does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3api: fail a listing when the null object cannot be read The listing's .versions rescan treated any failed read of the base-path null object as its absence. When that read failed for a moment and the scan found no versions, the walk retracted the null object it had just listed and answered success, paging past a key that still exists. The rescan now returns such a read error, which fails the listing as an unreadable version file already does; only a genuine not-found counts as no null object. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3api: keep a directory from standing in for the null object in a listing rescan The listing's .versions rescan read the base path and took whatever it found as the null object. When the base path is a bare directory that holds child keys, a directory newer than the remaining version replaced it, and the listing dropped the key although GET answers that version. The rescan now admits the base entry only when isNullVersionObject accepts it, as GET's recoverLatestVersionWithoutPointer does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com> |
||
|
|
4a0bc7fe83 |
mount/page_writer: count only uploads that park after the test starts waiting (#13352)
An earlier test can leave an upload parked on its read that goes on only after the next test has counted it. The count of parked uploads then never grows by the ones the next test parks, and it fails after 5s. Track the parked uploads by goroutine id and wait for new ones instead. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
874bc97814 |
s3api: answer 400, not 500, for list prefixes and markers that are not valid UTF-8 (#13350)
* s3api: refuse list prefixes and markers that are not valid UTF-8 A prefix, start-after, marker or continuation token holding bytes that are not valid UTF-8 reached the filer's listing request, which cannot carry them, and the failure answered 500 InternalError. ListObjects and ListObjectsV2 now answer 400 InvalidArgument for such a prefix or marker, and the "continuation token provided is incorrect" InvalidArgument for such a token, before listing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3api: refuse version list prefixes and key markers that are not valid UTF-8 ListObjectVersions sent the prefix and key-marker to the filer as well, so bytes that are not valid UTF-8 there also answered 500. They now answer 400 InvalidArgument. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3api: test listings with parameters that are not valid UTF-8 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
dc500b2cde |
kms/local: create on-demand keys only for new data keys (#13346)
With enableOnDemandCreate, every lookup of a missing key created it, so a Decrypt or DescribeKey naming a key that didn't exist got a new key instead of an error. Only GenerateDataKey creates keys now, since no other request can succeed with a key that didn't exist before it. An alias gets a key with a generated ID, as it would in AWS, instead of a key whose ID is the alias, and a key ARN spelling an alias, which names no key, creates none. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
2c48e8a014 |
worker: dir_usage keeps the sizes of buckets and their large directories (#13345)
* shell: fs.du walks with a shared treewalk.Walker The walker fs.du used moves to a new package, filer/treewalk, so that the dir_usage job proposed in #13257 walks the same way. fs.du adds up what its visitor is told; what it prints and how it fails stay the same. A page now also carries the snapshot the filer listed it at, and when it was listed. treewalktest serves a tree from memory and logs an event for each change, for the tests of walks and of what follows. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer/treewalk: Seed adds up a walk and the events logged while it runs Seed walks a directory tree while it follows the metadata log below it, and reconciles the two, so that the result is the tree as of one log position: - an event at or before the snapshot of the page that lists its name shows in that page, and so does an event in a directory not listed yet; - an event after the page's snapshot replaces what the page counted for the name, since the page may or may not show it; - once a page is older than a margin, a minute by default since a rename logs its events after the move, an event changes the entry from its old to its new entry. A directory missing from its parent's page counts from its events if it was created after that page's snapshot, and not at all otherwise. This is how the mount's metadata cache builds a directory from a listing and the events around it, with a replace per name in place of the cache's overwrite, which a running total cannot do. Follow reads the events of a range of the log. The lookup of where the log starts moves here from filer_ttl as LogStartTsNs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * worker: dir_usage keeps the sizes of buckets and their large directories A plugin worker job, off by default, that keeps what fs.du adds up of each bucket and each top-level directory outside the buckets folder, and of each directory in it holding at least 1% of its bytes, down to 10 levels. Directories at one depth do not overlap, so a bucket has at most 1,000 such records, whatever the shape of its tree. They are one JSON file per bucket under /etc/seaweedfs/dir_usage/<store signature>/. The buckets without a record are seeded in one treewalk.Seed walk of the buckets folder, and the top-level directories in one of /. After that, each run replays the events since the last run, up to a minute before now, applies each to the directories with a record above the entry, writes the files that changed, and saves a cursor that meta_log_purge keeps the log for. A record the log no longer reaches is seeded again, and so is every record when no log is kept and the cursor is older than the purge honors. A tracked directory that moves keeps its record, which the events of the entries it took along fill again. One deleted with totals left had entries that went without events, as when a store drops a whole bucket, and the rest comes off the directories above it. A bucket created since the last run is seeded by the next. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * shell: fs.du -report prints what the dir_usage job keeps fs.du -report [-depth=N] path prints the totals the dir_usage job keeps of path and of the directories below it with a record, down to N levels, the way fs.du prints a walk, and how old they are: as old as the job's cursor for a record the last replay did not change. Nothing is walked. For / and the buckets folder, the buckets and top-level directories add up. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * treewalk, dir_usage: wait for the filer's own position, stop waits on cancel A subscription with an end stops once it has read everything the filer has logged, without waiting for the end to come. So the seed's catch-up now waits until the filer's listing snapshot reaches the seed's end, and a replay ends at the snapshot the filer gives when it starts, both on the filer's clock rather than this process's. - A walk waiting for its pages to free names stops when its context ends. - A seed reports the listing that failed, not the cancellation it caused. - A walk canceled while the last page's subdirectories start fails. - LogStartTsNs passes over a day a purge that stopped midway left empty. - A bucket dropped while the buckets folder is seeded gets no record; the next run seeds it if it is made again. - Detection keys a store's job by its signature, so no two runs share a store whichever filer each starts from. - The buckets folder is taken without a trailing slash. - fs.du -report names the buckets and top-level directories it leaves out for want of a record, and no longer says why a directory has no total of its own. - treewalktest.Filer replays a quiet drop with what was below it, and can refuse a listing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * treewalk: list a page again after a transient failure A seed walks every bucket without a record in one walk, which on a large store runs for hours. One page that failed because the filer restarted or a connection dropped failed the whole walk, and the next run started it over. A page that fails with a transient error is now asked for again, with backoff, for up to a minute. Other failures still end the listing at once. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * dir_usage: keep the other seeded records when one fails to save A save that failed after a seed returned at once, so the records of the batch not saved yet were lost, and the top-level directories were not seeded at all when it was the buckets' batch that failed. The next run walked them all again, which on a large store takes hours. A failed save is now reported and the run goes on; the next run seeds only that root. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * treewalk: measure how far the filer's clock runs ahead in a seed A page's end is on this host's clock and the events it is compared to are on the filer's, so a filer clock ahead by more than the margin expired pages before the events they show arrived, and set the seed's end before positions the filer had already logged. The seed now learns a lower bound of the filer's lead from the page snapshots and the event stamps, and adds it to page expiry and to the end. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mini: expect the dir_usage handler among the default job types 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> |
||
|
|
18ba10b535 |
s3api: answer KeyTooLongError when the filer refuses an object's name (#13349)
* s3api: answer KeyTooLongError when the routed PUT's name is refused The filer checks an entry's name length before its first mutation stores anything, so a routed PUT refused with ENTRY_NAME_TOO_LONG on mutation 0 is a definite refusal, not an ambiguous outcome. Treating it as ambiguous sent a zero-byte PUT, which has no chunks to verify, to 503. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3api: test a routed PUT refused for its name length Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3api: keep the filer's error code when a routed mkfile is refused routedMkFile flattened the transaction's error into a string, so callers could not tell a refused name from an internal failure, and a CopyObject to a name the filer refuses answered 500. Wrap the code's sentinel, as CreateEntry does, so the existing error mapping answers KeyTooLongError. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3api: test a routed mkfile keeps the filer's error code Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3api: answer KeyTooLongError when a multipart completion's name is refused Completing an upload whose last key segment the filer refuses answered 500 InternalError. The refused create stores nothing, so answer KeyTooLongError as PutObject does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
7a51f796ab |
Import seaweed-block v1.1.0 with its history into seaweed-block/
The seaweed-block repository (v1.1.0, revision ff6b0b1b) is imported with its full history, rewritten into the seaweed-block/ directory. It keeps its own go.mod and module path, so the root module's builds do not include it. Development continues in the seaweed-block repository until v1.1.1; the later sync merges the same rewritten history. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
4f6c138beb |
sftp: report file owners in stat and listings (#13340)
Stat, lstat and directory listings always showed uid 0 and gid 0, although the filer stores the uploader's Uid and Gid. pkg/sftp only sends the owner when the os.FileInfo implements its FileInfoUidGid interface (Uid() and Gid()). EnhancedFileInfo exposed the owner through an Owner() method and a custom Sys() struct instead, which pkg/sftp never reads. Implement Uid() and Gid() on EnhancedFileInfo and drop the unused Owner(), Sys() and FileStat. Add a test that serves a session over in-memory pipes and checks the owner returned by Stat and ReadDir. Co-authored-by: Denis Maier <denis@dAir.lab> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
71b1911e44 |
mount: answer statfs from the stats at hand, refresh them in the background (#13337)
StatFs asked the filer for Statistics whenever its stats were older than 20 s and waited for the answer, up to the 20 s filer RPC timeout, so a slow filer or master held statfs for that long. A node agent that probes mounts with a bounded statfs, as the CSI driver's health monitor does with 5 s, took such a mount for hung and restarted it, on every node at once when the filer was slow for all of them. Every concurrent statfs also sent its own request while the stats were stale. StatFs now answers from the stats it has and starts a refresh in the background when they are older than 20 s, one at a time. Only the first statfs waits, for the first refresh. A refresh the filer does not answer keeps the last known stats, as before, and the next one starts 20 s after it. The stats are now read and written under a lock: the refresh and the quota check write them while statfs and the quota check read them. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
333c32d610 |
sftp: keep a folder a folder when its mode is changed (#13341)
chmod on a folder over SFTP failed with "existing entry is a directory". SETSTAT copied the client's mode into the entry as-is. A client sends only the permission bits, so the directory bit was dropped and the filer refused an update that would turn the folder into a file. Files lost their stored type bits the same way, just without an error. Keep the stored type bits and take only the permission, setuid, setgid and sticky bits from the client. Co-authored-by: Denis Maier <denis@dAir.lab> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |