Spark resolved hadoop-aws and the AWS SDK bundle through Ivy from Maven
Central only, so a refused Central request failed the suite with
"module not found" before any test ran. spark.jars.repositories adds the
Google mirror after Central in Ivy's resolver chain.
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* tikv: read a key from TiKV once per transaction
Inside one store transaction the filer reads the same key more than once:
a rename looks its source up when it starts and again to delete it, and
its target before the create and again in it. On TiKV a second read cannot
differ from the first. A transaction reads the store as it was when the
transaction began, and its own writes are answered from its buffer. Each
of those reads was still a request to TiKV, because the client keeps what
a batch get read with the transaction's snapshot and not what a get read.
Inside a caller's transaction a key is now read as a batch get of that one
key, and the next read of it is answered from the snapshot. A read outside
a caller's transaction is a transaction of its own and keeps the plain
get.
With the store on the client library's in-process TiKV, a rename of a file
to a new name sends 4 reads instead of 7, and one over an existing file 4
instead of 6.
The tests run the store on that in-process TiKV, which needs
pingcap/goleveldb as an indirect dependency.
* tikv: shorten the comment on the transaction read
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: MapleWhiteZZZ <18653045+MapleWhiteZZZ@users.noreply.github.com>
Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* filer: read the hard link records of a listing in batches
A hard-linked entry keeps its attributes and chunks in a record the file's
names share, and a listing reads that record for every hard-linked entry
it lists. It read them one at a time from the callback of the store's
listing: a round trip to the store for each such name, each waiting for
the one before, so a directory of hard-linked files listed far slower than
one of as many plain files.
A store may now say that it reads several KV keys in one round trip
(KvBatchReader). For a listing by such a store the wrapper holds the
entries back from the first hard-linked one on, up to 256 of them, reads
their records together and hands them on. The caller of the listing gets
the same entries in the same order, and the name of the entry it ended
the listing at.
TiKV implements it with the client's batch get. With the store on the
client library's in-process TiKV, the records of a directory of 200
hard-linked names take one batch get instead of 200 gets.
The TiKV tests run the store on that in-process TiKV, which needs
pingcap/goleveldb as an indirect dependency.
* filer: end a listing where its caller ended it, whatever the store met behind
The store goes on past the entry its caller ends the listing at, to the
entries that wait for their records with it, and may fail there. The
listing then returned the store's error, though a caller handed each entry
as it arrived would have stopped the store before it got that far. The
listing now ends at the entry its caller ended it at, and a caller that
fails among the waiting entries gets its own error, not the store's.
The same holds for the step a store takes after it is told to stop, when
the caller ended the listing at an entry the store had already passed. At
the last entry that waited the step's error is still returned, as it is
from a store that hands each entry on as it arrives.
* filer: finish a hard link listing on every return of the listing
The listing hands on the entries that wait from a deferred finish, so a
return path that lists from elsewhere with the same callback hands them on
too. The callback keeps the adjustedEntryFunc shape the prefixed listing
already had.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: MapleWhiteZZZ <18653045+MapleWhiteZZZ@users.noreply.github.com>
Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* filer: pass the reader's context to persisted metadata log listings
The day and minute listings behind ReadPersistedLogBuffer used
context.Background(), so nothing scoped to the subscription reached them.
List through one helper that takes the caller's context.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* filer: aggregated metadata stream reads the log files of peers with their own store
A filer with its own store never holds another filer's persisted
metadata log: log file writes emit no events and the bootstrap traverse
skips the log directory. The aggregated stream read history from the
local log directory and the in-memory aggregate ring only, and the ring
restarts empty, refilled from each peer's saved offset. A subscriber whose
cursor was older than that missed every event a peer recorded before it,
for example the S3 lifecycle worker replaying expirations.
Aggregated reads now also list the log directories of followed peers not
known to share this filer's store, merged by file name, so the existing
ordered reader and chunk-ref path serve their history. Local streams, which
peers aggregate from, stay local.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* filer: bound peer log listings and fail the read when one fails
Each peer listing gets its own deadline, so a peer that stalls mid-listing
cannot hold the read. A failed listing now fails the read instead of
silently hiding that peer's persisted files; peers already retired as
unreachable are left out. Peers are asked from the same start name the
caller uses for its own store instead of the whole directory.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* filer: keep a still-unreachable peer out of log listings after its mark expires
A followed peer that keeps refusing connections is marked removed once, and
the mark is dropped with its resume point an hour later. It was then listed
again and its failing listing ended every aggregated persisted-log read.
Leave out any peer refusing connections for peerUnreachableRemovalAfter,
marked or not.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* filer: subscribe tests track their peers on the test filer's store
Aggregated reads now list the log files of followed peers with their own
store. The subscribe tests' peers have no server and share the test
filer's store, so record that instead of dialing them.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* filer: read a missing path once when a rename or a delete looks it up
A rename looks its target up with FindEntryForOverwrite, and
DeleteEntryMetaAndData looks up the path it deletes the same way. Inside a
store transaction an ordinary lookup hides an expired S3 entry and leaves
its row for the commit. A write over the path still owes that row its
chunks and its hard link, so the store was read again whenever the lookup
came back with nothing.
It comes back with nothing far more often because the store holds nothing
at the path, which is what a rename to a new name finds. The second read
then repeats the first. Filer.findEntry already tells whether its answer
is what the store holds at the path, so the store is read again only for
a row the lookup found and kept from its caller.
Around 20 renames of a file to a new name on leveldb2 the store counter
shows 7 finds per rename before and 6 after.
* filer: shorten the overwrite-lookup comments
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: MapleWhiteZZZ <18653045+MapleWhiteZZZ@users.noreply.github.com>
Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
An open with O_TRUNC over an existing file stored the empty entry with an
unconditional UpdateEntry. The filer only routes conditional writes to the
path's write owner, so the truncate landed on the filer the mount talks to,
which deleted the chunks it dropped, while a peer's conditional chmod could
still commit at the owner over the entry it had not yet seen truncated. The
owner's write then brought the deleted chunks back into the entry.
The truncate now goes through saveEntryAttributes: guarded by the entry the
open found, routed to the owner, and replayed on the owner's entry when
refused.
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* volume: read security.toml section headers that carry a trailing comment
The volume server's own security.toml parser compared each whole trimmed
line with the section headers it knows, so `[fips] # policy`, valid TOML
that Go's viper reads, fell through to an unknown section and its `mode`
was dropped: Go enforced the mode while weed-volume ran with FIPS mode off
and logged nothing. The same held for `[jwt.signing]` and every other
section. Header lines now have a trailing `#` comment removed before they
are matched.
Refs #13029
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* sw-client: require the Extended Master Secret on verified HTTPS in FIPS mode
In FIPS mode only the `insecure_skip_verify` client configuration, which
sw-client builds itself, set `require_ems`. With certificate checks on,
reqwest built the configuration and left `require_ems` at rustls's
default, which is off for a provider that is not FIPS-validated, so a
trusted TLS 1.2 volume server without EMS was accepted where the insecure
path refused it. Go requires EMS in FIPS mode. Both FIPS-mode paths now go
through one rustls configuration built here: certificates checked against
`https.client.ca` or the system roots (loaded with rustls-native-certs, as
reqwest loads them), or not checked with `insecure_skip_verify`, and EMS
required either way. Off mode keeps reqwest's configuration.
Refs #13029
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* volume: refuse a FIPS mode from a security.toml parse that did not read the file
resolve_fips_setting reads security.toml once to check that it can, then
parses it. The parse falls back to defaults when its own read fails and
reports that only in `file_read`, which was not checked, so a file that
became unreadable between the two reads resolved to FIPS mode off. A
parse without `file_read` is now the same FipsModeError::File as a failed
first read.
Refs #13029
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* sw-client: refuse a malformed https.client.ca with insecure_skip_verify in FIPS mode
The FIPS-mode insecure_skip_verify configuration never parsed
`https.client.ca`, so a CA file whose certificate does not parse was
accepted there and refused on every other path, where reqwest or the
verified configuration load it. The CA is now parsed, and refused when
malformed, before it is set aside.
Refs #13029
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* seaweed-vector: lock sw-client's rustls-native-certs dependency
sw-client depends on rustls-native-certs since the FIPS-mode HTTPS
configuration; seaweed-vector depends on sw-client by path, so a --locked
build there refused to update its lockfile. The crate was already locked
in seaweed-vector; only the edge was missing.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
The outgoing client took reqwest's rustls configuration, which leaves
require_ems at rustls's default: off for a provider that is not
FIPS-validated. A TLS 1.2 peer without EMS was accepted where Go's FIPS
mode refuses it. In FIPS mode the configuration is now built with the same
roots, CA and identity, and require_ems set.
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* filer/posixlock: key lock owners and leases by principal
A lock's owner becomes (Principal, Sid, Owner). The principal is server-side
state, empty for unscoped callers, so owners with equal client-chosen sid and
owner under different principals conflict and never match on unlock, release,
reassertion or coalescing. The session index and leases key on
(Principal, Sid).
Scoped sessions are leased per key from their first acquisition: the lease
ends at the earlier of TTL after the last acquisition or renewal on that key
and Lease.NotAfter. Expired scoped locks are dropped before any operation on
their key as well as by ReapExpired. Unscoped sessions keep their current
whole-session lease, started by the first keepalive.
The handler passes the unscoped session for now, so behaviour is unchanged.
NewManagerWithClock lets tests drive lease boundaries.
* filer: bind scoped POSIX locks to the verified token id
PosixLock trusted the client-supplied sid. GET_LK reports a conflicting
lock's sid and owner, so a scoped caller with a write grant on the same path
could reuse them to unlock or release another holder's lock, keep it alive,
or replace it through a KEEP_ALIVE reassertion. A tokenless request with the
same identity could do the same.
A request admitted for a scoped token now acts for that token's verified jti,
derived in posixLockAuthority from the interceptor's authority. It controls
only the locks it took, whatever sid or owner it names. Its lease on each key
ends at the earlier of the 15s TTL after its last acquisition or renewal and
the token's expiry plus the clock leeway. Each renewal passes admission for
its key, so a narrower token cannot extend keys outside its grant. Tokenless
and unscoped calls keep the unscoped namespace and behaviour, and can no
longer match a scoped lock. Scoped TRY_LOCK and reassertion ranges must be
well-formed read or write ranges, checked before any state changes.
GET_LK, the protobuf and forwarding are unchanged; the principal is never
returned or logged. A renewed token with a new jti is a new owner: the old
locks expire and are reacquired.
* filer/posixlock: release an expired session once, however many ranges it holds
* posix locks: report a lock lost on re-assertion to the mount
A mount whose lease lapsed, for example when its scoped token expired or
was replaced by one with a new id, kept re-asserting locks that another
session had since taken. The filer logged the loss but returned success,
and the mount discarded the reply, so nothing on the mount side showed it.
KEEP_ALIVE now returns the first conflicting lock in the existing
has_conflict and conflict fields, which older mounts ignore. The mount
warns once per key when it learns of a loss and forgets it once a
re-assertion succeeds or the key is no longer held. Writes are not fenced.
* filer/posixlock: drop every expired session's ranges in one pass
* filer/posixlock: renew a scoped session's same-grant leases together
Scoped leases expire per key and a keepalive renewed only the key it named.
A mount renews its keys one keepalive at a time, so with many keys and slow
keepalives a round could outlast the 15s lease and a healthy mount lost
locks; unscoped sessions never had this problem because any keepalive
renews the whole session.
Each scoped lease now records a fingerprint of the verified grants it was
acquired or re-asserted under: a SHA-256 over the sorted, deduplicated
(access level, path) entries. A keepalive, bare or re-assertion, extends
every live lease of the same session (principal and sid) held under the
same fingerprint, each to the request's lease (the earlier of the TTL and
the token's expiry plus leeway). Leases taken under other grants, such as
a narrower token reusing the jti, are still renewed only by name, and a
lease that already ended is not revived before the sweep drops it. No
extra filer lookups; unscoped sessions are unchanged.
* filer/posixlock: bound same-grant renewal and refuse ended-lease grants
A scoped keepalive scanned every key of its session to renew those held
under the same grant, so a mount renewing N keys one by one did N^2 lease
visits per round under the manager's mutex. The scan now runs at most once
per quarter lease TTL per grant; every key under the grant still ends no
earlier than three quarters of a TTL after the latest renewal, and the named
key is always renewed in full.
TryLock now refuses a scoped grant whose lease has already ended, such as a
request admitted just before its token expired that then waited on the
manager, instead of granting a lock the next operation would drop. The filer
returns Unauthenticated, which the mount reports as EIO.
* filer/posixlock: skip same-grant scans by deadline floor, not by time
The scan throttle remembered when a grant was last renewed, not how long
that renewal made its keys last. A replacement token with the same id and
grants but a later expiry could then renew one key while the others kept
ending at the old token's expiry.
Each session now keeps, per grant, the deadline the last scan gave every
live key under it, lowered whenever a key is leased for less. A renewal
skips the scan only while that floor already reaches the earlier of its
own deadline and three quarters of a TTL from now, so a mount renewing
keys one by one still costs linear work.
A keepalive from a session holding no leases records nothing, and a
session's floors go with its last lease, so lock-less keepalives with
changing session ids no longer accumulate state the sweeper never sees.
* filer/posixlock: never move a scoped lease's deadline earlier
Renew, a re-assertion, a same-grant scan and a re-lock all set the key's
deadline to the request's own bound. A request under the old token of a
principal that already renews under a replacement (same id and grants,
later expiry) can land after the replacement's renewal, for example one
of the 32 concurrent keepalives in flight when the mount switched
credentials. It then cut the key back to the old token's expiry, and the
lock was dropped before the next round although the replacement had
renewed it. Keep the later of the current and the requested deadline:
every deadline still comes from an admitted request of the same
principal, so a lease never outlives the latest of its tokens.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* filer/posixlock: keep each session's index and leases in one map
bySession, lastSeen, leases and floors were four maps keyed by Session that
had to be created and pruned together. They become one sessions map whose
sessionState holds the session's keys (with each key's lease), its last
keepalive and its grant floors, so a session's state is dropped in one place.
The release loop shared by ReapExpired and ReleaseSession becomes releaseOn.
ReleaseSession now also forgets an unscoped session's last keepalive, so a
session it released is not reported again by the next sweep.
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>
* mount: refuse a merge whose local truncate cuts chunks a peer wrote
A flush refused by IF_ENTRY_EQUAL replays the handle's truncate onto the
stored entry. The truncate was made over the handle's base, so a chunk a
peer committed after that base was dropped or clipped silently, losing
data the peer had already fsynced. Like a stale whole-file rewrite over a
peer's chunk change, it now fails the merge. A base chunk the peer only
shortened carries no peer data and is still cut.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* mount: keep the later mtime and ctime when merging a delayed flush
The merge took every attribute the handle changed from the handle, so a
flush that waited behind a peer's commit moved mtime and ctime back to
the handle's older write. Each time is now merged as one value (seconds
and nanoseconds were merged field by field, so a moved second could take
the peer's nanoseconds): the handle's time stands unless a peer moved it
too and later.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* mount: let a truncate merge pass the handle's own committed chunks
A flush whose commit answer was lost finds its own chunks in the stored
entry while its base is still the older one. Those chunks are the
handle's writes, not a peer's, so they do not refuse the merge.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* mount: do not keep a stored copy of a chunk the merge re-adds from the handle
A stored chunk the base lacks but the handle holds is the handle's own
commit whose answer was lost. The merge appends the handle's chunks after
the stored ones, so keeping the stored copy referenced the chunk twice.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* mount: take the manifests of a failed flush's fold for the handle's own chunks
A flush can commit its folded manifests and lose the answer. The handle
reverts to the member chunks and keeps its old base, so the next merge
found the stored manifest, knew neither its file id nor its key, and
refused it as a peer write across the handle's truncate.
The handle now remembers the folds of flushes that failed over its base,
and a merge unfolds them in the stored entry before comparing, so the
members match the handle's chunks. A peer's manifest is still refused.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* mount: take a retried flush's own stored fold for its own chunks
The client retries a request whose connection dropped, and the first try
may have stored the flush's folded manifests. The retry is then refused
over them before the fold is recorded as failed, and the merge took the
manifest for a peer's write across the handle's truncate. The merge now
unfolds the flush's own fold in the stored entry as well; the condition
still names the entry as stored.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* mount: keep every fold the filer may hold instead of the last four
Dropping the oldest of four could forget the fold the filer committed,
and the merge then refused that manifest again. A fold is now kept only
when the flush failed without the filer's answer, or when the refusal
lookup shows it stored, so a refused flush no longer adds one, and the
list ends with the base.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* mount: keep a flush's fold when its first request may have been stored
A precondition verdict on a retried send does not prove the first send
stored nothing, and a failed refusal lookup then hid that it had. The
create now counts the sends of the request that carries the fold and
keeps the fold whenever the flush fails and that request was sent more
than once or never got the filer's answer. That covers both flush paths,
so revert is back to only restoring the chunks.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* mount: drop the failed folds a refused create shows were not stored
A refusal means the stored entry moved off the handle's base, so no
request guarded by that base can store another fold. After the refusal
lookup the handle keeps only the folds whose manifests the stored entry
holds, at most one, which bounds the list over a base.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* mount: bound the failed folds a handle keeps over one base
Flushes that keep failing with no filer answer each saved a new fold the
filer may hold, so the list grew for as long as the outage lasted. Once a
handle keeps maxFailedFolds folds over its base, its flushes send their
chunks unfolded for the filer to fold, and no kept fold is dropped.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* mount: keep the failed folds a refusal lookup does not show
The refusal comes from the file's write owner, but the lookup after it can
read a filer that lags behind and still shows the base. Pruning the folds
against that read forgot a fold the owner had stored, and once its manifest
showed up a pending truncate took it for a peer's chunk on every flush. The
maxFailedFolds limit bounds the list, so the folds stay until the base moves.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* mount: drop the chunks a failed flush sent that the handle has cut since
A flush that commits with its answer lost, then a truncate of the handle,
left the next merge with the handle's own committed chunks in the stored
entry, outside both base and the handle. The truncate check took them for
a peer's writes and refused every later flush over the base. A failed
flush now records the file ids of the chunks it sent that base lacks, and
the merge drops those the handle no longer holds: it cut or replaced them.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* mount: copy the failed flush's sent set with a loop
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* mount: keep folding past maxFailedFolds instead of sending chunks unfolded
The filer folds a flat chunk list itself, into manifests the handle does
not know: a lost answer then left one of them across a pending truncate,
and an acknowledged one gave the handle flat chunks under a folded base.
Flushes fold as before, and the handle stops keeping folds past the limit
while it still records the chunks they sent.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* mount: read the stored manifests a refused merge cannot name
A fold changes no content, but a manifest the handle does not know sat in
the stored entry as one chunk: across a pending truncate it refused the
merge, though it can hold the handle's own chunks (a fold it did not keep,
or one the filer made). When the merge is refused, the flush reads those
manifests, replaces them with the chunks they hold and merges again.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* mount: hold the chunks the filer stored after a plain acknowledged flush
The filer folds a flat chunk list (the mount's own fold failed), and the
acknowledgement makes the stored entry the base while the handle kept the
flat chunks. A later merge took them for writes of the handle, which can
bring back chunks a peer's truncate removed. As after a merge, the handle
now takes the stored chunks, keeping those attached since the request.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* mount: keep a bounded record per failed flush instead of a growing set
The set of chunk ids failed flushes sent grew with every overwrite while
commits failed, and each failure copied it whole. Each failed flush the
filer may have stored (a send got no verdict) now keeps one record, its
fold and the ids it sent, built once and at most maxFailedFlushes over a
base. Past that, a merge refuses the chunks of a flush it did not keep
that the handle has cut since, as a peer's.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* mount: register the chunks a rebase or install gives the handle for reads
A handle that takes the stored chunks after a flush (or a peer's, after a
merge) can get manifests the filer made, and resolving them needs the
file's read token. rebaseEntry and installRewrittenChunks now record the
chunks under the file's path before the read view resolves them.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* mount: keep every chunk id a failed flush sent, cap only the folds
Past four failed flushes over one base the handle stopped recording what a
later flush sent. If that flush was stored with its answer lost, a truncate
of its chunks was refused as a peer's write and kept failing after the
filer came back. The ids now go into one set shared by the base's marks,
each kept once and never copied, until the base moves. Only the folds stay
capped: a stored manifest past the cap is read when a refused merge cannot
place it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* mount: fail a flush over a peer's chunk change unless -concurrentWriteMerge
A content flush refused because another mount committed first used to
merge the handle's writes onto the stored entry. That merge now runs
only with the new -concurrentWriteMerge mount option (off by default).
By default a stored chunk change that neither the base nor the handle
holds fails the flush with EIO, and a peer's chunk event no longer
rebases a dirty handle. Attribute-only changes and the handle's own
commits (a lost answer, its own truncate) still merge.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* mount: recognize the shortened references a failed flush sent
A truncate shrinks a base chunk in place, keeping its file id. A failed
flush that may have stored such a reference recorded only file ids base
lacks, so a later truncate saw its own stored reference as a peer's
change and failed with EIO by default.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* worker: share the one-filer-per-store selection with other filer jobs
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* worker: add a meta_log_purge job that keeps the log past every TTL
The job deletes whole metadata log days once per filer store, keeping
every day that the longest filer.conf TTL, the longest S3 lifecycle rule,
a registered retention floor or a running replay job's cursor still
needs. A floor input that cannot be read stops the run before anything
is deleted.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* worker: register meta_log_purge in the lifecycle lane
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* maintenance: stop purging the metadata log from the default scripts
The meta_log_purge job now deletes old log days, keeping what TTLs,
lifecycle rules and replay jobs still need. fs.log.purge stays for
manual use.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* worker: let an idle filer_ttl rule's read position release the log
filer_ttl no longer needs events up to read_ns, and an idle rule keeps an
old ts_ns while read_ns advances, so the floor follows the later of the
two.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* worker: cap min_retention_days so a huge value cannot overflow
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* worker: show the min_retention_days limit in the admin form
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* worker: give a registered retention floor the store's filer client
A floor that only gets a context cannot tell which cluster or store it
answers for, so it cannot ask that cluster's master or read the store's
own settings. Pass the filer client the job already holds.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* worker: keep the log an unfinished lifecycle walk will replay
A cold-start or recovery walk that resumes across runs rewinds its
shard cursor to the walk's start minus the longest lifecycle TTL once it
completes. Until then only its walk checkpoint records that start, so a
walk running for more than a day let the purge delete the creation
events the rewound replay reads. A checkpoint with buckets done or
partly walked now holds the floor at started_ns minus that TTL.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* worker: hold the walk start until the checkpoint goes stale
A walk clears its checkpoint in finish() before each of its shards saves
the rewound cursor, so a purge scan that read the old shard cursor and
then the cleared checkpoint saw neither. A cleared checkpoint keeps
started_ns, so every live checkpoint now holds the floor at its start
minus the longest lifecycle TTL. A finished one stops holding once it
has not been saved for cursorStaleAfter.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* worker: read walk checkpoints before the shard cursors they rewind
A purge scan that read a shard cursor, then a checkpoint that a later
walk had already replaced, saw neither the earlier walk's hold nor the
rewind its shards saved. A walk replaces its checkpoint only after the
previous walk's rewind is on disk, so reading the checkpoints first
always sees one of the two.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* lifecycle: save a fresh walk's checkpoint at its first progress
A walk that progressed during its first save interval and then stalled
for more than a day had no checkpoint on disk, so the metadata log purge
saw nothing holding the days its completion replays. A fresh walk now
saves on its first finished entry or bucket; a resumed walk already has
its record on disk and keeps the interval.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* lifecycle: rewrite an unchanged shard cursor so its mtime stays fresh
A shard stuck on RETRY_LATER saved identical bytes each pass, and
SaveInsideFiler skips identical content, so the file's mtime aged past
the meta log purge's staleness cutoff while the shard still needed it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* worker: keep the log day a reader from the cursor lists first
Log files are named for their flush start, so a file from just before
midnight holds events after a cursor just past it. The reader backs off
one flush interval before choosing its first day; the purge now does too.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* worker: stop the meta log purge on an unreadable lifecycle policy
LoadCompileInputs reports a bucket whose lifecycle XML does not parse
separately from its error, so the purge used the shorter floors and
deleted days that bucket's rules may need once the policy is fixed.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* worker: read shard cursors with the replay's loader in the meta log purge
A shard cursor the replay refuses, such as an empty object, decoded as
a zero position and released the purge; it now stops the run instead.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* worker: saturate the meta log purge's TTL plus a day
A lifecycle TTL near the largest duration wrapped negative once a day
was added, so the purge fell back to the shorter floors; the walk hold
at started_ns minus that TTL likewise dropped below zero and was lost.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* worker: leave disabled lifecycle rules out of the meta log purge floor
AllActivePriorStates activates every compiled rule, so a disabled rule
still held the log for its TTL, and disabling it could not release it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* worker: compute the meta log purge floor in SafeKeepFrom
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* shell: fs.log.purge keeps the logs the meta log purge floor needs unless -force
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* shell: run the fs.log.purge floor test without a master client
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* filer: end a listing at a short page from a store that fills its pages
ListEntries read a directory a page at a time and stopped at the first
empty page, so every listing the caller's limit did not cut ended with
one more scan of the store, from the last name on, that returned
nothing: two scans for a directory smaller than a page.
A page that comes back short of its limit now ends the listing when the
store says it fills its pages (the new optional FullPageListingStore).
leveldb, leveldb2, leveldb3 and TiKV do: they iterate the directory's
keys until the limit is handed over or the keys end. A store that cuts a
page of names to the limit and then drops some (the Redis stores, for a
name whose entry is gone or expired) can end a page short with names
behind it; it does not declare the interface and is asked until a page
comes back empty, as before.
TiKV's listing swallowed an iterator error while it skipped the start
name or an expired entry, and ended the page there. It returns the error
now: a page that ends short must mean the keys ended.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
* filer: see through the path translator for a store that fills its pages
A path-specific store is wrapped in FilerStorePathTranslator, which does not
implement FullPageListingStore, so its directories kept the extra empty scan.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* filer: keep the last listed name when a refill lists nothing
A page that lost entries to expiry is refilled from its last name. A refill
that found nothing returned an empty last name, so the next page of a store
that does not fill its pages started over at the top of the directory and
listed every entry again.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* filer: name the stores that fill their pages instead of an interface
A short list of store names in Filer.ListsFullPages replaces the
FullPageListingStore interface, the wrapper method and the per-store
declarations. A path translator reports its backend's name, so it needs
no unwrapping.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* foundationdb: read a listing in batches until it fills the page
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* redis: fill a listing page past orphaned and expired members
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* redis2: fill a listing page past orphaned and expired members
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* mongodb: report a cursor error that ends a listing
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* tarantool: fail a listing on a malformed reply
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* filer: test the last listed name after a refill that lists nothing
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* filer: end a listing at a short page from any store
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* rocksdb: build the tests against the current NewFiler
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* rocksdb: count only listed entries toward the page limit
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* rocksdb: return the decode error instead of ending the listing
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: MapleWhiteZZZ <18653045+MapleWhiteZZZ@users.noreply.github.com>
Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>
Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com>
A listing's snapshot only accounted for this filer's in-flight writes. A peer on the same store can have stamped a write below it that is not committed yet; the listing misses it and the client drops its event as already listed, leaving a stale entry (a mount reads a just-closed file as empty) until the next listing.
* filer, s3: give an entry without chunks the ETag of its inline content
A file written through a mount stores no MD5. With no chunks either (an
empty file, or a small one kept inline) S3 answered HEAD, GET and
listings with an empty ETag, and the filer's HTTP API with the chunk
form for zero chunks, "d41d8cd98f00b204e9800998ecf8427e-0". Both now
answer with the MD5 of the inline content, which for an empty file is
what AWS gives an empty object and what the same file gets once it is
written through S3.
An entry whose size reaches past its inline content (a hole that no
chunk covers) keeps the ETag it had.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
* filer: match If-Match on an entry without chunks against its inline-content ETag
The gateway now answers the MD5 of the inline bytes for an entry with no
stored MD5 and no chunks; the filer's conditional check still saw an empty
ETag, so a PUT with If-Match set to the ETag HEAD returned failed with 412.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: MapleWhiteZZZ <18653045+MapleWhiteZZZ@users.noreply.github.com>
Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>
Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com>
* filer: count and time the gRPC requests by method
The filer's request metrics cover its HTTP API. The mounts and the S3
gateway reach it over gRPC, so on a cluster used through them the filer
reported its store operations and nothing about the requests behind
them: how many lookups, creates, renames or listings arrive, how long
each kind takes, how many end in an error.
Two metrics for the gRPC port, filled by a unary and a stream
interceptor: SeaweedFS_filer_grpc_request_total{method, code} and
SeaweedFS_filer_grpc_request_seconds{method}. A stream is counted when
it ends, and timed unless the client holds it open (a subscription, a
client stream). A lookup that finds nothing returns ErrNotFound without
a status; it is labelled NotFound rather than Unknown.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
* filer: label a call ending in its context's error as gRPC reports it
A handler that returns ctx.Err() reaches the client as Canceled or
DeadlineExceeded; status.Code labelled it Unknown.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* filer: count a health watch without timing it
grpc.health.v1.Health/Watch stays open until the client leaves, so its
duration is the connection's lifetime, like a subscription's.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* metrics: dashboard panels for the filer's gRPC requests
Calls, errors by code, and p99/p50 durations by method, in the Filer row.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: MapleWhiteZZZ <18653045+MapleWhiteZZZ@users.noreply.github.com>
Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>
Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com>
* filer: grow the metadata log collection on its own, fall back when it is full
metaLog.volumeGrowthCount (default 2) is sent with assigns into the
metadata log collection, so it grows by a few volumes instead of the
master's default growth. When that collection cannot take the piece, the
assign falls back to the collection the log uses without the override, so
a full cluster does not stall the log.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* filer: keep the metadata log in its own collection by default
metaLog.collection now defaults to filer-meta, so purging old log days
empties whole volumes instead of leaving log chunks scattered across the
default collection's volumes. Setting it to "" keeps the log in the
filer's -collection as before.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* volume: default -max to 10 to leave room for the metadata log collection
The default collection still grows by 7 volumes; the extra slots keep
the filer's metadata log collection (2 volumes by default) from taking
them. Go and Rust volume servers share the new default.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* filer: bound the meta log collection's share of the assign budget
A meta log collection that cannot grow (for example a replication the
cluster cannot place) keeps answering with retryable errors, so the
first assign used the whole shared budget and the fallback was never
tried. Give it 10s, then fall back, and skip it for a minute after a
failure instead of waiting on it at every flush.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* filer: name the default meta log collection so no bucket maps to it
A bucket named filer-meta mapped to the same collection, and deleting
it from the admin page or weed shell drops the collection directly at
the master, taking the metadata log with it. Bucket names cannot
contain "_", and filer group buckets map to "<group>_<bucket>".
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* filer: clear the meta log overrides after the viper test
Setting the collection back to its default value kept an explicit
override, so the defaults test passed even without the SetDefault.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* filer: retry the meta log collection once its fallback also fails
The pause after a failed meta collection assign kept pieces on the shared
collection for a full minute even when that assign failed too, so meta
volumes that finished growing stayed unused while every flush failed.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* filer: pick a default meta log collection no grouped bucket maps to
Filer group "_filer" with bucket "meta" maps to "_filer_meta". The
default now keeps its only "_" in front, and the test checks every
group and bucket split of it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* filer: default the meta log collection to _meta
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* filer: keep the default meta log collection on bucket delete
A filer that logs elsewhere did not treat _meta as reserved, so deleting a
bucket a storage rule maps to _meta dropped the collection other filers
write their logs to.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* s3api: refuse a "dir/" PUT body larger than a directory marker holds
A key ending in "/" whose body had no Content-Length took the marker
branch, was read whole into memory and stored inline in the directory
entry. One declaring more than 1024 bytes took the regular path, which
wrote it to the object "dir/dir".
Both now get EntityTooLarge: a declared length is checked before the
body is read, an unknown one is read at most 1025 bytes. An aws-chunked
body counts by its decoded length.
* s3api: size an aws-chunked "dir/" body without a decoded length as unknown
Without X-Amz-Decoded-Content-Length the marker check fell back to the
encoded Content-Length, whose chunk framing pushed a marker of up to 1024
bytes past the limit. Such a body is now read through the limit instead.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* s3api: keep a "dir/" body past a marker as a version in a versioned bucket
A versioning-enabled bucket stores a trailing-slash key larger than a
marker as a versioned object under its .versions directory, so refusing
it broke that write. Only the unversioned and suspended paths, which
would land on "dir/dir", refuse it now.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* s3api: recheck a large "dir/" PUT against the versioning state its write uses
The size check and the write path each read the versioning state, so
versioning suspended in between sent the body to the suspended path,
which writes "dir/dir".
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>
* webhook: send the bearer token only to the configured endpoint's host
A redirect to another host or port, or from https to http, now gets the
request without the Authorization header.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* webhook: test the token scope across redirects
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* webhook: compare effective ports when scoping the token
An omitted default port and an explicit :443 or :80 are the same
endpoint; http on port 80 upgrading to https on 443 keeps the token.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* worker: add a filer_ttl job that walks filer.conf TTL paths
A filer store without native TTL keeps the rows of expired entries until
something looks them up or lists their directory. The job lists every
TTL path subtree once per filer store, so the filer drops the expired
rows it meets.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* worker: register the filer_ttl job in the lifecycle lane
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* filer: re-check an expired entry under its path lock before a listing deletes it
A listing deleted the expired entries it collected by path after the page
was read, so a write that replaced one in between lost its new row. The
delete now re-reads the row under the lock writers take, and in one
conflict-checked transaction on stores that refuse a commit over another
writer's change; anything but a still-expired row is kept.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* worker: read each filer store's own filer.conf, chunk-backed included
Filers with separate stores keep separate filer.conf files, so one
filer's rules could hide another store's TTL paths. A config stored in
chunks read as empty. An unreadable config now fails the detection
instead of reading as no rules.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* command: count filer_ttl among the mini default job types
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* worker: resume an unfinished filer_ttl walk from its checkpoint
The walk position is saved in the job's filer store every 30s and at
the first failure, keyed by store signature, and cleared when a pass
completes. The next run skips the prefixes and subtrees already walked,
unless the TTL prefix set changed or the pass is over 7 days old.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* worker: save the filer_ttl checkpoint as soon as a walk fails
The first failure froze the checkpoint but only the end of the run saved it,
so a worker killed while walking later prefixes lost it. stop now saves it at
once; the end of the run saves again only if that save failed.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* worker: keep a path TTL rule from expiring the filer_ttl checkpoint
A filer.conf TTL rule over /etc/ gave the checkpoint that rule's TTL, so an
interrupted pass could lose its record long before checkpointMaxAge. The
checkpoint is now written with its own TTL of checkpointMaxAge, which the
filer keeps instead of the rule's.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* worker: remove a filer_ttl checkpoint the new pass will not resume from
An overwrite keeps the stored entry's Crtime, and the checkpoint's TTL counts
from it, so a pass that replaced a rejected record could lose its own record
before checkpointMaxAge. load now deletes a record it rejects, and the new
pass creates a fresh one.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* worker: expire filer_ttl entries from metadata events per TTL rule
Each run replays every filer.conf TTL rule's metadata events from that
rule's cursor up to the run start, and looks up each entry whose TTL has
passed so the filer removes its row. The first entry not yet due holds the
rule's cursor, so a later run replays it. A rule without a cursor, or
whose TTL changed, is listed once to reach rows older than its replay
window. The periodic full walk and its checkpoint are gone.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* filer: re-check an S3-expired entry under its path lock before a listing deletes it
A listing deleted an S3-expired object by the row it had read, so an upload
that replaced it after the page was read was removed. The delete now re-reads
the row under the path lock and removes it only if it is still S3-expired.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* filer: remove an expired row a lookup meets in a conflict-checked transaction
A lookup that met an expired row deleted it by path, so a replacement written
through another filer between the read and the delete was lost, even on
stores that refuse conflicting commits; a failed delete was hidden behind not
found. The lookup now re-reads and deletes through deleteIfExpired and returns
the delete error.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* worker: keep a failed filer_ttl lookup that ties a done event
When the first event at a timestamp was done and the second one's lookup
failed, the cursor already stood at that timestamp, so the retry subscribed
after it and skipped the failed event. A failed lookup now holds the cursor
below a tie, as a waiting entry does.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* worker: hold a filer_ttl event whose entry the filer still serves
A lookup that returned the live entry counted as done, so when the worker's
clock ran ahead of the filer's near the deadline the event was skipped and
the row stayed. An entry the filer still serves with the same deadline now
holds the cursor like one not yet due.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* worker: keep a path TTL rule from expiring the filer_ttl cursors
The cursors were written without a TTL, so a filer.conf TTL rule covering
/etc/seaweedfs/filer_ttl gave them the rule's TTL and every rule was listed
again once they expired. When a rule covers them they are now written with a
TTL of their own, which the filer keeps.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* worker: list a filer_ttl rule again for a live entry its replay cannot reach
A new rule nested under a longer one started its replay one TTL back, so a
live entry the enclosing rule had stamped with its longer TTL, written before
that, was in neither rule's replay: the nested rule now owns it and the
enclosing rule skips it. The listing of a new rule now records the earliest
deadline of such entries, and the rule is listed again then.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* worker: hand a removed filer_ttl rule's replay to the rule enclosing it
When a nested rule was removed, its entries became the enclosing rule's, but
that rule's cursor could already be past their events, so they were never
replayed. The enclosing rule now replays from the earlier of both cursors.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* worker: list a filer_ttl rule whose unfinished events the filer no longer keeps
When fs.log.purge removed the event of an entry still waiting for its TTL,
the rule's cursor matched, so the rule was never listed and the replay never
met the entry again. A rule whose cursor is older than the oldest kept
metadata log is now listed, and its cursor moves to that log. The cursor also
records how far a replay read with nothing left waiting, so a quiet rule is
not listed just because old logs were purged.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* worker: leave S3 lifecycle expiry to the s3_lifecycle job in filer_ttl
An entry whose TTL an S3 lifecycle rule set carries the S3 expiry flag;
s3_lifecycle evaluates and removes it. filer_ttl no longer looks such
entries up, and their deadline no longer holds a TTL rule's cursor.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* mount: drop the issue number from the shutdown test comment
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* mount: end the filer walk when the consumer stopped following
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* pb: end the follow when a retried event reports a stop
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* mount: check the subscriber is gone before the late event can end it
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* mount: never retry a filer call whose consumer stopped following
The walk already stopped on pb.ErrStopFollowing, but RetryOnError still
classified the wrapped error by its cause, so a transport-looking cause
reran the whole filer walk.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* pb: keep the cursor behind an event whose retry the follow ended
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* mount: close the meta cache after the follow-cancel test joins it
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* test(mount): reproduce the #5289 mount abort on a late metadata event
A metadata event that arrives after metaCache.Shutdown() reaches
glog.Fatalf through FatalOnError, so the mount dumps every goroutine and
exits 255 instead of unmounting cleanly — the signature reported in
issue #5289, still reachable on current master.
The subscriber has no way to stop: its context is rooted at
context.Background() and util.RetryUntil always retries, while unmount
closes the cache underneath it.
glog.Fatalf cannot be intercepted from another package (glog's
logExitFunc is unexported), so the reproduction runs the mount in a child
process and reads its exit code.
* mount,pb: stop following metadata when the cache closes
The mount follows metadata with FatalOnError, so an event that arrives
after metaCache.Shutdown() — which unmount guarantees, since the
subscriber is never stopped — was logged as a fatal and aborted the
process with a goroutine dump.
Report a closed cache as pb.ErrStopFollowing, a class the follow loop
ends on instead of routing through the per-event error modes. It is not
a failed event but the end of the subscription: no later event can land
either. SubscribeMetaEvents then leaves its retry loop rather than
reconnecting onto a store that no longer exists.
Also export the meta_cache sentinel as ErrClosed so consumers can tell a
closed cache from a storage failure.
* mount: end the metadata follow before closing the meta cache
The subscription goroutine had no owner: its context was rooted at
context.Background() and util.RetryUntil retried forever, while unmount
closed the cache underneath it. Every unmount left a window in which a
filer event landed on a closed store, and the mount survived it only
because the previous commit demoted that error.
Give the follow a context the mount owns, and stop it — cancel, then
join — before metaCache.Shutdown() in both teardown paths. MetadataFollowOption
takes a ParentContext so cancelling the caller ends the stream, which is
the ordering the filer already got in #11363 and #11663; the mount had no
equivalent.
Verified that the new assertion catches the ordering on its own: making
stopMetadataFollow a no-op fails it with the subscriber still running,
even with the fatal path already demoted.
* mount,pb: make a cancelled follow a stop, and cover the new seams
Review findings on the previous commits:
Cancelling the follow context surfaced as a bare gRPC Canceled, which
matched neither terminal condition, so every clean unmount logged an
ERROR, ran the retry callback — which wipes every cached listing on the
assumption that events were missed — and slept a second before the loop
stopped itself. Test the context instead of the error text.
Also assert the two new weed/pb seams where they are defined rather than
only through a mount exit code: ErrStopFollowing ends the stream without
reaching the per-event error modes and leaves the cursor behind the
event, and a cancelled ParentContext ends the stream. Publishing the
cancel handle and bumping the WaitGroup happen under one lock, so a
start racing a stop cannot let the join report success too early.
All four new tests were mutation-checked: dropping the early return,
ignoring ParentContext, removing stopMetadataFollow from ClearCacheDir,
and making stopMetadataFollow a no-op each fail their own test.
---------
Co-authored-by: whitefox <whitefox@mayflower.work>
* filer: flag help names the 503 an upload gets after the wait
The filer answers an upload that found no slot within
-inflightUploadDataTimeout with 503 and Retry-After: 1, not 429.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* docs: a restart after a Yandex token refresh may need a new token
The client keeps the refresh token Yandex returns in memory only, and
Yandex does not say whether the stored one survives the rotation, so the
doc no longer promises that a restart keeps working.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* filer: read the entry path once per write
A create looks the path up to decide what it makes of the entry: the inode and
crtime to keep, the chunks the write leaves behind, the old side of the metadata
event. The store wrapper looked the same path up again, in
handleUpdateToHardLinks, to learn the hard link the name carried before. Both
reads happen under the same per-path lock, a moment apart, and for a file written
without a hard link the second one decides nothing at all: its result is
discarded. An overwrite pays for it twice over, because that read decodes the row
being replaced -- gunzip included above CountEntryChunksForGzip -- and it is the
row the create already holds.
Neither read shows up as a second find in the store metrics: the wrapper's goes
to the actual store, and FilerStoreCounter counts only FilerStoreWrapper.FindEntry.
The wrapper now takes the caller's word. InsertEntryReplaces and
UpdateEntryReplaces carry the entry a caller read to handleUpdateToHardLinks,
which keeps to it instead of reading the path again. An insert whose lookup found
the path empty goes the way #13006 opened with InsertEntryKnownAbsent, which
rename alone used.
Which word may be taken is the delicate part, so Filer.findEntry reports whether
its answer is what the store holds at the path:
- a lazy fetch from a remote mount serves an object the store does not have and
writes nothing to it, so it says nothing about the row there;
- inside a store transaction a lookup hides an expired S3 entry whose row the
transaction keeps until the commit, and a write replacing it still owes that
entry its hard link -- which is why FindEntryForOverwrite exists;
- where the expiry check deleted the row, the delete dropped its link already, so
an answer of "empty" is honest.
The write also reads the path itself whenever there is a link to take off, for
two reasons. A file with a hard link has its record changed again when the store
refused a commit (changeLinkRecord runs its change up to linkRecordAttempts
times), and each run must judge the name as the store holds it by then. And a row
that carries a link is the row whose link this write drops: plain creates are not
routed to the write owner, so another filer may have replaced the same name
already and dropped that link, and dropping it twice deletes the record under the
file's remaining names. What is trusted is the case with nothing to decide --
no link on either side -- which is an ordinary file write, since a mount makes a
link id only when a file is linked or copied.
The HTTP append path read the entry three times: once to merge with it, once to
prove it had not changed while the chunks were uploaded, and once in the create.
The create takes the recheck's entry now.
A 20-chunk entry on leveldb2 goes from 343 to 286 allocs/op and from 44.6 to
38.3 KiB/op per overwrite, the difference being the decode of the replaced row.
Where the store is reached over the network, the read saved is a round trip per
write.
Tests count the reads one write makes at the store, pin that a dropped link is
dropped once against a row another filer has already replaced, and keep the
create using the entry it is handed. #9645's own guard expected the create's
lookup to be what separates passing existing from passing nil; both are one read
now, so it requires one read either way and checks the crtime came from the entry
passed in.
Issue #5067.
Review of the first version caught one more case. The known-absent shortcut must
not take an entry that carries a link: InsertEntryKnownAbsent counts the name as
joining without reading it, so another filer storing that name for the same link
between this lookup and the write would have it counted twice, and the count
would run one above the names. The regular insert reads the name inside the
change of the record. CreateEntry and ReplaceFileForRename keep the write's own
read for a linked entry; TestNewLinkedNameStillReadsThePath pins it.
* filer: drop issue numbers from the write-read test comments
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* filer: say a plain-over-plain write can miss a link stored after the read
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: whitefox <whitefox@mayflower.work>
Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
The filer walk told the caller's expiry apart from a filer failure by
ctx.Err() alone. A server-side DeadlineExceeded can reach the client
before the context's own timer runs, so the walk recorded a failure
against each filer and moved on with no budget left, the same race
LookupVolumeIds already guards against.
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* fix: retain released lock version watermarks
* fix(lock_manager): scope release records to lease identities
Keep a stable acquisition ID in opaque renewal tokens so release history cannot reject a valid lease from a different primary when generation counters overlap. Preserve earlier releases across new acquisitions and ownership eviction.
Carry the maximum lease expiry with releases, prevent renewals from shortening that bound, reject expired inserts, and reclaim release records after expiry. Track replication and handoff before sending copies so local-only leases need no release records.
Add regressions for fresh-primary failover, equal and lower generation counters, reordered releases and renewals, bounded retention, local-only workloads, ownership eviction, legacy release metadata, and gRPC release handling.
* lock_manager: name the release replay tests after the behavior they check
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(lock_manager): serialize lease handoff with local mutations
Hold per-key mutation admission through a fresh lease snapshot, the transfer RPC, and source demotion or removal. A release that wins first suppresses the transfer; a release arriving during handoff waits and is forwarded to the new primary afterward.
Keep incoming replication outside the gate to avoid callback cycles. Retain source authority on transfer errors and apply transfer completion only to the lease that was sent.
Add real gRPC regressions for releases during both handoff branches and replay after release, plus coverage for fresh snapshots, transfer errors, unrelated keys, and replacement leases.
* fix(lock_manager): retry handoffs without retaining renewal authority
Deliver a source-held lease to the current owner before forwarding renewal or unlock. Freeze local authority before sending a transfer, including when the receiver may have committed despite an RPC error. Retry without requiring a membership change, with backoff and shutdown cancellation.
Recheck ownership after a background handoff and preserve the copy until the latest owner receives it. Replicate the effective installed expiry instead of a shorter transfer input.
Replace timing assumptions with a same-key admission contention hook. Cover pre-handoff releases, lost acknowledgements, retry cleanup, owner changes, and effective expiry. Document why identityless legacy releases cannot safely delete slash-format leases with overlapping generation counters.
* test(filer): set up DLM handoff before the peer lock transfer check
Ring-change transfers now go through Dlm.TransferFn, which
SetupDlmReplication installs; without it the lock stays pending on the
old filer and the peer-auth transfer test cannot see it move.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* test(lock_manager): bound the handoff and unlock completion waits
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* test(filer): give the handoff retry expiry subtest a one-second lease
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(lock_manager): serve lock and unlock here when a handoff ends with this node as primary
transferToOwnerLocked now returns the primary it observed after the
handoff. LockWithTimeout and Unlock redirected to the primary read before
the transfer, so a ring that moved back during the handoff sent the client
away from the node that holds the lease.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* test(lock_manager): bound the admission probes in the handoff tests
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(filer): keep the holder's renew token while its lock handoff is pending
A failed transfer RPC or a frozen lease answered the lock request with an
error and an empty RenewToken. The client treats that as a rejection and
drops its token, so it can no longer renew the lease once the handoff
completes. Report transfer failures as LockHandoffPending and echo the
caller's token for that error.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* refactor(lock_manager): return lease expiry from Lock, Unlock and InsertLock
The DLM was the only production caller of these methods and used private
twins (lockWithExpiry, unlock, insertLock) to get the effective expiry.
Return it from the public methods instead and drop the twins.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* refactor(lock_manager): share the copy acceptance checks between InsertLock and InsertBackupLock
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* refactor(lock_manager): drive handoff tests through TransferLockToOwner
TransferLock and its helpers were only reachable from tests. Remove them
so the tests exercise the production handoff path.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* refactor(lock_manager): share the routing and handoff prologue of LockWithTimeout and Unlock
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Master <Master@node0.8m510.lpad-pg0.utah.cloudlab.us>
Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* mount: store a truncate through an open handle before answering
SetAttr with a new size and an open handle only marked the handle dirty,
so the size reached the filer at the next flush or release. A mount that
died before then brought the old size and data back, and an NFS export
answered SETATTR, which no COMMIT follows, with a size it had not stored.
Flush the handle once the entry locks are released, as a truncate
without a handle saves the entry. The writeback cache still defers it,
except under an NFS export.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* mount: test that a truncate through an open handle is stored
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* mount: refuse a truncate up past the quota before the file grows
The size is now stored before SetAttr answers, so a growth the quota
cannot take was installed and charged, then refused by the flush,
leaving the grown size on the handle. Check the growth first.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* mount: compare a truncate's growth with the quota headroom
The used size, the uncommitted writes and the growth were summed in
int64, so a truncate up to near 2^63 wrapped the sum negative and passed
the check. Take the growth as uint64 and compare it with what is left.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* volume: check the collection name in handlers that build file paths from it
AllocateVolume, VolumeMount, VolumeCopy and the EC rebuild, copy,
delete, mount and to-volume handlers joined the request collection into
volume file paths, so a collection such as "../x" reached files outside
the volume directory. They now apply checkVolumeCollection, as CopyFile
and ReceiveFile already do.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* seaweed-volume: check the collection name in handlers that build file paths from it
Mirrors the Go volume server: allocate_volume, volume_mount, volume_copy
and the EC rebuild, copy, delete, mount and to-volume handlers apply
check_volume_collection, as copy_file and receive_file already do.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* volume: check the source's collection before VolumeCopy builds paths from it
VolumeCopy names the destination files after the collection the source
reports in ReadVolumeFileStatus, so that value needs the same check as
the request's collection.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* seaweed-volume: check the source's collection before volume_copy builds paths from it
Mirrors the Go VolumeCopy: the collection the source reports in
ReadVolumeFileStatus names the destination files, so it gets
check_volume_collection too.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* volume: stub the source in the VolumeCopy source collection test
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* seaweed-volume: keep check_volume_collection's doc comment as on master
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
The master client marks a master current as soon as the stream opens and
applies the first VolumeLocation afterwards, so GetLocations right after
GetMaster can miss volume 1 on a loaded runner.
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* test(volume_server): wait out a server's disk I/O before calling its SIGINT exit a hang
stopProcess gave every server 10s to exit after SIGINT. On a CI runner
with a busy disk, the fsync in volume close can take longer than that:
the server is in uninterruptible sleep, not hung. Sample the server's
threads from /proc while waiting. Once one has been in D state, allow
up to a minute. A server that never touched the disk still fails at
10s, and the failure now lists its threads' states and wait channels.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* test(volume_server): wait for the sleep child before checking its stop
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* test(volume_server): reap the SIGINT-ignoring child if it never starts sleeping
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
ResolveChunkManifest gained a cutToSpan argument while this test was in
flight, so master stopped compiling weed/server. The test compares chunk
lists, so it resolves every referenced chunk.
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* grafana: count the failure that creates an EC shard copy failure series
The EC shard copy failure counter exports a collection and reason pair
only once a copy fails, so rate() saw that first value as a baseline and
never showed it. The panel now shows failures per rate interval and adds
the earliest value of a series that did not exist one interval ago.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* grafana: count a new EC shard copy failure series from its last value
increase() extrapolates the increments of a series that appears inside
the window, and an instant offset selector loses an old series across a
scrape gap, so the panel could add a whole counter as new failures.
A series with no sample in the day before the window now shows its last
value; every other series shows increase().
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* grafana: count the first EC shard copy failure after a restart
A restarted volume server exports a failure series again only at its first
failure, so when the same labels had a sample earlier in the day the window
held only the new counter's samples and increase() missed that failure. A
series whose lowest value in the window is below its last value before the
window has been reset since, and now shows its last value; a series back
from a scrape gap keeps its value and still uses increase().
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* Add per-call filer authentication sources and pooled client wrappers
* Authenticate gateway filer calls with per-call admin tokens
* Authenticate shell admin and synchronization filer calls
* Authenticate workers MQ and remaining filer client paths
* Cache filer client signing keys and sign subscriptions with the shared key
Re-reading security.toml on every filer RPC cost about 125us against 8us for
signing. Keep the keys for up to a second, re-reading at once when a WEED_
override or the configuration directory changes. When the file exists but
cannot be read, keep the last keys read, else the startup keys, as
FilerAdminKeys does, so a process without a key stays tokenless. Metadata
subscriptions prefer the shared key, as filer peers do, because older filers
verify subscription admin tokens only with it.
* Authenticate admin-script, maintenance and filer.conf shell paths
Plugin worker admin scripts and master maintenance scripts build their own
shell options and carried no filer token source; fs.configure and
s3.bucket.quota.check read filer.conf without it.
* filer.cat: report a failed read; isolate key overrides in the admin-script test
filer.cat ignored the error from its filer call and exited successfully,
leaving a truncated -output file. Report the error and exit with failure.
The admin-script token test now clears the WEED_ signing-key overrides,
which take precedence over security.toml.
* security: refuse gRPC keys too short to sign; query engine uses client TLS
Under GODEBUG=fips140=only, hmac.New panics on keys under 14 bytes. The
startup check now covers jwt.filer_signing.grpc_key and grpc_previous_key,
and filer client token sources check the keys they read, so a reloaded or
per-endpoint security file with a short key is refused instead of
panicking when the next RPC signs.
The query engine's broker client dialed every master, filer and broker in
plaintext, so the admin token it now sends could cross the network in the
clear. It dials with the grpc.client TLS settings instead, and weed-sql
loads security.toml as weed-db does.
* security: per-endpoint admin tokens ignore WEED_ key overrides
FilerAdminTokenFromFile honored WEED_JWT_FILER_SIGNING_GRPC_KEY and
WEED_JWT_FILER_SIGNING_KEY. Those are process-wide, so filer.sync with
-a.security and -b.security signed both clusters' admin tokens with the
one key, handing each cluster a token valid on the other. A per-endpoint
file now supplies its own keys only.
* weed-sql, weed-db: refuse to start on an unreadable security.toml
Both only warned when security.toml was present but could not be read or
parsed. They then dialed without the grpc.client TLS settings while the
filer token source could still sign admin tokens from WEED_ environment
keys, so the tokens could travel in plaintext. They now exit with an
error that does not quote the file; a missing file is still fine.
* pb: take the filer token source in WithGrpcFilerClient and WithOneOfGrpcFilerClients
Fold WithGrpcFilerClientAuth and WithOneOfGrpcFilerClientsAuth into the
existing helpers instead of keeping two names for each. Callers without a
token source pass nil.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* util: return the read error from ReadConfiguration
Fold ReadConfigurationWithError into ReadConfiguration. The error is
returned and not logged, since parser errors can quote values; the
existing reload callers already warn when no file was read.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* security: keep the test-only filerAdminToken helper in the test
It had no production caller. The test helper now resolves keys through
filerClientKeysFrom, as the token sources do.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* util: read security.toml once in LoadSecurityConfigurationOrError
It validated the file, then merged it with a second read whose failure
was ignored and whose parser error was logged. It now merges with one
read and logs nothing from the parser. Viper's search also treats a
directory the process cannot search as holding no file; a candidate
that cannot be checked for lack of permission is now refused too.
* security: verify admin subscription tokens with the gRPC clock leeway
CheckGrpcMetadataSubscription checked admin tokens strictly, while unary
filer calls allow jwt.filer_signing.clock_leeway_seconds. With ten-second
client admin tokens, a subscriber whose clock trailed the filer's by more
than ten seconds was refused with a matching key. It now takes the leeway,
and the filer passes its configured one. The leeway check moves from the
server package to security.IsFilerAdminTokenWithLeeway so both use it.
* util: start without security.toml only when every candidate is confirmed absent
A candidate whose check fails for any reason other than not existing,
such as a symlink loop, is refused like one the process cannot search.
---------
Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* filer: keep a stored manifest when a commit lists its chunks flat
Since #12462 the filer folds a commit's small chunks into manifests
256 at a time, whichever client sent them. A client that keeps its own
chunk list sends every chunk it wrote on each flush and does not take
the folded list back. The Hadoop client is one: SeaweedOutputStream's
hflush and hsync send CreateEntry with the whole list, which the client
folds itself only past 1000 chunks. Once 256 small chunks have piled
up, each flush makes the filer fold the same chunks again into a new
manifest blob, and the manifest of the entry it replaces is deleted:
up to three manifests written and three deleted per flush.
cleanupChunks now puts back, after compacting the list and before
folding it, each manifest of the replaced entry whose chunks the list
holds flat and unchanged (filer.ReuseStoredManifests). The manifest
must span exactly the chunks it holds. A manifest the commit lists
itself, one that cannot be read, one with a chunk changed or missing,
and a hard-linked file's are left alone. MinusChunks counts the kept
manifests as listed, so the commit does not delete them.
That entry has to be the one the commit replaces and deletes against.
UpdateEntry already prepares its chunks under the path lock from
the entry it read there. CreateEntry folded before taking the lock;
it now prepares the chunks under the lock, after its precondition
checks, and reads the replaced entry there when the request has at
least 256 chunks. filer.CreateEntry still deletes the chunks of the
replaced entry that the new list drops, which no longer include the
kept manifests.
TestCommitKeepsTheStoredManifestOfChunksListedFlat (create and update):
the second commit of the same list plus one chunk keeps the manifest,
writes no blob and queues nothing for deletion. It fails on master.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* filer: take the replaced entry in cleanupChunks instead of a cleanupChunksReplacing twin
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* filer: reuse a stored manifest only for its chunks listed in its order
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* filer: keep the stored entry's manifests out of a refused update's cleanup
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* filer: do not reuse a manifest whose chunk ties with a chunk outside it
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* filer: drop a pull request number from a reuse test comment
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* filer: look up same-timestamp chunks by index in the manifest reuse overlap check
The tie check rescanned the whole commit for every candidate manifest,
so a 102,400-chunk commit with 400 matching manifests ran 40M map
lookups under the path lock. Index the commit's positions by
ModifiedTsNs once and check only the positions sharing a held chunk's
timestamp.
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>
* filer, mount: read a manifest's chunks only within its span
Until #13042, a truncate through a manifest only shortened the manifest
chunk; the chunks it holds stayed whole. Reads resolve those chunks at
their own offsets and sizes, so once such a file grows over the cut again
without writing it, by an extending truncate or a write past the end, the
cut bytes come back where zeros belong. #13042 keeps new truncates from
leaving such manifests, but files a mount truncated between #12462 and
#13042 still have them.
Reproduced with weed mount on a local cluster: a mount from before #13042
appends 700 lines with one close() each, so the first 256 fold into a
manifest, and truncates the file to 100 lines; a mount from current master
then extends it past its old end with ftruncate. The extended range read
8,580 bytes of the cut lines instead of zeros, through that mount and
through the filer.
Reads now cut each manifest's chunks to the manifest's span:
ResolveChunkManifestForRead, used by NonOverlappingVisibleIntervals (filer
and S3 streaming, WebDAV, the mount's merge reads), the S3 ranged reads and
the mount's peer reads, and ChunkGroup for the mount's reads. A manifest
made by MaybeManifestize spans its chunks exactly, so only shortened ones
change. ResolveChunkManifest still returns the chunks whole: MinusChunks,
deletions and the other chunk-list comparisons need every chunk a manifest
references, or the chunks past the cut would never be deleted.
* sw-client: read a manifest's chunks only within its span
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* java client: read a manifest's chunks only within its span
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* filer: drop PR numbers from the manifest span comments
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* filer: fold ResolveChunkManifestForRead into ResolveChunkManifest
ResolveChunkManifest takes cutToSpan: the read paths pass true, the
deletion and chunk-list comparison paths pass false.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* s3api: cut manifests to their span when flattening an object's chunks
A full-object SSE GET, CopyObject and UploadPartCopy flatten the
source's manifests into a plain chunk list, which drops each manifest's
span, so the chunks a truncate left past a shortened manifest came back
as object data.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* shell: purge a volume.fsck path only for chunks within a manifest's span
A chunk past a shortened manifest's span is still referenced but never
read, so a missing volume under it loses nothing. The purge decision now
uses the span-cut chunks while the inventory keeps every reference.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* shell: cut manifests to their span in fs.distribute_chunks
The entry is rewritten with the resolved chunks as a flat list or a new
manifest that spans them, so chunks past a shortened manifest's span
became readable again. The filer's update still deletes them, since it
compares against the old entry's uncut chunks.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* shell: verify only the chunks within a manifest's span in fs.verify
A chunk past a shortened manifest's span is never read, so a missing
needle under it failed the entry and, with -pruneEntries, deleted a file
whose readable bytes were intact.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* shell: mark the chunks past a manifest's span instead of allowing the visible ones
The purge gate now skips only the resolved chunks that the span cut drops,
so chunks that come from outside the manifests keep their purge behavior.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* shell: skip the purge for a missing past-span chunk on a listed volume
volume.fsck -findMissingChunksInFiler queued a path for deletion when a
listed volume's index lacked any chunk the uncut inventory recorded,
including a chunk past a shortened manifest's span that no read reaches.
Record those chunks per path during the filer walk and let only a missing
chunk within the span queue the purge. The path is still reported.
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>
* feat(grpc): serve grpc.health.v1 on every server, add health-check-only client certificates
Every gRPC server built by pb.NewGrpcServer now answers the standard
grpc.health.v1.Health service, so blackbox_exporter's grpc prober,
grpc_health_probe and Kubernetes grpc probes can check SeaweedFS ports.
Check("") reports the server; Check(<service>) reports whether that
service is registered on the port.
grpc.health_check_commonNames lists client certificate common names that
pass the mTLS handshake on every component but may call only the health
service; any other RPC gets PermissionDenied. A monitoring probe can then
check the port and its certificate without a credential that opens the
whole gRPC API.
Fixes#5012
* seaweed-volume: serve grpc.health.v1 on the gRPC port
Mirrors pb.NewGrpcServer registering the health service on every Go
server: the whole server, the volume service and the health service
answer SERVING, other names NotFound.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* seaweed-volume: confine grpc.health_check_commonNames to the health service
Mirrors the Go healthCheckOnlyTap: a client certificate whose common name
is on [grpc] health_check_commonNames passes the handshake even when
allowed_commonNames is set, and any RPC outside grpc.health.v1.Health is
refused with PermissionDenied. WEED_GRPC_HEALTH_CHECK_COMMONNAMES
overrides the key like the other WEED_GRPC_ settings.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* seaweed-volume: end health watches when the gRPC server shuts down
Graceful shutdown waits for open streams, so a client holding a health
Watch kept the volume server from reaching store close. Clearing the
reported statuses ends every Watch stream once the shutdown signal fires.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* pb: end health watches before gRPC graceful stop
GracefulStop waits on open streams, and Watch held its stream until the
client left, so a connected probe kept volume and admin worker shutdown
from finishing and made filer and S3 wait out their drain timeout.
StopHealthWatches ends those streams; every GracefulStop path calls it
first.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* scaffold: point mTLS health probes at an exec probe
The built-in Kubernetes grpc probe sends no client certificate, so it
cannot pass an mTLS port; grpc_health_probe run as an exec probe can.
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>
* java client: read security.toml without an [https.client] section
toml.getBoolean returns null for a missing key, so unboxing it threw a
NullPointerException in the static initializer and every FilerClient
failed with ExceptionInInitializerError when security.toml held only
other sections, such as [grpc] or [jwt.filer_signing].
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* java client: sign filer JWTs and hold [filer.basic_auth] credentials
FilerSecurityContext reads jwt.filer_signing.key, jwt.filer_signing.read.key
(with their expires_after_seconds, defaulting to 10 and 60 like the Go
clients) and [filer.basic_auth] from security.toml, with setters to set
them in code. getFilerAuthorizationHeaderValue returns the credential for a
request to the filer's HTTP port: an HS256 token for the access level,
minted like security.GenJwtForFilerServer, else the filer Basic Auth, else
the existing [basic_auth] value.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* java client: send the filer credential on filer-proxied chunk requests
With volume server access through the filer proxy, chunk reads and writes
address the filer's HTTP port, which checks the filer JWT or Basic Auth
before proxying. The write sent the AssignVolume token instead, which the
filer rejects with "wrong jwt", and reads sent no filer token. Send the
filer credential on proxy URLs only; direct and publicUrl volume requests
keep the volume token. With no filer credential configured, the old
headers are sent unchanged.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* hdfs3: take filer JWT keys and Basic Auth from the Hadoop configuration
fs.seaweed.filer.jwt.signing.key, fs.seaweed.filer.jwt.signing.read.key
(and their expires.after.seconds) and fs.seaweed.filer.basic.auth.user /
password override security.toml. The secrets are read with
Configuration.getPassword, so a Hadoop credential provider can hold them.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* hdfs3: document a filer secured with JWT or Basic Auth
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* java client: fail a chunk fetch that answers a non-2xx status
doFetchOneFullChunkData returned the response body whatever the status,
so a 401 "wrong jwt" or a 404 JSON error was taken as chunk data and
cached. Throw instead, so the fetch tries the next location and reports
the error.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* java client, hdfs3: accept filer Basic Auth with an empty user
The filer turns Basic Auth on whenever the password is set, user empty or
not. The client dropped credentials without a user, so a password-only
filer refused every proxied chunk request.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* hdfs3: point the secured filer docs at [https.client]
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* java client, hdfs3: keep filer credentials on each filer client
The filer JWT keys and [filer.basic_auth] lived in process-wide fields,
so a second filesystem with its own fs.seaweed.filer.* options replaced
the credentials of the first one, and a filesystem without options
inherited the previous overrides. Each FilerClient now copies the
security.toml values into its own FilerCredentials, and chunk reads and
uploads use the credentials of the client that issued them.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* hdfs3: let each filer credential option override only its own value
A password-only or token-lifetime-only option in core-site.xml was
ignored or dropped the security.toml user and key. Each option now
replaces just the security.toml value it names.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* hdfs3: show [https.client] for a secured filer and per-option overrides
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* hdfs3: note that [https.client] does not check the filer host name
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* hdfs3: check filer tokens against the configured key and lifetime
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* java client: do not follow redirects on filer proxy chunk requests
HttpClient copies the request's Authorization header onto a followed
redirect, even to another origin, so a relayed 3xx would hand the filer
JWT or Basic credential to the redirect target. A 3xx now fails like any
other non-2xx answer and the read moves to the next location.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* hdfs3: close the filer client when credential options fail
A credential provider error or a malformed lifetime option threw out of
the store constructor after the client had opened its gRPC channels,
leaving them open on every failed initialization.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* hdfs3: say the filer HTTP credentials apply only to filerProxy mode
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* java client: pick filer credentials by access mode and filer address
The proxy check matched any URL containing proxyChunkId=, so a volume
url or publicUrl carrying that text would receive the filer JWT or Basic
credential. Only filerProxy-mode URLs that start with this client's own
filer proxy prefix count as filer requests now.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* filer: fold only runs of small chunks that lie end to end
#12462 folds every chunk under 1 MiB into manifests, 256 at a time in
list order. Two things go wrong when those chunks are not plain appends:
- A manifest's chunks are not compacted again. A small chunk that a
later write covers stays stored and referenced after the write hid it.
- weed mount's bloat check sums chunk sizes and counts a manifest by its
span. A manifest over chunks that are not next to each other spans
bytes other chunks hold, so the file looks bloated and the flush reads
it back and stores it again, whole.
With weed mount on a local cluster, a writer that appends 300-byte
records and rewrites a 4 KiB header at the front after each one (open,
two pwrites, close): after 766 records the mount logged "2.0x chunk
bloat detected ... (2 chunks, 475684 stored vs 233896 content),
merging" and rewrote the file, and did it again at 2.5x (1164184 stored
vs 463396 content); 1,600 records cost two whole-file rewrites. Each
rewrite reads and stores the whole file, and the next one comes a few
hundred flushes later. Random small writes fold their overwritten pages
the same way.
Only small chunks that no other chunk overlaps now fold, and only in
runs that lie end to end, so a manifest spans exactly the bytes it
holds. Appends make such runs and fold as before. Chunks between
full-size ones, chunks that overlap others and chunks with a hole
between them stay flat, as they did before #12462. What is left of a
run stays flat until the run grows.
* filer: size the small-chunk fold's result by its input
CodeQL alert 446 (go/allocation-size-overflow) flagged the capacity
len(inputChunks)-len(folded)+len(manifests). It cannot overflow, but the
input's length bounds the result anyway: each manifest takes the place of
SmallChunkManifestBatch chunks.
* 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>
* 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>
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>
* 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>
* 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>
* 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>
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>
* 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>
* 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>
* 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>
* 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>
* 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>
* 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>
* 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>
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>
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>
* 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>
* 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>
* 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>
* 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>
* 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>
* 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.
* 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>
* 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>
* 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>
* 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>
* 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>
* 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>
* 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>
* 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>
* 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>
* 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>
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>
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>
* 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>
* 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.
* 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>
* 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>
* 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>
* 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>
* master: gate operator-only management RPCs on the whitelist
CollectionDelete, DisableVacuum, EnableVacuum, VolumeGrow,
ResumeVolumeGrowth, LeaseAdminToken and ReleaseAdminToken now call
checkGrpcAdminAuth, matching the whitelist their HTTP counterparts
already enforce. VolumeGrow stays open to the in-process growth loop,
and callers on the local gRPC socket of weed server/mini are local.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* master: admit unknown masters over KeepConnected only from the whitelist
A KeepConnected registration as a master pulls that address into the
raft quorum. Accept it from any caller only for this master and its
-peers; any other master address now needs a whitelisted caller, the
same check RaftAddServer applies.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* master: test that every RPC is gated or listed with a reason
Port the volume server's coverage test so a new master RPC cannot skip
checkGrpcAdminAuth without an explicit exemption. The proto and AST
helpers now take the proto file and receiver name.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* volume: admit callers on the local gRPC socket
weed server and weed mini route same-host gRPC dials through a unix
socket, whose peer address carries no IP. With -whiteList set the
volume server refused the in-process master's AllocateVolume, so no
volume could be grown. The Rust volume server serves gRPC over TCP only.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* master: match a KeepConnected master against configured peers by gRPC endpoint
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* pb: bind the local gRPC socket for the owner only
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* filer: warn when a deleted bucket's collection is left on the master
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* pb: bind the local gRPC socket in a private directory before moving it into place
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* filer: report an unconfirmed bucket collection delete as such
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* s3_objectlock: read a bucket's default retention from its entry
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* sftp: give uploads into an Object Lock bucket its default retention
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* sftp: match uploads against the cleaned buckets folder
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* s3: do not delay the EOF read in the put stage timing test
TestPutStagesRecordEachStage checks that the storage stage is at least
5ms. That stage is the second chunk's assign wait (20ms) minus the final
read that only returns EOF, which slowReader also delayed by 10ms. When
busy goroutines hold every P, the reader's wakeup can lag the assign's
by as much as a preemption slice, and storage drops below the floor.
slowReader now delays only reads that return data, so the EOF read is
instant and storage covers the whole assign wait.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* s3: keep the EOF read out of the timed body in the put stage test
Skipping the delay on the EOF read still left that read inside
timedBody, so a stall there was subtracted from storage. Feed the upload
through an eight-byte limit instead: the final EOF comes from the limit
reader without reaching the timed body, so storage always covers the
second chunk's full assign wait. slowReader goes back to delaying every
read.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* feat: weed fix -verify to resync past damaged regions in .dat
Plain `weed fix` walks .dat by trusting each needle header, so a damaged
region in the middle loses or misindexes everything after it, and a torn
or garbage tail ends up in the index and keeps the volume read-only.
-verify reads every needle, checks structure and CRC32, and on a failure
searches forward at needle alignment for the next verifiable needle. Each
skipped region is reported as zero-fill / garbage / garbage+zeros with its
length, zero windows and the fid of the needle that was hit. The index is
rebuilt from verified needles only (old one kept as .idx.bak); -truncateTail
cuts trailing garbage so the load-time integrity check passes, -dryRun only
reports. Works with the 5BytesOffset build.
* feat: add weed fix.verify, a read-only check of .dat files
Runs the same needle/CRC verification and resync scan as `weed fix -verify`
but never writes: no .idx rebuild, no truncation. Takes folders and/or .dat
files, filters with -collection / -volumeId, prints the damaged regions
(optionally to -report) and exits 0 when clean, 3 when damage was found and
1 when a file could not be verified. The scan options are shared with
`weed fix -verify`.
* feat: weed fix -compact, verify and compact a damaged volume in one pass
-compact implies -verify. While the .dat is scanned, every verified needle
gets an index entry, and from the first damaged region in the middle of the
file the needle bytes are streamed into a new .cpd as well (the intact prefix
before it is copied as one block). The result is a .dat without the damaged
regions and an append-ordered .idx that matches it exactly, so a full volume
scrub no longer complains about the .dat size. The compaction revision is
bumped like a vacuum does.
A volume without damage is left untouched, and damage only at the tail is just
cut off in place, so neither costs a .dat copy. The old .idx is kept as
.idx.bak and the old .dat as .dat.bak (-deleteOriginal removes it). The free
space needed for the new .dat is checked before anything is written, a failing
swap is rolled back, and progress is printed every 30s.
* refactor: reuse backend, super block and throttler code in weed fix -compact
- create the .cpd with backend.CreateVolumeFile and preallocate the bound of
the new .dat; the result is truncated to its real length at the end
- read the super block with super_block.ReadSuperBlock (also in the verifier)
and write the bumped compaction revision with SuperBlock.Bytes()
- throttle the .dat writes with util.WriteThrottler (-compactionMBps)
- fsync the directory before and after swapping the new files in
ReadSuperBlock cannot read a super block with extra data, so such volumes are
rejected with its error instead of being handled by a hand-written parser.
* refactor: drop helpers that duplicate existing code in weed fix -compact / fix.verify
- util.FsyncDir instead of a local fsyncDir
- io.NewOffsetWriter instead of a hand-written WriterAt adapter; the throttle
now sits in one small writer wrapper used for both the prefix copy (via
io.CopyBuffer) and the streamed needles, replacing the manual copy loop
- needle.NewVolumeId instead of strconv for volume ids parsed from file names
* fix: resync in weed fix -verify must not accept payload-less look-alikes
After damage, a few bytes of a needle's tail followed by the next record's
header could parse as a payload-less needle and be confirmed only because the
file ended right after it, so a made-up key got into the index and swallowed
the real delete record behind it.
A payload-less candidate is now accepted without a verifiable successor only
if it is a size-0 tombstone ending exactly at the end of the file (or, with a
set timestamp, leaving less than a header); a set but implausible v3
timestamp rejects it. Anything else needs the next needle to verify.
* test: recovery integration tests for damaged .dat heads (#5674, #12914)
- zero-filled head (aligned and cut next record): all survivors indexed,
region reported as zero-fill, trailing tombstone kept
- plain weed fix stops at the first bad header (#12914 item 1) while
-verify recovers the needles behind it
- a needle rewritten after a damaged region is indexed at its newest copy
- a zeroed superblock fails with an explicit unsupported-version error and
fix.verify counts it as not verifiable (exit 1)
- v1/v2 needle layouts verify cleanly
* fix: reject a super block extra in fix -verify
A super block extra describes an erasure-coded layout; the .dat behind it was
re-striped into .ecXX shards and is not a plain needle file. Scanning it as
one silently produced damage reports instead of telling the operator the file
is out of scope. Return an explicit error instead.
* fix: guard fix -verify/-compact against pending compaction commits and -dir.idx
- refuse to start while a .cpc marker exists: an interrupted vacuum commit is
pending and the volume server must reconcile it first (roll forward/back);
writing a rebuilt .idx or new .cpd/.cpx over that decision would race it
- clear a stale .cpc after a completed swap so it can never be rolled forward
later (defensive; the start guard already refuses this state)
- spell out in the help and print after a rebuild that the index is written
next to the .dat: with a separate -dir.idx directory the .idx must be moved
there and any stale .ldb dropped
- tests: refusal leaves the marker and writes no .idx; a completed swap clears
a marker that slipped past the guard
* refactor: narrow this change to weed fix -verify
Drop weed fix.verify and weed fix -compact from this change; they follow in their own pull requests. -report, -windowMB and -zeroWindow go with them: the scan uses fixed windows and prints its report to stdout.
* fix: weed fix -verify: address review findings
- -maxNeedleSizeMB limits only guesses made while resynchronising; a record
reached at a known boundary may be as large as the file allows
- a v2/v3 record whose parsed fields do not add up to its size, or a live
record without data, is damage: a zero fill over the data length used to
pass as an empty file because the CRC is only checked when there is data
- a stamped v3 delete record found after damage stands on its own when its
time is believable, not older than the last verified record and followed
by zero padding, so a delete before a damaged tail is not lost
- a read error while searching for the next needle fails the run instead of
ending the scan and treating the rest as a garbage tail
- keys whose newest record is damaged while an older copy is indexed are
reported as stale-version warnings
- the rebuilt index is staged as .idx.tmp and swapped in when complete; a
stale .ldb next to it is removed so the volume server rebuilds it
- -ignoreError reports a volume that cannot be verified and goes on
- -truncateTail does not cut a tail it could not read and removes a partial
tail backup
- volume ids are parsed as uint32
- the test fixture stamps every record the way the volume server does
* fix: weed fix -verify: prove deletes found after damage, swap the index safely
- a delete record found while resynchronising must prove itself: a v3 one
needs a believable time not older than the last verified record and zero
padding (every v3 writer stamps deletes); a v1/v2 one needs the following
records to reach data that passes its CRC, or the exact end of the file.
Stray bytes in a zero-filled region used to pass as deletes of live keys.
- the rebuilt index is fsynced before the swap, the previous one is kept as
a hard link, and the new one replaces it in one rename, so a live .idx
exists at every moment
- .sdx and .rdb caches are removed with the .ldb
- -verify exits non-zero when it found damage, like plain fix and -verifyCrc
- with -ignoreError a file name whose volume id does not fit uint32 is
reported and the batch goes on
- the help and the printed hint say that a volume server prefers an .idx
next to the .dat over the one in -dir.idx
* fix: reject weed fix flag combinations -verify cannot honour
-verify -remoteFile skipped an explicit .dat and reported success, -dryRun
and -truncateTail were silently ignored without -verify, and -dryRun -ecx
still rebuilt EC indexes. Check the combinations before any file is touched.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix: apply -volumeId before rejecting an out-of-range volume file name
With -volumeId set, an unrelated file such as 4294967296.dat aborted the
run before the filter could skip it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix: check the data length before reading a record body in fix -verify
A damaged size field at a known record boundary made the scan allocate and
read a body of that size before rejecting it. Check that the data length
after the header fits the record first, as the resync probe already does.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix: accept a v1/v2 delete chain that reaches the end of the file on its last probe
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix: keep an implausible needle timestamp out of the fix -verify resync baseline
The data CRC does not cover the v3 timestamp, so a corrupted one passed and
then rejected every genuine delete record found after later damage. Report
it as a warning instead of using it as the lower bound.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix: stop fix -verify on a read error at a known record boundary
An EIO while reading a record was treated like damaged bytes: the scan
resynchronised past the unread record and the rebuilt index dropped it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix: sync the fix -verify tail backup before truncating the .dat
A crash right after the truncate could persist it before the backup's data
or directory entry, losing the cut bytes from both files.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix: let fix -verify -truncateTail retry when a tail backup already exists
After a backup succeeded and the truncate failed, the next run hit the
existing backup and could not get past O_EXCL. Keep the first backup and
save the tail under a new name, as the index backup does.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix: drop stale index caches before fix -verify swaps in the new index
Removing them after the rename left a window where a crash paired the new
.idx with the old .ldb, whose newer LOG skips the replay.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* test: pin fix -verify fixtures to needle version 3
-verify reads v1 to v3 records, so its fixtures should not follow the
build's current needle version.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix: refuse fix -verify on remote-tiered volumes
A remote-tiered volume is read from its remote .dat through the existing
.idx, so rebuilding that index from a local .dat would point it at the
wrong bytes.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix: pick a free backup name when fix -verify retries within one second
backupName fell back to path.bak.<unix time> without checking it, so a
second retry in the same second reused that name and the exclusive
create (or the .idx hard link) failed. Add a .<n> suffix until the name
is free.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix: refuse fix -verify when the volume info cannot be read
An unreadable or unparsable .vif may name a remote tier, so treat it like one
and keep the existing index.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* refactor: pass weed fix -verify options explicitly
* feat: move weed fix -verify into a weed fix.recover command
* docs: weed fix.recover help, point weed fix at it
* fix: keep the volume file helpers below runFix
Leaves the region between VisitNeedle and runFix as on master.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* test: build fix.recover fixtures at needle version 3
fix.recover reads needle versions 1 to 3, so its tests must not follow
GetCurrentVersion; writeFixTestVolume now takes the version.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: whitefox <whitefox@mayflower.work>
Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* filer: refuse unsafe chunk appends
* filer: report append representation preconditions
* filer: cover cached remote append eviction safety
* filer: cover lazy remote append refusal
* filer: refuse HTTP appends and offset writes onto remote-only entries
An HTTP append or offset write onto a remote-only entry stored the new
chunk with nothing below it, so reads returned zeros where the remote
bytes were and the entry stopped being remote-only. Small appends failed
with a retryable "inline file changed" error instead.
Refuse both with a client error, matching AppendToEntry.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* filer: AppendToEntry appends after a sparse tail
AppendToEntry placed new chunks at the end of the existing chunks, so a
file extended past them by a truncate got the appended bytes inside its
logical length instead of after it, and its size did not grow. Use the
entry size, as the HTTP append path does.
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>
* filer_pb: scrub cipher keys from both entries of an event
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* notification: keep chunk cipher keys out of webhook payloads
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* codespell: accept the Yandex Disk sandbox URL path
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: Claude Opus 5.5 <noreply@anthropic.com>
* filer: require bearer tokens for configured gRPC calls
* filer: authenticate owned peer RPCs with per-call admin tokens
* filer: retain scoped forwarding refusals with required authentication
* filer: preserve tokenless HTTP forwarding outside require mode
* filer: honor clock tolerance for gRPC admin fallback
* filer: preserve caller token on lock owner forwards
* filer: forward caller auth on target ping
* filer: authenticate startup peer digest checks
* filer: verify required subscription bearers independently of mTLS
* filer: assert exact caller bearer on forwarded ping
* filer: sign peer tokens with the gRPC verification key
peerContext signed filer-owned RPCs with jwt.filer_signing.key only. With
grpc_key as the only key and require-mode on, peer calls went out tokenless
and were refused. With both keys set, peers that verify with grpc_key and
lack the shared-key admin fallback refused the shared-key token even with
require-mode off. Sign with the key filesystem gRPC verifies, and keep the
shared key for metadata subscriptions, whose verifier accepts admin tokens
signed only with it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* filer: keep a subscription token's scope over mTLS in require-mode
Require-mode admitted a dedicated subscription bearer without the mTLS
shortcut, but the handler re-checked it with the certificate, which
granted the full stream past the token's prefixes and expiry.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* filer: delete uploaded chunks when the write owner refuses authentication
A forwarded HTTP append or offset write that the owner refused as
Unauthenticated kept its new chunks as if the outcome were unknown,
orphaning them.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* filer: hand the admitted subscription scope to the handler
The handler re-verified a dedicated subscription token after reading the
request. If the token expired in between, an mTLS peer fell back to the
certificate and got an unrestricted stream. The interceptor now passes
the scope it admitted, and the handler refuses it once expired.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* filer: accept grpc_key admin tokens on metadata subscriptions
A filer with only grpc_key signs peer subscriptions with it, but the
subscription verifier checked admin tokens against the shared key only,
so with a subscribe key set the aggregator's peer streams were refused.
An unscoped grpc_key token already has full filer gRPC access.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* filer: delete the generated manifest when the write owner refuses authentication
A forwarded HTTP append that crossed the manifest threshold left the
manifest blob it had uploaded orphaned when the owner refused the call
as Unauthenticated. The blob alone is deleted, since the manifest also
lists committed chunks.
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>
* filer, mount: keep a hard-linked file to one link id and count its names on the filer
A hard link's bookkeeping was done by the client. To link a file a mount
reads its entry and sends two writes, an update of the source and a create
of the new name, both with a link id and a count of the file's names. Two
clients that link one file at the same moment each worked from the entry
as it was before the other's writes:
- With no link id on the entry yet, each made one up. The second update
moved the source to its id, the store took the name off the first, and
the first client's new name was left alone on it: one file's chunks
under two link ids.
- With a link id there, both read the same count and sent it plus one.
The record counted one name fewer than the file had. Any write through
a name carried the client's copy of the count and replaced the record
the same way.
Either way the delete of the last counted name deleted the record and the
chunks while another name still read them.
The filer's own store now counts the names of a hard-linked file itself
(countLink): one more when the name written did not hold the link before,
the same when it did or when a rename moves it there (WithMovedLink), one
for a record that starts. The count sent is not used, and the entry gets
the count stored, so the response and the event carry it. The lookup of
the name, the count, the record and the name are stored as one change of
the record (changeLinkRecord), which DeleteHardLink goes through as well:
under a lock per link id, and in a transaction where the store refuses a
commit over a change made since it began, run again when it does. A
wrapper around a copy of some entries, such as a mount's metadata cache,
sees only some of the names and stores the count it is given.
UpdateEntry refuses to give a name that holds a hard link another link id
that no file has yet (refuseSecondHardLink). The mount sends a file's
first link's update as a unary RPC, which keeps that refusal apart from
an I/O failure, reads the entry again and links under the id the file has
by now.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
* filer: take a replicated update's link id without refusing it
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* filer: look a path-specific name up outside the record's transaction
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* filer: check the leveldb open and close it in the hard link test
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* mount: send a refused first link again from the entry as stored
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* mount: keep a first link's refusal over the next filer's error
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* filer: count a hard link's names next to the clients' count instead of in its place
The filer's count replaced the one clients send, which lost two things
that count did by being worked out ahead:
- A link's first write, the update of the source, carries the count with
the new name in it already. While the second write is on its way that
kept a delete of the source from being taken for the delete of the
file's last name (lastLinkDropped goes by the count it read), and the
chunks from being deleted under the name about to come. Counted only
when it arrived, the new name was stored with chunks that were gone:
104 of 300 rounds of a mount linking a file while another deletes it.
- A write of a name the store refused had counted the name already, and
sent again counted it once more.
The filer now keeps its count of the names in a key of its own next to
the record (linkNames), written once the name is stored, and the record
gets whichever is higher: the count the client sent or the names counted.
It is never lower than what the client alone would have left, and never
lower than the names the file has. A record from before has its count
recorded as the names when it is first written again.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
* mount: send a refused first link again with the file's inline content
The second attempt builds the new name's create from the entry as the
filer has it by now: attributes, chunks and extended attributes. A file
the filer keeps inside its entry has its bytes in Content, and the create
is what the filer writes the link's shared record from, so without them
the record lost the file's content.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
* filer: store a path-specific name before the record's lock is let go
A second create of the same new name on this filer took the lock between
the first one's count and its name write, missed the name, and counted it
again: the file's record and chunks then outlived its last name.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* filer: keep a link's names key out of the keys of a directory's entries
The key began with the link's random id. One that began as the root's
entry keys do in a store keyed by path put the names' 4 bytes in the
root's listing, and it failed to decode: listing / and the etcd scan
under fsck failed.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* filer: record a hard link's name before it is stored, and take it off if it is not
The names counted for a hard link were recorded once the name was stored.
On a store without transactions a failure of that write left the name
stored and not counted, and the write sent again found the name there and
did not count it either: the names recorded stayed one below the names
stored, the side a file is deleted under a name from.
They are recorded first now, inside the change of the record that counted
them, and a name the store then does not take is counted off again
(storeCountedName). A failure halfway leaves them one above the names
stored, and the file leaked. A name in a path-specific store is recorded
with the record as well, and counted off in a change of its own.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
* filer: keep a hard link's name counted when a failed write stored it
A write whose deadline passes after the store took the name returns an
error, and counting the name off then left the names one below the names
stored. A later write with the count from before the link lowered the
record to them, and the file was deleted under a name it still had. Read
the name back first, and keep it counted where that cannot be told.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* mount: carry the stored RemoteEntry into the name a retried first link adds
The retry rebuilds the new name from the entry the file has once another
client linked it, but kept the RemoteEntry of the entry first read.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: MapleWhiteZZZ <18653045+MapleWhiteZZZ@users.noreply.github.com>
Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>
Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com>
* test/s3: result checker for rclone fstests
* test/s3: run rclone fstests against SeaweedFS with expected failures
* ci: add rclone fstests workflow
* test/s3: catch parent-only failures and panics in rclone fstests check
* test/s3: check parent assertions and skips in rclone fstests, widen paths
* test/s3: drop issue numbers from the rclone expected-failures notes
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
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>
* feat(remote_storage): add a Yandex Disk backend
Yandex Disk joins s3/gcs/azure as a remote storage type, so it can back
remote mounts and sink replication (filer.remote.sync, filer.remote.gateway)
without a separate sink.
The Disk API has no buckets and no place for a file's mtime: a top-level
folder under yandex_root plays the bucket, and the entry's modification time
and content encoding travel as custom resource properties (seaweedfs_modified,
seaweedfs_content_encoding; rclone_modified is read too). The client also
handles the API's asynchronous operations (202 + operation polling), the
short-lived, single-use download links (a fresh link per read and per retry),
single-PUT uploads, mkdir -p of an S3-style key's parents, server-side copy
for a remote-only rename, and a ranged read that refuses a short body.
A caller-supplied endpoint goes through the guarded client like the s3 and
azure endpoints.
* feat(shell): configure and issue Yandex Disk tokens
remote.configure gains the yandex flags (token, client_id, client_secret,
root, trash, app_folder, endpoint). A refreshable token is issued in two
steps without a browser on the server: -yandex.oauth_url prints the
authorization url and keeps the app credentials, -yandex.code exchanges the
copied code for a token and stores it. The token and the client secret are
masked in the configuration listing.
docs/remote-storage-yandex.md walks through the OAuth app, both token flows,
the mount and replication commands, and the platform's limits.
* fix(remote_storage): handle missing Yandex folders on stat, copy and upload
A missing object is confirmed against the bucket folder rather than its
immediate parent, as the gcs client does: a key whose subfolder does not
exist yet (a rename destination) is a missing object, not a vanished mount,
and the sync only proceeds on ErrRemoteObjectNotFound.
CopyFile creates the destination's parent folders, so a remote-only rename
into a folder the remote does not have yet succeeds. The Disk API answers a
missing parent with 409 DiskPathDoesntExistsError; upload and copy treat it
like a 404, and the fake answers the way the API does.
An operation poll refreshes the token once on 401 and then fails, instead of
polling without a pause until the operation deadline.
* fix(remote_storage): retry a locked Yandex resource
A folder that is still being deleted asynchronously answers a write with
423 DiskResourceLockedError for a moment. The client now retries it with the
same backoff as 429/5xx/509, and the error stays transient for the sync's
upload retry when the client's retries run out.
* fix(remote_storage): harden the Yandex backend after review
Traverse reports objects only, like the s3, gcs and azure clients: its
callers (remote.cache, remote.copy.local) read the stamp of every entry, and
a folder came with none.
Deletes no longer reach what they were not meant for. A Disk API delete is
recursive, so DeleteFile keeps a folder that took a file's place on the
remote, and DeleteBucket removes an empty bucket folder only, the rule S3 and
GCS apply to a bucket.
CopyFile keeps the destination until its replacement exists: it copies with
overwrite and removes the old object (to the trash when configured) only when
the service kept it anyway. It refuses to replace a folder, treats a copy
onto itself as done, and carries the source's resolved modification time,
including rclone_modified and the service's own time.
Every metadata request and operation poll has a deadline that covers
reading the answer, and a token refresh or code exchange has its own, so a
stalled endpoint cannot block the client. Redirects are checked like the
transfer links, an endpoint that would send the token over plain http is
refused unless it is on a loopback host, a 202 without an operation link is
an error, and a read with an offset and no size starts at the offset.
* chore(seaweed-volume): keep only the Yandex fields in the remote.proto copy
* yandex: retry a failed operation poll
One throttled, failed or timed-out status poll ended a wait of up to 30
minutes while the operation kept running on the service, so a large
delete or copy was reported failed and redone.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* yandex: refresh a token once for concurrent 401s
Every request rejected with the same access token replaced the token
source, so N concurrent 401s refreshed, and rotated the refresh token,
N times.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* yandex: retry an operation poll whose answer was cut short
A status poll that got its 200 headers but lost the connection before the
JSON body ended failed with io.ErrUnexpectedEOF, which the poll retry did
not treat as transient, so the wait ended while the operation kept running.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
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>
* mount: keep a file's inline content when it is written to or resized
A small file the filer keeps inside its entry (-saveToFilerLimit, or
?saveInside=true on the upload) has its bytes in the entry's content and
no chunks. A mount dropped the content at the first write to the file, or
copy into it, and published the write's chunk alone: the bytes the write
did not cover read as zeros from then on, for an append as for two bytes
in the middle. A change of size left the content as it was. Grown, the
file read no further than its content on the mount and as zeros through
the filer; cut and grown again, it had the bytes that were cut off back.
The content now becomes a write of the handle's own, older than the one
about to change the file, and is flushed with it as a chunk
(bufferInlineContent: Write, CopyFileRange, Fallocate). SetAttr cuts it to
a smaller size, and stores it as a chunk before the file grows past it
(resizeInlineContent).
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
* mount: store resized inline content in chunks of the mount's chunk size
A file that grows past its inline content had the content stored as one
chunk, whatever its length, where a buffered write is split at the
mount's chunk size: content longer than a volume server takes in one
upload could not be stored, and the file could not grow.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
---------
Co-authored-by: MapleWhiteZZZ <18653045+MapleWhiteZZZ@users.noreply.github.com>
Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>
* mount: carry a file's inline content into the name a hard link adds
A small file the filer keeps inside its entry (-saveToFilerLimit, or
?saveInside=true on the upload) has content and no chunks. To link it a
mount updates the source and creates the new name, and the filer writes
the link's shared record from each of the two. The create carried the
source's attributes, chunks and extended attributes but not its content,
so the record was left with a size and nothing behind it: both names read
zeros from then on, through the mounts and through the filer.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
* mount: carry a remote-only file's RemoteEntry into the name a hard link adds
A file under a remote mount that is not cached yet has no chunks and no
content; its RemoteEntry is what sends a read to fetch the object. The
create of the new name left it out, so the hard link's shared record lost
it and both names read zeros.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* mount: cache a remote-only file before a hard link gives it a new name
The filer resolves a remote object from the name a read goes through, and
the new name has no object of its own, so a read through it failed until
the source name had been read. The link now has the filer cache the
object first, so every name shares its local chunks.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* mount: cache a linked remote-only file through its open handle
The cache moved the stored entry off the base of a handle open on the
source, so the handle refused the link change and its next flush failed.
A handle with buffered writes now publishes them first, and the cache
goes through the handle as a read does, which moves its base along.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: MapleWhiteZZZ <18653045+MapleWhiteZZZ@users.noreply.github.com>
Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>
Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com>
* s3: abort in-flight requests whose access is revoked
S3 checks access when a request starts, so a download or upload that
started before an identity, policy or bucket policy change runs to its
end. With -s3.abortRevokedRequests the gateway re-checks the requests it
is serving after such a change and aborts the ones now denied: an
HTTP/1.x request has its connection closed, an HTTP/2 request is
canceled.
The re-check looks the identity up again and repeats only authorization,
not the signature check, so clock skew or an expiring presigned URL never
cuts a long transfer. Off by default.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* s3: check revoked requests against whole reloads and configured identities
- A re-check pass holds reloadMu, so it never sees identities installed
before their policies are synced.
- STS and JWT sessions are not tracked: re-validating their token checks
its expiry, which a re-check cannot tell from a revocation.
- A request whose access changed while it was being admitted is checked
again once it is tracked.
- The identity source comes from how the request authenticated, and a
rotated secret revokes the requests signed with the old one.
- An aborted HTTP/2 request also has its body closed.
- Browser form uploads, which their handler authorizes, are not tracked.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* s3: track SigV2 requests that carry a session token
SigV2 never reads a session token, so a configured key that sent one was
classified as a session and skipped the re-checks. Only SigV4 resolves a
token, and it marks one it tolerated for a configured key ignored.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* s3: let the admission-race test pass only through the generation check
The re-check that the change schedules could run after the request was
tracked and abort it, so the test passed without the generation check.
Wait for that pass to take its snapshot before the request starts.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* s3: drop the executable bit from the revocation test file
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* s3: bump the re-check generation before its scope can be taken
scheduleRevalidation released t.mu before bumping the generation. A
pass already kicked could take the new scope in between, before a
request was tracked, and that request then saw the old generation and
was never checked again.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* s3: judge a re-checked request as of when it was admitted
A re-check evaluated aws:CurrentTime and a key's expiration at the time of
the pass, so an unrelated change aborted a transfer whose time-bounded
grant expired after it started. The re-check's copy of the request now
carries its admission time, which RequestConditionValues uses for
aws:CurrentTime and aws:RequestTime, and a key's expiration is compared
with it too.
A test covers a revoked HTTP/2 upload: closing its body releases the
blocked read, and a download on another stream of the same connection
runs to its end.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* stats: let http.ResponseController reach the writer under StatusRecorder
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* s3: reset a revoked HTTP/2 request's stream
A deadline in the past resets only that stream, so a download blocked
writing to a client that stopped reading is released too.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* s3: keep in-flight requests when their key's secret is rotated
A new secret for the same access key is a rotation, not a revocation.
Removing or deactivating the key, or losing the grant, still aborts.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* s3: always abort in-flight requests whose access is revoked
Drop -s3.abortRevokedRequests: the gateway tracks the requests it admits
and re-checks them on every change that can revoke access, so a revoked
client's transfers stop without a restart.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* s3: a catch-up re-check does not advance the revocation generation
A request tracked after an access change scheduled its bucket's re-check
through the same path as the change, which advanced the generation again.
A request that began authenticating before that advance then scheduled
another bucket-wide re-check, so overlapping admissions could keep the
re-check loop busy, holding reloadMu, with no access change.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* volume: vacuum keeps a needle's own unexpired TTL on a volume without TTL
Vacuum measured a needle's expiry against the volume TTL. On a volume
without TTL that is zero, so every needle carrying its own TTL was
dropped by the first vacuum while reads still served it. Fall back to
the needle's own TTL and append time, the rule reads use.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* volume(rs): vacuum applies a needle's own TTL on a volume without TTL
Rust vacuum kept every needle with its own TTL on a volume without TTL,
even long after reads stopped serving it. Use the read path's expiry
rule there, matching the Go vacuum.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* volume: check vacuum against a tally taken while loading the index
The compacted-size check summed its expected bytes inside the loop that
copies, so an entry the traversal never visited was missing from both
sides and the check could not see it. Tally the live entries while
replaying the .idx rows, count every copied, expired and unreadable
needle, and fail when they do not add up to the snapshot. The explicit
accounting also covers volumes with a TTL, so they are checked too.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* volume(rs): check vacuum against a tally taken while loading the index
Mirror the Go change: tally the live entries while replaying the .idx
rows, count every copied, expired and unreadable needle, and fail when
they do not add up to the snapshot, on volumes with a TTL too.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* volume: treat a TTL flag without TTL bytes as no TTL
A record can set the TTL flag and end before the TTL field, leaving
Ttl nil. Checking such a needle's own TTL panicked in reads and, now,
in vacuum on volumes without TTL.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* volume: log each TTL-expired needle vacuum drops
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* volume(rs): log each TTL-expired needle vacuum drops
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* feat(helm): optional volumeAttributesClassName on every PVC
The chart's claims only take storageClass, size and annotations, so
provisioned performance (IOPS/throughput on GKE Hyperdisk, EBS gp3,
Azure Premium v2) can only be set through a custom StorageClass. A
VolumeAttributesClass is the Kubernetes way to do that and can be
changed later without recreating the volume.
Every claim the chart renders now takes an optional
volumeAttributesClassName next to its storageClass: master.data/logs,
filer.data/logs and the deprecated filer.volumeAttributesClassName,
admin.data/logs, volume.dataDirs[]/idx/logs (and volumes.<name>), and
allInOne.data. It is rendered only when set, so default renders are
unchanged.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* helm: quote volumeAttributesClassName so names like 2026 or null stay strings
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* helm: say existing claims need a patch to change their volumeAttributesClassName
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>
* webdav: store a real md5 for each uploaded chunk
Chunks written through the shared gateway uploader had no md5, so the
file ETag was built from empty digests: every overwrite of a multi-chunk
file kept the same ETag (If-None-Match answered 304 for new content) and
single-chunk files had no ETag at all. Ask the uploader for Content-MD5,
as mount and filer.copy already do.
* webdav: quote the ETag it serves
DAV:getetag and the ETag header must be entity-tags. A bare digest never
matches a client's quoted If-None-Match or If-Match in http.ServeContent,
and single-chunk files now carry a digest instead of webdav's quoted
fallback.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* webdav: serve no filer ETag built from chunks without digests
Files written before chunks carried an md5 all hash to the md5 of empty
digests plus their chunk count, so unrelated files with as many chunks
share one tag and a conditional GET can answer 304 for changed content.
Leave the tag to webdav's modtime and size fallback for those.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* webdav: answer a PUT with the ETag of the content it committed
webdav.Handler stats the file before Close uploads the last chunk and
updates the entry, so every PUT answered the empty created entry's tag
and an If-Match with it failed against the stored file. Close now
records the committed entry's tag on the PUT outcome and the response
writer sends it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* webdav: serve no filer ETag for inline content without an md5
filer.ETag hashes only the chunk list, so every inline entry without
Attributes.Md5 gets the empty-list tag. Fall back to webdav's own tag.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* webdav: upload the PUT test's chunk during Close
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* webdav: tag inline content without an md5 by its bytes
The modtime+size ETag webdav derives matches two equal-size contents stored
in one second, so a replace could answer 304. util.Md5 follows the
cluster's digest, which fips140=only keeps off MD5.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* webdav: tag chunks stored without digests by their file ids
The modtime+size ETag webdav derives matches two equal-size files stored
in one second. A rewrite stores new chunks, so their file ids and
placement tell contents apart.
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>
* server: log a response the client hung up on below error level
A client that closes a download early (a video player seeking, a browser
cancel) fails the next response write with a broken pipe, a connection
reset, or an HTTP/2 stream close, and ProcessRangeRequest logged each one
as an ERROR. net/http cancels the request context once a write to the
client fails, so a canceled context now logs at V(3); a failure under a
live request still logs as an error.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* filer: log a stream the client hung up on below error level
The filer logged "failed to stream content" as an ERROR for every
download a client closed early, next to ProcessRangeRequest's own line.
It now goes through the same check, so only a failure under a live
request reaches the error log.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* s3: log a GET the client hung up on below error level
A client closing a download early made GetObject log two ERROR lines,
from streamFromVolumeServers and from GetObjectHandler, and the SSE copy
paths logged a third. The write fails with a broken pipe or connection
reset rather than context.Canceled, so the canceled-stream check missed
it. net/http cancels the request context once a write to the client
fails, so streamCanceled also treats a canceled request as the client
leaving.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* filer: log a canceled chunk read below error level
A ranged S3 GET reads through ChunkReadAt with the request context, so a
client hanging up cancels the chunk fetch and the reader logged
"fetching chunk ...: context canceled" (and, when the lookup was the
step canceled, "operation LookupFileId ... failed") as an ERROR. A read
whose caller canceled it now logs at V(3).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* sts: honor the provider role mapping for web identity roles it names
AssumeRoleWithWebIdentity only checked the role's trust policy, so with
trust policies that allow the provider without claim conditions any
token from that provider could assume any of its roles, including ones
the provider's roleMapping assigns to other claim values. Bearer auth
already uses the mapped roles. A role named by the mapping (a rule or
the default role) is now issued only to tokens the mapping gives that
role; roles the mapping does not name keep the trust-policy-only check.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* sts: trim role mapping targets when checking which roles the mapping names
Bearer auth trims mapped roles, so a padded target still assigns that
role; without the trim the web identity check treated the role as
unnamed and left it to the trust policy alone.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* sts: compare the provider's mapped roles as a list, not a comma-split string
The OIDC provider joins mapped roles with commas, and role names may
contain commas, so splitting the joined attribute could match a piece of
one mapped role against a different role, or miss the mapped role.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* sts: check the session role in the web identity role mapping test
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* mount: merge each run of a sparse file's data, not just the run before its first hole
The chunk stream reader ends at a hole, so the merge stopped there and
replaced every chunk with ones covering only the data before the first
hole. Read and save each contiguous run of visible data on its own, and
leave the holes between runs unwritten.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* filer: skip the small-chunk merge for a sparse file
The merge reads the chunks through the stream reader to its end, which
stops at a hole, and keeps only the chunks before its start offset, so
an append to a sparse file lost the data past the first hole after it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* fips140=only: refuse HMAC keys too short for FIPS mode where they are configured
Under GODEBUG=fips140=only, hmac.New panics on keys shorter than 112 bits
(14 bytes). A short JWT signing key starts fine and then kills weed server
on the first write (the master's Assign mints a volume JWT in an
unrecovered gRPC handler), and an S3 secret of 8 or 9 characters (the
SigV4 signing key is HMAC keyed with "AWS4"+secret) makes every request
from that identity panic in its handler.
Only under crypto/fips140.Enforced():
- security.toml: LoadSecurityConfiguration exits with an error naming the
setting when a jwt.signing / jwt.filer_signing key, read key or
previous key is under 14 bytes. LoadFilerJwtFromFile (filer.sync
-a.security/-b.security) returns the same error, and
Guard.UpdateSigningKeys keeps the keys in effect on a reload that
brings in a short key.
- S3: SigV4 (header, presigned, streaming seed and POST policy) answers
InvalidAccessKeyId, as for an inactive key, when the credential's
secret is under 10 characters, and logs the access key. Loading such a
credential logs a warning; it stays loaded and stored.
- IAM CreateAccessKey (IAM API, embedded IAM, admin UI) requires a
caller-supplied SecretAccessKey of at least 10 characters.
Refs #12839
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fips140=only: check jwt.filer_signing.subscribe.key and the imgproxy key too
The filer verifies metadata subscription tokens with
jwt.filer_signing.subscribe.key and `weed shell fs.meta.token` signs them
with it, so under GODEBUG=fips140=only a short value panics on first use;
LoadSecurityConfiguration now refuses it with the other JWT keys. `weed
image` signs imgproxy URLs with HMAC keyed with IMGPROXY_KEY;
gateway.New refuses a key under 14 bytes in that mode.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* util: warn about JWT keys too short for fips140=only outside that mode
Outside GODEBUG=fips140=only a JWT signing key under 14 bytes works, so
LoadSecurityConfiguration (every weed command but fuse) and
LoadFilerJwtFromFile now log a warning naming the setting instead of saying
nothing: such a key is refused under fips140=only, and a future release may
refuse it in every mode, so the warning asks for a rotation to a longer key
with previous_key while it still works. A short previous_key holds the old
key during that rotation, so its warning only asks to clear it afterwards.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* s3api: refuse a short secret under fips140=only with AccessDenied, not InvalidAccessKeyId
InvalidAccessKeyId says the access key does not exist, so a client refused
for a secret too short for fips140=only went looking for a missing key. The
new ErrFips140SecretTooShort answers AccessDenied (403) with "This access
key cannot be used while the server runs in FIPS 140 mode. Ask the
administrator for a new secret." The message leaves out the length rule:
the refusal comes before the request's signature is checked, so any caller
that knows the access key ID would learn the secret is short. The embedded
IAM API maps it to AccessDenied as well.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* s3api: log an S3 secret too short for fips140=only at error level
Under GODEBUG=fips140=only every request signed with such a key is refused,
so the identity is unusable; the load-time message is an error, not a
warning.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* util, security: name every JWT key too short for fips140=only in one error
CheckFips140SigningKeys stopped at the first short key, so a cluster with
two short keys failed at startup, was fixed, and failed again on the next
one. CheckFips140HmacKeys checks every setting and names each short key
("jwt.signing.key is 10 bytes, jwt.filer_signing.key is 8 bytes; ..."); with
one short key the message is unchanged. Guard reloads use it as well.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fips140=only: say what happened, to what and what to do in the short-key messages
The messages about S3 secrets and JWT keys too short for FIPS 140 now start
from the process's mode, name the key, its owner or file, the limit, and the
fix:
- loading S3 identities: "this process runs with GODEBUG=fips140=only, and
refuses all S3 requests signed with access key ... (identity ...) because
its secret is shorter than the 10 characters FIPS 140 needs for SigV4
secrets; give that access key a new secret of at least 10 characters";
- a refused request logs its request ID, which the client gets back, its
client IP (as the audit log records it, s3err.RemoteIP) and the identity;
- the startup refusal names security.toml's path and every short key, and
links the wiki section on replacing them with or without downtime;
- the startup warning outside fips140=only says the server would not start
in that mode, and links the same section.
A short previous_key no longer gets a warning outside fips140=only: it holds
the old key while switching to a longer one, and under fips140=only the
startup refusal names it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* security: a reload under fips140=only drops short previous keys, not the new keys
UpdateSigningKeys refused the whole key set when a previous key was too short,
so a volume server kept its old keys while the filer's volume signer, which
gets no previous keys, took the new ones; proxied chunk reads then failed with
401. Short current keys still keep the keys in effect. A short previous key is
dropped with an error log instead: nothing under fips140=only can sign with it,
so no token is lost, and every server ends up with the same current keys.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* security: check only the filer keys filer.sync uses in its security files
LoadFilerJwtFromFile checked every JWT setting in a -a.security/-b.security
file, so under fips140=only filer.sync refused to start over a short volume or
previous key it never uses. It now checks jwt.filer_signing.key and its read
key, after the fallback to the process-wide configuration, which startup
checks already.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* s3api: answer a short secret under fips140=only with SignatureDoesNotMatch
A distinct answer before the signature is checked told anyone who knows an
access key ID that its secret is short. The refusal now runs where the
signature would be checked, after the permission, expiry and signed-header
checks, and answers the SignatureDoesNotMatch a wrong signature gets. The
server log keeps the cause, the request ID and the client. This drops
ErrFips140SecretTooShort and its IAM mapping.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* security, filer: keep Basic Auth on a reload whose JWT keys are refused
When a reload under fips140=only refused the new filer JWT keys, the filer
still removed Basic Auth, so a configuration that switches from Basic Auth to
short JWT keys left the filer with neither. UpdateSigningKeys and
ReloadSigningKeys now report whether the new keys are in effect, and the
filer drops Basic Auth only when they are.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* util/http: do not install a volume read key too short for fips140=only
A reload installed jwt.signing.read.key into the read-signing cache without a
length check, so under fips140=only a short key made later chunk reads panic
signing with it. loadJwtConfig now leaves the key in effect when the new one
is too short.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* util/http: keep the volume read key when the volume guard would refuse the reload
Under GODEBUG=fips140=only a volume server's reload keeps its keys when
jwt.signing.key or jwt.signing.read.key is too short. The read-key cache
checked only the read key, so it could sign reads with a key the volume
servers had not taken. It now checks the same two keys.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* util: build the short-key list in one append in CheckFips140HmacKeys
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* s3api: keep the blank line before the permission check in verifyV4Signature
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* s3api: skip TestFIPS140OnlyShortSecret under real fips140=only enforcement
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>
* admin: return compact plugin job detail to read-only sessions
Read-only sessions got the stored parameters, labels, description and
result output of a job, while job listings already leave them out.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* admin: require admin access to read plugin job type config
The stored config holds literal values such as the admin script, so a
read-only session must not read it, the same as it cannot write it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* plugin worker: log only the command name in admin script activities
The activity timeline is readable by read-only sessions, and command
arguments can carry secrets; the full command lines stay in the output.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* admin: keep only the command name in admin script running activities
Activities stored before the worker change, and activities sent by
workers that have not been upgraded, still carry full command lines.
Reduce them when they are loaded and when they arrive.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* admin: redact admin script activities whose report omits the job type
A progress report for a tracked job can leave the job type out; use the
tracked job's type so the command arguments are still dropped.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* admin: keep a test comment on its test
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* admin: require the job-type-less admin script report to be recorded
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* admin: type untracked admin script progress from the pending execution
A progress report that carries neither a job type nor a tracked job id
still belongs to the execution the admin sent under its request id; use
that job type so its admin script activities lose the command arguments.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* admin: redact running executor activities whose job type is unknown
A report that arrives after its execution timed out or was cancelled can
carry only a request id. Its job type cannot be resolved any more, so
treat it like an admin script report and keep only the command name.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* admin: test the plugin config route on a bare handler in its own file
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* admin: match the unredacted admin script message exactly in the test
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* s3tables: read bucket policy from the listing
ListTableBuckets looked up every listed bucket again to read its policy, which is already on the listed entry: one extra filer lookup per bucket.
Co-Authored-By: Claude Opus 5.5 noreply@anthropic.com
* s3tables: cancel the list test helper's context
The handler stops reading the filer listing once a page is full, so a
call made with a context that is never cancelled leaves that stream
open until the connection closes.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* s3tables: drop the list tests' note about master
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com>
* mount: update go-fuse for the export support option
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* mount: optionally retain the paths of forgotten inodes
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* mount: answer lookups of "." and ".." for file handle decoding
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* mount: add -nfsExport to negotiate export support and retain forgotten inodes
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* mount: test file handle lookups of "." and ".."
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* mount: fail a file handle lookup when its path now holds another file
A "." lookup resolved a forgotten inode by its remembered path, so a
file created at that path since was served to the old handle. Compare
the entry's inode with the handle's and answer ESTALE on a mismatch.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* mount: register a file handle's inode under the table lock
A "." lookup checked the file at the remembered path and then registered
it with Lookup, which hands back whatever inode holds the path by then.
LookupHandle takes the reference on the handle's own inode, or enters it
at the path only while no other inode holds it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* mount: keep a forgotten inode's retained path across a rename
A rename whose source inode the kernel had already forgotten left the
retained path at the old name, so its file handle failed with ESTALE.
An index from retained path to inode lets MovePath move it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* mount: register a file handle only at its current retained path
A rename between resolving a forgotten inode's path and registering it
moved the retained entry, yet LookupHandle still entered the old path.
It now compares the path with the retained one under the table lock.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* mount: drop the target a forgotten inode is renamed over
Moving a forgotten inode's retained path onto a live name left the
replaced inode mapped there. Once a retained entry moves, the target is
taken apart as for a live source and reported as replaced.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* mount: test that a renamed path-inode file fails its file handle closed
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* go.mod: use the go-fuse v2.9.5 release
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* volume: check a CRC32C of each chunk upload, in every digest mode
In sha256 digest mode the uploader sends no Content-MD5, so the volume
server and its replicas store a chunk without checking that its bytes
arrived as sent. The uploader now sends X-Seaweed-Content-Crc32c, the
std-base64 of the big-endian CRC32C of the bytes Content-MD5 is checked
against (the file data after undoing Content-Encoding: gzip; the
ciphertext for ciphered chunks), in both digest modes. Uploads that
forward a stored needle (IsReplication) carry only a value the primary
volume server checked.
The Go and Rust volume servers refuse a mismatch or a malformed value
with 400, as they refuse a wrong Content-MD5, and forward the checked
value to replicas, which check it again. A gzipped upload without
Content-MD5 is checksummed while its size is counted, without holding
the uncompressed bytes. Servers that predate the header ignore it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* volume(rs): keep the first part's headers when no part has a filename
Go's parseUpload falls back to the first multipart part with its
Content-Type, Content-MD5 and Content-Encoding. The Rust fallback dropped
them, so a gzipped part without a filename was stored as plain bytes and
its X-Seaweed-Content-Crc32c was checked against the compressed body.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* volume(rs): read the RFC 2231 filename* of a multipart part
Go's uploader names a part with mime.FormatMediaType, which writes
filename*=utf-8''... for a non-ASCII name, and Go's Part.FileName()
decodes it. multer reads only filename, so the Rust volume server missed
the file part and lost its name, gzip encoding and Content-MD5.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* volume: send replicas the CRC32C of a rewritten JPEG
Once the orientation fix rewrites a JPEG, the client's CRC32C no longer
covers the bytes the primary forwards, so the replica got no checksum.
Send the CRC32C of the stored bytes instead, in Go and Rust.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* volume(rs): read filename* only outside quoted parameter values
A quoted name such as "note; filename*=utf-8''decoy" split at its
semicolon and was taken for the part's filename.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* volume(rs): refuse a decoded filename* with control characters
A percent-encoded CR/LF in the name would end the header block of the
part the primary forwards to its replicas.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* volume: read the forwarded CRC32C with the replica response in the test
A failing assertion left the CRC32C in the one-slot channel, so the next
subtest's replica blocked instead of the test reporting the failure.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* volume(rs): use naïve for the non-ASCII filename test data
codespell reads the ASCII part of café as a misspelling of calf.
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>
* mount: create at the filer only where no entry is stored
A create sent to the filer at open time (mknod, and every create under
EagerFilerCreate) went without OExcl, so the filer stored it as an update
of a file another mount had created there: open without O_EXCL emptied
that file and mknod replaced it. Send OExcl, report EEXIST, and drop the
cached listing so the reopen finds the stored entry.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* mount: store an exclusive create at open
A create is deferred to the first flush and checks only this mount's
view, so two mounts could both open the same new name with
O_CREAT|O_EXCL. Send an exclusive create to the filer at open instead,
where OExcl refuses the name another mount already stored. Writeback
keeps deferring: it assumes one writer.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
A bucket-policy Allow skips IsActionAllowed and only asks
IsPrincipalActionExplicitlyDenied for an overriding Deny. That check
validated the session token and its revocation but not the role ID the
session was issued for, so a session kept a bucket policy's grant after
its role was deleted or replaced by a role of the same name.
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Object keys and bucket names are case-sensitive, so a statement naming one
resource must not cover a key that differs only in case. Actions still
match case-insensitively.
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* fix: add -verifyCrc to leave needles with damaged data out of the index
weed fix reads only record headers, so a needle whose data was damaged is
indexed and fails on every read. With -verifyCrc it reads each body and
checks it; a needle that fails is not indexed, an older copy of its key is
not brought back, and fix exits non-zero.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix: read each record to verify it, so a read error fails instead of dropping it
The scan passes a body buffer even when reading it failed, so -verifyCrc
took bytes it never read for damage. Read the record through a handle of
its own, drop it only when its bytes are corrupt, and fail the scan on any
other read error. -verifyCrc needs the local .dat.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix: -verifyCrc rejects a record with a size but no data
A needle with no data is written with size 0, and the CRC covers only the
data, so a record whose data size was zeroed parsed cleanly and skipped
the CRC check. Treat it as corrupt, as the tail repair does.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix: index a needle that fails -verifyCrc as deleted
Leaving it out of the index let loading the volume read the bytes past
the last indexed needle as an interrupted append: the older copy of the
key came back and the damaged record was cut. Handle it like a delete
marker, so with -includeDeleted its tombstone keeps the key deleted and
the loader leaves the .dat alone.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* storage: resume data compaction past an unreadable record
Compacting by data follows record headers through the .dat, so one corrupt
header ended the scan: the compaction failed, or, when the header's size
jumped past the end, every record after it was dropped. Compacting by index
copies past such a record.
When the scan stops on a corrupt header or jumps past live records, resume
it at each live record the index places further on. A read error still
fails the compaction.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* storage: do not copy a record whose header size disagrees with the index
A live record whose header carries a damaged size was copied with that
size, and the compacted volume indexed a needle it could not read. The
index records each live record's size, so a header that disagrees is
damaged: skip it, and let the scan resume at the next live record.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* storage: verify a live record's body instead of comparing its size with the index
Data compaction copied a record whose body failed to parse, and the size
check dropped an intact record when only its index row was wrong. Read the
body only for the record the index points at, drop it on the same errors
-method index drops on, fail on any other read error, and keep the size
the record itself carries.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* storage: resume data compaction at every live record the scan did not reach
The resume started past the last header the scan parsed, so a corrupt size
that landed on a later valid header lost the live records it jumped over.
Track the records the scan copied or dropped, resume at each live record it
did not reach in .dat order, and stop a resumed scan at a record an earlier
pass already handled so nothing is copied twice.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* command: read the compacted volume's version from its super block in tests
Compaction can write a different needle version than the source volume,
so parse the .cpd with the version it records instead of the current one.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* storage: do not walk a run of damaged headers again on every resume
A record whose header id is damaged is not marked as handled, so each
resume at one of a run of such records walked the rest of the run before
reaching a copied record, which is quadratic in the run length. Remember
the offsets resumed scans pass, skip resuming at them, and stop a resume
when it reaches one.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* storage: count the resumed scans' reads in the damaged-run test
The kept keys come out the same when every resume walks the rest of the
run, so bound the reads made through the volume's data backend instead.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* storage: drop a record whose header size runs past the end of the .dat
Reading such a record sized its buffer from the corrupt header: a size
near 2 GiB allocated that much on 64-bit and panicked in makeslice on
32-bit. Check the record end against the file size first and drop the
record as unreadable.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* needle: compute ReadBytes slice bounds in int
NeedleHeaderSize+size was Size arithmetic and wrapped for a damaged size
near MaxInt32, so the slice panicked instead of failing the read.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* needle: fail ReadNeedleBlob for a size that does not fit in an int
On 32-bit a damaged size near MaxInt32 made the buffer length negative
and panicked in makeslice. Return ErrorSizeInvalid instead.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* needle: compare DataSize bounds in uint64
On 32-bit builds int(DataSize) is negative for a damaged DataSize of
0x80000000 or more, which passes the bounds check and panics on the
slice instead of returning ErrorCorrupted.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* s3api: refuse a marker delete on a stored version's physical path
A delete of "<key>.versions/v_<id>/" was answered AccessDenied only when the
version file held neither chunks nor remote data, and since the check for a
file rather than a directory moved to the front, not even then: the delete
reported success. The version-file check now runs first, as it does for the
same key without the slash.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* s3api: test a marker delete on a chunked version file
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* ci: run the S3 suites in every digest mode with both volume servers
The sha256 digest (-filer.digest=sha256) and GODEBUG=fips140=only had no
S3-level CI run, and the Rust volume server none in any digest mode.
s3-digest-matrix.yml builds weed with GOFIPS140=v1.0.0 and weed-volume once,
then runs the basic ceph s3-tests list and the etag and checksum Go suites in
md5, sha256 and fips140only cells, each with the Go and the Rust volume
server and JWT signing on. test/s3/digest_matrix/start_cluster.sh starts a
cell's cluster.
The basic ceph test list moves to test/s3/compatibility/s3tests_basic.txt,
shared with s3tests.yml. The etag suite computes expected ETags with
util.NewMd5For(S3_DIGEST), so it checks each cell's digest; the checksum
suite skips SHA-1 when S3_FIPS140_ONLY=1. Three ceph tests whose answer the
mode changes on purpose are deselected in the cells of that mode.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* ci: run the digest matrix when the protos or the S3 fixtures change
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* test: keep newTrailerChecksumClient's doc comment on its function
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>
* ci: add optional Graphify code-graph workflows
Build a code knowledge graph with the open-source Graphify CLI in code-only mode (tree-sitter, no API key or secret) on a daily schedule, cache graphify-out/ between runs, and upload graph.json.gz, graph.html and GRAPH_REPORT.md as a workflow artifact. Attach the same bundle to published releases.
graph.json is about 150 MiB, above GitHub's 100 MiB file limit, so the graph is not committed; graphify-out/ is ignored.
* ci: keep the Graphify cache bounded and align the release build
- Set GRAPHIFY_NO_BACKUP=1. Hub-named community labels make graphify treat
the graph as curated and snapshot it into graphify-out/<date>/ before every
overwrite, without pruning; the cache would grow by ~100 MiB a day. The
cache path also excludes graphify-out/20*.
- Cluster once on a cold build (extract --no-cluster, then cluster-only), and
label the release graph the same way as the scheduled one instead of
"Community N" placeholders.
- Release builds restore the default branch's cache (restore only) and run an
incremental update instead of a cold extract.
- Add workflow_dispatch with a tag input to graph-release.yml for releases
created with GITHUB_TOKEN, which do not trigger the release event.
- Use actions/cache@v6 and actions/setup-python@v7 like the rest of the
repository; drop setup-uv and the full-history checkout.
- Bundle graph.html only when graphify generated it.
* ci: graph: build from a full extraction on every run
graphify update re-extracts only the files that changed since the
cached build. Go function ids include the file stem, so after a
function moves to another file, callers in unchanged files keep edges
to the old id, and the cache chain never resets that drift. A cold
code-only build takes about five minutes on a hosted runner, so drop
the cache and always extract. GRAPHIFY_NO_BACKUP only mattered for
the cached graphify-out.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* ci: graph: attach the release bundle from a separate write job
graph-release.yml ran graphify and its dependencies with a
contents: write token persisted in the checkout's git config. Build the
release bundle in the read-only graph job and upload it from a job that
only downloads the artifact. The release asset is now the same bundle
as the daily artifact, graph-health.json included.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* ci: graph: do not persist the checkout token
Nothing after the checkout talks to a git remote, so keep the token out
of .git/config where graphify could read it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* ci: graph: keep artifact and asset names valid for any tag
A dispatched tag such as release/v4.0 made an artifact name with a
slash, which upload-artifact rejects. Name the artifact after the
commit again and replace slashes in the release asset name.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* ci: graph: never call an LLM
cluster-only auto-detects a labeling backend from API-key variables and the
claude CLI; locally it picked up the claude CLI. Set GRAPHIFY_BACKEND=none so
the build stays code-only even if a runner image provides one; communities
keep hub-node names.
---------
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>
* util, filer: choose the digest at filer startup with -digest
NewMd5 and NewSha1 returned SHA-256 cut to size whenever the process ran
under GODEBUG=fips140=only, so the kind of digest a cluster stores followed
each process's own environment. They now follow a digest mode set once at
startup: util.SetDigest("md5"|"sha256"), or "" to keep following
fips140.Enforced(). The default is unchanged.
weed filer -digest, weed server -filer.digest and weed mini -filer.digest
set it; fips140=only refuses md5 at startup. The leveldb2/leveldb3
directory-key marker follows the mode, as do the places that compare a
NewMd5 digest with Content-MD5 or pass it on as one: S3 PutObject, filer
HTTP uploads, the Content-MD5 the filer returns, and the uploader's
Content-MD5 to volume servers. Places that verify Content-MD5 with a real
MD5 (volume servers, S3 request bodies and archive uploads) keep keying on
fips140.Enforced(), since they can check it whenever MD5 is available.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* filer, command: report the filer's digest and make its clients use it
GetFilerConfigurationResponse carries the filer's digest mode in a new
field 16, digest. weed s3, mount, webdav, sftp, iam and filer.copy adopt
it before they serve or write, so a gateway started with a different
GODEBUG writes the same kind of ETag and chunk digest as the rest of the
cluster. A process under fips140=only refuses a filer that reports md5. A
filer that reports no digest predates the field; the client then keeps
its own mode and logs a warning.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* filer.sync, s3 sink: keep digests within one kind
filer.sync copies entry digests and ETags as they are, so syncing a filer
with digest sha256 into one with md5 left SHA-256 ETags in the md5
cluster. It now reads both filers' digests and refuses to start when they
differ, with a warning when either filer does not report one.
The S3 sink sent the entry digest as Content-MD5 unless its own process
ran under fips140=only. From a sha256 source into a target that checks
Content-MD5 every single-part upload failed with BadDigest and the backup
retried it forever. It now asks the source filer for its digest once and
forwards the entry digest only when that is md5.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* filer.meta.backup, filer.backup, filer.replicate: keep digests within one kind
filer.meta.backup opened its backup store in its own digest mode, so a copy
of a sha256 filer made by a process outside fips140=only got MD5 directory
keys and could not be opened as that filer's store. It now adopts the source
filer's digest before the store opens.
filer.backup and filer.replicate with a filer sink copied entry digests into
the target filer without comparing digests, as filer.sync did before. Both
now refuse, and exit, when the source and target filers report different
digests. replication.CheckDigestsMatch is the shared check; filer.sync uses
it too.
weed server and weed mini apply -filer.digest before they start the master
and volume server, so every part of the process hashes with one digest.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* filer, filer.sync: refuse a peer filer with another digest; exit on mismatch
Filers peering through the meta aggregator now compare digests. A peer with
a store of its own would replay entries holding the other kind of digest
into this filer's store, so its changes are refused and the reason logged
on every reconnect. A fresh filer bootstrapping from such a peer refuses the
copy, so a new filer whose digest differs from the existing filers' exits at
startup. A peer on the same store writes into it directly, and refusing its
stream would only starve this filer's subscribers, so that mismatch is
logged as an error and the stream kept.
filer.sync exits with status 1 when the two filers use different digests,
as filer.backup and filer.replicate do: it is a configuration error a
restart cannot fix.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* filer: -digest help says a store keeps the digest it was created with
The help text said existing data keeps the digest it was written with,
which reads as if the flag could be changed on a store with data. Stores
that hash keys stop finding existing entries under another digest, so the
text now says to set it when the store is created, and that switching means
copying the metadata into a new store with fs.meta.save and fs.meta.load.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* filer, s3, replication, admin, iceberg: address review of the digest checks
- A filer checks its peers' digests on every start, not only at the fresh-store
bootstrap: the store signature is written when the store opens, so a fresh
filer refused at bootstrap restarted as an initialized store and served
without its peers' files.
- Under digest sha256 with MD5 available (not fips140=only), a client's
Content-MD5 is checked against a separate real MD5 of the body, in S3 object,
part and directory-marker uploads and in filer HTTP uploads. It goes
unchecked only when no MD5 can be computed.
- filer.backup and filer.replicate exit only on a DigestMismatchError; a filer
that cannot be reached is retried, so a backup started before its target is
up resumes once the target answers.
- The admin file browser and Iceberg compaction write chunks into a filer they
do not follow at process level. They read that filer's digest and pass it to
the chunk upload (ChunkedUploadOption.Digest), so their content and chunk
digests match the filer's.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* filer, s3 sink: retire digest-refused peers; no Content-MD5 for an unknown digest
- A peer refused for its digest counts as unreachable: the check now runs
before notePeerReachable and its error wraps errPeerUnreachable, so the
subscribe loop retires the peer from the low watermarks after the usual
grace instead of keeping its zero watermark, which held every aggregated
subscriber at the settled horizon.
- When the source filer's digest cannot be read, the S3 sink no longer sends
the entry digest as Content-MD5: it may be a SHA-256 digest the target
would reject.
- TestCheckPeerDigest skips the cases that need MD5 locally under
GODEBUG=fips140=only.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* iceberg, util: tests for the per-filer digest
The Iceberg tests' fake filer serves GetFilerConfiguration, which uploads now
call to read the target filer's digest; it reports none, as a filer that
predates the setting does. TestNewContentMd5 computes a real MD5, so it skips
under GODEBUG=fips140=only.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* filer: bound each startup peer digest read with a timeout
CheckPeerDigests read each peer's configuration with the caller's context,
which at startup has no deadline, so a peer that accepted the connection but
never answered held the filer's startup. Each read now has its own
peerDigestReadTimeout (10s, inside the one-minute announce cap), after which
the peer is logged and skipped like an unreachable one.
setDigestForTest restores the previous digest setting instead of the default.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* util, s3, filer: one-shot digests for data held in memory
Md5For hashes with md5.Sum or sha256.Sum256 instead of writing into a
hash.Hash, and the Content-MD5 checks of S3 directory markers and of filer
uploads saved inside the filer use BodyMd5Of on the bytes they already hold.
Streaming uploads keep their io.TeeReader.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* filer: hash Content-MD5 on the upload's digest hash, not on its body
teeContentMd5 wrapped the request body in a TeeReader before
uploadRequestToChunks. CodeQL's go/reflected-xss query follows the body
from r.Body through the chunk upload to upload_content.go's
w.Write(prepared.data), which it resolves to the response-writer
wrappers in s3vectors, s3tables, webdav and server/common.go. Those
flows exist on master from other sources (extract, tagging, the
multipart POST); the wrapped body put them through lines this PR
changed, so CodeQL reported six of them as new.
newUploadHash now builds the digest hash that uploadReaderToChunks and
the inline-append paths already tee the body into, and adds the
separate MD5 there; uploadBodyMd5 reads it back for the check. The body
reaches uploadRequestToChunks as on master. Behaviour is unchanged:
under digest sha256 with MD5 available, Content-MD5 is checked against
the body's MD5, including empty and inline appends.
Checked with CodeQL 2.27.6 (go-queries 1.6.16, ReflectedXss.ql) on this
tree: no flow of the nine reflected-XSS results passes a changed line.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* replication: keep the ReadFilerSignature name and return the digest with it
Renaming it to ReadFilerSignatureAndDigest left its other callers with an
undefined function. Keep the name and add the digest to what it returns.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* util: keep HashToInt32 off the digest mode
HashToInt32 names things that processes derive on their own, such as a
mount's local socket path and MQ partition key hashes. weed mount adopts
a -digest=sha256 filer's digest before it names its socket, while
weed shell mount.configure keeps md5 and dialed a different socket.
Follow GODEBUG only, as before the digest setting.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* filer.meta.backup: wait for the source filer's digest instead of exiting
A backup with a saved offset used to start its stream loop and retry
until the source filer answered. Reading the digest first made it exit
when started before the filer. Retry the read; exit only when the
digest is refused.
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>
The test took a single chunk stamped 0 as the sign that a flush merged
the file. Merged chunks now carry the stamp of the oldest data they hold,
so the loop never saw the merge and the test failed before reading.
Take a flush that leaves one chunk where several were stored as the merge.
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* filer: check the read-only rule on the path a POST or PUT writes
A write to an existing directory without a trailing slash stores the
entry under it (the multipart file name, or the base name on PUT), but
the read-only rule was only matched on the request path, so a rule on
the directory's slash-terminated prefix did not apply.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* filer: check the read-only rule on the copy destination entry
Copying into an existing directory stores the entry under it, so match
the read-only rule on that final path rather than only the request path.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* filer: check the read-only rule on the path saveMetaData persists
saveMetaData resolves the target path with its own directory lookup, so
a directory created after the early check could still route the entry
under a read-only prefix.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* filer: record which peers share this filer's store
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* filer: send a delete that misses locally to the write owner
Exclusive and conditional creates are stored on the path's write owner.
With separate filer stores, a delete sent to another filer before it has
replayed the create found nothing, reported success, and left the entry
on the owner, from where it replicated back. Such a delete now goes to
the owner, unless the owner runs on this filer's store. A forwarded
delete is applied only by the filer its own ring names as the owner.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* s3api: delete a directory marker on its write owner
The marker is read on the key's write owner, but the delete went through the
connected filer. When the marker still has children, the filer refuses the
delete and the marker is demoted by a lookup and an update on that same
client. A connected filer that has not caught up with the owner misses the
marker there and reports success, so the owner keeps listing the key.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* s3api: also delete a directory marker on its prior owner
While a ring change is in its cooling-off window, the routed read can find
the marker on the key's prior owner before it reaches the new one. The
delete went only to the new owner, so a nonempty marker was demoted on a
filer that did not have it, and the prior owner kept listing the key.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* s3api: check a directory marker on the prior owner before deleting it there
The prior owner's delete ran unchecked and through the failover walk. When
the new owner held an empty marker and the prior owner already held the
object without the slash, the delete removed that object's data. And when
the prior owner could not be reached, another filer reported the delete
done while the marker stayed on the prior owner.
The prior owner's entry is now read on that filer and judged like the
routed one before anything is deleted, and its delete runs on that filer
only. A prior owner that cannot be read fails the delete for the client to
retry, which lasts at most the ring's cooling-off window.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* s3api: probe a marker's prior owner when its write owner misses
A miss on the write owner returned success before the prior owner was
checked, so an unreachable prior owner that still held the marker left it
in place behind a reported delete. The miss now falls through to the
prior-owner probe, which fails the delete when that filer cannot be read.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* s3api: check the entry a marker delete removes on the filer it runs on
The read that decides the delete can be answered by another filer than
the delete: the owner write walk fails over when the owner's channel does
not come up. Each delete now reads its filer's own entry first and leaves
an entry holding uploaded data alone, as the routed read already does.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* s3api: send no marker delete to a filer that misses the marker
A filer that misses passes the delete on to the key's write owner, which
applies it without the marker checks and may hold uploaded data under the
key. The delete now runs only where the entry was checked; a miss on an
entry the read found fails the delete for the client to retry.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* s3api: leave the object without the slash alone when deleting its marker
A marker delete removed the entry unless it carried chunks or remote data,
so the object "dir" stored inline, or empty and known only by its promotion
mark, went with a delete of "dir/". A plain file or a prefix object holds
the key without the slash, as reads already treat it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* filer: free a closed file's chunks for a download waiting on the budget
A weed mount stopped answering reads for three days. Its goroutine dump:
351 downloads waited in ReaderCacheBudget.reserve, all 31 releases sat in
SingleChunkCacher.destroy waiting for one of them, all 100 reads waited for
one of them as well, and a few goroutines spun in reserve's eviction loop.
The stuck reads filled the 128 FUSE background slots, so every read of the
mount blocked.
Closing a file runs ReaderCache.destroy, which takes the file's chunks out
of the map and then destroys them one at a time. When it reaches a download
waiting for budget first, it waits for that download, and the budget the
download needs can be held by the file's other chunks, which are out of the
map as well:
- Eviction skips a finished chunk that is out of the map. removeUnpinned
refuses it, so reserve puts it back on the idle list and retries at once.
When a stream is positioned in it, remove() does nothing, so reserve only
takes it off the idle list.
- A download that fails is never evictable, and a download destroy()
cancels fails too. remove() does nothing for one that is out of the map,
so its reservation stays until destroy() reaches it.
Since #12616, destroy() cancels the waiting download when nothing reads
it. It does not when a stream is positioned in the download because the
read that started it gave up, for example because its process was killed:
closing a ChunkGroup does not release the streams.
Eviction now destroys a chunk that is out of its file's map instead of
skipping it. Whoever took it out destroys it too, and destroy() is safe to
run twice. A download that fails gives its reservation back at once, also
when it is out of the map.
TestReaderCacheDestroyWhileDownloadWaitsForBudget closes a file while one
of its downloads waits for budget, 30 rounds per case. When the waiting
download is a prefetch nobody read, the test passes on master. When a
stream is positioned in it, it hangs on master, both when the downloads
holding the budget are prefetches the close cancels (the release fixes
this) and when streams are positioned in them too (the eviction fixes
this). TestReaderCacheBudgetStress runs reads (some given up midway),
prefetches, failing downloads and close/reopen on four files that share a
budget of four chunks; it hangs in 10 of 10 -race runs on master.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* filer: do not wait for a dropped download while holding another chunk
A read registers on its new chunk and only then drops the chunk its stream
left (unpin, removeConsumed). When that chunk's download had not finished,
removeConsumed cancelled it and then waited for it in destroy(), still
holding the new chunk. The download could be evicting that very chunk for
budget: reserve falls back to a chunk a stream is positioned in, and
destroying it waits for its reads, this one included. Neither went on.
A dropped chunk whose download has ended is still destroyed at once. One
still downloading, cancelled when it was dropped, is destroyed by a
goroutine once the download gives up, so the read goes on.
TestReaderCacheBudgetStreamsStress moves eight streams between four chunks
under a budget of two and gives up a third of the reads midway. In 20 -race
runs it hangs 4 times on master and 8 times with only the previous commit,
in this cycle; with this change it does not hang.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
weed mini is a single-host sandbox whose other components already
listen on -ip.bind without authentication. Moving the unauthenticated
Admin UI and WebDAV to loopback broke setups that open them from
another machine on a private network. -admin.allowInsecureBind and
-webdav.allowInsecureBind now default to true; set them to false to
keep an unauthenticated Admin or WebDAV on loopback. The Admin worker
gRPC control plane still defaults to loopback.
Claude-Session: https://claude.ai/code/session_011UpvahFvcQGAmXWpPrXZY1
* helm: reload S3 identities with a SIGHUP sidecar instead of restarting
The chart restarts the filer and S3 pods when the content of
existingConfigSecret changes, so every identity change briefly takes S3
down, completely so with a single filer. SeaweedFS reloads the identities
file on SIGHUP.
filer.s3.configReloader and s3.configReloader, off by default, add an
s3-config-reloader sidecar that sends SIGHUP to SeaweedFS when kubelet
updates the mounted file, turn on shareProcessNamespace, and stop
hashing the existing Secret into checksum/s3config. The sidecar uses the
component's image and container security context, so it runs as the same
user as SeaweedFS, and it logs a warning when it cannot signal it.
* helm: address review of the S3 config reloader
- Default the configReloader map to dict, so a release upgraded with
--reuse-values from a chart without it still renders.
- With the reloader and existingConfigSecret, leave checksum/s3config off
the pod, so values of the Secret the chart generates cannot restart it.
- README: the restart comes from the next Helm upgrade, the timing holds
for the kubelet's default settings, and a reload re-creates the KMS
providers, which replaces the in-memory keys of the local provider.
* helm: describe Secret propagation as eventually consistent
Kubernetes gives no bound on when a Secret volume is updated, so the README gives typical delays instead, and says a revoked identity keeps working until then.
* filer: stamp a manifest chunk with the newest chunk it folds
mergeIntoManifest saved the manifest with tsNs 0, so manifest chunks
carried no modification time. Give it the newest ModifiedTsNs of the
chunks it holds.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* mount: stamp merged chunks with the newest chunk they replace
maybeMergeChunks uploaded the rewritten chunks with tsNs 0, so any
older chunk that overlaps them later, like a covered chunk sent with the
commit, outranked the merge. Give them the newest ModifiedTsNs of the
chunks they replace.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* mount: stamp a merged chunk with the oldest data it holds
The newest stamp of the whole merge outranked a peer's pending write
that is newer than the bytes the merge carries for its range but older
than the newest of them. Stamp each merged chunk with the oldest visible
data in its range, or 0 over a hole, so such a write still shows while
chunks older than all of its data lose to it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* mount: find a merged chunk's range by binary search
Each uploaded chunk scanned the visible intervals from the front.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* filer: ask the master for log chunks the volume map lacks
loadLogFileEntries reads the log chunks that SubscribeMetadata and
SubscribeLocalMetadata replay from the persisted log, and it looked each
chunk's volume up only in the filer's cached volume map. A volume missing
there fails with "volume N not found", which isChunkNotFoundError takes
for a deleted volume, so the replay skips the rest of the log file. Once
the same pass reads a later entry from a file whose volume the map does
hold, for any path, the subscriber's position moves past the skipped
file, and filer.sync, filer.backup, filer.meta.tail or an S3 gateway
never receive its events.
A live volume is missing from the map in two cases:
- A starting filer serves subscriptions once its gRPC port is up, but
gets its volume map only when it registers with the master, and
AnnounceOnceCaughtUp holds that until the peers found at startup have
caught up (at most a minute). Until then the map holds only volumes
the filer has looked up through the master for other reads.
- A failed chunk read sets the volume's cached locations aside and looks
the volume up again, which a cache-only lookup answers with "not
found", as #11964 found for NewChunkStreamReaderFromFiler.
Use GetLookupFileIdFunction, which asks the master on a miss, like the
streaming reader since #11964 and the replay's other lookups.
Asking the master adds one more way to fail: no answer, when the master
cannot be reached before the client's retries run out. That error still
reads "volume N not found", since no locations are known, but it says
nothing about the volume, and skipping would lose the file's events for
good. wdclient now marks it with ErrLookupUnanswered, and
isChunkNotFoundError does not count a marked error as not found: the
replay returns it, and the subscriber resumes from there once the master
answers. A volume the master says does not exist is still skipped.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* filer: trim the replay lookup 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>
A sidecar in the filer or S3 pod cannot signal SeaweedFS, because every
container has its own process namespace and the chart has no setting to
share it. One use is reloading the S3 identities file with SIGHUP from a
sidecar that watches the mounted Secret.
filer.shareProcessNamespace and s3.shareProcessNamespace, off by default,
render shareProcessNamespace: true in the filer StatefulSet and the S3
Deployment.
* remote/s3: WEED_REMOTE_S3_CREDENTIALS=workload, the workload's identity only
A remote of type s3 with no access key and no secret takes its credentials
from the SDK default chain, which looks at AWS_ACCESS_KEY_ID and
AWS_SECRET_ACCESS_KEY first. A SeaweedFS process often holds keys of its own
there: `weed mini` and `weed server -s3` read their initial S3 identity from
those variables. On EC2, a remote mounted on an Amazon S3 bucket with the
instance's role (no keys) therefore signs with the server's local identity,
and every call answers InvalidAccessKeyId, while a filer.remote.sync of the
same remote, started without those variables, works with the role.
WEED_REMOTE_S3_CREDENTIALS=workload makes such a remote take the AWS
workload's identity alone: web identity when AWS_WEB_IDENTITY_TOKEN_FILE and
AWS_ROLE_ARN name one (EKS IRSA), then the ECS/EKS container credentials
endpoint or the EC2 instance metadata service, on an unguarded HTTP client as
the default-chain path already does. Environment keys and shared credentials
files are never read. Unset, nothing changes. Keys in the configuration win;
half a key pair and an unknown value are refused; other S3-compatible types
are not affected. The volume server's client cache key includes the variables
that choose the source.
* remote/s3: a configured web identity has no instance-role fallback
With AWS_WEB_IDENTITY_TOKEN_FILE and AWS_ROLE_ARN both set, a failed token
read or role exchange fell through the chain to the container endpoint or
IMDS, so requests were signed with the node's role.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* remote/s3: the workload credential session reads no shared files
SharedConfigDisable still loads the shared credentials file, so a selected
AWS_PROFILE whose role_arn lives there failed every workload client build.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* remote/s3: exchange the web identity in the workload's region
The credential session took the bucket's region, so with regional STS a pod
whose only reachable STS endpoint is its own region could not sign for a
bucket in another one. AWS_REGION/AWS_DEFAULT_REGION win; the bucket's
region remains the fallback.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* volume: a container authorization token change rebuilds the guarded client
The container credential provider captures AWS_CONTAINER_AUTHORIZATION_TOKEN
and its _FILE path when it is built.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* remote/s3: the workload's web identity uses the regional STS endpoint
SDK v1 still defaults to the legacy global endpoint for most regions, so a
pod that reaches only its regional STS endpoint got no credentials. An
explicit AWS_STS_REGIONAL_ENDPOINTS keeps its say.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* volume: a workload region or STS endpoint mode change rebuilds the guarded client
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* remote/s3: a workload-mode storage session reads no shared files either
A selected profile the SDK rejects still failed the storage session even
though it carries the workload's credentials.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* volume: hash AWS_ROLE_SESSION_NAME into the guarded credentials version
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* volume: an IMDS endpoint or mode change rebuilds the guarded client
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* volume: a keyed s3 remote's guarded version follows the credentials mode too
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* volume: hash every AWS_* variable into a default-chain remote's guarded version
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>
s3api: validate ACL grant Permission
Reject a grant whose Permission is missing or not one of the five S3
values with a new MalformedACLError, and skip grants without a
permission when building GetAcl responses instead of panicking.
Co-Authored-By: Claude Opus 5.5 noreply@anthropic.com
* mount: add -idmap to allow ID-mapped bind mounts
FUSE allows ID-mapped mounts only for a server that announces FUSE_ALLOW_IDMAP.
Once announced, the kernel sends uid and gid 0xFFFFFFFF on most requests after checking permissions itself, so the checks that read the caller treat that value as already checked.
* fuse: refuse an unsupported -o idmap before starting the child
The child exits on checkIdmap, but the parent waits for its readiness signal
and never returns, so weed fuse -o idmap hung on macOS and FreeBSD.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* mount: refuse -idmap on Windows instead of ignoring it
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fuse: take -o defaultPermissions as the mount flag
-o defaultPermissions=false was forwarded to the kernel as an unknown
option, which failed the mount, and left the flag at true, so
-o idmap,defaultPermissions=false passed the idmap check.
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>
* s3api: create a recovered PUT's missing directory
The filer stores a new entry before its parent directories, and a parent
that fails to insert leaves the entry stored with an error returned. Both
PUT recoveries then find the stored entry and answer success, so the object
reads by key but no listing shows it, and an overwrite takes the filer's
existing-entry branch, which creates no parents either.
Before claiming the stored entry, create its directory when it is missing,
and answer an error when that fails.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* s3api: create a committed completion's missing directory
A CompleteMultipartUpload whose commit stored the object but failed on its
parent directory answered success through the committed-despite branch, and
a retry that finds the committed object answered success the same way.
Both now create the object's directory first and fail while it cannot be
created; the upload directory is kept, so the retry can finish the job.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* s3api: test recoveries that create the stored object's directory
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* s3api: check every directory level when repairing an object's parent
A repair mkdir stores the directory it creates before that directory's own
parents, so a failure there can leave a lower level stored without its
parent, and a retry that saw the lower level answered success. Walk from the
bucket down and create each missing level. A file left by a failed
prefix-object promotion is not a directory a listing descends, so it fails
the repair rather than passing as an existing directory.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* s3api: free unused parts when a completion's directory repair fails
The early return skipped the cleanup of parts the committed object does not
use, and the retry that finds the commit removes the remaining entries
metadata-only, so the unused parts' data leaked. Run that cleanup and keep
only the upload directory for the retry.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* s3api: test the per-level parent repair and the failed repair's cleanup
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* s3api: bound the parent repair with the recovery's lookup budget
The repair's filer calls ran on a background context, so a filer that
stopped answering held the object write lock without a deadline. The PUT
recoveries pass their lookup context, and the completion gives the repair
the same createLookupTimeout.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* s3api: fail the parent repair when the bucket directory is missing
The filer creates missing ancestors for a directory create, so walking
down from an absent bucket directory would recreate a bucket deleted
during the write as a plain directory.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* master: include the cluster UUID in TopologyInfo
VolumeList now returns the topology's persisted UUID alongside the
topology tree, so clients can show which cluster they are looking at.
Claude-Session: https://claude.ai/code/session_011UpvahFvcQGAmXWpPrXZY1
* shell: show the cluster UUID as the cluster.status id
The id line printed the topology root's fixed name, topo, which is the
same on every cluster. Print the cluster's persisted UUID instead, and
fall back to the old value for masters that do not report it.
Claude-Session: https://claude.ai/code/session_011UpvahFvcQGAmXWpPrXZY1
* s3_objectlock: read each listing page before scanning its subdirectories
The scan listed a subdirectory while the parent listing was still open.
On a store with one connection, such as SQLite, a parent page that
filled its stream window kept the connection the child listing needed.
Pages now skip chunk lists, since only the lock metadata is read.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* s3_objectlock: scan names that contain a backslash
With backslashes allowed in object keys, a key such as a\b is stored
under that name. The scan skipped it, and every key below such a
prefix, as if the name were a path separator.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* s3_objectlock: scan keys below a .uploads prefix
The scan skipped every directory named .uploads, so an object stored
below a key prefix such as a/.uploads/ was never checked. It now skips
only the directories of pending multipart uploads, whose lock settings
belong to an object that does not exist yet.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* s3_objectlock: keep only what the scan reads in a buffered page
A page now stays in memory while its subdirectories are scanned, and a
listing still carries the contents of files stored inline in the
filer. A page keeps only each entry's name, directory flag and extended
attributes.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* s3_objectlock: scan objects stored below a pending upload directory
A key such as .uploads/<upload id>/c is an ordinary object, and the
scan skipped it along with the upload directory it sits in. The scan
now descends into upload directories and ignores only the lock
settings an upload directory holds for its future object.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* s3_objectlock: exempt upload directories only while under .uploads
A renamed upload directory keeps its multipart key, so outside .uploads it
is checked like any other directory marker.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* mount: publish an unpublished create's writeback drain after a peer rename onto its name
With -writebackCache, the drain flushes metadata only while the saved path
still maps to the handle's inode. Another mount renaming its file onto the
name of a file this mount created and has not published moves that path to
the peer's inode, so the drain skipped the flush and dropped the writes
without an error or a failed-metadata record.
A local rename or unlink of a draining handle waits for the drain or marks
it, so for an unpublished create a lost mapping means another mount's file
took the name. Skip the guard for it: the create-if-not-exists commit then
keeps a recovery record when the name is taken and publishes when it is free.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* test(fuse_dlm): accept only EEXIST on O_EXCL as an early second-create refusal
The concurrent create test returned early on any error from the second open,
so an EIO, or an open failure in the O_TRUNC case, passed without writing
either payload.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* mount: refuse publishing an unpublished create after a peer renames onto its name
Another mount's rename onto the name of a file this mount created but has
not published takes that name. The create used to publish there later with
create-if-not-exists as soon as the name was free again: after a local unlink
of what the name showed, it reappeared, and after a move of its directory it
landed under a path no longer reachable. markHandleReplaced now records that
the name was taken, and the publication check refuses the handle from then
on: a writeback drain keeps a recovery record and default mode fails close.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* webdav: refuse to delete entries under Object Lock or WORM
DELETE removed versions under legal hold or retention and WORM files that
the S3 API and the filer HTTP API refuse to delete. Check the entry, and
for a collection everything below it, then pin the delete to the Object
Lock state that was checked.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* webdav: refuse to move entries under Object Lock or WORM
MOVE could rename a locked version or WORM file away, move a directory
holding them, or replace a protected target. Check the source, a source
directory's contents and the target before the rename.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* webdav: refuse to overwrite entries under Object Lock or WORM
PUT and COPY replaced a locked or WORM file with a fresh entry, dropping
its content and its lock. Check an existing file before creating over it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* webdav: pin an upload's final update to the Object Lock state it read
An upload writes the whole entry back when it closes. A hold or retention
set on the new object while the upload was buffering would be dropped, so
the filer now refuses the update if that state changed.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* webdav: recheck an upload's target when it commits instead of pinning it
The precondition on the final update sent it to the path's write owner,
while the placeholder create stayed on the connected filer. With
separate filer stores the owner could miss the placeholder and refuse
the update, leaving an empty file. The upload now rechecks the target
right before the update, as the SFTP upload does, and the update stays
local.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* filer: share the WORM retention and subtree checks
FilerConf.WormEnforced and IntersectsWorm replace the copies in the filer
server and mount; ReadFilerConfFromClient reads filer.conf over a filer client.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* sftp, webdav: use the shared Object Lock and WORM helpers
Both servers now call FilerConf.WormEnforced, IntersectsWorm,
ReadFilerConfFromClient and s3_objectlock.ObjectLockState instead of
keeping their own copies.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* s3tables: let DirHoldsFiles count only files older than a cutoff
A non-zero cutoff skips files created at or after it, and Iceberg metadata
files directly under the walked directory's metadata/ folder, which a create
stages before its record exists. Existing callers pass the zero time and
keep counting every file.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* s3tables: keep files a deleted table or view did not write
DeleteTable purged the table's directory (or its decoupled data location)
recursively, and DeleteView purged the view's directory, so files that
were already there when the record was created, or that were written under
a view, went with it. Those files now stay: the record's attributes are
cleared and the directory is left as a leftover. A table still purges the
files it wrote after its create, and its staged metadata.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* iceberg: skip the drop purge of a location holding older files
DropTable and DropView purge the dropped entry's location after the
catalog delete. A location that holds files older than the table, or any
file other than metadata for a view, is left alone, matching DeleteTable
and DeleteView.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* s3tables: count a file from the record's own second as older
File creation times have second granularity, so an upload made in the
same second as the table's create compared equal and was purged. An
equal second now counts as older, and the view cutoff no longer needs the
extra second.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* s3tables: count S3 objects stored on directories in DirHoldsFiles
A trailing-slash key, or a file promoted to a directory by a child write,
is an S3 object on a directory entry. The walk only counted plain files,
so a delete purged such objects, including one on the purged path itself.
They now count like files.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* s3tables: keep every non-metadata file under a deleted view
A view writes nothing but its metadata files, so a file under it counts
whatever its creation time, including one stamped ahead of this clock.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* s3tables: count a file from the record's own second as the record's
File times are whole seconds, and a writer's first file (an insert right
after a create, or a CTAS writing in the second it staged) often shares
the record's second. Counting it as older kept the table's own files on
drop, so a re-create at the location found it non-empty.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* iceberg: date a staged create's table from its stage
The engine writes a staged create's first files before the commit
registers the table, so they predate its record and a drop kept them.
The commit now passes the time the stage marker recorded, in process
only, and the table's CreatedAt starts there.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* s3tables: say a view name holds plain files instead of a table
A view deleted over files it did not write leaves its directory without
a catalog record. CreateView reported that directory as a table.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* s3tables: keep a view location's metadata files older than the view
A view writes its metadata only after its record, so a metadata file from
an earlier second at the location is not the view's and keeps the
directory on a drop, like any other file.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* iceberg: test that a view drop keeps older metadata at its location
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* iceberg: date both view drop test files from one record time
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* iceberg: drop only the table or view record the lookup read
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* iceberg: test a drop whose record is replaced after the lookup
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* iceberg: check the location claim again after the drop scan
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* iceberg: test a location claimed while the drop scans it
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* s3api: recheck existing-object tag conditions on PutObject overwrites
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* s3api: recheck existing-object tag conditions on POST Object overwrites
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* s3api: recheck existing-object tag conditions on CompleteMultipartUpload
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* s3api: recheck existing-object tag conditions on the CopyObject destination
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* s3api: test tag-conditioned PutObject Deny on overwrites
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* s3api: evaluate the copy destination policy before bucket default encryption headers
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* s3api: recheck the self-copy snapshot's tags before committing it
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* s3api: recheck multipart completion tags only when it commits a new object
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* s3api: recheck zip extraction members instead of the archive key
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* s3api: load the bucket before PutObject's policy checks
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* s3api: test the tag-conditioned PutObject Deny on a cold bucket
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* s3api: complete a real multipart upload in the overwrite tag-policy test
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* s3api: recheck the entry a trailing-slash multipart key completes onto
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* s3api: test the tag recheck for a multipart key ending in a slash
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* s3api: recheck the copy destination's tags under the write lock before commit
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* s3api: test a copy over a destination tagged while the copy ran
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* s3tables: load bucket tags for bucket-level policy checks
GetTableBucket, ListTableBuckets, DeleteTableBucket, Get/DeleteTableBucketPolicy
and the bucket maintenance operations built their policy context without the
bucket's tags, so aws:ResourceTag and s3tables:TableBucketTag conditions in the
bucket policy never matched there.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* s3tables: evaluate aws:ResourceTag against the bucket on bucket-scoped checks
Namespace operations, ListTables, CreateTable, table rename targets, CreateView,
ListViews and absent-target checks authorize against the bucket ARN but left
ResourceTags empty, so an aws:ResourceTag Deny in the bucket policy never
matched. Table and view targets keep their own (or no) tags.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* s3tables: test aws:ResourceTag Deny on bucket-scoped operations
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* s3tables: pass CreateTableBucket's tags to IAM policy conditions
The IAM authorization path built its request context without the requested
tags, so a role or user policy conditioned on aws:RequestTag or aws:TagKeys
never matched CreateTableBucket.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* s3tables: test aws:RequestTag on the IAM authorization path
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* s3tables: pass request tags as scalars so policy variables expand
expandPolicyVariables substitutes only scalar values, so a slice left
${aws:RequestTag/<key>} unexpanded and a matching Allow failed.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* s3tables: read a listed bucket's policy and tags from one lookup
The tags came from the listing while the policy was read afresh, so a
policy could be judged against tags from an older version of the bucket.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* s3tables: recheck the bucket tags when deleting the bucket policy
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* s3tables: test a tag change between policy deletion's check and its write
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* vector: restrict indexed-only searches to shared index coverage
* vector: expose indexed-only queries through a compatible backend RPC
* s3vectors: accept signed indexed-only search requests
* s3vectors: document indexed-only queries and exercise SDK signing
* vector: expose restricted ANN execution for enterprise ownership
* vector: score unscored hits within the query scope
* s3vectors: verify search mode in the SigV4 authenticator
* s3vectors: resolve table descriptors for indexed-only queries
* vector: recover short results within a fragment restriction
* vector: avoid a fragment prefilter for fully indexed unfiltered queries
* docs: remove the boto3 signing hook after query errors
* vector: recover short indexed-only results with full coverage
* webdav: optional HTTP Basic Auth from [webdav.basic_auth]
WebDAV reaches the filer over gRPC, so neither the filer JWT nor the
filer's Basic Auth covers it, and it had no authentication of its own.
With a password set in [webdav.basic_auth], every request needs it.
Without one, startup warns when the gateway listens beyond loopback.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* mini: bind WebDAV to loopback unless Basic Auth is set
weed mini starts WebDAV by default on -ip.bind, which is 0.0.0.0, so
anyone on the network could read, write and delete all bucket data even
with S3 IAM on. Without [webdav.basic_auth], bind it to 127.0.0.1, as is
done for the unauthenticated Admin UI. -webdav.allowInsecureBind keeps
the network bind.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* command: treat a bracketed IPv6 loopback as loopback
-ip.bind='[::1]' failed net.ParseIP, so mini moved an unauthenticated
WebDAV or Admin listener off it to 127.0.0.1.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* security.toml: note TLS for WebDAV Basic Auth
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* sftp: refuse to delete entries under Object Lock or WORM
rm and rmdir sent DeleteEntry with no protection check, so an SFTP user
could delete versions under legal hold or retention, and filer.conf WORM
files, that the S3 API and the filer HTTP API refuse to delete. Check the
entry first and pin the delete to the Object Lock state that was checked.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* sftp: refuse to rename entries under Object Lock or WORM
A rename moved a protected version out of its .versions folder, or
replaced a protected target, which the delete check alone does not stop.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* sftp: refuse to overwrite or setstat entries under Object Lock or WORM
An upload over an existing protected entry replaced its content, and a
setstat could truncate it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* sftp: let a rename onto itself succeed for a protected entry
The filer treats it as a no-op, so there is nothing to protect.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* sftp: read WORM rules from a filer.conf stored in chunks
ReadFilerConf without a master client reads only inline content, so a
chunked filer.conf looked empty and WORM went unenforced.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* sftp: pin setstat to the Object Lock state it checked
The update writes back the entry it read, so a hold set in between
would be dropped. The filer now refuses the update instead.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* sftp: recheck an upload's target when it commits, and refuse directories
The upload buffers until Close, so a hold set while it was open still
let it overwrite the entry. A PUT to a directory path also lands on a
child of that directory, whose protection was never checked.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* sftp: refuse to rename a directory that holds protected entries
A directory rename moves every descendant, so checking the directory
alone let it carry locked versions away from their keys, or WORM files
out from under their rule. Refuse when a WORM rule covers the subtree,
as the filer does for scoped tokens, or when an object in it is under
Object Lock.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* s3_objectlock: scan a literal .versions directory recursively
A directory named exactly .versions was listed as flat version files, so a
locked object nested below it was missed by the subtree and bucket scans.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* mount: decide chown's set-id clearing by the caller, keep it on directories
SetAttr read input.Uid as the caller, but in SetAttrIn that field is the new
owner; the caller is input.Caller.Uid. Root giving a file away cleared its
SUID/SGID bits, a user giving a file to root kept them, and every chown to a
non-root owner cleared the SGID bit of a directory, which Linux keeps so new
entries go on inheriting the group.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* mount: let Linux decide chown's set-id clearing
The mount does not handle killpriv, so Linux sends the cleared mode with a
chown that must drop the set-id bits. Clearing them again by caller dropped
the SGID bit Linux keeps on a file without group execute when a user changes
only its group. Other systems keep the caller rule.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
PageWriter.ReadDirtyDataAt walks the requested range one chunk at a
time but overwrote maxStop with each chunk's result. When an earlier
chunk had dirty data and a later chunk in the same read was clean, the
clean chunk's 0 replaced the earlier stop, so the caller under-reported
how much of the buffer the dirty pages filled.
Take the maximum across chunks instead.
Fixes#12946
A file created on a mount is published to the filer at flush; until then its
handle is dirty and has no base. When another mount creates the same name and
its event arrives first, invalidateOpenFileHandle skips the branch that keeps
a dirty handle's writes, because that branch needs a base. It falls through,
destroys the handle's dirty pages and installs the other mount's entry as the
base. The flush then has nothing to publish, and close() returns 0 although
the writes are gone. A delete or rename of the name by another mount marks the
handle deleted or moves it, with the same result, and a rename onto the name
has onEntryInvalidation mark it deleted.
The filer holds nothing of such a file, so an event at its name is about
another file. Leave the handle alone. Its create-if-not-exists commit then
reports a taken name as a conflict (close() fails with EIO, or with
-writebackCache the request is kept in failed-metadata), and publishes as
usual when the name is free.
Part of #12941.
* filer: retry a chunk delete that a replica in maintenance mode refused
The filer sends BatchDelete to every replica on its own, and BatchDelete does
not replicate. A volume server in maintenance mode refuses it with "volume
server X is in maintenance mode", which the deletion pipeline took for a
permanent error, so the delete was dropped while the other replicas had
already applied it. That replica then kept the needle live for good, which
breaks EC encode ("no union") until volume.check.disk -syncDeleted repairs it.
Maintenance mode is what a rolling upgrade puts each volume server into, so
every filer delete in that window was lost on one replica.
Treat the maintenance-mode refusal as retryable. The retry runs after the
server leaves maintenance mode; the replicas that already deleted the needle
answer it as not modified.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* seaweed-volume: refuse in maintenance mode with Unknown, as the Go server does
The Go server refuses with a plain error, which arrives as Unknown. The
Rust server sent Unavailable with no details, which Go clients take for
a dead channel: each refused BatchDelete closed the filer's shared
connection to the server and cancelled the other RPCs on it. The message
is unchanged, so the filer still retries the refused delete.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* ec: stop describing a Rust maintenance refusal as Unavailable
Both volume servers now refuse in maintenance mode with Unknown, so the
orphan sweep's Ping disambiguation comments no longer name Rust.
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>
* filer: assignment tokens and chunk proofs for scoped writes
* filer: tighten scoped chunk identities and write boundaries
* filer: apply gRPC key removal on config reload
* filer: prevent scoped chunk alias and remote append data loss
* filer: guard scoped writes across stored data representations
* filer: preserve lazy scoped admission lookups
* filer: avoid summing chunk counts for map capacity
* filer: keep a scoped assign in its path's collection
A scoped token could name another bucket's collection in AssignVolume and
upload chunks there, charging that bucket's quota and losing them when that
collection is deleted. A scoped caller now gets the collection its path
resolves to; naming a different one is refused before the master call.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* filer: rotate gRPC keys and bind chunk proofs to collections
---------
Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* filer: keep chunk coverage when timestamps tie in readResolvedChunks
When an overlapping chunk started with the same ModifiedTsNs as the
currently visible one, it was never inserted into the sweep queue, and
an END point removed whichever queued chunk had a matching ts rather
than the chunk that actually ended. Either way part of the file was
dropped from the visible intervals, and SeparateGarbageChunks could then
treat the still-live chunk as garbage.
Insert tied starts ahead of the existing tail so the visible chunk keeps
winning, and remove the queued entry for the chunk that is ending.
Fixes#12934
* filer: break readResolvedChunks timestamp ties by chunk order
On a tie the sweep let the chunk that started first keep the overlap, while
MergeIntoVisibles, which a section uses when a chunk is added after its
first read, lets the later chunk win. A later write that got the same
timestamp lost its overlap, and the two paths disagreed on which chunk's
bytes a read returns and which chunk is garbage. Ties now go to the later
chunk in the list, which also makes the order total.
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>
* build(deps): bump golang.org/x/term from 0.47.0 to 0.48.0
Bumps [golang.org/x/term](https://github.com/golang/term) from 0.47.0 to 0.48.0.
- [Commits](https://github.com/golang/term/compare/v0.47.0...v0.48.0)
---
updated-dependencies:
- dependency-name: golang.org/x/term
dependency-version: 0.48.0
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
* telemetry: tidy go.mod for golang.org/x/sys v0.50.0
The x/term bump raises x/sys in the root module, which telemetry/server
replaces, so its build failed with "updates to go.mod needed".
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* mount: refuse RENAME_EXCHANGE instead of renaming over the target
renameat2(a, b, RENAME_EXCHANGE) asks for the two names to be swapped
atomically. Rename let the flag through and went on as a plain rename, so
a was moved over b, b's content was gone, and the call reported success.
The filer's rename moves one entry and cannot swap two, so the mount now
answers EINVAL, which is what renameat2(2) returns for a flag the file
system does not support, and callers fall back on it.
RenameWhiteout was 3, which is RENAME_NOREPLACE|RENAME_EXCHANGE; the flag
is 1<<2. Both values, and any other flag the mount does not implement,
now get the same EINVAL (3 answered ENOTSUP, 4 already EINVAL).
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
* mount: trim the rename flag comments
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: MapleWhiteZZZ <18653045+MapleWhiteZZZ@users.noreply.github.com>
Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>
Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com>
The mount replaced every invalid UTF-8 run in a name with "_" so the name
could go into proto string fields. That mapped different names to one entry:
two legacy-encoded names shared one file, a write or unlink through an
invalid name hit an existing file with "_" in its place, and O_EXCL failed
with EEXIST for a name that did not exist.
Making such a name (create, mknod, mkdir, symlink, link, rename target) now
fails with EILSEQ, and looking one up or removing it answers ENOENT, before
anything is sent to the filer. Entries stored earlier under a rewritten name
stay reachable by that name.
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* mount: read SSE-S3 objects through an authenticated S3 gateway
* mount: check each comma-joined mount option against -sseS3ReadEndpoint
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* mount: read a mounted version file by its object key and version id
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* mount: read a current null-version object without s3:GetObjectVersion
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* mount: declare -sseS3ReadEndpoint with the other mount options so weed fuse accepts it
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* mount: require the canonical bucket path as the root of an SSE-S3 read mount
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* mount: fall back to the null version when the current object is another version
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* master: list the S3 endpoint each S3 gateway advertises
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* s3: advertise the gateway's S3 endpoint to the master
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* mount: find the S3 gateway through the masters instead of -sseS3ReadEndpoint
-sseS3Read turns gateway reads on. The reader lists the S3 endpoints the
filer's masters have registered, prefers HTTPS, and picks another gateway
when the current one cannot be reached.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* mount: retry an unreachable S3 gateway read on a different gateway
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* mount: warn when -sseS3Read falls back to a plain-HTTP gateway
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* mount: do not retry an unreachable HTTPS gateway over plain HTTP
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* mount: tell HTTPS gateways apart by the parsed URL scheme
An S3 gateway advertised as HTTPS://host lost the HTTPS preference and
the plain-HTTP fallback guard, since the check matched the raw string.
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>
* filer: run an entry update again when a rename or delete of it commits meanwhile
UpdateEntry reads the entry, checks its preconditions against it, then
writes. The path lock keeps the two together only against writers of that
path on that filer. A rename or a delete sent to another filer does not
take it, and on any filer a rename or recursive delete of a directory above
the entry moves and removes what is below it unlocked. One that committed
between the read and the write had the write store the entry again at the
path it had left, and the update returned success: the entry back under a
directory that is gone, two names sharing chunks, or a file back after its
unlink returned.
Where the store refuses a conflicting commit, the read, the checks and the
write now run in one store transaction. The rename or delete wrote the
entry's key after it began, so the commit is refused with
ErrTransactionConflict and the update runs again, up to five times with
the rename's back-off, and answers from what is there now.
- filer.ConflictRefusingStore is how a store says so. TiKV does. Other
stores, and entries in a path-specific store, run once without a
transaction, as before.
- A refused run gives up its commit stamp and deletes the manifest chunks
it folded the request's chunks into.
- Chunk deletion and the metadata event come after the commit, in the
order they had.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
* filer: commit what an update's lookup removed, give up a failed run's manifests
From the review of 156a0078c.
FindEntry removes an expired entry and, for an expired S3 object, tells the
subscribers. Inside the update's transaction a NotFound rolled that removal
back while the event stayed, and the next lookup announced it again. What
the read answers the update with (the entry is not there, a precondition
does not hold) is now the run's result and not its failure: the run commits
whatever the lookup removed and UpdateEntry returns the answer. Only an
error of the write itself rolls back.
A run that fails after cleanupChunks folded the request's chunks into
manifests is rolled back, so nothing refers to them: it now gives them up
the way a run with a refused commit does. The cleanup tolerates a run that
got no further than its lookup.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
* filer: leave an expired S3 object to a lookup outside a transaction
FindEntry's removal of an expired S3 object deletes a remote copy and
publishes a delete event at once. Inside a store transaction a refused
commit restores the entry but not those, so subscribers could keep a
delete for a path that still holds an entry. A lookup in a transaction
now only answers NotFound and leaves the removal to one outside it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* filer: guard update retries and retain expired rename targets
Reject retries when the originally observed entry changes, so stale requests cannot restore chunks already deleted by a concurrent writer. Keep expired S3 overwrite targets visible to rename cleanup, and defer overwritten remote-object deletion until commit succeeds. Add regression coverage for concurrent updates and renames, both rename RPCs, remote data, and rollback.
* filer: extend conflict-checked entry updates to FoundationDB
Specify the optional capability in terms of entry/KV read-modify-write conflicts, without promising atomic bulk operations or blind-write conflicts. Opt FoundationDB into the update transaction path and normalize only known uncommitted conflicts. Add routing, error-classification, and live FoundationDB entry/KV conflict tests, and document its transaction boundaries.
* filer: prepare update manifests outside metadata transactions
* filer: keep update rereads from restoring renamed remote entries
---------
Co-authored-by: MapleWhiteZZZ <18653045+MapleWhiteZZZ@users.noreply.github.com>
Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>
Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com>
Co-authored-by: Chris Lu <chris.lu@gmail.com>
* mount: keep a clean handle off the file a peer renamed over the one it has open
A peer renames another file over the one a handle has open here. When this
mount has looked the rename's source up, MovePath reports the handle's inode
as replaced and the handle is marked deleted. When it has not, which is the
usual case for "write a temp file, rename it over the real one" done on
another mount, MovePath has nothing to move and reports nothing. The event
for the target path then reaches the handle as an update: a dirty handle
refuses it, but a clean one installs the newcomer's entry, and everything
the descriptor does afterwards lands in the replacement: writes, mmap
writes, ftruncate, fchmod, fsetxattr.
A clean handle now takes an entry with another inode at its path for what it
is. The handle is marked deleted, as after a delete, and its inode gives the
name up as a replaced rename target does, so the kernel gets ESTALE for the
old inode, walks the path again and reaches the newcomer under an inode of
its own. An entry or a handle without an inode cannot tell and installs as
before, and so does an update in place, which keeps the inode.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
* mount: a replaced handle keeps a surviving hard link, a renamed one ignores its old name
From the review of a4c9a89a6.
- A hard-linked file replaced under one of its names lives on under the
others. The handle follows it to a name this mount knows, as after a
peer's unlink of one name, instead of being marked deleted.
- A handle that just followed its file's rename no longer reads the cache
at the path it left. When another file had taken that name before the
rename was applied to the handle, the handle was marked deleted (and
before this branch, installed that file's entry).
- The replaced name is taken from the inode only while it is still the
inode's (RemovePathOf): a rename on this mount may have handed it to
another inode in between.
- The kernel keeps resolving the name to the old inode for as long as it
trusts its lookup (entryValidSec). A chmod by path in that window went to
the detached handle and reported success. The lookup is dropped with
EntryNotify, from the invalidation worker after the handle's locks are
released.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
* mount: mark a replaced handle deleted only once its inode gives up the name
The worker looks the inode up by name before it takes the handle's lock,
so a rename on this mount can move the inode off that name in between.
The handle was then marked deleted while its file lived on under the new
name, and its flushes were dropped. RemovePathOf now decides: when the
name is no longer the inode's, the event is another file's and the
handle is left alone.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* mount: release the worker gate on every exit of the renamed-handle test
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* mount: check alias ownership before following surviving links
---------
Co-authored-by: MapleWhiteZZZ <18653045+MapleWhiteZZZ@users.noreply.github.com>
Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>
Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com>
Co-authored-by: Chris Lu <chris.lu@gmail.com>
* fix: do not index a record that runs past the end of the .dat
A truncated .dat, or a header whose size points past the file end, left
weed fix indexing a needle the volume cannot serve. Stop the scan at such a
record instead.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix: exit non-zero under -ignoreError when a volume fails
-ignoreError kept going but always exited 0, so an empty or partial index
looked like success. Record the failure in the exit status, and keep the
existing .idx when the super block could not be read.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* compact: remove the partial .cpd/.cpx when compaction fails
A failed weed compact exited through glog.Fatalf and left a partial .cpd
next to the volume. Remove both outputs and report the failure in the
exit status instead.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix: skip the end-of-file check for a volume on a remote tier
The scan reads the remote object when the .vif lists one, so a retained
local .dat is the wrong length to check records against.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix: keep a key deleted when its last record is truncated
Stopping before a truncated delete record left the key's earlier live
record in the index, so a deleted file came back. Drop the key instead.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix: return the .idx open error from SaveToIdx
The bare return gave back the nil named result, so a failure to open the
index looked like a successful save.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix: exit non-zero when a record is cut off by the end of the .dat
A record past EOF ends the scan like a bad header does, so report it the
same way while keeping the index of the records before it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* compact: close the volume before removing a failed compaction's output
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix: remove a failed .idx only after SaveToIdx opened it
An open failure no longer reaches the caller's cleanup, so an existing
.idx that could not be opened is left in place.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* test(s3vectors): drop the worker and CLI flags #12906 removed (#12911)
* test(s3vectors): start weed-worker with only --admin
weed-worker no longer accepts --namespace, --masters or --filer-group; it
takes the Lance Namespace and the filers from admin. The worker jobs passed
all three, so the worker exited on its arguments before registering.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* test(s3vectors): let weed-vector-cli find the namespace through the masters
weed-vector-cli dropped --namespace and looks the Lance Namespace up among
the gateways the masters list, so the index job test failed on its
arguments once the worker could register.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* util/http: hedge a chunk read whose location goes quiet
A chunk read tried its locations one at a time and read each answer to the
end. A response that stops arriving holds the read for as long as TCP takes
to recover: on a lossy path a lost segment costs at least the 200 ms
retransmission timeout, doubled for every further loss, and nothing gives
up on the connection meanwhile. A sequential reader waits for its chunks in
order, so one stalled chunk stops it, although a replica could send the
chunk in milliseconds. A location that never answers holds the read for the
transport's response header timeout.
In production this showed up as 13 GB checkpoint verifications, read back
serially with O_DIRECT through weed mount, crawling at 25-65 MB/s instead
of 300 MB/s and more, while the hosts of the volume servers saw 2-5% TCP
retransmissions. The volume servers' own GET latency stayed at a few
milliseconds: the stall is on the wire, after the handler has written the
chunk into the socket buffer.
hedgedChunkPass keeps the order and the move-on-at-failure of the old
loops. In addition, once every request in flight has been quiet for longer
than it may be, the read is asked of the next location as well, or, once
every location has been asked, again over a new connection of a location
whose server answered. A request may be quiet for 200 ms before its
response headers, while the server may still be reading the needle from a
busy disk, and for 100 ms in the body, which a healthy server sends without
pauses: half the minimum retransmission timeout, ahead of every wait for a
retransmission, while shorter pauses that recover on their own go by. The first complete answer wins, and the other requests are
cancelled. A read hedges at most twice.
The first request reads straight into the caller's buffer, as before.
Hedges read into pooled buffers, and a winning hedge is copied over only
after the request writing the caller's buffer has ended, so the buffer has
one writer at a time and is not written after the call returns.
Hedging is budgeted: every read earns a tenth of a token, a hedge spends
one, and at most ten are saved up, so hedges stay below about a tenth of
the reads when the whole cluster is slow. A location that had sent no
response headers when another one delivered the chunk is recorded as
unreachable, which leaves it to the background probe of #12776 to put it
first again, and counts as a failure for the location refresh. A body that
stalled after its headers does neither.
Measured with two volume servers whose outgoing links drop packets (netem,
MTU 1500, 0.2 ms delay), reading a 1 GiB file of 2 MiB chunks through weed
mount with dd iflag=direct bs=4M, before and after:
bursty loss ~2.3% on both replicas 26-76 MB/s 162-193 MB/s
random loss 3% on both replicas 106-119 MB/s 147-170 MB/s
random loss 5% on one replica only 71-81 MB/s 157-158 MB/s
no loss no change, 0-2 hedges per 512 reads
Under loss 4-8% of the chunk reads were hedged. A 50 ms body limit did
better on random loss (179-220 MB/s with 3% on both) but worse and less
steadily on bursty loss (108-206 MB/s), where it spent the hedge budget on
pauses that recover by themselves.
Callers: RetriedFetchChunkData on the streaming and the direct path, which
weed mount, the S3 gateway and the WebDAV server read chunks through.
Readers that stream a chunk to a writer as it arrives are unchanged.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* util/http: account hedge buffers, go past a throttled hedge, cap hedges per read
Three review findings:
- A hedge reads into a buffer of its own, which weed mount's reader cache
budget did not see, so stalled downloads could hold twice the configured
memory. The reader cache now passes its budget in the context
(WithScratchBudget), and a hedge first takes room for its buffer with
ReaderCacheBudget.TryReserveScratch. Like a download, that evicts idle
chunks no stream is positioned in, but it never waits and never evicts a
pinned chunk or a download in flight: a hedge that does not fit is not
sent. The room is returned when the buffer is freed, also for requests
abandoned in the background.
- A hedge answered with 429 ended the asking, so the read waited out the
stalled request although a third location was idle. The download limit
behind a 429 is local to that server, so a throttled hedge now moves on to
the next location; the 429 is still returned when nothing else delivers.
- Each retry pass earned a new budget share and started a new count of two
hedges. Both now belong to the read (readHedges) and carry over its passes.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* util/http: note an error's headers as an answer, take a hedge token before room
Second round of review findings:
- A location that sent the headers of an error response (a 500, say) and
then stalled its body was still taken for one that had not answered while
StatusError waited for that body. Had another location delivered the chunk
meanwhile, it was recorded as unreachable and the location list refreshed.
The response headers are now noted as soon as Do returns, before the
status is looked at.
- A hedge took room for its buffer before its token, and room can evict
cached chunks. With no token left the room was given back, but the chunks
were gone. The token now comes first, and is given back when there is no
room.
- TestReaderCacheBudgetLendsScratchToHedges opens the gate of the download
it holds in a defer, so a failed assertion cannot leave the cache's
teardown waiting on it. TestChunkReadHedgeCapCoversRetries also checks that
the read earned its budget share once.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* util/http: do not take a location asked again for unreachable
A location whose response stalled is asked again over a new connection.
When the first request then recovered and delivered the chunk, the new
request had not answered yet, so the host that just served the chunk was
recorded as unreachable and the location list refreshed. A location any
request of the read heard from is no longer counted.
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>
* filer: path- and method-scoped tokens on the filesystem gRPC service
* filer: close scoped admission and compatibility gaps
* filer: test subscription key ambiguity and retained write success
* filer: assert verified peer chains survive subscription fallback
* filer: keep a hard link's count and chunks together under a scoped token
A scoped write may keep a hard link the target already has, but the link
count it sends was stored as is, and its chunks could stay on the name
with the link dropped. Either let a scoped token delete its own name and
take the chunks of a name outside its grants with it: the forged count
reaches zero, or the detached name owns the shared chunks.
The handler recheck now refuses a scoped write that changes a stored
link's count or keeps its chunks without the link. Dropping the link
together with the data, and appending to a linked file, are unchanged.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* filer: leave subscriptions with a non-scope bearer to the existing verifier
The stream interceptor refused a SubscribeMetadata or SubscribeLocalMetadata
call whose bearer does not verify under the filer key unless the bearer was
a subscription token, and it checked that token with the peer stripped. With
no subscription key, or on an mTLS peer, the existing verifier admits such a
call, so filer.sync sending another cluster's admin token stopped.
When the bearer is no filer scope, the subscription verifier now decides on
the original context, as before scoped tokens. A scoped token still reaches
the refusal for scoped subscriptions, and malformed metadata is still refused.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* filer: refuse scoped writes that would make ancestors outside the grant
A scoped create, append or rename checked only its target. The filer then
creates the target's missing ancestors up to the first one it finds, and
turns that one into a directory if it is a file, dropping its ttl. A token
granted /data/proj/ws could so promote the file /data/proj, or create /q and
/q/r for a grant /q/r/ws.
The scope now walks the same ancestors before admitting the write and
refuses one outside the write grants that is missing or not a directory. A
create with skip_check_parent_directory makes no ancestors and is not
walked.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* filer: require write grants for scoped lock mutations
* filer: document scoped signatures and read-only token upgrades
* filer: enforce WORM retention for scoped mutations
* filer: refuse scoped writes through shared hard links
* filer: drop series notes from scope comments
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* filer: refuse scoped subtree mutations across WORM rules
---------
Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* test(s3vectors): start weed-worker with only --admin
weed-worker no longer accepts --namespace, --masters or --filer-group; it
takes the Lance Namespace and the filers from admin. The worker jobs passed
all three, so the worker exited on its arguments before registering.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* test(s3vectors): let weed-vector-cli find the namespace through the masters
weed-vector-cli dropped --namespace and looks the Lance Namespace up among
the gateways the masters list, so the index job test failed on its
arguments once the worker could register.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Windows joins with a backslash, so the Windows desktop build failed
looks_up_the_process_group_and_its_ancestors.
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* glog: honor an explicit -stderrthreshold under -logtostderr and the default -alsologtostderr
* glog: print the goroutine dump of a FATAL to stderr under -logtostderr
* glog: keep a FATAL's goroutine dump in JSON lines under -log_json
* glog: let an explicit -alsologtostderr=true win under -logtostderr too
---------
Co-authored-by: vic6996-web <320442181+vic6996-web@users.noreply.github.com>
* mount: send covered chunks no stored entry named, so the filer deletes them
A flush compacts the handle's chunks before it publishes them, dropping
chunks later writes fully cover. The filer deletes only the chunks the
stored entry loses and the ones the request itself covers, so a chunk
uploaded and then overwritten before any publication named it (a file
rewritten in place before close, like FFmpeg's +faststart pass) was left
on the volume servers with no reference.
Both the close flush and the periodic metadata flush now carry those
chunks along in the request, after the base snapshot, when the request's
own plain chunks still cover them; the filer compacts them out and
deletes them after the commit. Chunks rewritten by a merge are stamped 0
and the filer does not look into manifests, so a chunk that would show
through again is not sent.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* mount: test that flushes hand covered unpublished chunks to the filer
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* mount: check each covered chunk against the request's own chunks
The coverage check compacted the dropped chunks together with the
request's, so one dropped chunk could hide another. Only the request's
chunks reach the filer with it: after a merge, whose chunks are stamped
0, an older dropped chunk hidden only by a newer dropped one would show
through and the filer would delete the merged chunk instead.
Each dropped chunk is now sent only if newer visible plain chunks of the
request hide all of its range.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* master, s3: an S3 gateway advertises its Lance Namespace port
The gateway registers with the master already; it now says which port its
Lance Namespace listens on, and ListClusterNodes returns it, so admin can
tell workers where the catalog is instead of each deployment configuring it.
* admin: tell workers where the Lance Namespace is
Each S3 gateway that serves a Lance Namespace is now in the cluster context
admin sends with every request, and a preview request carries the context
too, so a worker can be pointed at admin alone.
* seaweed-worker: take the filers and the Lance Namespace from admin
Admin names both with every request, as it does for the Go worker, so
weed-worker needs only --admin. --namespace is used when admin names no
namespace, as an admin or gateways from before they could do so name none.
--masters and --filer-group are accepted and ignored; the filer group is the
one the filers report.
* helm: weed-worker needs only the admin address
The Lance container no longer derives a namespace URL or passes the masters
and filer group; worker.namespaceUrl, when set, is the worker's fallback.
* s3: advertise the Lance port only once its listener has bound
A gateway whose Lance port was taken kept advertising it, so workers that
picked that gateway sent every Lance request to a port nobody served.
The listener now binds before the master registration, and the port
reaches the master only when the bind succeeded.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* admin: stop waiting for the cluster context at the caller's deadline
The admin provider builds the context with context.Background(), so a
master outage held a preview, which now loads the context before it is
sent, past its own deadline. Loading the context now returns when the
caller's context ends.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* helm: keep giving the Lance worker its masters, group and namespace
A worker image pinned to 4.55 or older needs the masters and the
namespace and exits without them, and a 4.56 worker under an older admin
needs the namespace. The chart now passes all three through the
environment, which a 4.56 worker reads only when admin names nothing,
and the namespace again defaults to the S3 service's Lance port.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* helm: give admin the filer group
Admin lists filers and S3 gateways from its own group, and the Lance
worker now takes its filers from admin, so with filer.filerGroup set the
worker had no filers. Admin now gets the group; an -filerGroup in
admin.extraArgs still wins.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* seaweed-worker: drop --namespace, --masters and --filer-group
Admin names the namespace and the filers with every request, so the worker
takes them from there alone. Handlers and the preview hold the admin-fed
cluster, which also carries the signing key. The live tests get the filer
through WEED_FILER and feed it to the worker as admin would.
* helm: drop worker.namespaceUrl
A worker from 4.56 takes the namespace from admin and has no option for it,
so the value could only reach a pinned older image; the environment still
gives one the S3 service's namespace, masters and filer group.
* weed-vector: size the caches itself, and drop the tuning and config-dir flags
The engine caches a quarter of the memory it may use, its cgroup limit or
the machine's, split 2:4:1 between file reads, loaded indexes and table
metadata as the three flags' defaults were, so a small pod is not
overcommitted and a large host is used. --read-cache-mb, --index-cache-mb,
--metadata-cache-mb, --nprobes and --exact-match-limit are gone, and with
them the perf test's cold mode. --config-dir is gone too: weed mini passes
the security.toml it finds there.
* weed-vector-cli: find the Lance Namespace through the masters
A table id is looked up in the namespace of an S3 gateway the masters
list, so --namespace is gone; a local path still needs no cluster.
* helm: weed-vector sizes its own caches
vector.readCacheMB and vector.nprobes are gone with the engine's flags; an
older pinned image keeps its own defaults.
* weed-vector: size the caches from the process's own memory cgroup
A systemd service is limited in its own group below the cgroup root, which
the root's limit file does not show. The engine now reads its group from
/proc/self/cgroup and takes the smallest limit of it and its ancestors.
* mini: leave an explicit WEED_VECTOR_SECURITY_TOML to the engine
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* mount: read chunks with filer-issued exact-file read tokens
* mount: preserve read authorization across delayed lookups and hard links
* mount: retain response tokens across read cache eviction
* mount: keep a shared read-token lookup alive when its first caller is cancelled
Token refreshes for one entry share a singleflight lookup that ran under
the first caller's context. An interrupted read cancelled that lookup, so
every other read of the entry waiting on it got no token, went out
unauthenticated, and failed with EIO on a volume server enforcing read
JWTs. Run the lookup detached from the caller (each attempt stays bounded
by the filer RPC wait) and let a cancelled caller stop waiting at once.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* filer: serve a cached chunk past the cache cutoff instead of fetching it
The full-chunk read path consulted the chunk cache only for chunks below
the cache size cutoff. Read-auth and peer-sharing mounts cache every
chunk they upload, so a read-after-write of a high-offset chunk went to
the volume, where a read-auth mount has no token before the entry is
published.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* mount: re-track read tokens when this mount renames an open file
Writeback mounts skip their own rename event, so only the subscriber
path re-tracked an open handle's chunks. After a local rename a token
refresh looked up the vacated name and the read failed. The rename
response, the subscriber rename and the surviving hard link now share
ReadAuth.TrackHandle.
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>
* master, s3: an S3 gateway advertises its Lance Namespace port
The gateway registers with the master already; it now says which port its
Lance Namespace listens on, and ListClusterNodes returns it, so admin can
tell workers where the catalog is instead of each deployment configuring it.
* admin: tell workers where the Lance Namespace is
Each S3 gateway that serves a Lance Namespace is now in the cluster context
admin sends with every request, and a preview request carries the context
too, so a worker can be pointed at admin alone.
* seaweed-worker: take the filers and the Lance Namespace from admin
Admin names both with every request, as it does for the Go worker, so
weed-worker needs only --admin. --namespace is used when admin names no
namespace, as an admin or gateways from before they could do so name none.
--masters and --filer-group are accepted and ignored; the filer group is the
one the filers report.
* helm: weed-worker needs only the admin address
The Lance container no longer derives a namespace URL or passes the masters
and filer group; worker.namespaceUrl, when set, is the worker's fallback.
* s3: advertise the Lance port only once its listener has bound
A gateway whose Lance port was taken kept advertising it, so workers that
picked that gateway sent every Lance request to a port nobody served.
The listener now binds before the master registration, and the port
reaches the master only when the bind succeeded.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* admin: stop waiting for the cluster context at the caller's deadline
The admin provider builds the context with context.Background(), so a
master outage held a preview, which now loads the context before it is
sent, past its own deadline. Loading the context now returns when the
caller's context ends.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* helm: keep giving the Lance worker its masters, group and namespace
A worker image pinned to 4.55 or older needs the masters and the
namespace and exits without them, and a 4.56 worker under an older admin
needs the namespace. The chart now passes all three through the
environment, which a 4.56 worker reads only when admin names nothing,
and the namespace again defaults to the S3 service's Lance port.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* helm: give admin the filer group
Admin lists filers and S3 gateways from its own group, and the Lance
worker now takes its filers from admin, so with filer.filerGroup set the
worker had no filers. Admin now gets the group; an -filerGroup in
admin.extraArgs still wins.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* seaweed-worker: drop --namespace, --masters and --filer-group
Admin names the namespace and the filers with every request, so the worker
takes them from there alone. Handlers and the preview hold the admin-fed
cluster, which also carries the signing key. The live tests get the filer
through WEED_FILER and feed it to the worker as admin would.
* helm: drop worker.namespaceUrl
A worker from 4.56 takes the namespace from admin and has no option for it,
so the value could only reach a pinned older image; the environment still
gives one the S3 service's namespace, masters and filer group.
* seaweed-worker: keep the last known namespaces while admin lists none
When a master call fails, admin still sends its cached filers but no S3
gateways. With no --namespace fallback left, that emptied the worker's
namespaces and failed every Lance job until the master answered again,
though the gateways serve the namespace without it. The namespaces are
now kept like the filers are.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* helm: run the Lance container for the filer's S3 gateway and an external admin
The container was left out whenever the chart's own S3 gateway served no
Lance namespace. A filer's embedded gateway serves one too, and an external
admin names its cluster's, so both now get it; the namespace variable for a
pinned older worker is set only when the chart's gateway serves one.
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* storage: re-forward a deleted EC read's delete to the holders that read it deleted
The retry used first-success routing, which can stop at another copy of
the primary shard (a quarantined local one, or a replica that never saw
the delete) and leave the reporting holder's other disk live. Probe each
primary shard holder with a one-byte read and forward to those answering
deleted; with no such holder, fall back to normal routing.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* seaweed-volume: re-forward a deleted EC read's delete to the holders that read it deleted
Mirror Go: probe each primary shard holder with a one-byte read and
forward the delete to those answering deleted, so the retry cannot stop
at another copy and leave the reporting holder's other disk live; with
no such holder, fall back to normal routing.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* storage: bound each delete-retry probe with the read-hint timeout
A holder that keeps the stream open without answering held the delete's
reply, even after the reporting holder took the delete.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* seaweed-volume: bound each delete-retry probe with the read-hint timeout
Mirror Go: a stalled holder's probe gives up after EC_READ_HINT_TIMEOUT
and the retry moves on to the next holder.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* storage: bound each delete a retry forwards
A holder that answers the probe deleted but stalls on the delete held the
reply and the holders after it. The Rust server already bounds this call
at 10 s.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 22:18:40 -08:00
997 changed files with 84048 additions and 6239 deletions
sed -i "/# request PartNumber out of range/,+4{s/assert status == 400/assert status == 416/; s/assert error_code == 'InvalidPart'/assert error_code == 'InvalidPartNumber'/}" s3-tests/s3tests/functional/test_s3.py
The same process also runs the master, a volume server, the filer, WebDAV, the Iceberg REST catalog, and the Admin UI. Add `S3_TABLE_BUCKET=warehouse` to also create an Iceberg table bucket, or `warehouse:LANCE` for a Lance one. Drop the AWS keys to run without authentication for development.
Without Admin authentication or mTLS, `weed mini` binds the Admin UI/API and its worker gRPC control plane to loopback rather than `-ip.bind`. Set `WEED_ADMIN_PASSWORD` or configure `https.admin` mTLS to keep the network bind. Remote workers must opt in with `-admin.worker.ip=<address>` and should configure `grpc.admin` mTLS. `-admin.allowInsecureBind` restores the legacy unauthenticated network bind and should only be used on an isolated network.
`weed mini` binds the Admin UI/API and WebDAV to `-ip.bind` like its other components, even without authentication, so use it on a trusted network or set `WEED_ADMIN_PASSWORD` or `https.admin` mTLS. Pass `-admin.allowInsecureBind=false` or `-webdav.allowInsecureBind=false` to keep an unauthenticated Admin or WebDAV on loopback. The Admin worker gRPC control plane stays on loopback; remote workers must opt in with `-admin.worker.ip=<address>` and should configure `grpc.admin` mTLS.
> macOS: if the binary is quarantined, run `xattr -d com.apple.quarantine ./weed` first.
@@ -175,6 +176,15 @@ cd seaweedfs/weed && make install
`weed` lands in `$GOPATH/bin`. [Getting Started][GettingStarted] covers running master, volume, filer, and S3 as separate processes.
## Development builds ##
Each dev build workflow publishes its latest successful build of `master`:
- **Binaries**: the [`dev` release](https://github.com/seaweedfs/seaweedfs/releases/tag/dev) has Linux amd64, Windows amd64, and macOS amd64/arm64 archives named `weed-<yyyymmdd-HHMM>-<linux|windows|darwin>-<arch>.tar.gz` (`.zip` on Windows) and `weed-large-disk-<yyyymmdd-HHMM>-<linux|windows|darwin>-<arch>`, each with an `.md5` checksum. The Rust volume server is published there too as `weed-volume-*` for Linux amd64 (glibc) and macOS amd64/arm64. The Go archives contain `weed-normal-disk` or `weed-large-disk` (`.exe` on Windows) rather than `weed`, and the Rust archives contain `weed-volume-normal` or `weed-volume-large-disk` rather than `weed-volume`, so rename or symlink the one you want. The `.md5` files are published for the Go archives only.
- **Containers**: `docker pull chrislusf/seaweedfs:dev` or `ghcr.io/chrislusf/seaweedfs:dev`, built for `linux/amd64` and `linux/arm64`. The [dev compose file](docker/seaweedfs-dev-compose.yml) runs the Docker Hub image as master, volume, filer, S3, WebDAV, and admin.
The timestamp in a binary name is the UTC start time of the run that built it. The Go binaries, the Rust volume server, and the `:dev` image come from three separate path-filtered workflows, so they can carry different timestamps and lag `master` by hours, or much longer when their paths were not touched. The release can list more than one timestamp for a while, for example after a failed or retried run; use the newest one for your platform. The `dev` release is marked pre-release, so it does not appear under [releases/latest](https://github.com/seaweedfs/seaweedfs/releases/latest); these builds come from `master`, can break at any commit, and are not recommended for production.
## Scale out ##
Capacity is a volume server. Start one on any machine with disk and point it at the master:
The compose file below uses `chrislusf/seaweedfs:dev`, built from `master`. It is a development image, not a stable release, and can lag `master` by hours or more; the `org.opencontainers.image.revision` label records the commit it was built from, and pinning by digest keeps that exact build. See [Development builds](../README.md#development-builds) for the `dev` binaries and image details.
| `-yandex.token` | token JSON or a bare access token |
| `-yandex.client_id`, `-yandex.client_secret` | OAuth app credentials, needed to refresh the token and for `-yandex.code` |
| `-yandex.root` | folder that holds the buckets, default `/` |
| `-yandex.app_folder` | the token only reaches the app folder: paths are addressed under `app:` |
| `-yandex.trash` | move deleted files to the trash instead of deleting them permanently (the trash keeps occupying quota) |
| `-yandex.endpoint` | override the API endpoint, e.g. for a proxy (default `https://cloud-api.yandex.net/v1/disk`); it must be `https`, plain `http` is accepted on a loopback host only, since every request carries the OAuth token |
A dedicated root (`-yandex.root=/seaweedfs`) is recommended: with the default
`/`, `remote.mount.buckets` treats every top-level folder of the disk,
It needs Kubernetes 1.34+, or 1.31+ with the `VolumeAttributesClass` feature gate.
`volumeClaimTemplates` cannot be changed on an existing StatefulSet, and a new
template only reaches claims created after it. To set it on a release that
already exists, patch `spec.volumeAttributesClassName` on each existing claim,
and delete the StatefulSet with `--cascade=orphan` before the upgrade so the
upgrade can apply the new template.
### Master data: hostPath vs a claim
The master's `-mdir` holds its Raft log and snapshots, and with them the
@@ -330,6 +342,47 @@ applies. Rotating a key in the Secret takes effect on the next pod restart, as
with any other environment variable. The COSI driver parses the config itself
and does not resolve these references.
#### Reload identities without a restart
The chart hashes `existingConfigSecret` into the filer and S3 pod templates when it renders,
so the first Helm upgrade after the Secret's content changes restarts those pods, and every
identity change briefly takes S3 down, completely so with a single filer. SeaweedFS also
reloads the identities file on SIGHUP, which `configReloader` uses instead:
```yaml
filer:
s3:
enabled: true
enableAuth: true
existingConfigSecret: my-s3-identities
configReloader:
enabled: true
```
`s3.configReloader` does the same for the standalone S3 gateway. With it:
- An `s3-config-reloader` sidecar checks the mounted identities file every second, and
sends SIGHUP to SeaweedFS when it changes and once when it starts. Kubelet updates the
file at its next sync of the pod. Secret volumes are eventually consistent, so there is no
fixed bound: with the kubelet's default settings (a one-minute sync period and the `Watch`
Secret change detection strategy) it typically takes up to about 90 seconds, and changing
an annotation on the pod usually brings it down to seconds. Other kubelet settings can make
it slower. Until the file is updated, a revoked identity keeps working.
- Changes to the content of `existingConfigSecret` no longer restart the pod: the chart
leaves `checksum/s3config` off it. Adding, changing, disabling and deleting identities
apply without a restart. Other files in the Secret, such as an audit log config, still
need one, and so do changes to the values the chart generates its own Secret from, such
as `s3.credentials`.
- Every reload also re-creates the KMS providers configured in the identities file. The
`local` provider keeps its keys in memory, so a reload replaces them, as a restart does;
use another provider for objects that must stay readable.
- The pod shares its process namespace (see [Sharing the process namespace](#sharing-the-process-namespace)),
so the sidecar can see SeaweedFS. It uses the component's image and container security
context, because it must run as the same user as SeaweedFS to signal it. If it can't
signal SeaweedFS, it logs a warning.
The all-in-one deployment does not have this option.
## Admin Component
The admin component provides a modern web-based administration interface for managing SeaweedFS clusters. It includes:
@@ -629,6 +682,10 @@ The volume servers do not require client certificates, because kubelet probes ca
`commonLabels` adds labels to the metadata of every object the chart creates. It may be a map or a template string rendering to one. The chart's own labels cannot be overridden, and pods (see `podLabels`) and `volumeClaimTemplates` are left unchanged.
## Sharing the process namespace
`filer.shareProcessNamespace` and `s3.shareProcessNamespace` let the containers in the filer and S3 pods see each other's processes, so a sidecar can signal SeaweedFS, for example with SIGHUP to reload the S3 identities file. SeaweedFS is then no longer PID 1 in its container, and every container in the pod can read the other containers' processes and files through `/proc`. Both are off by default.
## Pod and container security contexts
Pod and container security contexts are configurable independently for every built-in workload and remain empty by default for backwards compatibility. The examples in `values.yaml` show how to enable a `RuntimeDefault` seccomp profile, disable privilege escalation and privileged mode, drop all Linux capabilities, and use a read-only root filesystem.
@@ -729,7 +786,7 @@ global:
The engine registers its pod address with the masters and stores indexes through the filers and volume servers. Both Go and Rust volume servers use the same setup. The maintenance worker builds and updates ANN indexes; queries can scan data before indexing completes. Enabling filer write signing also requires clients writing directly to the filer HTTP API to supply a signed JWT.
The bundled engine images support Linux amd64 and arm64. Use `vector.imageOverride` to select a compatible engine build, `vector.masters` for an external cluster, and `vector.resources` to set memory and CPU limits. The cache defaults to 512 MiB and is configured with `vector.readCacheMB`.
The bundled engine images support Linux amd64 and arm64. Use `vector.imageOverride` to select a compatible engine build, `vector.masters` for an external cluster, and `vector.resources` to set memory and CPU limits. The engine sizes its caches to a quarter of its memory limit.
`global.seaweedfs.enableSecurity` provisions and mounts the vector certificate and shared security configuration. With external certificates, provide the `<fullname>-vector-cert` secret (`my-seaweedfs-vector-cert` for release `my`). `fullname` follows `seaweedfs.fullname`, including `fullnameOverride`, `nameOverride`, and DNS-name truncation. Provide this secret alongside the existing CA and client secrets.
{{- if and $s3ConfigReloader (not .Values.s3.enableAuth) }}
{{- fail "s3.configReloader.enabled needs s3.enableAuth: it reloads the identities file that mounts" }}
{{- end }}
{{- $minGracePeriod := add $preStopSeconds 15 }}
{{- if and (gt $preStopSeconds 0) (lt (.Values.s3.terminationGracePeriodSeconds | int) $minGracePeriod) }}
{{- fail (printf "s3.terminationGracePeriodSeconds (%v) must be at least %d: the gateway keeps serving for s3.preStopSeconds (%d) after SIGTERM, then gives in-flight requests up to 15s to finish; add the time any s3.lifecycle.preStop hook takes" .Values.s3.terminationGracePeriodSeconds $minGracePeriod $preStopSeconds) -}}
{{/* "true" when the worker runs its Lance container: an S3 gateway of this release serves a Lance namespace, or the worker serves an external admin, which names its cluster's */}}
{{- define "seaweedfs.worker.lanceEnabled" -}}
{{- if or (include "seaweedfs.worker.lanceNamespaceUrl" .) .Values.filer.s3.enabled .Values.worker.adminServer -}}
true
{{- end -}}
{{- end -}}
{{/* Return the proper volume image */}}
{{- define "seaweedfs.volume.image" -}}
{{- if .Values.volume.imageOverride -}}
@@ -784,6 +789,65 @@ on install.
| toJson | sha256sum -}}
{{- end -}}
{{/*
The s3-config-reloader sidecar of the filer and S3 pods. It checks the mounted identities file every
second and sends SIGHUP to SeaweedFS when it changes, so SeaweedFS loads it again without a restart.
It only signals once SeaweedFS listens on its S3 port, because SeaweedFS registers the reload when it
starts serving S3, and it sends one SIGHUP when it starts, which catches changes made while it was not
running. It needs the pod's process namespace to see SeaweedFS, and the same user to signal it, so it
uses the component's image and container security context.
"description":"Failed EC shard copies into each volume server per rate interval, by collection and reason (source_not_found, empty_index, no_space, timeout, io_error, other). The volume server log names the volume, shards and source of each failure.",
"type":"timeseries",
"id":269,
"gridPos":{
"h":8,
"w":12,
"x":12,
"y":142
},
"fieldConfig":{
"defaults":{
"color":{
"mode":"palette-classic"
},
"custom":{
"axisBorderShow":false,
"axisCenteredZero":false,
"axisColorMode":"text",
"axisLabel":"",
"axisPlacement":"auto",
"barAlignment":0,
"drawStyle":"line",
"fillOpacity":10,
"gradientMode":"none",
"hideFrom":{
"legend":false,
"tooltip":false,
"viz":false
},
"insertNulls":false,
"lineInterpolation":"linear",
"lineWidth":1,
"pointSize":4,
"scaleDistribution":{
"type":"linear"
},
"showPoints":"never",
"spanNulls":false,
"stacking":{
"group":"A",
"mode":"none"
},
"thresholdsStyle":{
"mode":"off"
}
},
"mappings":[],
"unit":"short",
"thresholds":{
"mode":"absolute",
"steps":[
{
"color":"green",
"value":null
}
]
}
},
"overrides":[]
},
"options":{
"legend":{
"calcs":[
"lastNotNull",
"max"
],
"displayMode":"table",
"placement":"bottom",
"showLegend":true
},
"tooltip":{
"mode":"multi",
"sort":"desc"
}
},
"targets":[
{
"datasource":{
"type":"prometheus",
"uid":"${DS_PROMETHEUS}"
},
"editorMode":"code",
"expr":"sum by (instance, collection, reason) ((last_over_time(SeaweedFS_volumeServer_ec_shard_copy_failures_total{cluster=~\"$cluster\"}[$__rate_interval]) and (min_over_time(SeaweedFS_volumeServer_ec_shard_copy_failures_total{cluster=~\"$cluster\"}[$__rate_interval]) < last_over_time(SeaweedFS_volumeServer_ec_shard_copy_failures_total{cluster=~\"$cluster\"}[1d] offset $__rate_interval))) or (increase(SeaweedFS_volumeServer_ec_shard_copy_failures_total{cluster=~\"$cluster\"}[$__rate_interval]) and count_over_time(SeaweedFS_volumeServer_ec_shard_copy_failures_total{cluster=~\"$cluster\"}[1d] offset $__rate_interval)) or (last_over_time(SeaweedFS_volumeServer_ec_shard_copy_failures_total{cluster=~\"$cluster\"}[$__rate_interval]) unless count_over_time(SeaweedFS_volumeServer_ec_shard_copy_failures_total{cluster=~\"$cluster\"}[1d] offset $__rate_interval)))",
The engine caches a quarter of the memory it may use (its cgroup limit, else the machine's), split 2:4:1 between file reads, loaded indexes and table metadata, and logs the sizes at startup. Each query probes a tenth of the index's partitions, at least 8, and more under a filter.
The HTTP listener provides `/health`, `/ready`, and `/metrics`. Readiness requires an active registration with the master. The gRPC listener also implements the standard health service for `vector_pb.VectorService` and the whole server. These health statuses follow master registration.
Metrics use the `SeaweedFS_vector_` prefix:
@@ -35,6 +35,49 @@ The S3 gateway separately publishes `SeaweedFS_s3_` request metrics with `type="
For mutual TLS, configure `[grpc.vector]` for the engine's server certificate, `[grpc.client]` for its master/filer connections, and the cluster CA. HTTPS volume reads also use `[https.client]`. The engine follows the same signing and encryption configuration as the other cluster clients.
Run the Lance maintenance worker against the same masters and Lance namespace to build and update ANN indexes. Queries can scan data that has not been indexed yet. See the [maintenance worker documentation](../seaweed-worker/README.md) and [Helm chart](../k8s/charts/seaweedfs/README.md) for deployment settings.
Run the Lance maintenance worker against the cluster's admin to build and update ANN indexes. Queries can scan data that has not been indexed yet. See the [maintenance worker documentation](../seaweed-worker/README.md) and [Helm chart](../k8s/charts/seaweedfs/README.md) for deployment settings.
The integration suite at `test/s3vectors` runs the same API and observability checks against both Go and Rust volume servers, including mutual TLS, signed volume reads, and encrypted volume data.
## Search indexed data only
The default search includes recent writes by scanning data that indexes do not
cover yet. To exclude that data, send `x-seaweedfs-vector-search-mode: indexed-only`
on `QueryVectors`. Omit the header, or set it to `all`, for the default behavior.
This is a SeaweedFS extension. With SigV4, the header must be signed.
For example, inject it before boto3 signs the request:
stringyandex_root=84;// folder under the disk that holds the buckets, default "/"
boolyandex_trash=85;// move deleted files to the trash instead of deleting them permanently (default: delete permanently)
boolyandex_app_folder=86;// the token only reaches the app folder: address paths under "app:" instead of "disk:"
}
messageRemoteStorageMapping{
Loaded 100 of 997 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.