Commit Graph
21820 Commits
Author SHA1 Message Date
pingqiuandClaude Opus 5.5 cd0f60a2f0 seaweed-block: bump google.golang.org/grpc to v1.83.2
Same go.mod/go.sum change as the module's own upstream commit 8051b18e,
applied under seaweed-block/. Clears the dependency review of the
imported v1.1.0 tree (grpc 1.80.0 advisories); a later sync of the
module carries the identical change, so it merges cleanly.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-03 22:40:33 -08:00
pingqiuandClaude Opus 5.5 7a51f796ab Import seaweed-block v1.1.0 with its history into seaweed-block/
The seaweed-block repository (v1.1.0, revision ff6b0b1b) is imported with its full history,
rewritten into the seaweed-block/ directory. It keeps its own go.mod and module path, so the
root module's builds do not include it. Development continues in the seaweed-block repository
until v1.1.1; the later sync merges the same rewritten history.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-03 10:49:21 -08:00
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>
2026-12-03 10:40:49 -08:00
Yip LeoandClaude Opus 5.5 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>
2026-12-03 10:39:23 -08:00
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>
2026-12-03 10:38:33 -08:00
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>
2026-12-03 10:37:50 -08:00
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>
2026-12-03 10:36:56 -08:00
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>
2026-12-03 10:34:45 -08:00
Chris LuandClaude Opus 5.5 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>
2026-12-03 10:34:03 -08:00
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>
2026-12-03 10:33:02 -08:00
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>
2026-12-03 10:32:34 -08:00
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>
2026-12-03 10:31:58 -08:00
Yip LeoandClaude Opus 5.5 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>
2026-12-03 10:30:23 -08:00
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>
2026-12-03 10:29:05 -08:00
D.Maier 8afef5166b sftp: serve reads on read-write opens instead of writing zeros (#13343) 2026-12-03 07:59:06 -08:00
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>
2026-12-03 01:15:42 -08:00
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>
2026-12-03 01:12:44 -08:00
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>
2026-12-03 00:48:29 -08:00
Chris LuandClaude Opus 5.5 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>
2026-12-02 23:51:58 -08:00
Chris LuandClaude Opus 5.5 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>
2026-12-02 23:50:44 -08:00
Chris LuandClaude Opus 5.5 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>
2026-12-02 23:47:50 -08:00
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>
2026-12-02 23:47:12 -08:00
Chris LuandClaude Opus 5.5 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>
2026-12-02 23:46:20 -08:00
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 c40e01786 set. Before it, an assignment that could not record its
file ids left the volume charged for them: 1 MB for an id never handed out.

* sequence: stop the memory sequencer at the largest file id instead of wrapping

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* master: refuse a file id draw whose ceiling would wrap past the largest 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>
2026-12-02 23:45:31 -08:00
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 b248167800)

* filer: read unordered stores in full pages when filtering a prefix

