* 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>
A plain detach whose final cut ran to the caller's deadline settled on
that already expired context: its first remote call failed and the caller
was told the outcome was unknown, while the background settlement found
nothing committed and resumed serving a moment later.
With a caller deadline, the cut is now cancelled min(4 s, a quarter of
the bound) early and the settlement runs on WithoutCancel(cutCtx) up to
the deadline, the shape the live detach already uses. Outcomes are
unchanged: an undecidable settlement still answers outcome unknown.
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>
MaxNewVolumeBytes is 256 GiB (65,536 chunks of 4 MiB), derived from the
measured number of chunks a commit checks within one 2 s update of HEAD,
halved and rounded down. The release note states the limit, why, that a
restore target takes its source's size, and that it is planned to be
removed in 1.0.1.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The three servers' port pairs were picked together before the master
started, and the filer binds its pair seconds later; a listener that
appears in between (another job's weed on the same host) took the filer's
gRPC port. Each pair is now picked right before its server starts. A
cluster with a fault-injection filer front gets the same fresh-ports
retry: its front is built again on each start's ports.
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>
CreateVolume and the cluster-spec start check refuse a new volume above
geometry.MaxNewVolumeBytes with ErrVolumeTooLarge, naming the size and the
maximum, before any record or store exists. The check is at creation
only: a volume that already exists keeps opening under the uint32-LBA
limit. The value is a placeholder (MaxVolumeBytes) until it is set from
the measured capacity limit.
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>
A scheduled snapshot or periodic cut refused because an earlier HEAD
commit's outcome is unresolved logged only the raw error. Every later
cut, snapshot and detach of the volume is refused until that settles,
so the line now names the state (PendingUnresolved), its cause and the
cure, once per attempt, never per write.
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>
Tests and ledger only; the product code is byte-identical.
- The cap oracle is the literal 32 (a 32 -> 64 change of the constant
fails it: 64 in flight).
- Every wait is bounded, and each control's cleanup opens its gates,
cancels and joins the commit, so a failing control returns promptly.
- The cancel control holds every admitted lookup past the cancellation
until the test opens their exit: a commit that returns before that did
not join them (a removed-join mutant fails), HEAD takes no update, and
a keep-admitting mutant starts 502 lookups.
- The order control holds the earlier lookup until the later failure has
fully returned and nothing else is in flight (a first-to-finish mutant
fails both ways).
- invariants.md: the wait rows name the caller-held LayoutRemote.mu
(CASHead, CommitPendingSnapshot).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Tests only, plus the ledger; the product code is unchanged.
- TestCommitLookupsNeverExceedTheCap: every lookup is held until the cap
is reached; no 33rd starts (a cap-33 mutant fails it).
- TestACancelledCommitStopsJoinsAndWritesNothing: cancelled before any
lookup and mid-flight, the commit returns within a bound with no lookup
still running, admission stopped and HEAD not written (a mutant that
keeps admitting after a failure starts 502 lookups and fails it).
- TestTheEarliestFailureByPositionDecidesTheError: of two failures the
earlier position wins, whichever finishes first (a first-to-finish
mutant fails it both ways).
- invariants.md: the admission and join waits of allOwnedBySession in
C.W, and the scale, detach and control tests on
INV-SNAPK-COMMIT-REACH-001.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
SWFS's HTTP client had no transport of its own, so it used Go's shared
default, which keeps only two idle connections per host: every needle
request past two in flight to one volume server opened a new TCP
connection and left a TIME_WAIT behind. It now has its own transport
keeping 64 idle connections per host, and a delete drains its response
body before closing it, so that connection is reused too.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Once a lookup fails, no new one starts: lookups start in order, so every
object before the failure has started and is waited for, and the first
failure in order is still the one reported.
The test object store's Stat is now safe for the concurrent lookups (its
hook runs outside the lock), and TestRunCommit_LooksUpOnlyWhatIsNew
compares the set of objects looked up, not their order.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
RunCommit checked every new own chunk, every segment and the root with
one filer lookup each, one at a time, before its conditional update. The
work grows with the proposal and the cut's deadline does not: a first
snapshot of a 1 TiB volume names all 262,144 chunks, and each attempt
(and each re-proposal, and a restart's next commit) ran out of the 5 min
cut context around chunk 250k, so no retry could ever land.
The check now runs at most 32 lookups at once. It is unchanged in what
it decides: every object must be written by this session and unmarked,
the first failing object in the same order decides the error, and no
update is issued unless all pass.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>