mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-12-04 18:17:16 +01:00
dbf0f3bb35a0bd96265648dd7549a8ea5364fa3a
16804
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
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> |
||
|
|
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> |
||
|
|
4cef7c1f41 |
sftp: refuse to read a folder instead of returning no data (#13339)
* sftp: refuse to read a folder instead of returning no data Opening a folder for reading succeeded and every read returned EOF, so a client that downloads without checking the type first saved an empty file. readFile now refuses a directory, which reaches the client as SSH_FX_FAILURE, as the read(2) of a directory does on OpenSSH's sftp-server. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * sftp: refuse to read a symlink instead of returning no data A symlink entry, as weed mount creates it, keeps its target in SymlinkTarget and stores no content, and readFile does not follow it, so a download of one also came back as an empty file. Refuse it with OP_UNSUPPORTED. 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> |
||
|
|
65d082e788 |
sftp: answer unsupported requests with OP_UNSUPPORTED (#13342)
* sftp: answer unsupported requests with OP_UNSUPPORTED SYMLINK and the hardlink@openssh.com extension were answered with SSH_FX_FAILURE ("unsupported: Symlink"). Clients such as OpenSSH sftp and rclone use SSH_FX_OP_UNSUPPORTED to fall back; FAILURE reads as an attempt that broke. Return sftp.ErrSSHFxOpUnsupported instead, before path resolution, since a symlink's Filepath is the raw link target. The version reply also used pkg/sftp's default extension list, which advertises hardlink@openssh.com and statvfs@openssh.com. Weed implements neither, so advertise only posix-rename@openssh.com. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * sftp: check the OP_UNSUPPORTED status a client receives for a symlink Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * sftp: answer READLINK with OP_UNSUPPORTED Without a Readlink handler pkg/sftp sends READLINK to Filelist with Method "Readlink", and listDir listed the path: a folder answered with its first child's name as the link target, and a file or symlink with NO_SUCH_FILE. Answer it, and any other method Filelist does not serve, with OP_UNSUPPORTED like SYMLINK and hardlink. 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> |
||
|
|
7c41ed0635 |
kms: swap a reload's providers in as a whole, after S3 parses its identities (#13344)
* kms: build every provider before a reload swaps them in A reload replaced the providers one at a time, closing each old instance as its replacement went in, and kept the providers and bucket mappings the config no longer listed. Between closing the old default instance and setting the new global provider, S3 could get the closed instance. A reload now builds every provider first and swaps the whole set in at once, along with the default, the bucket mappings and the global provider. The default provider failing still fails the reload, and then nothing changes. Any other provider that fails keeps its previous instance. Providers the config no longer lists are dropped, and a bucket mapped to one falls back to the default. A manager other than the global one no longer sets the global provider. The manager no longer keeps the provider configurations, which nothing read. Each load health-checks every provider once, after the swap, for filer.toml as for the identities file. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3api: parse the identities before loading KMS Loading the S3 config loaded KMS before parsing the identities, so a file whose identities didn't parse still replaced the KMS providers. A file without a kms block left the previous providers in place, and one with a number out of float64 range, which protojson accepts, skipped KMS without an error. The identities are now parsed first, and a file that fails there changes neither. A file without a kms block drops the providers, so a reload that took the block out turns SSE-KMS off. A file encoding/json can't read fails the KMS load with an error that doesn't quote it, as it could quote key material. A KMS load that fails is logged as an error, not a warning. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * kms: skip a bucket mapping with an empty bucket name SetBucketKMSProvider refused an empty bucket name, which the rebuilt mappings no longer went through. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * kms: check a rejected load leaves the installed provider open 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> |
||
|
|
f1562aa130 |
filer: keep a child's chunks in a recursive delete when its rule retains them (#13338)
* filer: keep a child's chunks in a recursive delete when its rule retains them A recursive delete batched each child file's chunks and checked only the deleted directory's disableChunkDeletion, so a file under a more specific rule lost chunks that deleting it alone keeps. Check the child's own rule, the one that already decides its fsync. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: assert which chunk a recursive delete queues under a retaining child rule Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
1858665311 |
util/http, operation, topology: give the DELETE helpers a deadline (#13333)
* util/http, operation, topology: give the DELETE helpers a deadline Delete and DeleteProxied made their request without a context and read the whole answer. Only the shared client's 30 s response header timeout bounded them, and nothing bounded an answer whose body never ends. - The cleanup after a failed chunk upload (deleteChunkFromHolders, used by PutObject and every chunked upload) asks the holder that just failed the write, often the one that stalls. A holder that did not answer held the upload for 30 s per holder and attempt, with the chunk's buffer. One that sent its headers and stalled held it for good, and the holders after it were never asked. Each delete is now bounded by cleanupDeleteTimeout (10 s), as the copy path's cleanup is by copyCleanupTimeout (#13297). A delete that runs out is logged and leaves the needle, as a failed delete did before. - A delete forwarded to a replica that does not answer held the primary's DELETE for 30 s, while a forwarded write fails at replicaRequestTimeout. The delete forward now has the same bound, as the Rust volume server's replica_request already gives deletes. Its timeout is counted as a timeout, through replicaDeadlineError, which the write forward uses as well. Delete and DeleteProxied take a context. benchmark and the unmaintained repeated_vacuum pass context.Background(). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * topology: let a replica's failure leave the other replica deletes running DistributedOperation cancels its context when the first replica fails, and the delete deadline was derived from it, so a sibling's failure could cut the deletes to the other replicas short. The old context-free Delete kept them going, and they must: the needle is gone on this server already, so a replica that is not asked keeps its copy. Each delete now takes its deadline from context.Background(). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * topology: read the replica delete bound once, before the fan-out A replica delete that outlives ReplicatedDelete read the package bound again after its answer, racing a later caller that changes it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com> |
||
|
|
370fd46ed9 |
filer/elastic: report a failed read as an error, not as a missing entry (#13334)
* filer/elastic: report a failed read as an error, not as a missing entry FindEntry returned filer_pb.ErrNotFound for any error from Elasticsearch other than not-found, so a lookup that timed out or met an unavailable cluster answered that an existing entry was gone. It now returns the error, as #13287 and #13289 made the TiKV, MongoDB, ArangoDB and RocksDB stores do. KvGet reported a value it could not decode as missing. It now returns the decode error. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer/elastic: keep a top-level directory whose lookup failed DeleteEntry looked up a top-level entry to decide whether to drop its index, and treated a failed lookup like a file: it deleted the entry and left the directory's index behind. Return the lookup error instead, so the delete fails and a retry drops the index. 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> |
||
|
|
5dafe56a63 |
mount: let SEEK_DATA and SEEK_HOLE see data that is not in the chunks (#13335)
* mount: let SEEK_DATA and SEEK_HOLE see data that is not in the chunks Lseek searched only the file's uploaded chunks. Writes not uploaded yet, inline content and the data of a remote file that is not cached are not in them, so for such a file SEEK_DATA answered ENXIO and SEEK_HOLE found a hole at the offset. A program that copies by data ranges, such as qemu-img, takes the data for a hole and writes zeros in its place. A file whose data is not all in its chunks is now answered as one data range without holes, as lseek(2) allows: SEEK_DATA returns the offset and SEEK_HOLE the end of the file. The upload pipeline attaches a chunk before it counts the upload as done, and writes hold the handle lock that lseek shares, so a file with no pending upload has all its written data in its chunks. Lseek also read the file size without the entry lock, while upload workers append chunks under it. It now holds the lock for that read. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mount: answer lseek from the chunks of a cached remote file A remote file keeps its RemoteEntry once cached, so checking only for RemoteEntry reported every such file as one data range. Use IsInRemoteOnly, as Read does, so the holes of a cached file are found. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mount: trim the lseek 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> |
||
|
|
34d36e599a |
mount: drop a directory's listing when the cache refuses an entry update (#13336)
* mount: drop a directory's listing when the cache refuses an entry update UpdateEntry and UpdateEntryChecked returned the store's error and left the entry in the local store as it was. The mount uses them to refresh the other names of a hard-linked file after a link or an unlink (syncHardLinkSiblings), which only logged the error at V(4). With a full cache disk the siblings kept their old link count and ctime until their directory was read again. A refused update now drops the listing of the entry's directory, as dropListingsOf does for an event the store cannot take (#13141), so the next lookup there goes to the filer. The listing is dropped after the cache lock is released, as dropListingsOf does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mount: shut the meta caches of the refused update test down Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
5e4b2fc42f |
docker: one FIPS mode for the Go processes and the Rust binaries (#13296)
* docker: one FIPS mode for the Go processes and the Rust binaries In the image, Go processes ran with fips140=on by default (#7590) while the Rust binaries, which take their mode from fips.mode alone, ran with unrestricted TLS; and WEED_FIPS_MODE=off or strict made every Go process refuse to start, since the entrypoint's fips140=on did not match. The entrypoint now states the image's mode once, as WEED_FIPS_MODE_DEFAULT=on, and gives Go processes the fips140 GODEBUG that matches WEED_FIPS_MODE, else that default. The Rust binaries use the default when neither WEED_FIPS_MODE nor fips.mode sets a mode; Go processes check their GODEBUG against it and refuse to start on a mismatch, naming WEED_FIPS_MODE as the way to pick another mode. Setting WEED_FIPS_MODE_DEFAULT empty leaves every process in its own default, as outside the image. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docker: take the image's FIPS mode from a fips140 the caller sets GODEBUG=fips140=off, the entrypoint's advice since #7590, made every Go process exit once the Rust binaries joined the image's mode. The entrypoint now maps the caller's fips140 to WEED_FIPS_MODE_DEFAULT, so Go and Rust run in that mode and the old advice keeps working. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docker: say fips.mode alone cannot change the image's FIPS mode Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docker: read an empty fips140 as off and debug as on, as Go does Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docker: warn when GODEBUG fips140 picks the image's FIPS mode The entrypoint keeps translating a caller's fips140 into the mode for the Rust binaries, so existing docker run setups keep starting, but logs that WEED_FIPS_MODE is the setting that also covers launches without the entrypoint. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docker: set the FIPS mode after dropping privileges Running as root, the entrypoint re-runs itself through su-exec, and the second pass took the fips140 the first pass had exported for the caller's own, warning on default starts and prepending fips140 twice. 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> |
||
|
|
8afef5166b | sftp: serve reads on read-write opens instead of writing zeros (#13343) | ||
|
|
0daa7558e2 |
filer: propagate HBase and remote child deletion errors (#13328)
* test/s3: FsMkdir no longer fails on its own in the rclone fstests expected_failures.txt listed the test itself because DeleteBucket answered BucketNotEmpty at the end of the run. Since #13311 a null delete marker can be deleted, the bucket ends up empty, and the check has failed on master and on every pull request the workflow runs for: TestIntegration/FsMkdir: now fails only through its subtests, remove it from expected_failures.txt * filer/hbase: propagate errors when deleting directory children * filer: reclaim HBase chunks after each confirmed row deletion * filer: return a child's remote delete error from a recursive delete Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: drop the per-row folder delete store capability Keep the HBase scan and row-delete errors reaching the caller without a new FilerStore capability. A store that fails partway through DeleteFolderChildren leaves already-removed rows' chunks to volume.fsck, as every non-transactional store already does. 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> |
||
|
|
f4290b5ec2 |
kms/local: resolve key and alias ARNs (#13331)
* kms/local: resolve key and alias ARNs AWS KMS takes a key's or an alias's ARN wherever it takes a key ID or an alias, and the local provider hands out ARNs in DescribeKey, but it looked them up as plain names, so an ARN named no key. A local ARN now resolves to the key or alias it names, in requests, in the keys list's key_id and aliases, and in CreateKey's aliases. An ARN with an empty key ID names no key. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * kms/local: register a key created by ARN under its key ID Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * kms/local: refuse a key ARN listed as an alias Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * kms/local: refuse a key ID that is an ARN of an ARN Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * kms/local: resolve a key ARN only to the key with that ID Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * kms/local: create an on-demand key under the ID its ARN names Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * kms/local: decrypt keeps the key ARN a ciphertext was wrapped under A key configured by its ARN had that ARN as its ID before key ARNs resolved, and S3 stored it with each object and compares it with the ID Decrypt returns. 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> |
||
|
|
63e15ce1ea |
kms: take the default provider from the config being loaded (#13332)
* kms: take the default provider from the config being loaded S3 wraps and unwraps data keys with the default provider alone. Without default_provider, the loader made the first provider the manager listed the global one, and the manager still holds the providers earlier loads listed, so a reload could leave S3 on a provider the config dropped. The manager's own default, which buckets without a mapping use, was left unset. The default is now the first provider by name in the config being loaded, for both. A default_provider that isn't listed under providers fails the load before any provider changes, where before it could name a provider left over from an earlier load. With more than one provider and no default_provider the load logs a warning, as adding a provider whose name sorts first would switch S3 to it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * kms: load the default provider first and fail the load if it can't be loaded A load whose default provider failed replaced and closed the other providers first, so S3 could be left on a closed instance of one of them as the global provider. 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> |
||
|
|
a7c1cc32ec |
s3api: fail closed when the directory marker lock check cannot read the marker (#13326)
* s3api: refuse a directory marker PUT when the existing marker cannot be read Only a missing marker skips the Object Lock check. Any other lookup error now fails the request instead of letting mkdir replace a marker that may be under retention or legal hold. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3api: create the Extended map before applying upload ACL metadata A directory extracted from a zip without an owner header reached applyPutObjectACL with a nil Extended map and panicked. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3api: refuse extracting over a marker that cannot be read The zip extract mkdir path had the same fail-open lookup as the directory marker PUT; a failed read now reports InternalError for the member. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
d6d5e99f9b |
s3api: limit service account keys to their stored actions (#13325)
* s3api: limit service account keys to their stored actions A service account created with an action subset authenticated as its parent and was authorized with the parent's full permissions. Map each restricted service account key to a copy of the parent that carries the subset as a boundary, and check it in the S3, bucket listing and IAM authorization paths. An empty action list still inherits the parent. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3api: drop restricted service account keys with their removed parent RemoveIdentity only dropped keys that mapped to the parent itself, so a restricted service account key, which maps to its own bounded copy, kept authenticating after the parent was deleted. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * sts: keep restricted service account keys out of their parent's roles A named role is admitted by its trust policy alone, so a service account key limited to Read could assume any role trusting its parent and use the role's permissions. Require the key's action subset to allow sts:AssumeRole. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3api: let a service account's scoped upload listing grant pass its boundary The upload and part listing routes are authorized as Read, and the legacy path falls back to the listing grant. The boundary check now does the same, so a service account limited to ListBucketMultipartUploads can still list uploads without being allowed object reads. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * sts: refuse self sessions for restricted service account keys AssumeRole without a RoleArn and GetFederationToken issue sessions that carry the caller's own policies, which for a service account are its parent's. A restricted key would shed its action subset that way, so refuse both for it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * sts: give the restricted service account role test its own role Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3api: check a restricted key's parent grants apart from its boundary The boundary is checked against the request first, so the legacy action check only has to cover the parent's grants. Checking the boundary there again without the request denied a Read parent's upload listing to a key limited to ListBucketMultipartUploads. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
515b905011 |
s3notification: lose the test lock on the fetch of the records' partition (#13324)
TestALeadThatLostItsLockDoesNotSend dropped the forwarder lock on the first fetch of any partition, then waited for a fetch of partition 0. When another partition's goroutine fetched first, the lead stopped before partition 0 was fetched and the wait timed out (seen on the 32-bit job). The hook now gets the request and drops the lock on partition 0's fetch. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
1606fe4f39 |
operation: resend an upload that hits a broken pipe on a stale connection (#13322)
* operation: resend an upload that hits a broken pipe on a stale connection A pooled connection the server has closed fails an upload in one of three ways, depending on when the close reaches the client. Two of them, a reset and a closed connection, already get the request resent once with its body rewound. A broken pipe did not. A volume server closes a connection idle for 30 seconds and the client keeps idle ones for 90, so a request that reuses a connection as it turns 30 seconds old races with the close. The forward of a write to a replica makes a single attempt: there the write failed with a 500, and the needle already stored on the primary stayed on that one replica. * seaweed-volume: resend a replica forward that hits a reset on a stale connection The Rust replica forward made one attempt, so a pooled connection the peer closed at its idle timeout failed the write with a broken pipe or a reset, as the Go forward did before. Resend it once on a new connection, as Go's upload_content does. 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> |
||
|
|
2f300c2969 |
s3api: keep the in-flight upload counters 64-bit aligned on 32-bit (#13321)
The recursiveListDeclined sync.Map placed ahead of inFlightDataSize and inFlightUploads moved them off 8-byte alignment on 386, so the first throttled upload panicked with "unaligned 64-bit atomic operation". atomic.Int64 is aligned wherever it sits in the struct. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
006885232e |
master: start file ids past the ones a previous master may have handed out (#13320)
* master: start file ids past the ones a previous master may have handed out
The file id sequence lives in memory. A master that starts, or takes over
as leader, continues it from what the volume servers report: the largest
needle id each of them holds. That is the largest id written, not the
largest one handed out, so the ids of uploads that had not landed when the
previous master was lost are handed out a second time.
Two uploads then hold one needle id in one volume with different cookies.
The one that lands second is refused, and deleting its file id, which goes
by needle id, removes the needle of the other: a file the filer had
answered 201 for lost its chunk on every replica that way.
A volume server's first report to a master now sets the sequence past its
largest needle id by a margin instead of right after it. Later reports
count as before, and a server that holds nothing adds no margin.
* master: shorten the unwritten file id margin comments
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* master: record the file ids handed out through raft
Starting a margin past a volume server's first report does not hold for
two masters lost in a row: with nothing written in between, the second one
gets the same report and hands out the same id.
The master now records through raft how far it may hand file ids out
before it does (MaxVolumeIdCommand.FileIdCeiling, a step of 2^20 ids at a
time), and every master moves its sequence past what another one recorded,
from the log or from a snapshot. An id goes out only when it was drawn
under a ceiling this master recorded itself: recording one applies what
the masters before recorded first, so an id drawn after that is past all
of theirs, and one drawn before it is dropped.
A master that does not know the field ignores it. Snowflake ids are made
from the clock and are left alone.
* master: leave room for a file id draw larger than the ceiling step
A draw of more ids than fileIdCeilingStep never fit under the ceiling
recorded after it, so the assignment kept recording ceilings through raft.
The record now covers the dropped draw and the next one, and a count past
2^32 is refused before the additions can wrap.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* master: tell a recorded file id ceiling apart from another master's
A master that took over could propose the same ceiling the one before it
recorded and it had not applied yet. Applying that entry then looked like
applying its own, so its sequence stayed below ids the other master had
handed out. Each record now carries an id of the master process, and only
an entry with that id and value leaves the sequence where it is.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* master: charge assigned bytes only once the file id is recorded
An assignment that failed to record its file ids kept the bytes charged to
the volume, which could mark a volume near its limit full for an upload
that never came.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* master: move the sequence before publishing a file id ceiling
An assignment that loaded a ceiling another master recorded, before the
sequence had moved past it, could draw an id below it when this master had
proposed the same value.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* master: test that a failed file id record charges the volume nothing
The order
|
||
|
|
217795e34c |
Continue prefix listings on unordered filer stores (#13330)
* filer: continue prefix listings on unordered stores
* test/s3: FsMkdir no longer fails on its own in the rclone fstests
expected_failures.txt listed the test itself because DeleteBucket answered
BucketNotEmpty at the end of the run. Since #13311 a null delete marker can
be deleted, the bucket ends up empty, and the check has failed on master and
on every pull request the workflow runs for:
TestIntegration/FsMkdir: now fails only through its subtests, remove it
from expected_failures.txt
(cherry picked from commit
|
||
|
|
390c5acc00 |
test/s3: FsMkdir no longer fails on its own in the rclone fstests (#13323)
expected_failures.txt listed the test itself because DeleteBucket answered BucketNotEmpty at the end of the run. Since #13311 a null delete marker can be deleted, the bucket ends up empty, and the check has failed on master and on every pull request the workflow runs for: TestIntegration/FsMkdir: now fails only through its subtests, remove it from expected_failures.txt Co-authored-by: MapleWhiteZZZ <18653045+MapleWhiteZZZ@users.noreply.github.com> |
||
|
|
605b5f7f79 | docs: regenerate star history chart | ||
|
|
3c9bdaca86 |
sftp: create uploaded files 0644, keep modes on overwrite, and support put -p (#13319)
* sftp: create uploaded files with mode 0644 The upload writer carried a 0644 mode that never reached the filer, so the PUT fell back to the filer default of 0660. Pass the mode on the PUT, as OpenSSH's sftp-server creates new files 0666 minus a 022 umask. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * sftp: keep an existing file's mode when an upload overwrites it An overwrite went through the same PUT as a new file, so a 0600 file came back with the default mode. Send the stored mode instead, as open(2) on an existing file keeps it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * sftp: apply an fsetstat sent while an upload is still buffering "put -p" sets the mode and times on the open handle before closing it, but the upload only reaches the filer on close, so the setstat found no entry and the client failed with "No such file or directory". Keep such attributes on the open upload: a size cuts the buffered bytes, the mode goes on the PUT, and the rest is set once the file is stored. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * sftp: clear the sub-second part of an mtime a setstat replaces SFTP times are whole seconds, but the stored nanoseconds of the old mtime stayed, so a touched or "put -p" file showed a time the client never set. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * sftp: set the attributes queued on an upload in its post-upload update A new file can be under its bucket's default retention as soon as the PUT stores it, and a setstat after that is refused, so "put -p" into such a bucket stored the file and then failed the close. Apply the queued attributes in the update that already sets the owner after the upload. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * sftp: leave a setstat alone when two uploads share its path A setstat carries only the path, so with two uploads of one path open in a session it went to whichever opened last, and a size cut the other upload's bytes. Route it to an upload only when that upload is the only one open. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * sftp: fail the close when an upload's queued attributes are not stored The setstat already answered success, so a failed post-upload update was only logged and "put -p" lost the times without the client knowing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
5038508fd9 |
shell: volume.fsck says how many chunks its cutoff left out of the missing-chunk check (#13318)
* shell: volume.fsck says how many chunks its cutoff left out of the missing-chunk check volume.fsck -findMissingChunksInFiler leaves out every filer chunk written within -cutoffTimeAgo, five hours by default, and did not say so. Run after volume servers lost power, it found nothing missing for exactly the files at risk: the ones written last. The check now counts the chunks it leaves out for the cutoff and ends with one line that gives the number and points at -cutoffTimeAgo. The default cutoff stays, and the orphan check is not touched. * shell: volume.fsck counts only the chunks its run would have checked The walk reads the whole filer, so a recent chunk on a volume that -volumeId or -collection left out of the run was counted too, and the report said a shorter cutoff would check it. Count a chunk only when its volume is one of the run's, or one the master does not list and -volumeId does not leave out, which is what the check itself looks at. * shell: volume.fsck applies -modifyTimeAgo before counting chunks the cutoff left out A chunk older than -modifyTimeAgo is not checked at any cutoff, so it does not belong in the count a shorter -cutoffTimeAgo would check. 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> |
||
|
|
a89971ff66 |
filer: delete the chunks a failed copy wrote (#13316)
* filer: delete the chunks a failed copy wrote A copy through the filer (POST dst?cp.from=src) writes the destination's chunks first and its entry last. When it ended before the entry was written (the client gave up, a chunk failed to copy, the entry write failed), the chunks already on the volume servers stayed there, with no entry to reference them and nothing to delete them. The fan-out now waits for the copies it started, starts no further one after a failure or once the request has ended, and deletes what the completed ones wrote. A chunk copy that fails deletes the file id it was assigned, as a failed write can still have stored the needle. A failed entry write deletes only the chunks the destination does not hold, since CreateEntry can fail after storing the entry. #13217 did the same for the S3 copy paths. * filer: keep the copied chunks when the entry write fails CreateEntry can fail after it stored the entry: the entry stays when only its parent folders could not be created. Reading the destination afterwards does not settle whether the chunks are live, since an entry that was stored may have been renamed by then, and deleting on a miss would take its data. So a failed entry write keeps the chunks, as it did before. Only the failures that come before the entry write delete what the copy wrote. * filer: fail a copy whose request ended after its last chunk A request cancelled once every chunk copy had returned still handed the chunks on, to an entry write that the cancelled context then fails, and that write keeps them. The end of the request now fails the fan-out whether or not a copy was left to start, so the chunks are deleted there. --------- Co-authored-by: MapleWhiteZZZ <18653045+MapleWhiteZZZ@users.noreply.github.com> |
||
|
|
ca4e568832 |
volume.check.disk: resurrect needles a vacuumed replica provably never had (#13304)
* volume.check.disk: resurrect needles a vacuumed replica provably never had -resurrectMissingNeedles copies a needle that is live on one replica and absent on the other only into a replica that was never vacuumed: a vacuum erases deleted needles together with their delete markers, so on a vacuumed replica an absent needle may be a delete. Once every replica has been vacuumed, a replica that lost writes, the tail of its volume after a crash for one, has no repair but copying the whole volume. A vacuum erases only among the needles the index holds when it commits. The volume now records the largest needle id it held then, deleted ones included, in its .vif (VolumeInfo.vacuumed_max_file_key), before the vacuumed files replace the old ones. A needle with a larger id that the replica has no index entry for was never deleted there, since no vacuum has touched its marker: it was never written there. volume.check.disk -resurrectMissingNeedles reads the record with the compaction revision and copies such needles back; absent needles up to the recorded id are left alone as before. The record is only good if no vacuum went unrecorded, so it starts at a volume's first vacuum and is kept through each one after it. A volume vacuumed before it had a record never gets one and keeps the present rule. A copy of a volume takes the record along in the .vif. * volume.check.disk: look at vacuumed replicas whose live counts match, and judge only what stays unrepaired Two replicas at different compaction revisions with equal live counts were skipped under -resurrectMissingNeedles when both had been vacuumed, since neither could take a needle back. One that recorded its vacuums can, and a missed write plus a missed delete leave the live counts equal. Under the flag such a pair is now compared. A run without -apply ends with a verdict on the needles one replica has and the other lacks. It counted the ones the run would have resurrected with -apply, so two replicas each missing needles above the other's recorded id were called a split brain not to be repaired. Needles above the recorded id of the replica lacking them are left out of the verdict. * volume: trust the vacuum record only at the revision it was written for A vacuum by a volume server that does not keep vacuumed_max_file_key (an older Go one, or the Rust one) erases delete markers above the record but leaves the .vif as it was. Once a server that reads the record serves the volume again, volume.check.disk -resurrectMissingNeedles takes those ids for missing writes and raises deleted needles. The record now names the compaction revision its vacuum produced. It is saved after the swap, so a vacuum that fails to record it leaves a revision that no longer matches, and check.disk and later vacuums only take it up while it equals the volume's live revision. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * volume: number the vacuum record fields 12 and 13 VolumeInfo 10 and 11 already carry other bool fields in a downstream build. A volume server of that build answering ReadVolumeFileStatus would read here as vacuumed_max_file_key 1 at revision 1, a record that lets check.disk resurrect every absent needle. The .vif is keyed by name, so only the wire numbers move. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * volume(rs): record the largest needle id a vacuum could have erased Mirror the Go volume server: VolumeInfo carries vacuumed_max_file_key and the compaction revision it was taken at (fields 12 and 13). commit_compact keeps the record through every vacuum once the volume has one, saves it after the swap, and drops it once a vacuum went unrecorded. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * volume(rs): keep the ids of cut tail needles in the decoded index The EC decoder dropped the .idx row of a deleted needle past the decoded .dat, so the compaction that follows recorded a vacuumed max needle id below it. volume.check.disk -resurrectMissingNeedles could then copy that deleted needle back from a stale replica. Write the row as a tombstone without the offset instead, as Go keeps every .ecx row. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * volume(rs): count tombstone keys toward the max file key on redb loads metrics_from_idx skipped the max-key update for tombstone rows, unlike Go's needleMapMetricFromIndexFile and the in-memory replay. A deleted tail needle then left a redb volume's vacuum record below its id. 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> |
||
|
|
add9d60378 |
s3api: list a versioned key whose .versions folder streams past the page (#13317)
* s3api: list a versioned key whose .versions folder streams past the page A key's .versions folder sorts after the longer keys it prefixes: "a.pom.versions" follows "a.pom.sha1.versions" although the key "a.pom" sorts before "a.pom.sha1". A ListObjects page that filled in between returned the longer key and resumed past the folder name, so the shorter key was never listed. When a versioned page is truncated, look up the .versions folder of each proper prefix of the page's last item that would still stream after it, add the live keys found, drop as many items off the end, and resume from the last key kept instead of a .versions folder name. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3api: test versioned listing pages that end between a key and its .versions folder Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3api: test encoded versioned listing pages with spaces and plus signs Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3api: keep recovered versioned keys in raw key order Encoded keys do not sort like raw ones ("a%20b-1/x" before "a+b"), so a key recovered past the page boundary is placed by its raw key before the page is trimmed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3api: order a versioned page by raw key when listing with encoding-type=url The in-page insert compared encoded keys, which sort differently from raw ones once a directory and a file name escape a space differently. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3api: test encoded directory keys at a versioned page boundary Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3api: scan raw keys when retracting a delete-marked null object The page is now ordered by raw key, so the backward scan that finds the null object to retract stops on raw keys too. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
8a6c948b12 |
s3api: delete a null delete marker named by versionId=null (#13311)
* s3api: split the .versions file delete out of deleteSpecificObjectVersion deleteVersionFile deletes a version stored under .versions and repoints the latest pointer past it. deleteSpecificObjectVersion keeps "null" as the plain object entry, which the suspended delete and lifecycle paths rely on, and calls deleteVersionFile for every other version id. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3api: delete a null delete marker named by versionId=null A suspended-versioning delete stores its marker as .versions/v_null, but DELETE ?versionId=null only looked at the plain object entry. With no null object there, it answered 204 without x-amz-delete-marker and left the marker in place, so the bucket could never be emptied. When the plain null object is missing and a null marker exists, delete the marker file and repoint the latest pointer to the prior version. The routed specific-version delete leaves that case to the lock path, which already handles batch deletes the same way. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3api: order the repoint past a deleted null delete marker by the versions left A null delete marker's id has no format, so the routed version delete read the recompute order from the first remaining version file. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3api: delete a null delete marker on the key's owner The marker is read from the owner, so deleting it through the gateway's own filer could answer success while the owner kept it. Both the routed DELETE and the lock path delete it with a routed transaction instead. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3api: rank the versions left by time when deleting a null delete marker Mixed legacy and inverted ids made the first file name a wrong guide to the repoint order. The routed delete now finds the newest remaining version and picks the name order that reaches it; when neither end of the order is the newest, it leaves the delete to the lock path. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3api: keep only the ends and the newest while scanning for the null marker repoint Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3api: choose the null marker repoint from the owner's own listing A filer other than the key's owner can lag it, and the recompute runs over the owner's full directory, so a direction picked from a replica's partial listing could repoint the object to an older version. Scan .versions on the owner only; when the owner cannot answer, leave the delete to the lock path. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
3764534dd1 |
kms: read filer.toml and the identities file with one parser (#13313)
* kms: read filer.toml and the identities file with one parser The KMS settings from filer.toml and from the identities file went through two paths: the JSON one was wrapped in an adapter so it could be read like viper. Both are now parsed into the same settings and loaded by the same code. Viper lowercases the provider tables in filer.toml but not the values that name a provider, so a mixed-case default_provider or bucket provider never matched and failed the load. Those values are now lowercased for filer.toml. Providers load in name order, a providers or buckets section that isn't a table fails the load instead of being ignored, and so does a default_provider that isn't a string. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * kms: test the parser's section types and JSON provider names A providers or buckets section that isn't a table and a default_provider that isn't a string fail the parse, and a JSON config keeps the case of the provider names it uses. The check-once test now loads through the whole loader, which sets the global provider, so it clears it after. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * kms: pick the first provider by name when no default is set ListKMSProviders iterated the provider map, so with several providers and no default_provider the global SSE-KMS provider changed between loads, and objects written under one could not be read after a restart. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3api: report KMS load errors from the identities file Any failure loading the identities file's kms block was logged at V(2) as no KMS configuration, which hid the parser's errors and a default_provider that does not exist. Only a missing block is quiet now. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com> |
||
|
|
a16ca18ae0 |
kms/local: load master keys from the provider config (#13312)
* kms/local: load master keys from the provider config The local provider generated its master keys in memory, so a restart or a reload lost them, and with them every object they encrypted. It now reads a keys list from its config. Each entry has a key_id, 32 bytes of key_material in hex or base64, and optional aliases and description. A reload reads the list again, so objects encrypted under a listed key stay readable. A name that's already taken, key material that isn't 32 bytes, or enableOnDemandCreate together with keys fails the provider, and the keys it loaded before the error are cleared. No default key is generated when keys are listed, since whatever it wrapped would be lost on a restart. CreateKey and CreateKeyWithID refuse a name that's taken instead of replacing that key. GetStringMap copies a list of tables like the other nested values it hands out. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * kms/local: give a racing on-demand request the key the first one created CreateKeyWithID refuses a key ID that's taken now, and the on-demand path looked the key up and created it under separate locks. Two requests for the same new key could both miss it, and the second then failed with KMSInternalFailure. The on-demand path checks for the key under the lock it stores it with, and returns the one stored in the meantime, so the first request's data key stays readable. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * kms/local: serve requests that name no key with the configured aws/s3 key With keys configured there is no generated default key, so an SSE-KMS request without a key ID failed even when the bucket-default path (which already resolves to alias/aws/s3) would work. Resolve an empty key ID to alias/aws/s3, as AWS does, so an operator picks the default by giving a configured key that alias instead of a new setting. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * kms/local: refuse a master key that Close cleared mid-request A reload replaces the provider and closes the old one, which zeroes its key material in place. A request that looked up a key before the close could then build its cipher from zeros and store a data key no provider can unwrap. Build the cipher under the provider lock and refuse a key that is no longer registered. 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> |
||
|
|
2938037cae |
filer: end a subscriber's stall when memory serves its cursor (#13310)
* filer: end a subscriber's stall when memory serves its cursor
A metadata subscriber that finds nothing in the ring yet parks until data
arrives ("no readable in-memory entries yet"), which starts its stall
clock. When data arrives the ring serves the cursor and the read goes on,
but nothing stopped the clock: only the paths that leave a gap do.
The clock is what bounds the wait on a gap. With it still running from
that first park, the first real gap the subscriber meets, hours later,
looks older than maxGapStall the moment it parks: the park gives up at
once and skips to the eviction watermark, and the events a peer would have
flushed within the flush interval are never delivered. The log shows a
subscriber "parked" for hours at a cursor a few seconds old, and the gap
skipped in the same millisecond. A mount keeps the stale listing it has
for those events, and filer.sync loses them.
resolve now ends the stall when it sends the read to memory.
* filer: age the first stall in the memory-serves test instead of shrinking maxGapStall
With maxGapStall at 50ms, a scheduler pause between the fresh park and its
give-up check expired the new stall and failed the test against the fixed
code. Keep the real bound and backdate the first park's clock.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* filer: shorten the comment on ending the stall in resolve
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: MapleWhiteZZZ <18653045+MapleWhiteZZZ@users.noreply.github.com>
Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
|
||
|
|
c7ba8bd079 |
sftp: give user store accounts without a Uid a non-root id (#13309)
* sftp: give user store accounts without a Uid a non-root id An entry that leaves out Uid decoded to 0, and Uid 0 skips every Permissions check, so a read-only account could write and delete. Generate a regular id for it the way NewUser does, and default an omitted Gid to the Uid. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * sftp: test that an omitted Uid or Gid does not load as root Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * sftp: keep the default Uid of an account stable across loads Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * sftp: test that a default Uid survives Reload and a new store Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * sftp: keep a default Uid off the ids other accounts use Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * sftp: test that a default Uid skips ids other accounts use Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * sftp: refuse a user store with no free id for an omitted Uid When every id in the default range is taken, loadUsers now fails instead of reusing a taken id, and it fails before replacing the loaded users so a Reload keeps the previous accounts. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * sftp: test that a full id range rejects the store and keeps old users Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
b445228794 |
volume: read the fields it knows from a .vif a later version wrote (#13305)
* volume: read the fields it knows from a .vif a later version wrote The .vif is parsed as strict JSON, so one field this version does not know fails the whole file. The volume server only logs that and serves the volume with an empty VolumeInfo: a read-only mark is gone, and so is the remote file of a tiered volume. Every field added to VolumeInfo makes the .vif files written from then on unreadable to the versions before it, which is what a rollback runs into. When neither the strict parse nor the old format's reads the file, it is now parsed once more with unknown fields ignored. The fields this version knows apply, and a warning names the file. The old format is still tried first, since read this way it would lose its DestroyTime, and a file that is not a VolumeInfo is still an error. * volume(rs): read an old-format .vif before the current format VifVolumeInfo ignores fields it does not know, so an old-format .vif parsed as it too: its DestroyTime and BytesOffset were dropped and the old-format fallback never ran. The Go server tries the old format before reading a file with unknown fields ignored, which keeps the destroy time. The old format is now taken only when every field in the file is one of its own, and a file that is not old-format reads as before. 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> |
||
|
|
d05cb0d308 |
volume: keep the largest needle id of a leveldb-indexed volume through a vacuum (#13306)
* volume: keep the largest needle id of a leveldb-indexed volume through a vacuum The index a vacuum builds for a volume with a leveldb needle map is loaded by LevelDbNeedleMap.DoOffsetLoading, which counted the files and tracked the end of the data but not the largest needle id, as the in-memory map's loader does. After the commit the volume reported 0 as its largest id until a needle with a larger one was written, and after each vacuum again. The volume server sends the largest id over its volumes in every heartbeat, and the master keeps its id sequence above it. A server whose largest ids sit in volumes that were vacuumed since they were last written reported too small a value, which is all the master has to go by when its own sequence is behind. * volume: test the largest needle id when nothing lands during the vacuum 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> |
||
|
|
d0b431b192 |
filer: pace the deletion ledger's snapshots to a byte budget (#13301)
* filer: pace the deletion ledger's snapshots to a byte budget The durable deletion ledger is written as a snapshot of the whole pending set, and the snapshotter is woken by every queued and every finished delete. A filer deleting a hundred chunks a second rewrote the set a hundred times a second, close to 4KB written to the store per deleted chunk. The cost of each snapshot is the size of the set, so a filer that holds deletes it cannot finish yet, the ones it retries, rewrote that whole backlog on every other change as fast as the store took it. A snapshot is now followed by a pause in proportion to the bytes it wrote (filer.deleteQueue.persistBytesPerSecond, 64KiB a second by default, and 4KiB charged per snapshot), never longer than the periodic interval. The first change after a quiet spell is still written at once; the changes made during the pause go into the next snapshot. A crash therefore loses the ids queued since the last write instead of those of the write in flight. * filer: fix the deletion ledger's write budget instead of a config key The pacing needs no operator knob: 64KiB a second keeps a large backlog's snapshots at the periodic interval and a small ledger's at a few a second. The snapshotter reads the budget and the interval once when it starts, so a test that pins the budget does not race a running snapshotter. 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> |
||
|
|
75ba2b125c |
filer: count the store's KV requests in the store metrics (#13302)
* filer: count the store's KV requests in the store metrics FilerStoreWrapper counts and times InsertEntry, UpdateEntry, FindEntry, DeleteEntry and the listings, but passed KvPut, KvGet, KvBatchGet and KvDelete straight to the store. Hard link records, the deletion ledger and the per-path commit records are all kept in KV, so that part of what a filer asks of its store did not show in SeaweedFS_filerStore_request_total or in the request duration histogram. The four KV calls are now counted and timed like the others, as kvPut, kvGet, kvBatchGet and kvDelete. * filer: shorten the KV metrics helper comment Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: MapleWhiteZZZ <18653045+MapleWhiteZZZ@users.noreply.github.com> Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
5c36ee70ee |
master: sign a LookupVolume token for the file id asked for (#13300)
* master: sign a LookupVolume token for the file id asked for LookupVolume signed the token with the bare volume id, and the volume server checks the token's fid against vid,key, so every token it handed out was refused. /dir/lookup signs the file id. operation.LookupJwt goes through LookupVolume, so the expired-token renewals of the S3 PutObject and copy cleanup deletes, the admin file browser and weed benchmark all got a token the volume server refused. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * master: sign lookup tokens for the base file id The volume server checks a token's fid against the file id with its _<delta> suffix stripped, so a token minted for vid,key_N, over gRPC or /dir/lookup, was refused. Sign baseFid of the file id in both paths. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |