mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-12-04 10:07:28 +01:00
cd0f60a2f0858c07ea202b00ebf8df19e65a10a2
11094
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
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
|
||
|
|
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> |
||
|
|
dc15685282 |
filer: rename a postgres_flat scan test bucket codespell flags (#13314)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
ae99aae2cb |
mq: report the caller's deadline when a broker sees it first (#13303)
* mq: report the caller's deadline when a broker sees it first doConfigureTopic checked ctx.Err() to tell the caller's deadline from a broker failure. A broker's DeadlineExceeded status (or its RST_STREAM, which gRPC maps to DeadlineExceeded once the deadline has passed) can arrive before the context's own timer has run, so ctx.Err() was still nil and NewTopicPublisher returned the wrapped gRPC error instead of context.DeadlineExceeded. Once the deadline is behind us, wait for the context's timer before reading ctx.Err(). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mq: let the configure call start before its deadline passes in the test The deadline the test reported had already passed when NewTopicPublisher started, so the check before the first broker caught it and the check after the call was never exercised. The fake broker now moves the deadline behind us only once it has the call, and answers with its own DeadlineExceeded. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
f599f870a8 |
s3: list without a delimiter from one range of the filer store (#13263)
* s3: -s3.listRecursiveFromStore, on by default Lets an operator keep recursive listings on the directory walk. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011UpvafvK8JpagF94MHWqwK * s3: list without a delimiter from one range of the filer store A bucket that never had versioning is listed with ListEntriesRecursive: one read of the bucket's path range per page instead of one directory listing per directory. A folder object's "<dir>/" key waits for its place in key order, and the folder objects whose rows sort before the range (the one the prefix names, those the marker ends inside of) are looked up. .uploads is skipped; a .versions folder hands the page to the walk, as does a filer that answers Unimplemented, which is then not asked again for a minute. The test pages through both ways over the same tree, for prefixes, markers and page sizes, and expects the same keys, sizes, ETags and markers. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011UpvafvK8JpagF94MHWqwK * test/postgres_flat: a range-read gateway lists what the walking one does A second S3 gateway with -listRecursiveFromStore=false runs on the same filer. ListObjectsV2 and V1 pages agree for prefixes, markers and page sizes over folder objects, a prefix object, an unfinished upload and +/-/0 neighbours. Listing 60 keys five directories deep scans the bucket table 2 times from the range read and 302 times from the walk. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011UpvafvK8JpagF94MHWqwK * s3: range-read listings without the -s3.listRecursiveFromStore flag A filer whose store cannot list a range answers Unimplemented and the gateway already walks that bucket's directories instead, so the flag only switched off a path that falls back by itself. The unit test forces the walk through the decline cache, and the postgres_flat test checks pages against the keys in byte order rather than against a second gateway. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3: step a range-read listing over the bucket's upload parts The walk skips the bucket's .uploads folder as one entry, but a range read from the bucket root streamed every part of every unfinished upload and dropped them, one 1024-row window after another, on each first page. Every path under .uploads/ sorts before ".uploads0", so the read resumes there and looks up the one key with that name. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3: list a waiting folder object once a row passes its key A range-read page queued every childless folder object until a file row arrived, so max-keys=1 over a bucket of empty folders read the whole bucket before answering. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3: forget a deleted bucket's recursive-listing decline Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
77a070fe0a |
s3api: tell a symlink apart from an empty object on GET and HEAD (#13299)
A symlink made through weed mount holds no data, so GET and HEAD answered for it as for an empty file: Content-Length 0 and a type guessed from its name. An S3 client could not tell it from an empty file, nor see where it pointed. For an entry with the symlink mode bit, send the target as user metadata, x-amz-meta-seaweedfs-symlink-target, escaped like a key under encoding-type=url, and use Content-Type inode/symlink (what file(1) reports) when none is stored. User metadata is the one place AWS has for an object's own fields, so SDKs and the AWS CLI show it as they are. The link is not followed: the target is a path on the client that made it. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
acb7728915 |
filer: ListEntriesRecursive RPC (#13262)
* filer: name the check that a listing expires an entry Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011UpvafvK8JpagF94MHWqwK * filer: StreamListRecursiveEntries lists a subtree in path order It pages through the store's RecursiveLister until the limit, leaves out and deletes expired entries as a directory listing does, and declines a subtree in or holding a remote mount. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011UpvafvK8JpagF94MHWqwK * filer.proto: ListEntriesRecursive A new RPC rather than a field on ListEntries: a filer that predates it answers Unimplemented instead of listing one directory. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011UpvafvK8JpagF94MHWqwK * filer: serve ListEntriesRecursive Unimplemented when the store cannot list the subtree in path order. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011UpvafvK8JpagF94MHWqwK * filer: a scoped token is refused ListEntriesRecursive Classified with TraverseBfsMetadata: it lists a whole subtree, past the per-directory checks a scoped ListEntries gets. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011UpvafvK8JpagF94MHWqwK * filer: trim a trailing slash before checking a recursive listing for remote mounts An empty directory lists from the root. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: keep the recursive listing cursor when a page comes back empty Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
a9d4714aed |
s3api, filer: keep a symlink a symlink when CopyObject copies it (#13298)
* s3api, filer: keep a symlink a symlink when CopyObject copies it A symlink made through weed mount is an entry with the symlink mode bit, a SymlinkTarget and no data. CopyObject builds the destination's attributes afresh, with the permission bits from the request, so a copy to another key dropped both and landed as an empty regular file. A metadata-only self-copy (REPLACE) kept the target but reset the mode, leaving the link an empty regular file in place. Keep the symlink mode bit and the target on both paths. The permission bits still come from the request, as for any other copy. The filer's own copy (copyEntry) already carries the source's whole attribute set. A copy into a new prefix creates the symlink in a missing directory, and the filer gave each parent it created the entry's whole mode plus ModeDir. With the symlink bit as well, a mount shows those directories as regular files, and nothing under them can be reached. Parents now take the entry's permission bits only. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: drop the symlink type when promoting an entry to a directory A key nested under a symlink promotes the symlink's entry to a directory. The promotion added ModeDir and kept the symlink bit, so a mount showed the directory as a regular file and could not reach the nested key. Keep only the permission bits there too, with the same restorableModeBits a missing parent now takes from its entry. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3api: keep a self-copied prefix object a directory when it was a symlink A prefix object promoted from a symlink before the filer change still has the symlink bit. A routed self-copy of it restored ModeDir and then keepSymlink added the symlink bit back, leaving a directory a mount shows as a regular file. keepSymlink now leaves directory destinations alone. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer_pb: a prefix object keeps no type bit but the directory's MarkPrefixObject added ModeDir and the execute bits to whatever mode the object had. A symlink copied onto a key that other keys are nested under, or a self-copy outside the owner route of a prefix object promoted from a symlink before the filer change, kept the symlink bit next to ModeDir, which a mount shows as a regular file. Clear the other type bits first. 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> |
||
|
|
85b783cc0d |
s3api: copy a chunk to another volume when its volume fails the write (#13297)
* s3api: copy a chunk to another volume when its volume fails the write CopyObject and UploadPartCopy assigned one volume to each copied chunk and failed the whole copy when that volume failed the write: a streamed copy sent a single POST, and a buffered copy retried only the same fid. PutObject asks for a fresh assignment instead (upload_chunked.go), so a volume that filled up, went away or was overloaded failed a copy that a PUT would have survived. In production, a CopyObject failed with 500 because the destination volume server broke the connection mid-upload, and only the client's retry completed it. Every chunk copy now writes through uploadCopiedChunk: streamed, buffered, range, and the five SSE re-encryption paths. When a volume fails the write in a way another volume would not, the copy deletes whatever the failed write may have stored, asks for another volume and writes the chunk again, as PutObject does: up to three volumes, and only one more after an overload. The uploader's errors are judged by operation.ShouldReassignUpload, and a streamed POST by its status (no response, a 5xx, or an overload refusal). A streamed retry reads the source again, and a range copy digests only the bytes of the attempt that landed. A failed source read is not retried on another volume: a streamed copy now records the source's read error apart from the POST's. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3api: delete a failed copy chunk only when its write reached the volume A streamed copy reads its source inside the write, so a source that could not be read also came back through uploadCopiedChunk, which then deleted a fid nothing had been written to. Only a failure of the volume itself (copyUploadError) is followed by the delete now; the tests check that a source failure sends none. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3api: reassign copy writes refused before the append, bound the cleanup A streamed copy's POST dropped the volume's X-Seaweed-Write-Outcome header, so a 409 from a volume that turned read-only before the append, or a 401 for a token that expired in the queue, failed the copy where the uploader's ShouldReassignUpload tries another volume. The POST now keeps the header and reassigns on the same marked answers; unmarked 409 and 401 stay final. The delete of a failed chunk read its answer with no deadline, so a volume that sent the headers and stalled the body held the copy up for good. Each delete now runs within copyCleanupTimeout (10s), its answer included, and still logs the status and up to 4 KiB of the body. Tests: the fake volume keeps the file it was sent, and each retry case checks that the second volume stored the copied bytes. An SSE-C chunk copied under a new key decrypts with the key and IV its chunk names. Marked 409 and 401 answers reassign, unmarked ones do not, and a stalled cleanup delays the copy by the timeout only. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3api: renew an expired token for a failed copy chunk's delete A copy's write token is minted at the assignment, before the source is read, and lasts 10s by default. A write that failed after that left the cleanup delete refused with 401 and the needle orphaned. PutObject's cleanup renews the token from the master on a 401; do the same. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3api: log the status and body of a cleanup delete whose read failed A delete whose answer began but whose body read failed, such as one cut off by copyCleanupTimeout, was logged with the error only. Log its status and the part of the body that arrived as well. 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> |
||
|
|
38422bd1fa |
filer: RecursiveLister, a subtree in path order from one range of postgres_flat (#13261)
* filer: RecursiveLister, a store capability to list a subtree in path order The wrapper hands it to the default store, reading hard links as listings do, and declines it when path-specific stores could hold part of the subtree. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011UpvafvK8JpagF94MHWqwK * filer/sql: list a subtree with one range scan when rows are keyed by path AbstractSqlStore lists recursively when its generator implements RecursiveListSqlGenerator. The range runs from the directory and prefix to the least string past every path starting with them. A directory whose subtree spans the bucket tables is declined. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011UpvafvK8JpagF94MHWqwK * filer/postgres: the postgres_flat generator lists a path range Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011UpvafvK8JpagF94MHWqwK * filer/store_test: check recursive listings Byte order across +, -, / and non-ASCII names, prefixes holding a slash, literal % and _, resuming after a path, pages of one and three, a directory outside the buckets, and the directories that span bucket tables. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011UpvafvK8JpagF94MHWqwK * filer/sql: a recursive listing's start path outside the bucket table bounds it by full path A start path in another bucket was trimmed as if it were inside this one, so a start path past the bucket listed it all again, and one before it could skip entries. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
b5a7d9600e |
kms: read provider settings as TOML gives them (#13294)
* kms: read provider settings as TOML gives them Provider settings were read with plain type assertions, so a setting of another type read as its zero value. TOML decodes integers as int64, which GetInt ignored, so max_cache_size from filer.toml never applied, and Viper lowercases TOML keys, so the local provider never saw enableOnDemandCreate. A cache_ttl that didn't parse fell back to an hour without a word. Settings are now read through one typed getter. An int64 or a whole float64 reads as an int, a key matches ignoring case when it isn't found as given, and a provider that reads a setting of the wrong type fails to load and is closed. The loader reads the cache settings the same way and fails a provider whose cache settings don't parse. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * kms: apply the cache defaults to a setting given as null A JSON null for cache_enabled or cache_ttl counted as set, so it turned caching off or failed the provider on an empty duration, where it used to read as the default. 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> |
||
|
|
ed177d31e3 |
kms: run provider health checks without the manager's lock (#13295)
* kms: run provider health checks without the manager's lock GetKMSHealth held the manager's read lock while it asked every provider for a key, and a remote KMS can take its whole timeout to answer. A provider change waited behind it for the write lock, and every request looking up a provider then waited behind the change. The checks now run on a copy of the providers. SetDefaultKMSProvider and SetBucketKMSProvider check that the provider exists and set it under one lock, so a provider removed in between can't be left as the default or as a bucket's provider. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * kms: health-check only the provider a load adds Loading a provider checked every provider loaded so far, so a configuration with N providers made N(N+1)/2 remote calls at startup, and one slow provider could spend the shared 10s budget and get the new provider reported unhealthy. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * kms: run provider health checks concurrently The checks shared one deadline and ran one after another, so a provider stuck until the deadline got every provider checked after it reported unhealthy, and startup waited for the checks in turn. 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> |
||
|
|
acff807879 |
filer: postgres_flat store keyed by the full path (#13253)
* filer/store_test: conformance suite for filer stores Entries in and out of buckets, byte-ordered and prefixed listings, key-value records, transactions, bucket tables and the snapshot scan. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011UpvafvK8JpagF94MHWqwK * filer: run postgres2 and mysql2 through the conformance suite RUN_POSTGRES_TESTS and RUN_MYSQL_TESTS enable them, as RUN_REDIS_TESTS does the Redis stores; each test gets a schema or database of its own. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011UpvafvK8JpagF94MHWqwK * ci: give the go test job Postgres and MySQL services Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011UpvafvK8JpagF94MHWqwK * filer/sql: generators bind the arguments of row statements Insert, update, find and delete now take the row key and return their arguments with the query, so a generator decides how a key maps to its columns. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011UpvafvK8JpagF94MHWqwK * filer/sql: generators bind the arguments of directory statements Listing and deleting a directory's children take the directory and return their arguments with the query. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011UpvafvK8JpagF94MHWqwK * filer/sql: batch lookup takes row keys and matches rows by name and directory A key-value key's directory column already determines its dirhash, so the batch read no longer selects dirhash to match its rows. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011UpvafvK8JpagF94MHWqwK * filer/postgres: build the connection string with pgxutil.BuildDSN The credential store already does; it quotes values per libpq, so a password or certificate path with spaces or quotes no longer breaks the connection string. The OpenPGXDB alias has no callers left. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011UpvafvK8JpagF94MHWqwK * filer/sql: scan pages take the row key of the last row as their cursor Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011UpvafvK8JpagF94MHWqwK * filer/postgres: postgres and postgres2 share their connection setup ReadConnection reads the settings and their defaults, Connection.Open opens the store's pools. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011UpvafvK8JpagF94MHWqwK * filer/sql: key-value records may live in a table of their own A store whose entry tables have another layout keeps its key-value records in KvTable, written by KvSqlGenerator; its scans then read only entries and need not tell the records apart. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011UpvafvK8JpagF94MHWqwK * filer/postgres: SQL generator keyed by the full path Rows have path as their primary key; a (directory, name) unique constraint serves the directory listings. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011UpvafvK8JpagF94MHWqwK * filer: postgres_flat store Entries are keyed by their full path, the object key inside a bucket's table; buckets get tables of their own as in postgres2. Key-value records keep the postgres2 layout in filemeta_kv. The store refuses a filemeta table of another layout, so it needs a schema of its own. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011UpvafvK8JpagF94MHWqwK * filer: register postgres_flat and add it to the filer.toml scaffold Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011UpvafvK8JpagF94MHWqwK * filer/sql: test the arguments each generator binds Each statement's arguments must match its placeholders in count and column. Check them for every generator method, including the Postgres UPDATE whose parameters are now numbered key first. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer/postgres_flat: name a missing filemeta table instead of a foreign layout With createTable = false and no filemeta table, the layout check said the table had no path column and blamed a postgres2 layout. Report the missing table and the key-value table that also has to be created. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer/postgres: postgres_flat escapes the table name inside its quotes A double quote in it is doubled, as PostgreSQL reads a quoted identifier. Bucket names cannot hold one, but the statements no longer rely on that. Reported by CodeQL (go/unsafe-quoting). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011UpvafvK8JpagF94MHWqwK * filer/postgres: escape the table name inside its quotes A double quote in it is doubled, as PostgreSQL reads a quoted identifier. Bucket names cannot hold one; the statements no longer rely on that. Reported by CodeQL (go/unsafe-quoting) on the lines this branch changed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011UpvafvK8JpagF94MHWqwK * filer/postgres: postgres_flat shares the generator's tableIdent Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011UpvafvK8JpagF94MHWqwK * filer/postgres: keep the nameExpr doc comment on nameExpr Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer/postgres_flat: find filemeta along the search path when checking its layout The store's queries name filemeta unqualified, so with schema = "a,b" they reach a table in b; the layout check looked in current_schema() only and refused it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011UpvafvK8JpagF94MHWqwK * filer/postgres_flat: force byte order when the path column is locale-ordered Directory listings order and bound rows by path, but only the name column's collation was checked. A createTable with a locale-ordered path column listed in locale order, and byte-order bounds missed entries. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer/postgres: read the ordered columns' collation along the search path The collation check looked for filemeta in current_schema() only. With the tables in a later schema of the search path it found no column and took the database's order, so a locale-ordered path column next to a C database went unforced, and byte-ordered columns in a locale database got a needless sort. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011UpvafvK8JpagF94MHWqwK * filer/postgres_flat: list a directory from its path range A directory's children are the rows of its path range whose directory is the listed one. The listing reads that range in growing batches and skips the rows of the children's subtrees in Go, so a versioned object's .versions rows cost no query of their own. Past 64 rows of one subtree it queries again from that subtree's end. A name prefix narrows the range. Listing no longer reads the (directory, name) index. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer/postgres_flat: find a folder's children in its path range Deleting a folder's children looked them up by directory alone, which only the (directory, name) index serves. Bound the delete by the folder's path range as well. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer/postgres_flat: key the table by path alone Listing and deleting a folder's children both read the path range now, so the (directory, name) unique index only cost writes and storage: flatPath already makes the path unique per (directory, name). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer/postgres: read the ICU or builtin database locale before datcollate An ICU-default database can report datcollate 'C' while its default collation orders by the ICU locale, so a name column on the database default looked byte-ordered and the listing kept locale order. Read datlocprovider and the provider locale (via to_jsonb, so servers before Postgres 15 still answer) and treat an ICU default as locale-ordered. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer/postgres_flat: list a folder's children from its path range The bucket enumeration listed /buckets by directory and ordered by name, a sequential scan and sort now that path is the only index. Read the folder's path range in path order instead. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer/postgres_flat: only the path column needs byte order Listings now order and range by path alone, and directory and name are only compared for equality, which no deterministic collation changes. Drop their COLLATE "C" and check only the path column's order. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
ce7b6c93b2 |
filer: read the views of the chunk a boundary read leaves in one goroutine (#13293)
A read across a chunk boundary started a goroutine for each view of the chunk the stream leaves, outside the limit on chunks read at once, so a compressed chunk written over in many places could start any number of them. One goroutine started before the others now reads those views one after another, and the other views are back under the errgroup limit. It reads every view from the held download before a view the download can't serve falls back to a read of its own, as that read can make room and evicting the chunk waits for the holds. The test of a boundary read that doesn't wait for the chunk it leaves now has four times as many views of that chunk as chunks run at once, and checks that the read starts fewer goroutines than that. The waits for a prefetch to reserve and for a boundary read to fetch its last chunk are bounded, so a failing test reports instead of hanging. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |