Commit Graph
16555 Commits
Author SHA1 Message Date
Chris LuandClaude Opus 5.5 40a95a8ef5 admin: filter plugin jobs and activities by volume id (#13077)
* admin: keep the volume id on tracked plugin jobs

Volume-scoped jobs carry their volume in the volume_id parameter, but
the in-memory job list drops parameters, so nothing could select a
volume's jobs without reading every job detail file.

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

* admin: filter plugin jobs and activities by volume id

/api/plugin/jobs and /api/plugin/activities accept volume_id, applied
before the limit like the lane filter. Activities follow the tracked
jobs of that volume.

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

* admin: volume id filter on the plugin monitor

A Volume ID box next to the execution state filter narrows the queue,
execution jobs and activities to that volume's jobs, fetched with the
volume_id API filter.

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

* admin: keep detection scans visible under the volume filter

Detection activities belong to no job, so the volume-filtered activity
window had none of them and the Detection Jobs table went empty. That
table now reads its own job-type window.

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

* admin: accept zero-padded volume ids in the monitor filter

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

* admin: drop a monitor refresh that finishes after a newer one

Two refreshes of the same scope can finish out of order; the older one
then replaced the newer rows, with empty lists when its volume-filtered
fetch failed.

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

* admin: keep rows committed for the scope when a plugin monitor refresh fails

A failed request fell back to the rows captured when the refresh started,
so a refresh overlapping one that had already committed the new scope's
rows cleared them. Resolve the fallback when the refresh commits.

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

* admin: validate the monitor volume id before fetching

Out-of-range ids went to the APIs and came back 400. The filter is now
applied only from a valid change event, so the periodic refresh no longer
reads a value still being typed.

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

* admin: volume id filter on the job queue view

The queue renders the volume-scoped rows, but the only filter box sat on
the execution view, so an active filter was invisible and could not be
cleared there. Both views now carry a box kept in sync.

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

* admin: reject unparsable volume id text instead of clearing the filter

A number input holding text like "1e" reports an empty value with
validity.badInput set; treat it as invalid rather than as a cleared box.

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

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-27 18:42:11 -08:00
Chris LuandClaude Opus 5.5 ec34160a1a master, admin: report the real last heartbeat time of volume servers (#13074)
* master: report each volume server's last heartbeat time

DataNode.LastSeen only moves when a volume server registers, so nothing
recorded when the master last heard from it. Stamp every processed
heartbeat and carry it in DataNodeInfo.last_heartbeat_ns.

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

* admin: show the master's last heartbeat time for volume servers

The volume server details reported the admin's own clock as the last
heartbeat. Use the time the master reports, and show unknown when the
master does not report one.

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

* admin: carry the last heartbeat time into the volume servers page

GetClusterVolumeServers builds its records from the master's volume list
without the topology conversion, so the details dialog showed unknown.

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

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-27 18:02:55 -08:00
Chris LuandClaude Opus 5.5 df98e9df3e admin: wait for the failed record in the worker-restart orphan test (#13079)
handleJobCompleted hands the completion to the dispatcher before it
updates the tracked job, so the test could read the record while it
still said assigned.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-27 17:57:38 -08:00
Chris LuandClaude Opus 5.5 2e81c0b7c0 filer: route a rename whose source misses locally to the write owner (#13064)
* filer.proto: mark a forwarded StreamRenameEntry with is_moved

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

* filer: send a rename whose source misses locally to the write owner

Exclusive and conditional creates are stored on the path's write owner. With
separate filer stores, a rename sent to another filer before it has replayed
the create found no source and failed, so a mount that flushed a deferred
create and renamed the file right after got EIO. Such a rename now goes to
the source's write owner, which moves the entry and whose events are relayed
to the caller, unless the owner runs on this filer's store. A forwarded
rename is applied only by the filer its own ring names as the owner.

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

* filer: send an AtomicRenameEntry whose source misses locally to the write owner

The same race reaches the unary rename that S3, WebDAV, SFTP and fs.mv use:
an object or file created through the owner and renamed through another
filer before replication found no source. It is forwarded like the stream
rename, with is_moved bounding it to one hop.

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

* rename: report a missing source as ENOENT

A rename whose source is absent fails with the store's "no entry is found"
error, which neither the filer's errno mapping nor the mount's message
mapping recognized, so the client got EIO instead of ENOENT.

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

* filer.proto: report a forwarded AtomicRenameEntry's last event position

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

* filer: answer a forwarded rename once the owner's events are replayed here

The rename's target is stored on the owner only until this filer replays
it, so an unlink of that name sent here right after the rename would miss
it and report success. The owner now reports the log position of the
rename's last event, and the forwarding filer holds its answer (bounded)
until its stream from the owner has delivered that far.

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

* filer: refuse a forwarded no-replace rename over a target this filer has

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

* filer: wait for an owner this filer no longer follows before answering a forwarded rename

PeersCaughtUpTo counts an untracked peer as caught up. An owner whose
stream was down long enough to be dropped has replayed nothing here, so a
forwarded rename answered then could leave a follow-up unlink through this
filer missing the target. Require the owner to be tracked with a watermark
at or past the rename, still bounded by ownerEventsCatchUpCap.

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

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-27 17:54:48 -08:00
Chris LuandClaude Opus 5.5 96fd7fe6e2 volume: report mounted EC shards whose file on disk is gone, replaced or resized (#13069)
* volume: report mounted EC shards whose file on disk is gone, replaced or resized

Each EC heartbeat tick stats every mounted shard file and compares it with the
open descriptor: a missing path or a different file is a ghost, a size other
than the mounted one is stale_size. Mismatches are logged per shard and counted
in SeaweedFS_volumeServer_ec_shard_disk_mismatch{reason}.

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

* volume(rs): report mounted EC shards whose file on disk is gone, replaced or resized

Mirror of the Go check: each EC heartbeat tick compares every mounted shard
with its file (missing or another inode = ghost, other size = stale_size),
warns per shard and sets SeaweedFS_volumeServer_ec_shard_disk_mismatch{reason}.

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

* metrics: chart EC shards that disagree with their file on disk

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

* volume(rs): tell a replaced EC shard file apart on non-unix hosts

Without inode numbers, compare the creation and modification times of the
path and of the open handle.

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

* volume: check mounted EC shards off the heartbeat loop

A stat stuck on a stalled disk no longer holds up heartbeats or shutdown; at
most one check runs at a time.

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

* volume(rs): check mounted EC shards off the heartbeat loop

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

* volume(rs): compare file ids to tell a replaced EC shard file apart on Windows

Timestamps can match on a replacement file. Use the volume serial and
file index from GetFileInformationByHandle there, and dev/inode on
unix, the same identity Go's os.SameFile compares.

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

* volume(rs): copy mounted EC shard state out before checking the disk

The check held the store read guard across its file system calls, so a
stalled disk kept the guard and a waiting writer could then stall the
heartbeat's own read. Copy each shard's path, size and file id under
the guard and check them after it is released. The id is recorded when
the shard opens, so no extra handle is held for the check.

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

* volume(rs): run the EC shard disk check on a detached thread

Dropping the runtime waits for spawn_blocking tasks, so a stat stuck on
a hung disk could hold up shutdown. A plain thread is not waited on.

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

* volume(rs): stat the EC shard path instead of opening it

A replacement the server cannot read failed the open and was never
counted as a ghost. Compare device, inode and length from the path's
metadata, as the Go side does with os.Stat; on Windows open it with no
access rights.

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

* volume(rs): test the EC tick past a stalled disk check

The check thread start takes the check to run, so a test can stall one
after its snapshot and show that a writer still gets the store, the tick
still reports, and no second check starts.

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

* volume: keep VolumeServer int64 counters 8-byte aligned on 32-bit

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

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-27 17:53:58 -08:00
Chris LuandClaude Opus 5.5 8ab78a9a06 s3: return part checksums in ListParts (#13076)
* s3: return part checksums in ListParts

UploadPart stores the part's checksum on the part entry and returns it,
but ListParts built each Part from the SDK type, which has no CRC64NVME
field, and never filled the checksum fields. List each part with its
stored checksum so a client can verify an uploaded part after losing the
UploadPart response.

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

* s3: name the upload's checksum algorithm and type in ListParts

CreateMultipartUpload records the requested checksum algorithm and
type on the upload, but ListParts never reported them. Return both, as
AWS does, when the upload was created with a checksum.

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

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-27 17:52:47 -08:00
Chris LuandClaude Opus 5.5 2ce8b75b3f ci: refresh the apt index before installing musl and cross toolchains (#13075)
The runner image's package index can name versions the mirrors have
already dropped, so apt-get install fails with a 404 on the first
security update after the image was built.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-27 17:51:52 -08:00
Chris LuandClaude Opus 5.5 b53f6d4b5e admin: warn when more than one scheduler runs the same maintenance work (#13065)
* admin/maintenance: report whether the running manager queues a task type

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

* admin: list the EC balancers that are active at the same time

The plugin ec_balance job, the legacy maintenance manager's ec_balance task
and an admin_script job that runs ec.balance -apply each plan shard moves
from the same topology without knowing about the others.

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

* admin: log a warning while more than one EC balancer is active

The check runs on the maintenance metrics tick and logs again only when the
set of active balancers changes. The legacy maintenance entry names the
admin.toml switch that turns it off.

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

* admin: warn on the plugin pages when more than one EC balancer is active

The scheduler status API returns the active EC balancers, and the scheduler
banner on the plugin and lane pages lists them when there are two or more.

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

* admin/maintenance: count a task type only when a registered worker can run it

Only legacy maintenance workers pull tasks from the legacy queue. With plugin
workers alone, the queued ec_balance tasks never run, so they do not compete
with the plugin ec_balance job.

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

* admin: parse ec.balance apply flags like the flag package

A value counts only when strconv.ParseBool reads it as true, and a # token
ends the arguments, as it does for the shell command's flag parser.

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

* admin/maintenance: skip legacy workers past their heartbeat timeout

A disconnected worker keeps its queue record until the cleanup loop removes
it, so the capability check also requires a heartbeat within the worker
timeout.

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

* admin: count ec.balance only when its flags parse the way the command parses them

An invalid boolean in -apply or -force fails the whole command, the last
value of a flag wins, -force overrides -apply, and parsing stops at the
first non-flag argument.

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

* shell: share ec.balance's flag set and report whether its arguments apply the plan

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

* admin: count an admin_script ec.balance only when ec.balance accepts its flags

Unknown flags and invalid values of any flag fail the command before it
can move shards, so they no longer count as an active balancer.

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

* shell, plugin/worker: move admin_script command tokenizing into the shell package

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

* admin: split admin_script ec.balance arguments with the executor's tokenizer

A quoted value with spaces is one argument to ec.balance, so flags after it
are still seen.

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

* shell: report through one lookup whether a command's arguments change the cluster

ec.balance now also rejects an invalid -volumeIds, as its Do does.

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

* shell: report whether volume.balance arguments apply its plan

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

* shell: report whether ec.encode accepts its arguments

ec.encode has no dry run, so any accepted invocation changes the cluster.

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

* shell: report whether volume.vacuum accepts its arguments

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

* admin: report overlap for every maintenance work that more than one scheduler runs

The plugin scheduler, the legacy maintenance manager, and an admin_script can
each run volume balance, EC balance, EC encoding, and vacuum. Check all four
from one table and report each work with two or more active runners, in the
log and in the scheduler-status API as maintenance_overlaps.

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

* admin: show each maintenance overlap on the plugin pages

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

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-27 17:46:34 -08:00
Chris LuandClaude Opus 5.5 1e4739f97a s3api: count object reads that fail after the status line is sent (#13073)
* s3api: count object reads that fail after the status line is sent

A GET whose body breaks after the 200/206 was committed is recorded by
SeaweedFS_s3_request_total as a success and only shows up in the log.
SeaweedFS_s3_read_aborted_total{bucket,cause} counts these reads on the
volume-server, SSE and remote-mount stream paths, split into
client_canceled, deadline_exceeded and read_error, and is dropped with
the other per-bucket series when a bucket is deleted.

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

* grafana: plot aborted S3 reads by bucket and cause

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

* s3api: count aborted reads of inline objects and directory content

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

* s3api: count gRPC deadline failures as deadline_exceeded aborted reads

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

* s3api: count an aborted read as client_canceled only when its request was canceled

A context.Canceled error under a live request context comes from an
internal cancellation, such as a shared lookup canceled by another
request, so it is recorded as read_error.

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

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-27 17:44:12 -08:00
Chris LuandClaude Opus 5.5 ef633dcc4d admin: inspect an S3 object's versions, retention and chunk volume health (#13078)
* admin: inspect an S3 object's versions, retention and chunk volumes

For a bucket and key, collect the base entry and every entry under
<key>.versions, decode version id, delete marker, ETag, client checksum,
Object Lock mode, retain-until, legal hold and the WORM enforcement time,
and map each chunk to its volume. One filtered VolumeList then reports,
per volume, replicas present versus the replica placement, or the EC
shards present and missing against the data shard count.

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

* admin: serve the S3 object inspection at /api/s3/buckets/{bucket}/objects/inspect

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

* admin: add an Inspect Object page for a bucket and key

/object-store/buckets/{bucket}/inspect?key= renders the inspection:
volume health per chunk volume with a link to the volume or EC volume
page, then every version with size, mtime, ETag, client checksum, lock
mode, retain-until, legal hold, WORM time and its chunk file ids.

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

* admin: link each bucket to the object inspector

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

* admin: inspect a key that is also a prefix of other keys

The filer keeps such an object on a directory entry marked as a prefix
object, so the base entry lookup must accept it like a file.

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

* admin: count only S3 version entries as an object's history

A sibling named <key>.versions is history only when it is a directory,
and only children with a version id (attribute or v_ file name, as
VersionIdFromEntry reads them) are versions. Without a base object or
any such version the inspection is not found.

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

* admin: mark the newest version latest when the pointer is missing

When the base object is gone and .versions has no latest pointer (for
example after deleting a current null version), pick the latest with the
S3 gateway's own version ordering, exported as SelectLatestVersionId,
instead of leaving every version noncurrent. A truncated listing marks
none, since it may not hold the newest version.

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

* admin: report the ETag the S3 gateway returns

Use objectETag, exported as ObjectETag, so remote-only entries show
their remote ETag and entries without a stored ETag or MD5 show the
chunk-derived one.

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

* admin: read the buckets path with the inspection's request context

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

* admin: report the filer's logical size for each inspected version

filer.FileSize also covers chunk extents past a stale attribute size and
a newer remote size.

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

* admin: drop EC shard state once a volume also reports a replica

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

* admin: let the latest-version pointer outrank the null-is-latest flag

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

* admin: page the inspector's version scan past non-version entries

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

* admin: judge an inspected EC volume by its newest encode run

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

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-27 17:43:19 -08:00
github-actions[bot] ebe5c8ac91 docs: regenerate star history chart 2026-11-28 01:19:02 +00:00
Chris LuandClaude Opus 5.5 46fe0f10da volume: count failed EC shard copies by reason (#13068)
* volume: count failed EC shard copies by reason

Each failed VolumeEcShardsCopy now increments
SeaweedFS_volumeServer_ec_shard_copy_failures_total{collection,reason} and
logs the volume, shards, source and reason. Reasons: source_not_found,
empty_index, no_space, timeout, io_error, other.

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

* grafana: chart EC shard copy failures by reason

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

* volume(rs): count failed EC shard copies by reason

Mirrors the Go volume server: each failed VolumeEcShardsCopy increments
SeaweedFS_volumeServer_ec_shard_copy_failures_total{collection,reason}
with the same reasons and logs the volume, shards, source and reason.

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

* volume: classify wrapped gRPC NotFound and DeadlineExceeded copy errors

A source status that the destination wraps as text keeps its code only as
"code = NotFound" (Go) or the code's description (Rust), so match those
too.

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

* volume(rs): record EC copy failures inside the copy task

The copy keeps running after the caller cancels, so its failure is
reported from the spawned task; a join error is reported by the handler.

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

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-27 15:22:00 -08:00
Chris LuandClaude Opus 5.5 b6237dd8b1 master, admin, shell: warn about volume servers left in the default data center or rack (#13066)
* master: warn when a volume server registers in the default data center or rack

A volume server started without -dataCenter or -rack lands in
DefaultDataCenter/DefaultRack. Next to servers with explicit placement it
becomes its own failure domain for placement and balancing. Log a warning
when such a server registers while other servers name their data center,
or other racks of the same data center are named.

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

* admin: warn about volume servers left in the default data center or rack

The Volume Servers page lists the servers that fell back to
DefaultDataCenter or DefaultRack while other servers name theirs, with
their volume and EC shard counts, so the stray failure domain shows up
before placement and balancing act on it.

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

* shell: cluster.check warns about volume servers in the default data center or rack

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

* shell: cluster.check prints placement warnings before the capacity checks

A disk type with no free slots made cluster.check return before the
default data center/rack warnings were printed.

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

* admin: list each data center's rack once in the default placement check

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

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-27 15:16:25 -08:00
dependabot[bot] 8df718eaf3 build(deps): bump actions/dependency-review-action from 5.0.0 to 5.0.1 (#12929)
Bumps [actions/dependency-review-action](https://github.com/actions/dependency-review-action) from 5.0.0 to 5.0.1.
- [Release notes](https://github.com/actions/dependency-review-action/releases)
- [Commits](https://github.com/actions/dependency-review-action/compare/a1d282b36b6f3519aa1f3fc636f609c47dddb294...bbc44d14a204704ccc493733616cd1e93a0321ec)

---
updated-dependencies:
- dependency-name: actions/dependency-review-action
  dependency-version: 5.0.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-11-27 15:04:34 -08:00
76bc731c69 feat: s3: record object path in needle Content-Location pair (#13061)
* feat: operation: pass needle pairs through chunked uploads (#12997)

* feat: s3: build Content-Location needle pair from the object path (#12997)

* feat: s3: record object path in needles written by putToFiler (#12997)

* feat: s3: record destination object path in copied chunks (#12997)

* feat: s3: record destination object path in stream-copied chunks (#12997)

* test: s3: pin Content-Location in putToFiler upload options (#12997)

* s3: record no path on copies of volume-encrypted chunks

A chunk written with -encryptVolumeData is copied as ciphertext through
the plain upload path, so the copy sent the destination path in
plaintext next to encrypted data, while PutObject's cipher upload sends
no pairs at all.

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

---------

Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-27 15:02:15 -08:00
bf0da715fc ci: keep dev builds published and document them (#13059)
* ci: keep dev builds published and document them

The dev release was emptied before every build: the cleanup job deleted
all weed-* assets first, and cancel-in-progress cancelled the build on
the next master push. Build the platforms with one prepare timestamp,
upload first, then prune assets from older builds. Queue runs instead
of cancelling them, and allow manual runs from master only.

Document the dev binaries and the :dev container images in the README
and docker/README.md.

Refs #5009

* ci: key dev build concurrency by ref

A workflow_dispatch from another branch joined the single dev group and
replaced the pending master run before failing its ref guard, so the
newest master commit was never built.

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

* ci: keep newer dev builds when an older run retries

A "Re-run failed jobs" of an older run keeps that run's BUILD_TIME, so
its prune treated a newer complete build as stale and deleted it. Prune
now deletes only assets whose stamp sorts before BUILD_TIME.

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

---------

Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-27 14:59:44 -08:00
Chris LuandClaude Opus 5.5 978ff95327 volume(rs): reload TLS server certificates on SIGHUP (#13067)
The Go volume server re-reads its gRPC and HTTPS cert/key files on
SIGHUP (certreload.ReloadAll). The Rust server built each rustls
ServerConfig with a fixed cert, so a rotated pair only took effect
after a restart. Serve the pair through a resolver that re-reads the
files on SIGHUP and keeps the previous pair when the new files fail to
load.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-27 14:57:26 -08:00
Konstantin Lebedevandwhitefox b0df54aa8f security: reload TLS credentials on SIGHUP (#13058)
TLS certs currently refresh only on the periodic WEED_TLS_CERT_REFRESH_INTERVAL poll (5h by default), so after replacing cert/key files an operator has to wait up to one interval for the new material to be used. SIGHUP already reloads configs and JWT keys, but not TLS.

Replace gRPC's pemfile.Provider with a small certprovider.Provider in weed/security/certreload that keeps the current KeyMaterial, refreshes on the same timer, and can be forced to re-read the files via Reload. A process-wide registry plus grace.OnReload(ReloadAll) makes SIGHUP apply rotated certs immediately to every gRPC and HTTPS server/client.

On parse/read errors the previous material is kept, so a broken rotation does not take the listener down.

Fixes #13056

Co-authored-by: whitefox <whitefox@mayflower.work>
2026-11-27 14:57:06 -08:00
7bbb65fa80 master: /col/delete requires an explicit collection name (#13055)
* master: /col/delete requires an explicit collection name

A /col/delete request without a collection parameter, or with an empty
one, read as the empty-named default collection and deleted it. Return
400 instead, and accept collection=_default (the keyword weed shell
uses) to delete the default collection deliberately.

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

* master: keep a collection literally named _default addressable by /col/delete

collection=_default now names the empty-named collection. A collection
created with that literal name would have been unreachable, and a request
meant for it would have deleted the default collection instead. Resolve
the keyword to the literal collection when one exists, and refuse the
request when both exist.

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

* master: /col/delete accepts only the DELETE method

A GET is expected to be safe, yet a bare GET or a link prefetch deleted
the named collection. Any other method now gets 405 with an Allow
header, and the docs, benchmark help and test helpers send DELETE.

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

* master: /col/delete accepts _default_ for the default collection

When a collection literally named _default exists next to the default
collection, collection=_default is refused, which left the default
collection with no way to be named. Accept the _default_ spelling that
weed shell collection.delete already takes; it always means the
default collection.

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

* master: /col/delete keeps a literal _default_ collection addressable

_default_ now resolves like _default: to the literal collection when one
exists, to the default collection otherwise, and refuses the request when
both exist.

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

* REST_API: /col/delete when both keyword names are literal collections

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-11-27 14:56:18 -08:00
Chris LuandClaude Opus 5.5 96321141cc filer.sync: stop deleting versions on transient lookups and in-flight pointers (#13063)
* filer.sync: retry an update whose destination lookup failed transiently

FilerSink.UpdateEntry reported every lookup error as a missing entry, so
the replicator and filer.sync deleted the destination key and created it
again. For a directory, a canceled or unavailable lookup removed it with
everything under it. Only a real not-found now lets the caller recreate
the key; other lookup errors are returned for retry.

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

* s3: leave a pointer to a recently minted version unrepaired

When a versioned read finds a latest pointer whose version file is
missing, the self-heal rescanned .versions and then either removed the
directory (no version left) or rewrote the pointer to the newest version
found. With filer.sync the directory and its pointer can arrive before
the version file, so the heal acted on a version still in flight: the
local directory removal replicated back and deleted the committed
version on the source cluster, and a pointer repair would roll its
latest pointer back.

While the pointer names a version minted in the last ten minutes, the
read now answers from the rescan without persisting anything, and the
reconciler skips the key. After that window the heal works as before.

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

* filer.sync: retry a failed destination lookup before giving up on an update

Returning a transient lookup error leaves the retry to the caller, and
filer.replicate hands a failed event to the notification input instead
of replaying it. Retry the lookup in place with the shared bounded
backoff; a not-found still returns at once.

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

* filer.sync: count only the not-found sentinel as a missing destination

LookupEntry already maps every miss to filer_pb.ErrNotFound, plain-text
ones included. Matching the sentinel's text in any error also counted an
Unavailable lookup carrying that text as a miss, which let the caller
delete and recreate the key.

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

* s3: requeue an in-flight versions pointer for after the grace window

The reconciler dropped a key whose pointer named a version still in
flight, so nothing revisited it once the window passed. Requeue it for
one grace window without counting the skip as an attempt.

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

* s3: probe the latest version file before deferring an in-flight pointer

A recent pointer whose version file is already present needs no repair;
deferring it kept the key queued for the whole grace window and used
up queue capacity.

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

* s3: retry an in-flight versions pointer when its grace runs out

The reconciler waited a full grace window after the deferral, so a
pointer first seen near the end of its grace stayed unrepaired for
almost twice as long.

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

* s3: run the in-flight pointer grace from its local commit too

The grace was measured from the version id's mint time on the origin
cluster against the local clock, so a peer whose clock ran more than
the grace ahead, or a filer.sync backlog longer than the grace, saw a
just-synced pointer as stale and could remove or roll back the version.
The .versions entry's commit time is stamped by the local filer when
the pointer is stored, so it bounds the wait with the local clock.

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

* s3: repair a pointerless .versions entry despite a recent commit

The in-flight grace protects a pointer whose version file has not arrived
yet. A .versions entry with no pointer names no such file, so a recent
commit of it must not hold back the rebuild of its pointer.

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

* s3: hold a stale-pointer repair while the live entry is still in grace

The heal checked the grace on the snapshot it took before the scan. A
.versions entry stored again with the same pointer during the scan
restarts the grace, so check it on the live entry the CAS is conditioned
on before persisting the repair.

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

* s3: recheck the live grace before removing an empty .versions

The empty-directory cleanup checked the grace on the pre-scan snapshot,
so a pointer stored again during the scan could still have its
.versions removed. Re-read the entry and leave it while its grace lasts.

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

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-27 14:51:53 -08:00
Chris LuandClaude Opus 5.5 e01133bfa3 ec_balance: keep node addresses out of the task ID so tasks can be persisted (#13062)
* ec_balance: keep node addresses out of the task ID

The ID embedded both host:port node addresses, and the admin's task
persistence rejects any ID containing ':', so every ec_balance task
failed to save on each state change and lived only in memory. The
volume, shard, timestamp and index already make the ID unique; the
nodes stay in the task's Reason and params.

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

* admin: test that a detected ec_balance task saves and loads

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

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-27 12:58:08 -08:00
77333a5578 s3: match copy-source ETag conditions with the shared helper (#13054)
* s3: match copy-source ETags as the read and write paths do

validateSourceConditionalHeaders compared the source ETag to the header
value with strings.Trim, so x-amz-copy-source-if-none-match: W/"<etag>"
did not match and an unchanged source was copied instead of answered
with 412. An If-Match list that contained the source's ETag was
rejected for the same reason. RenameObject shares the helper, so
x-amz-rename-source-if-* behaved the same way.

Use util.ETagListMatches, which the GET and PUT paths already use:
strong comparison for If-Match, weak for If-None-Match, and the quoted
tag lists RFC 9110 allows.

* s3: drop the history comment from the copy-source ETag checks

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

* mount: skip the truncate manifest test on freebsd like its fake filer

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

---------

Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-27 12:48:08 -08:00
397a156104 security: a fips.mode setting that Go checks against GODEBUG and the Rust binaries apply to TLS (#13029)
* util: refuse to start when fips.mode in security.toml disagrees with GODEBUG

security.toml gains [fips] mode = "off" | "on" | "strict", also settable
as WEED_FIPS_MODE: one setting that states the FIPS 140-3 mode of every
process in a deployment, so the Rust binaries, which do not run on the Go
runtime, can follow it. Go processes keep taking their behaviour from
GODEBUG=fips140 and now check it against the setting:
LoadSecurityConfiguration and `weed worker` exit when "off" runs without
fips140=off, "on" without fips140=on, or "strict" without fips140=only,
naming the setting and the GODEBUG value it needs. An unknown value is
refused; unset or empty changes nothing.

Refs #12839

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

* rust: fips.mode with FIPS-mode TLS in weed-volume, weed-worker and weed-vector

seaweed-common gains a fips module: FipsMode resolved from fips.mode in
the security.toml a binary uses, with WEED_FIPS_MODE over it. Each binary
resolves it once at startup, logs it and installs the matching rustls
provider as the process default, refusing to start on an unknown value or
when another provider was installed first.

Under "on" and "strict" the provider is aws-lc-rs filtered to the lists
Go's crypto/tls applies in FIPS mode: TLS 1.3 AES-GCM suites and TLS 1.2
ECDHE AES-GCM suites (no ChaCha20-Poly1305), X25519MLKEM768,
SecP256r1MLKEM768, P-256 and P-384 (no plain X25519), Go's ten signature
schemes (no ML-DSA). Configurations SeaweedFS builds require the Extended
Master Secret in that mode, and the volume server refuses a non-FIPS suite
in tls.cipher_suites instead of falling back. sw-client installs the same
provider instead of ring. Unset or "off" keeps aws-lc-rs's default
provider unchanged.

This is behavioural parity only: the provider still runs on the
non-validated aws-lc-rs build.

Refs #12839

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

* util: refuse a fips.mode that is not a string

viper's GetString turns an array or a table into "", so mode = ["strict"]
under [fips] skipped the GODEBUG check while the Rust binaries refused the
same file. RequireFipsMode now reads the raw value (ViperProxy.Get, under
its lock) and exits when it is not a string, naming its source; an absent
or empty value still means unset, and WEED_FIPS_MODE still wins.

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

* rust: read fips.mode with the parser that reads the JWT keys

seaweed_common::fips::resolve parsed security.toml with the toml crate,
while the volume server reads the rest of the file with its own lenient
loader. A file with [fips] mode = "on" beside an unquoted value the loader
accepts resolved to off and logged "fips.mode unset", although the JWT
keys from the same file were applied. Each binary now reads fips.mode
with the loader it uses for everything else and hands the value to
resolve: the volume server through its line parser, the worker and vector
engine through their parsed Security table, which already refuses a file
that is not TOML. A security.toml the volume server finds but cannot read
stops startup. A missing setting is still off, and WEED_FIPS_MODE still
wins. seaweed-common no longer depends on toml.

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

* sw-client: offer only FIPS signature schemes with insecure_skip_verify

With https.client.insecure_skip_verify, reqwest installs its own verifier,
which advertises a fixed scheme list including SHA-1 and Ed448 whatever
the process provider allows. In FIPS mode the volume transport now builds
its rustls configuration itself on the process provider: the server
certificate and host name are not checked, as the setting asks, but
handshake signatures are verified with the provider's algorithms, only its
schemes are offered, and TLS 1.2 requires the Extended Master Secret.
Outside FIPS mode the reqwest path is unchanged.

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

* seaweed-common: sign only with Go 1.27's FIPS schemes, allow ML-DSA

The FIPS provider kept aws-lc-rs's key provider, so a FIPS-mode listener
signed handshakes with whatever scheme its key and the peer agreed on,
outside the list the provider verifies with. Keys now load through a
provider that limits each key to the FIPS signature schemes and refuses a
key that can sign none of them, such as Ed448; the volume server and the
worker's gRPC TLS name the certificate and key files in that error.

The lists follow Go 1.27.4, which go.mod now requires: its
defaults_fips140.go allows ML-DSA-44, -65 and -87 as signature schemes and
ML-DSA certificate keys (for Go's native module only), so they are allowed
here as well. Go also allows MLKEM1024 but does not enable it by default,
so it stays out of the key exchange list as in Go's defaults. "off" keeps
the default key provider.

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

* mount: skip the truncate manifest test on freebsd like its fake filer

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-11-27 12:47:44 -08:00
dependabot[bot] 977513cf35 build(deps): bump github/codeql-action from 4.39.3 to 4.39.4 (#12930)
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 4.39.3 to 4.39.4.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/v4.39.3...v4.39.4)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-version: 4.39.4
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-11-27 08:55:12 -08:00
Chris Lu 781288cf11 s3api: ignore custom x- query parameters on bucket requests (#13046) 2026-11-27 02:42:37 -08:00
Yip Leo eb655f46ba mount: merge a flush's folded chunks as the chunks, not as a new manifest (#13043)
* mount: merge a flush's folded chunks as the chunks, not as a new manifest

A flush folds the handle's chunks into manifests before it commits, and
installs the folded list in the handle. When the commit finds that a
peer changed the entry, mergeContentEntry replays the handle's changes
since its base onto the peer's entry: a chunk not in the base counts as
the handle's own write, a base chunk missing from the handle as one it
dropped. A manifest the flush just made of base chunks therefore goes in
as a write of the handle's, with every chunk it holds:

- after a peer rewrote the whole file (a bloat merge, stamped with the
  oldest data it holds) or dropped chunks, the manifest brings the old
  chunks back, and where their stamps are newer they hide the peer's
  bytes;
- after a peer folded the same chunks, the entry holds both manifests.

Since #12462 a flush folds every 256 small chunks, so two mounts that
append to one file, as the ranks of a training job often do with its
log, reach this.

The flush now records what its fold packed (chunkFold). The merge sees
the folded chunks instead of the new manifests, so the fold is no change
at all; the merged entry goes out unfolded, and the next flush folds it
again. When the commit fails, the fold is taken back out of the handle,
whose base still has the chunks, so a later merge or flush does not take
the manifests for writes either. Their blobs are left unreferenced, as a
failed fold leaves them.

* mount: rebase a merged flush onto the entry the filer stored

Review follow-up. A merged commit sends the merged chunks unfolded, and the
filer can fold them before it stores the entry (cleanupChunks). The flush
installed the request in the handle, but took the stored entry as the
handle's base (ackedBase), so the handle held flat chunks against a base
that lists a manifest. A later merge, such as a peer's truncate reaching the
dirty handle, would take those chunks for writes of the handle's and
publish them again.

The handle is now rebased onto the stored entry it takes as its base, in
both flush paths. rebaseEntry still gets the request, so chunks attached
after it was taken are kept.

TestFlushMergeInstallsTheEntryTheFilerStored: a peer's chmod refuses the
first commit, the merged retry sends 256 flat chunks, and a filer that folds
them stores a manifest; the handle and its base must both hold the stored
entry. It fails with the request installed.
2026-11-26 22:48:58 -08:00
424c67ad06 mount: truncate a manifest the cut goes through as the chunks it holds (#13042)
* mount: truncate a manifest the cut goes through as the chunks it holds

Truncating a file shortens every chunk the new size cuts through, a
manifest chunk included. A manifest's span only says where its chunks
lie: reads resolve the chunks inside it at their own offsets and sizes,
so the bytes past the cut stay readable. Once the file grows over them
again without writing them, by an extending truncate or a write past the
end, they come back where zeros belong.

Reproduced with weed mount on a local cluster: 700 lines appended with
one close() each, so the small-chunk fold put the first 256 into a
manifest; then a truncate to the first 100 lines and an ftruncate past
the old end. The extended range read 8,580 bytes of the cut lines
instead of zeros, through both mounts of the file. Since #12462 any file
grown by a few hundred small appends has manifests; before it, only
files of 10,000 chunks did.

A truncate now opens each manifest the cut goes through, nested ones
too, and cuts the chunks it holds. The manifest leaves the entry, and
the filer deletes it with the chunks past the cut when the entry is
stored. A manifest shortened by an earlier truncate first gives up the
chunks past its own span. If a manifest cannot be read, the truncate
fails with EIO and the file is left as it was.

* mount: keep a truncate's expanded chunks from merges, read its manifests with a token

Review follow-ups:

- The chunks a truncate takes out of a manifest are not in the handle's
  base, which lists the manifest. A merge onto a peer's entry took them for
  writes of the handle's, so after a peer cut the file shorter and the filer
  queued the rest for deletion, the handle could publish references to
  those chunks again; the gap check passed because plain chunks covered the
  range. Before the expansion, the manifest across the cut refused that
  merge. A truncate that expands a manifest now marks the handle as having
  rewritten its chunks, so the merge is refused when the peer changed
  chunks, at the next flush and when the peer's event reaches the handle.
- A truncate by path, with no open handle, read the manifest before its file
  id was registered for a filer-issued read token, so a mount reading with
  -volumeReadAuth sent the read without one and the truncate failed with
  EIO. The entry's chunks are registered under its path first.
- All manifest reads of one truncate share one one-minute deadline, instead
  of a minute each.

TestTruncateThroughManifestCutsItsChunks runs SetAttr with and without an
open handle: it fails without the registration (no handle) and without the
rewrite mark (open handle). TestMergeRefusesTruncateExpansionOverPeerTruncate
shows the merge that published a peer-dropped chunk, and its refusal.

* mount: answer a truncate interrupted while reading a manifest with EINTR

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

---------

Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-26 22:47:52 -08:00
Chris LuandClaude Opus 5.5 be8eb02ac0 util: remove multipart temp files parsed on the idle-timeout pause's request copy (#13044)
* util: remove multipart temp files parsed on the paused request copy

net/http removes the temporary files of a multipart form parsed on the
Request it passed to the handler. PauseIdleTimeoutWhileHandling hands the
handler a shallow copy when the request has a body, so a form parsed
there (ParseMultipartForm, or FormValue on a multipart body) left its
temporary files behind.

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

* util: test that the idle-timeout pause removes multipart temp files

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

* util: point the multipart temp-file test's temp dir at Windows' TMP and TEMP too

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

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-26 22:47:05 -08:00
Chris LuandClaude Opus 5.5 f2e9e49842 master: stop volume growth from leaking volumes into a just-deleted collection (#13035)
* topology: stop a grow once a delete fences its collection

A grow request creates its volumes one after another and resolves the
collection by name for each, so once the collection was deleted the rest of
the request recreated it. The request now keeps the collection it started
in and holds a per-collection fence shared while it creates each volume. A
delete can raise the fence exclusively, which waits out the volume in
flight, and the request stops at its next volume. A collection dropped only
because its last layout emptied is followed to the one published under its
name.

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

* master: fence volume growth before deleting a collection

The delete listed the collection's servers, fanned out DeleteCollection, and
only then dropped the collection from the topology. A grow still running
created its next volumes during or after the fan-out, on servers that had
already been cleaned or were not in the list, and those volumes registered a
new layout for the deleted collection that nothing removed. A bucket deleted
right after its first write leaked most of its initial volumes this way.

The delete now raises the collection's growth fence first, so the volume in
flight registers and is deleted with the rest, and the grow stops. A failed
fan-out lifts the fence, since the collection stays in place.

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

* topology: refuse assigns from a collection being deleted

The delete waits for the volume a grow is creating before it lists the
collection's servers, and the collection's writable volumes stayed
assignable meanwhile, so a write could land in a volume about to be
deleted. The delete now raises the fence before it waits, and assigns
check it.

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

* topology: list only collections that hold a volume layout

A grow request publishes its collection before its first volume
registers, so one that created nothing left a collection with no
volume in the list.

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

* topology: queue no grow for a collection being deleted

PickForWrite returned the layout's shouldGrow before it checked the
fence, so an assign on an empty layout of a collection being deleted
still queued a grow. That grow could run after the delete finished and
recreate the collection. Check the fence right after the pick, before
any early return.

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

* topology: keep an emptied collection published while growth holds it

DeleteLayout unpublished a collection as soon as its last layout
emptied, even while a grow held it or a delete had fenced it. The
volume in flight then registered by name into a new collection that
the delete never listed servers for, and the delete's final
DeleteCollection dropped it from the topology while it stayed on disk.
Unpublish an empty collection only when no grow or delete holds it.

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

* topology: fence the collection still published under the name

An emptied-layout cleanup that passed its fence check could unpublish the
collection while the delete waited to fence it. The delete then fenced and
listed an orphaned object, while growth published a new collection under
the name that no fence held. Topology.FenceGrowth re-checks publication
once the fence is up and moves to the collection published since.

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

* topology: run one delete of a collection at a time

Two deletes of one collection both fenced it and fanned out by name. Once
the first removed it, a write could recreate the collection, and the
second delete removed the new one's volumes and topology entry.
FenceGrowth now waits for a delete already running on the collection and
finds nothing once that delete removed it; a delete that failed hands
the collection to the one waiting.

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

* topology: stop a delete another delete beat to the collection

A delete that fenced the collection but had not yet checked that it was
still published retried when it was not, for the collection an emptied
layout drops. A delete that removed it in between also left it
unpublished, so the retry fenced and returned the collection a write had
recreated under the name since. finish(true) now marks the collection
deleted before it unpublishes it, and the retry stops at that mark.

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

* master: keep the name fenced through the EC pass of a delete

The normal pass unpublished the collection and let growth back in before
the EC pass ran. The EC pass deletes by name on every server holding the
collection's shards, and DeleteCollection on a server also drops its
normal volumes, so a write recreating the bucket in between could land a
volume that the EC pass then deleted. A second delete of the name, finding
no collection, also ran its own EC pass by name.

deleteCollection now fences the name once, before either pass, and lifts
or ends the fence after both. finish(true) unpublishes the collection then.
A name with EC shards only gets an empty collection to fence, so an assign
under it is refused too, and a delete that finds nothing skips both passes.

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

* topology: wait for the second delete's lock instead of sleeping

The overlapping-delete tests slept before acting on the first delete. A
second delete scheduled late started after the collection was replaced, or
after the first delete was already over, so the tests could fail or pass
without the overlap they check. They now wait until the second delete is
blocked on the delete lock, read from the goroutine stacks.

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

* topology: empty the layout through UnRegisterVolumeLayout in the test

The test called DeleteLayout, whose signature differs in builds that key
layouts by more than replication, TTL and disk type. UnRegisterVolumeLayout
reaches the same cleanup from a VolumeInfo and has one signature everywhere.

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

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-26 22:46:28 -08:00
Chris LuandClaude Opus 5.5 8053e77813 s3api: decide existing-object-tag denies on the object's tags (#13038)
* s3api: report a bucket policy Deny on existing object tags

HasExistingObjectTagDeny tells whether a bucket policy has a Deny statement
conditioned on s3:ExistingObjectTag/<key>, so the auth layer knows when a
deny may turn on tags it has not read yet.

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

* s3api: decide existing-object-tag denies on the object's tags

The auth layer evaluates the bucket policy before the handler reads the
object, so s3:ExistingObjectTag/<key> resolves to a missing tag. A Deny
with a negated condition (StringNotEquals, StringNotLike,
StringNotEqualsIgnoreCase, Null true) then matched every object and was
final, even one whose tag satisfies it, as in the deny-until-scanned-clean
pattern.

When that early evaluation denies and the policy has such a Deny, look up
the object's entry and evaluate again with its tags. A missing object or a
failed lookup keeps the deny. Copy sources and per-key checks that go
through authorizeObjectKeyAction get the same treatment.

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

* s3api: give identity checks the object tags a Deny was decided on

With IAM integration, VerifyActionPermission evaluates the mirrored bucket
policy again alongside the identity's policies, from a condition context
built from the request alone. The negated existing-tag Deny matched there
once more and denied an object tagged to pass it.

evaluateBucketPolicy now returns the request carrying the tags it read,
and RequestConditionValues reports them as s3:ExistingObjectTag/<key>.

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

* s3api: recheck in-flight tag conditions on the version served

An in-flight request is authorized again when access changes. The entry
lookup read the version current by then, so a newer version tagged to
pass the Deny could keep a download of an older, denied version running.
The handler's entry recheck now records the entry it authorized on the
tracked request, and the re-check decides on that entry.

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

* s3api: load the bucket before deciding an object request on its policy

On a bucket whose policy was not loaded yet, the early bucket policy check
found no policy and skipped the object-tag lookup, so the identity checks
saw the request without the object's tags.

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

* s3api: keep an owned copy of the entry a tracked request served

Handlers change the entry's metadata after the check, for example when
storing new tags, so revalidation read a map the handler was writing.

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

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-26 21:58:10 -08:00
aaca5c8c0a s3: verify SigV4 header values with each SDK's Trimall (Go, Java, botocore) (#13036)
* s3: trim only ASCII spaces in SigV4 canonical header values

signV4TrimAll used strings.Fields, which also splits on Unicode spaces
(U+00A0, U+202F, ...). A signed header whose value holds one inside, such
as an x-amz-meta-* filename from a macOS screenshot ("... at 2.20.09 PM"),
got a different canonical request than the client signed, and the request
failed with SignatureDoesNotMatch. Trim and compress only ' ', as the AWS
SDKs do (aws-sdk-go-v2's v4.StripExcessSpaces).

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

* s3: verify SigV4 with both clients' Trimall for non-ASCII-space whitespace

The AWS SDK for Go v2 collapses only ASCII spaces in a signed header value and
trims the edges with strings.TrimSpace; botocore turns every whitespace
character into a space. Match the Go SDK first (now also trimming Unicode
whitespace at the edges) and, when it gives a different canonical request,
retry with the previous strings.Fields form so botocore signatures keep
verifying.

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

* s3: pass the header value trim to getCanonicalRequest and getCanonicalHeaders

Fold canonicalRequestWith and canonicalHeadersWith into the existing
functions instead of keeping them as wrappers.

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

* s3: also verify SigV4 header values with the AWS SDK for Java Trimall

The Java SDKs collapse runs of spaces and tabs but keep Unicode spaces, so
a value with both a tab and a U+00A0/U+202F matched neither the Go SDK nor
the botocore form. It is tried between the two, so a value with only one
kind of whitespace still computes at most two signatures.

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

---------

Co-authored-by: Bear1110 <14165451+Bear1110@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com>
2026-11-26 21:57:31 -08:00
e743f99bb5 util: keep a request's context while its handler works quietly past the idle timeout (#13040)
* util: keep a request's context while its handler works quietly past the idle timeout

A request that the server works on for longer than the listener's idle
timeout, without reading or writing, lets that timeout end net/http's
background read: the read the server keeps waiting while a handler runs,
to see a client hang up. net/http takes the failed read for the client's
connection failing and cancels the connection's context, so the request in
progress, and every later request on the kept-alive connection, run with a
canceled context. #10212 covered a long write-only response, whose writes
now extend the read deadline; an answer that has not started yet has
nothing to extend it.

On the S3 gateway (-idleTimeout 120 s) such requests are the ones that
answer only when their work is done, e.g. a large CopyObject into a
versioned bucket, which the copy keep-alive of #12862 does not cover. After
one, the next requests on that connection fail within a millisecond: a
ListObjectsV2 answers 500, a GetObject and a PutObject 499
ClientDisconnected while the client is still connected. The filer's HTTP
listener has a 10 s idle timeout by default.

PauseIdleTimeoutWhileHandling, which newHttpServer now installs next to the
ConnContext hook it already sets (S3, filer, IAM and master HTTP), takes
reading out of the activity timeout from the moment a request's body has
been read to its end (at once when it has none) until its handler returns:
the client is waiting for the answer, so a connection that carries nothing
means the server is at work. Reading a body, writing an answer and waiting
for the next request stay under the timeout, and a client that closes its
connection still cancels the context. Over HTTP/2 the frame reader keeps no
deadline while such a handler runs and gets it back when the last one
returns.

Tests: weed/util/net_timeout_test.go (a quiet handler over HTTP/1.1, TLS
and HTTP/2, and the next request on the same connection; the same after a
1 MiB body; a stalled body, an idle connection, an idle HTTP/2 connection
and a client hang-up still end as before; concurrent requests; a waiting
read held by the pause and released at its end; the context loss without
the wrapper) and weed/command/server_http_test.go (newHttpServer).

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

* webdav: serve through newHttpServer so quiet handlers keep their context

weed webdav serves a util.Listener with an idle timeout (10 s by default)
but built a bare http.Server, so it had neither ConnContext nor the idle
timeout pause. A COPY or MOVE of a large file answers only once it is done,
and like the S3 and filer handlers it then lost its context, and so did
every later request on the connection.

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

* util: pause the idle timeout for HTTP/1.x requests only

HTTP/2 has no background read to protect: when its connection carries
nothing for the timeout, the frame reader's deadline closes the connection,
and no later request runs on it. That deadline is also what ends a stream
whose client stopped reading, since the answer waits for flow-control
credit, not on the socket, where the write deadline would end it. With the
pause on HTTP/2 requests, a download whose client stopped reading held its
handler and connection until the client acted, and a stream that declared
content-length 0 but never ended could hold its handler the same way.

Pause only HTTP/1.x requests; HTTP/2 keeps the timeout it had.

Tests: TestStalledDownloadStillTimesOut over HTTP/1.1, TLS and HTTP/2 (the
HTTP/2 case was still waiting after 8 s with the pause on HTTP/2) and
TestOnlyHTTP1RequestsArePaused; the HTTP/2 quiet-handler cases are gone,
with them the HTTP/2 subtest that flaked under -race.
TestPauseUnderConcurrentRequests gets a 1 s idle timeout, so that a request
waiting for its turn on a slow run does not find its connection closed.

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-11-26 21:56:12 -08:00
1f8ad7016f filer: compare garbage chunks by needle identity (#12992)
* Normalize chunk identities during garbage comparison

* Keep replication chunk respellings observable

* filer: skip the needle identity index when nothing is subtracted

Every compaction subtracted its retained chunks from an often empty
covered list, parsing and re-formatting each retained file ID first.

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

* filer: skip the identity subtraction at the compaction call site

Returning early from doMinusChunks on an empty minuend stopped
MinusChunks from calling GetFileIdString on the new entry's chunks.
After CreateEntry of a new file, the caller's chunks then kept the
FileId that BeforeEntrySerialization cleared, so tus completion built
its still-referenced set from empty IDs.

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

* filer: match needle spellings through DoMinusChunks instead of a new function

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

* filer: DoMinusChunks always matches chunks by needle

Drop the byNeedle parameter so DoMinusChunks keeps its two-argument
signature and every caller, including ones added on master since,
compares equivalent file ID spellings as the same needle. The needle
normalization moves from the server scope checks to filer.ChunkIdentity
so both share it.

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

* filersink: match replicated source file IDs by needle

compareChunks no longer reports a respelled source chunk, so the
replica keeps the SourceFileId it was copied under. Removing chunks the
source dropped and judging stale backup chunks now compare that ID by
needle, otherwise a later removal in the other spelling would leave the
replica's chunk behind.

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

---------

Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-26 17:25:55 -08:00
github-actions[bot] f927436567 docs: regenerate star history chart 2026-11-27 00:34:29 +00:00
dependabot[bot] 68e99fe04d build(deps): bump github.com/ydb-platform/ydb-go-sdk/v3 from 3.155.1 to 3.157.1 (#12925)
build(deps): bump github.com/ydb-platform/ydb-go-sdk/v3

Bumps [github.com/ydb-platform/ydb-go-sdk/v3](https://github.com/ydb-platform/ydb-go-sdk) from 3.155.1 to 3.157.1.
- [Release notes](https://github.com/ydb-platform/ydb-go-sdk/releases)
- [Changelog](https://github.com/ydb-platform/ydb-go-sdk/blob/master/CHANGELOG.md)
- [Commits](https://github.com/ydb-platform/ydb-go-sdk/compare/v3.155.1...v3.157.1)

---
updated-dependencies:
- dependency-name: github.com/ydb-platform/ydb-go-sdk/v3
  dependency-version: 3.157.1
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-11-26 13:25:45 -08:00
39675b2faf filer: hide remote rename source paths from scoped responses (#13010)
* filer: redact remote rename source from scoped responses

* Preserve scoped remote rename markers

* Consolidate scoped marker replacement coverage

* Refuse scoped whole-entry guards during remote rename

* Keep coded create refusals for guarded scoped writes

* Make scoped subscription batch coverage deterministic

* filer: refuse scoped conditions that compare the remote rename source

IF_EXTENDED_NOT_EQUAL clauses and ExpectedExtended on Create, Update
and DeleteEntry could still compare a guess against the hidden marker,
so a scoped client could confirm the source path it redacts.

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

* filer: refuse scoped condition gates on the remote rename source

An IF_EXTENDED_TIME_ELAPSED gate applies its time check only when the
gate value matches, so a gate on the marker also confirms a guess.

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

* filer: keep a pending rename source out of remote copy errors

A failed copy of a pending remote-only rename named the marker's source
location, which the backend error repeats, and rename RPCs return that error
to scoped callers. Log the full error and return one naming only the paths
the caller supplied.

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

* filer: let a scoped local overwrite end a pending remote rename

Scoped replacements kept the hidden rename source marker even though a
scoped entry can never stay remote-only, so the marker was stale on the
local copy and every later scoped IF_ENTRY_EQUAL write was refused. Drop the
preservation and let the overwrite clear the marker as other local writes do.

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

* codespell: ignore poligon only inside URLs

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

---------

Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-26 12:31:02 -08:00
0fb1387226 s3: compare If-None-Match weakly, as the filer and volume servers do (#13033)
* s3: compare If-None-Match weakly, as the filer and volume servers do

The S3 gateway matched conditional ETags by trimming quotes, so a weak
tag such as W/"etag" in If-None-Match never matched and a revalidating
GET got 200 instead of 304. Move the filer's RFC 9110 matcher to
weed/util and use it in the gateway: weak comparison for If-None-Match,
strong for If-Match. The routed write condition now sets AllowWeak on
IF_ETAG_NOT_MATCH so the check under the object lock agrees with the
gateway's pre-check.

* s3: split write-condition ETag lists the way the gateway matches them

etagList split on every comma and kept empty elements, so the filer's
locked If-None-Match check (now a weak comparison) could match a fragment
of one quoted tag, or an empty element, that the gateway's pre-check
ignores. A PUT with If-None-Match: W/"<etag>,x" passed the pre-check and
then got 412 under the lock. Reuse the gateway's quote-aware splitter and
drop empty elements.

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

---------

Co-authored-by: Mansur Akhmadi <10739460+mansur-akhmadi@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-11-26 12:30:33 -08:00
Chris LuandClaude Opus 5.5 7738ea7f45 s3: keep a bucket policy change from aborting its own request (#13034)
* s3: keep a bucket policy change from aborting its own request

The bucket metadata event re-checks every request in flight on the
bucket, including the PutBucketPolicy, DeleteBucketPolicy or DeleteBucket
request that made the change while it is still answering. A deny-all
policy, or the removal of the policy that granted the requester access,
then closed that request's connection after the change was stored; the
client saw a reset and its retry was denied.

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

* s3: keep re-checking a policy change until it stores it

Exempting the policy-changing actions at admission let a request whose
key was revoked while it read its body still replace or delete the
policy. The request stays tracked now and untracks itself right before
it stores its change; if it was aborted by then, it stores nothing.

DeleteBucket untracks itself before the delete, which also covers the
identity re-check its bucket-scoped action pruning triggers.

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

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-26 12:29:48 -08:00
dependabot[bot] 01b88ad2f9 build(deps): bump go.etcd.io/etcd/client/pkg/v3 from 3.7.3 to 3.7.4 (#12927)
Bumps [go.etcd.io/etcd/client/pkg/v3](https://github.com/etcd-io/etcd) from 3.7.3 to 3.7.4.
- [Release notes](https://github.com/etcd-io/etcd/releases)
- [Commits](https://github.com/etcd-io/etcd/compare/v3.7.3...v3.7.4)

---
updated-dependencies:
- dependency-name: go.etcd.io/etcd/client/pkg/v3
  dependency-version: 3.7.4
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-11-26 12:29:11 -08:00
dependabot[bot] b42a5ca24e build(deps): bump github.com/rabbitmq/amqp091-go from 1.16.0 to 1.17.0 (#12928)
Bumps [github.com/rabbitmq/amqp091-go](https://github.com/rabbitmq/amqp091-go) from 1.16.0 to 1.17.0.
- [Release notes](https://github.com/rabbitmq/amqp091-go/releases)
- [Changelog](https://github.com/rabbitmq/amqp091-go/blob/main/CHANGELOG.md)
- [Commits](https://github.com/rabbitmq/amqp091-go/compare/v1.16.0...v1.17.0)

---
updated-dependencies:
- dependency-name: github.com/rabbitmq/amqp091-go
  dependency-version: 1.17.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-11-26 12:28:42 -08:00
dependabot[bot] 5be58fccd7 build(deps): bump github.com/apache/arrow-go/v18 from 18.8.0 to 18.9.0 (#12926)
Bumps [github.com/apache/arrow-go/v18](https://github.com/apache/arrow-go) from 18.8.0 to 18.9.0.
- [Release notes](https://github.com/apache/arrow-go/releases)
- [Commits](https://github.com/apache/arrow-go/compare/v18.8.0...v18.9.0)

---
updated-dependencies:
- dependency-name: github.com/apache/arrow-go/v18
  dependency-version: 18.9.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-11-26 12:28:22 -08:00
8d975574d4 docker: let the caller's GODEBUG fips140 setting override the entrypoint's default (#13026)
docker: let the caller's GODEBUG fips140 setting override the default

entrypoint.sh appended fips140=on after the caller's GODEBUG, and Go
applies the last of repeated settings, so `docker run -e
GODEBUG=fips140=only` ran with fips140=on, and fips140=off stayed on. The
default now goes first.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com>
2026-11-26 08:47:56 -08:00
Chris LuandClaude Opus 5.5 c2c5aac943 test: fall back to a Maven Central mirror for the Spark Lance connector (#13031)
spark-submit resolved the Lance bundle and its dependencies through Ivy
from Maven Central only, so a refused Central request failed the run in
seconds with "module not found". --repositories adds the Google mirror
after Central in Ivy's resolver chain.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-26 08:43:09 -08:00
Chris LuandClaude Opus 5.5 9c17e0038d volume(rs): sign a fresh write JWT for each replica forward (#13030)
* volume(rs): sign a fresh write JWT for each replica forward

The primary checks the write JWT when the request arrives, then reads the
body. A body slower than the JWT lifetime (10 s by default) left the
forwarded Authorization header expired, so replicas answered "wrong jwt"
and the write failed with 500. With a write signing key, each forward now
carries a JWT signed right before it, after the replica lookup, for the
base file id the request was authorized for. A raw jwt= query field, which
the replica reads before the header, is no longer forwarded on writes.
Without a signing key the incoming Authorization header passes through as
before. Deletes are unchanged.

Mirrors the Go volume server change in #13028.

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

* volume(rs): take the replica forward key from the write auth snapshot

The replica JWT key was read from the guard again after the body was
read, so a reload that enabled write signing in between could sign
replica forwards for an upload that was never authenticated. Read it in
the same guard snapshot as the write's JWT check, as Go's PostHandler
does with writeSigningKey.

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

* volume(rs): drop jwt query fields by decoded name on write forwards

Go's GetJwt decodes query names and reads jwt before the Authorization
header, so a forwarded %6Awt=x would still override the fresh JWT on a Go
replica. Drop every field whose decoded name is jwt from a write forward.

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

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-26 08:42:33 -08:00
Lennart K. M. Schulz a409877b8f volume, operation: refresh the write JWT for replica forwards and filer-proxy retries (#13028)
* volume, operation: refresh the write JWT for replica forwards and filer-proxy retries

A write JWT is checked when a request arrives, but a slow chunk can take longer to stream in than the JWT lives.
The volume server then forwarded the already expired JWT to its replicas, which rejected it with wrong jwt, and the client retried through the filer with its own filer JWT, which by then had expired too.
Only a 401 marked as an expired volume JWT re-minted the filer JWT, so the 500 from the failed replica forward led to retries that could never succeed.

The volume server holds the signing key and has already authorized the request for this file ID, so it signs a fresh JWT for the forward; without a signing key it forwards the incoming one as before.
A filer-proxy upload re-mints its filer JWT before every retry, whatever the previous failure was.

Refs #6220

* volume: mint the replica forward JWT right before each forward

A JWT minted before the uncached master lookup spends part of its lifetime on that lookup, so the replica can still see it expire; minting inside the forward path gives each replica request its full lifetime.
Minting stays unconditional rather than forwarding a still-valid incoming JWT, which could expire in flight and reintroduce the failure.
The cost is a key rotation constraint: a new write signing key must be verify-only on every volume server before any server makes it current.

The base file ID trim moves into one helper so the authorization check, the expiry classification and the mint cannot disagree on which file ID a write JWT covers.
2026-11-26 08:42:25 -08:00
Chris LuandClaude Opus 5.5 d0661afad8 mount: refuse SSE-KMS and SSE-C objects the native read path cannot decrypt (#13027)
* mount: refuse SSE-KMS and SSE-C objects the native read path cannot decrypt

The native read check only recognized SSE-S3, so objects the S3 gateway
stored with SSE-KMS or SSE-C were read chunk by chunk and the mount
returned their ciphertext with success. Detect every S3 server-side
encryption type, from the object metadata or any chunk, and answer
open, read and copy_file_range with ENOTSUP unless the object is SSE-S3
and -sseS3Read routes it through a gateway.

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

* mount: drop S3 encryption markers when a file is truncated to zero

A full truncate removes the encrypted payload, but the object metadata
still named SSE-C, SSE-KMS or SSE-S3, so the plaintext the mount wrote
afterwards was refused on read. Clear those markers in SetAttr and
truncateEntry when the size becomes zero, and reset the handle's cached
classification.

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

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-26 08:41:20 -08:00
35caf2542c operation: report a delete result for volumes the lookup cannot locate (#12488)
* weed/filer: retry deletes when volume replicas are offline or missing

Signed-off-by: Tyagiquamar <mohdquamartyagi@gmail.com>

* operation: assert one delete result per file id in the no-location test

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

---------

Signed-off-by: Tyagiquamar <mohdquamartyagi@gmail.com>
Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-26 08:38:30 -08:00
e9a5d733b1 weed: report host THP policy; build: declare Go 1.27.4 to match the releases (#13025)
* weed: report the host transparent huge page policy at startup

Go maps the heap with MADV_HUGEPAGE, so the host THP policy applies to a
SeaweedFS process whether or not the operator asked for it, and the advice in
the Go GC guide depends on the heap size. Operators had no way to see which
mode a node actually runs in.

Log enabled/defrag/khugepaged.max_ptes_none once at startup from the
long-running commands, and print the Go toolchain in `weed version` so a
support bundle identifies the runtime that produced the binary. Nothing
changes the policy: THP is host-wide, and GODEBUG=disablethp=1 remains the
only per-process control.

Refs #5437

* build: declare Go 1.27.4, the toolchain the releases already use

The 4.55 release binaries report go1.27.4 (`go version -m` on the published
tarball), while go.mod still said 1.26.6, the Dockerfiles pinned golang:1.26,
and the release workflows left the Go version to the action default of "the
latest stable at build time". A source build, a container and a downloaded
tarball therefore ran different toolchains from the same tag, and the next
release could silently pick up another one.

Set the go directive to 1.27.4 in the root module and in the four modules that
build in CI, bump the 16 Dockerfiles, and pin goversion: 1.27.4 in the 16
release and dev action steps.

`go mod tidy` now emits the two require blocks Go 1.27 expects; no dependency
version changed. Go 1.27's gofmt realigns 8 files.

* weed mini: report the THP policy after quieting stderr

The startup line ran from the dispatch point before runMini applied
quietMiniLogs, so every weed mini start on Linux printed it to stderr,
which mini keeps for the welcome banner, warnings and errors. Log it
from runMini after quietMiniLogs so it lands in the log file only.

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

* util: report whether the Go heap can use huge pages

The runtime advises only GC metadata with MADV_HUGEPAGE and leaves the
heap arenas to the host default, so under enabled=madvise the heap stays
on small pages. The log still printed go_heap_disabled=false there, which
reads as "the heap uses THP". Report go_heap_thp, true only under
enabled=always without GODEBUG=disablethp, and drop the struct comment
that said the heap is mapped with MADV_HUGEPAGE.

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

* util: count an inherited PR_SET_THP_DISABLE in go_heap_thp

A launcher can disable THP for the process with prctl, and children
inherit it, so enabled=always alone does not mean the heap gets huge
pages.

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

* util: read GODEBUG disablethp the way the runtime does

The runtime applies GODEBUG left to right, so with
disablethp=1,disablethp=0 the heap keeps THP, while the helper stopped at
the first disablethp=1. The helper also missed other nonzero values such
as disablethp=2, which the runtime treats as disabled, and trimmed spaces
around keys, which the runtime keeps. Take the last disablethp with an
integer value, treat any nonzero value as disabled, and match keys
exactly. The parser now takes the GODEBUG string, so it is tested without
changing the environment.

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

* util: honor per-size THP policies in go_heap_thp

Since Linux 6.8 each anonymous huge page size has its own policy in
hugepages-<size>kB/enabled, and only "inherit" follows the top-level
knob. A 64kB size set to "always" gives the unadvised heap huge pages
under a top-level "madvise" or "never", and a 2048kB size set to "never"
takes them away under "always", but the log judged only the top-level
value. Read the per-size policies and report go_heap_thp=true when any
size reaches the heap. Under a top-level "never", the "disabled by the
host" line is now printed only when no size reaches the heap.

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

* util: report go_heap_thp=unknown when the process setting is unreadable

If PR_GET_THP_DISABLE fails, for example because a seccomp profile
rejects it, the process THP setting is not known, but the log treated it
as allowed and could print go_heap_thp=true. Print go_heap_thp=unknown
in that case. It stays false when the host or GODEBUG already rules out
heap huge pages.

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

* util: report go_heap_thp=unknown when a per-size THP policy is unreadable

An unreadable hugepages-<size>kB/enabled was skipped, so the log could
say the host disabled THP while that size allowed it. Keep it as an
empty mode and report unknown unless a readable size already allows
huge pages.

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

* ci: take the Go version from go.mod in tests and releases

posix-compliance pinned GO_VERSION 1.26 and built go 1.27.4 modules only
through the GOTOOLCHAIN auto-switch; nine workflows used go-version ^1.26 and
the kafka jobs ran in golang:1.26-alpine. Read the version from go.mod with
go-version-file, as the other setup-go steps already do, moving checkout ahead
of setup-go where it came after so the file exists. The posix report takes the
version from the setup-go output.

The release and dev builds pinned goversion 1.27.4 in 16 places. The pinned
go-release-action reads the go directive when goversion is go.mod, so the
binaries now follow go.mod without a second copy of the version.

* weed: report the THP policy from every long-running command

mount, worker, iam, master.follower, the filer sync/backup/remote/replicate
daemons and the mq agent and kafka gateway keep serving after startup like
the commands already listed; mount is likely where heap size matters most.

fuse is not listed: its first process starts a child with the same arguments
and waits, so logging at dispatch would print the line twice. It logs in
runFuse just before handing over to runMount, which only the child reaches.

---------

Co-authored-by: Konstantin Lebedev <whitefox@mayflower.work>
Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-26 08:36:36 -08:00
77a6787335 Bound upload memory: admission by size, gateway holder writes, 503/SlowDown back-pressure, body deadline (#13021)
* util: one admission rule for upload limits

* operation: mark gateway fan-out holder writes as client traffic

* volume: bound upload admission, limit gateway holder writes, 503 on timeout

* volume: charge unknown-length uploads half the budget, document client wait cap

* s3, filer: admit uploads by inFlight+size and charge unknown lengths a chunk

* s3: answer a volume overload as SlowDown with Retry-After

* operation: cut an upload whose body crawls below the minimum rate on any host

* operation: make the slow-commit deadline test honour the request context

* s3: stop chunk uploads when the client goes away

* operation: treat a body deadline cut as back-pressure, not a same-holder retry

A body that crawls past the body deadline returns from retriedUploadData at
once, like an overload, and counts toward the single reassign the chunk loop
and the filer retry gate give back-pressure. A watchdog cut keeps its retry on
a fresh conn. Both still match ErrUploadStalled and stay reassignable.

* operation: apply the body deadline only to uploads that opt in

UploadOption.BodyDeadline and ChunkedUploadOption.BodyDeadline turn the
body deadline on; S3 chunk uploads (relay and fan-out) and the filer's chunk
loop set it. Mount, filer.sync, filer.copy and UploadWithRetry keep the stall
watchdog only, as before the deadline existed.

* s3, operation: check a chunk cancelled with its client is deleted from every holder

A volume commits on a context that ignores the cancel, so a chunk whose
caller went away after sending the body may still land. The chunk loop
already deletes the fid from every holder after a failed attempt; pin that
for the relay and fan-out paths and for an S3 PUT whose client goes away.

* s3: count a request's declared bytes in the circuit breaker byte limits

The per-bucket and global byte counters go back to the declared length (an
unknown length counts one chunk), so a bucket bytes limit still rejects a
single PUT larger than it. Only the upload budget uses the capped gateway
charge.

* s3: answer copy chunk overloads as SlowDown, tidy the client-gone checks

CopyObject and UploadPartCopy map a volume overload or an exhausted stall to
SlowDown, as PutObject does. The client-gone log check matches the mapper's
context.Canceled test, the truncated-body case drops a check the first case
already makes, and the Retry-After test reads the headers actually sent.

* filer, volume: clamp the filer charge chunk, set the upload gauge under the lock

A filer with -maxMB 0 charges its default chunk size instead of nothing. The
volume server sets its in-flight upload gauge inside the critical section.
The upload limit tests wait until the waiter is parked before releasing,
check handleUploadRequest gives its charge back, and use CI-safe bounds.

* volume: cap the Rust server's client upload-slot wait at 5s

Same cap as the Go volume server's volumeClientUploadWaitCap, so a gateway's
body deadline never fires before the 503.

* operation: reflow the body deadline comment

* volume(rs): count a gateway's src=client holder write against the upload limit

Mirrors operation.IsReplicaForward: only a primary-to-replica forward
skips the upload budget; a gateway's ?type=replicate&src=client fan-out
waits like any client write.

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

* volume(rs): admit uploads by inFlight+size, reserved atomically

Mirrors the Go volume server's waitForUploadSlot: an upload is admitted
by util.UploadAdmits (idle server, or inFlight + size within the limit)
and reserves its bytes in the same step, so concurrent waiters cannot
all pass one check. Primary-to-replica forwards and unlimited servers
are counted but never refused. UploadLimitCond counts once per waiting
upload, and the wake-up is armed before each check so a release in
between is not missed.

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

* volume(rs): charge an unknown-length upload against the upload limit

Mirrors the Go volume server's uploadCharge: a chunked upload without
Content-Length reserves one file's worth of budget, at most half the
limit and at least 1 byte, instead of 0.

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

* volume(rs): a zero -inflightUploadDataTimeout waits the 5s client cap

The Go volume server now reads 0 as the 5s cap (its flag help says so);
the Rust server used a 2s wait.

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

* volume(rs): close a rejected large or unknown-length HTTP/1 upload

Mirrors the Go volume server's uploadRejectCloseThreshold: the 503 for
a body over 256 KiB, or one without a length, carries Connection: close
instead of keeping the connection for a body nobody reads.

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

* volume(rs): drop src from a primary's replica forward

A client upload carrying src=client kept it on the forward, so replicas
treated the forward as gateway fan-out and could refuse it after the
primary had already appended. Go's ReplicatedWrite builds a fresh query.

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

* volume(rs): keep the upload admission CAS buildable on rust 1.91.1

Atomic try_update is stable only since 1.95.

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

* volume(rs): refuse an upload the in-flight counter cannot hold

A replica forward added its charge with fetch_add, so a Content-Length
near i64::MAX wrapped the shared counter negative and let later client
uploads past admission. The forward now reserves with a checked add and
answers 503 when the size does not fit; the client CAS adds only after
admission passes. With no upload limit the counter only feeds the gauge,
so it keeps wrapping arithmetic.

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

* volume: refuse an upload the in-flight counter cannot hold

A replica forward added its charge unchecked, so a Content-Length near
math.MaxInt64 wrapped inFlightUploadDataSize negative and let later
client uploads past admission. Under the lock the reservation now
checks that the counter can hold the charge and answers 503 otherwise,
matching the Rust volume server.

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

* volume: keep the request body on a rejected upload

Replacing r.Body with http.NoBody hid the server's early close of the
unread body from net/http before Go 1.27, so it skipped the FIN-then-wait
close and reset the connection under a client still sending. Go 1.26.6,
the version go.mod declares, then failed
TestUploadLimit503ReachesGoClientForLargeBody with a write error instead of
the 503.

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

* util: compare upload admission without forming inFlight+size

* operation: reassign a chunk after a 429 as after a 503

* s3: do not count a chunk assignment the client cancelled as a filer failure

* filer: charge an upload by its request chunk size, and an inline upload by its whole body

* s3: hold an aws-chunked body to its X-Amz-Decoded-Content-Length

* volume: answer a rejected small-body upload without waiting for its body

* s3: fill the upload budget before testing that a release wakes every waiter

---------

Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-26 08:34:47 -08:00
41f1c25d01 s3api: drop bucket size gauges on an instance that lost the metrics lock (#13019)
* s3api: drop bucket size gauges on an instance that lost the metrics lock

Only the S3 instance holding the s3.leader lock collects bucket sizes and
quota state, once a minute. An instance that loses the lock and keeps
running never clears what it set. bucketMetricTTLControl drops a bucket's
gauges only after 10 minutes without activity, and every request the
instance serves for the bucket counts as activity. So for the buckets
clients keep using through it, its bucket_size_bytes,
bucket_physical_size_bytes, bucket_object_count, bucket_quota_bytes and
bucket_read_only series stay at the values it collected last, next to the
new holder's current ones. Summing a gauge over instances counts those
buckets twice, and taking the max shows a bucket that has shrunk since at
its old size.

On every tick without the lock, reset these five gauges. Only the
holder's collection sets them, so an instance that never held the lock
loses nothing, and one that lost it stops reporting within a minute.

In a cluster with seven S3 instances, one kept 10 to 14 buckets at their
old values for four days after losing the lock; at one point the max
over instances put a bucket 37 TB above its size.

TestBucketSizeMetricsTickWithoutLockDropsGauges sets the gauges for two
buckets, checks that a tick with the lock leaves them, and that a tick
without it removes all five. Without the reset it fails for each gauge.

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

* s3api: shorten the bucket size metrics lock-loss 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-11-26 08:31:16 -08:00