An unordered store can have to be read to its end for a prefix, and
reading it in pages of the caller's limit (max-keys + 2 for S3) turned
one listing into a store query per few entries.

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>
2026-12-02 23:31:01 -08:00
MapleWhiteZZZandMapleWhiteZZZ 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>
2026-12-02 23:29:28 -08:00
pingqiu-cpu cfd39b0b26 docs: v1.1 known limitation, list pages left after a volume delete (#977)
Interim merge note (spec trace workflow startup_failure since 22:45Z): docs-only change to the v1.1 release notes on release-1.1 (known limitation 7). go test (linux) and process-level tests (real binaries) passed on a07cebc3; spec-trace-check.sh and public-text-check.sh run locally with the base branch's scripts against this head and body (base release-1.1 at 4187ddaf): both pass. Docs review ACCEPT on a07cebc3 (accuracy and public text: no findings).
seaweed-block/v1.1.0
2026-12-02 21:39:25 -08:00
pingqiu-cpu 4187ddaffd docs: v1.1 known limitations (#973)
Interim merge note (spec trace workflow startup_failure since 22:45Z): docs-only change to the v1.1 release notes on release-1.1. go test (linux) and process-level tests (real binaries) passed on bc83e995; spec-trace-check.sh and public-text-check.sh run locally with the base branch's scripts against this head and body (base release-1.1 at a6304c21): both pass. Docs review ACCEPT on bc83e995 (accuracy and public text: no findings).
2026-12-02 20:05:19 -08:00
pingqiu-cpu a6304c2101 feat(geometry): new volumes up to 1 TiB (v1.1) (#757)
Interim merge note (spec trace workflow startup_failure on all branches since 22:45Z): branch updated to current main (69c5c6bd); go test (linux) and process-level tests (real binaries) passed on 69c5c6bd; spec-trace-check.sh and public-text-check.sh run locally with the base branch's scripts against this head and body: both pass (Model line now also cites FormatGate.Report for core/host/master/services.go, mapped since the PR was accepted). Code review ACCEPT on e1ed5073; the 1 TiB loaded first-cut measurement on current main passed on both volume formats.
2026-12-02 18:05:50 -08:00
github-actions[bot] 605b5f7f79 docs: regenerate star history chart 2026-12-03 01:53:42 +00:00
pingqiu-cpu 53211a2d9d ops chunk verify: --timeout is a no-progress window; add --deadline (#966)
Interim merge note (spec trace workflow startup_failure on all branches since 22:45Z): go test (linux) and process-level tests (real binaries) passed on cc3a8a6c (run 46997615891); spec-trace-check.sh and public-text-check.sh run locally with the base branch's scripts against this head and body: both pass. Code review ACCEPT 6161155789; model review ACCEPT 6161515202 (per-call read/trace follow-up recorded there).
2026-12-02 16:34:31 -08:00
pingqiu-cpu bc617dd5ee test(c3): observe recovery progress on the final restore (#968)
Interim merge note (spec trace workflow startup_failure on all branches since 22:45Z): go test (linux) and process-level tests passed on 7ae34a7e; spec-trace-check.sh and public-text-check.sh run locally against this PR's body and diff on main af07f8be: both pass.
2026-12-02 15:41:21 -08:00
Chris LuandClaude Opus 5.5 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>
2026-12-02 14:56:45 -08:00
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>
2026-12-02 14:21:42 -08:00
MapleWhiteZZZandMapleWhiteZZZ 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>
2026-12-02 14:10:27 -08:00
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>
2026-12-02 14:08:37 -08:00
Ping Qiu af07f8be92 Merge pull request #958 from seaweedfs/fix/957-c3-progress-window
fix: observe C3 recovery progress and graceful stop separately
2026-12-02 14:05:35 -08:00
Chris LuandClaude Opus 5.5 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>
2026-12-02 13:52:05 -08:00
pingqiu 25d640a084 merge main into recovery progress harness 2026-12-02 13:41:55 -08:00
Chris LuandClaude Opus 5.5 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>
2026-12-02 13:18:23 -08:00
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>
2026-12-02 13:16:52 -08:00
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>
2026-12-02 13:14:11 -08:00
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>
2026-12-02 13:12:20 -08:00
Chris LuandClaude Opus 5.5 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>
2026-12-02 12:49:44 -08:00
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>
2026-12-02 12:48:05 -08:00
Ping Qiu 9c56ca2e7e Merge pull request #962 from seaweedfs/fix/served-topology-issued
master: a clean move releases the static topology home
2026-12-02 12:46:06 -08:00
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>
2026-12-02 12:45:23 -08:00
Ping Qiu 53d0b7182d Merge pull request #963 from seaweedfs/docs/model-code-trace-batch2
trace: map PageChain, StaleClean and the QueueCap busy wait to code
2026-12-02 12:40:06 -08:00
Ping Qiu 2da3e02cb9 Merge pull request #960 from seaweedfs/fix/fence-durable-slices
storage: fence slices bypass the page cache and are durable before they count
2026-12-02 12:38:07 -08:00
Ping Qiu 8145e4decf Merge pull request #959 from seaweedfs/feat/presync-until-short
storage: the pre-barrier sync repeats until its tail is bounded
2026-12-02 12:37:58 -08:00