mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-12-04 18:17:16 +01:00
663af6fccbf71456dee42e8a2f30fb053e3f6df4
16574
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
663af6fccb |
mount: review fixes for the metadata follow shutdown (on top of #13092) (#13097)
* 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> |
||
|
|
63ab6c6190 |
mount: stop the metadata follow before closing the meta cache (#13092)
* 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> |
||
|
|
a7cc8fb767 |
filer, docs: 503 in the upload wait flag help; Yandex restart after a token refresh (#13096)
* 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> |
||
|
|
ef0967bead |
filer: read the entry path once per write (#13090)
* 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> |
||
|
|
e7cbfdcc44 |
s3: blame no filer for a deadline gRPC reports before ctx.Err() (#13098)
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> |
||
|
|
5b7e2d9e9e |
fix: retain released lock version watermarks (#13083)
* 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> |
||
|
|
889af96779 |
mount: store a truncate through an open handle before answering (#13089)
* 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> |
||
|
|
6b2ad112a8 |
volume: check the collection name in handlers that build file paths from it (#13087)
* 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> |
||
|
|
16412c374a |
test(filer): wait for the fake master's volume location in the manifest reuse tests (#13086)
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> |
||
|
|
efcee4a186 |
test(volume_server): wait out a server's disk I/O before calling its SIGINT exit a hang (#13085)
* 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> |
||
|
|
e6aed012f8 |
filer: pass cutToSpan in the manifest reuse test (#13082)
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> |
||
|
|
4cf028f683 |
grafana: show the first EC shard copy failure of each series (#13071)
* 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> |
||
|
|
a9fda6b50f |
filer clients: authenticate filer gRPC calls with per-call admin tokens (#13039)
* 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> |
||
|
|
f6b130f61c |
filer: keep a stored manifest when a commit lists its chunks flat (#13051)
* 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> |
||
|
|
3880e7ee5a |
volume(rs): keep the needle_not_found doc comment on its function (#13070)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
c7fc40c76c |
filer, mount: read a manifest's chunks only within its span (#13048)
* 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> |
||
|
|
c812a37c83 |
feat(grpc): serve grpc.health.v1 on every server, add health-check-only client certificates (#13049)
* 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>
|
||
|
|
6c54935723 |
java client, hdfs3: authenticate to a filer that requires filer JWT or Basic Auth (#13053)
* 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> |
||
|
|
50ac729a71 |
filer: fold only runs of small chunks that lie end to end (#13041)
* 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. |
||
|
|
40a95a8ef5 |
admin: filter plugin jobs and activities by volume id (#13077)
* admin: keep the volume id on tracked plugin jobs Volume-scoped jobs carry their volume in the volume_id parameter, but the in-memory job list drops parameters, so nothing could select a volume's jobs without reading every job detail file. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * admin: filter plugin jobs and activities by volume id /api/plugin/jobs and /api/plugin/activities accept volume_id, applied before the limit like the lane filter. Activities follow the tracked jobs of that volume. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * admin: volume id filter on the plugin monitor A Volume ID box next to the execution state filter narrows the queue, execution jobs and activities to that volume's jobs, fetched with the volume_id API filter. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * admin: keep detection scans visible under the volume filter Detection activities belong to no job, so the volume-filtered activity window had none of them and the Detection Jobs table went empty. That table now reads its own job-type window. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * admin: accept zero-padded volume ids in the monitor filter Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * admin: drop a monitor refresh that finishes after a newer one Two refreshes of the same scope can finish out of order; the older one then replaced the newer rows, with empty lists when its volume-filtered fetch failed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * admin: keep rows committed for the scope when a plugin monitor refresh fails A failed request fell back to the rows captured when the refresh started, so a refresh overlapping one that had already committed the new scope's rows cleared them. Resolve the fallback when the refresh commits. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * admin: validate the monitor volume id before fetching Out-of-range ids went to the APIs and came back 400. The filter is now applied only from a valid change event, so the periodic refresh no longer reads a value still being typed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * admin: volume id filter on the job queue view The queue renders the volume-scoped rows, but the only filter box sat on the execution view, so an active filter was invisible and could not be cleared there. Both views now carry a box kept in sync. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * admin: reject unparsable volume id text instead of clearing the filter A number input holding text like "1e" reports an empty value with validity.badInput set; treat it as invalid rather than as a cleared box. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
ec34160a1a |
master, admin: report the real last heartbeat time of volume servers (#13074)
* master: report each volume server's last heartbeat time DataNode.LastSeen only moves when a volume server registers, so nothing recorded when the master last heard from it. Stamp every processed heartbeat and carry it in DataNodeInfo.last_heartbeat_ns. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * admin: show the master's last heartbeat time for volume servers The volume server details reported the admin's own clock as the last heartbeat. Use the time the master reports, and show unknown when the master does not report one. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * admin: carry the last heartbeat time into the volume servers page GetClusterVolumeServers builds its records from the master's volume list without the topology conversion, so the details dialog showed unknown. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
df98e9df3e |
admin: wait for the failed record in the worker-restart orphan test (#13079)
handleJobCompleted hands the completion to the dispatcher before it updates the tracked job, so the test could read the record while it still said assigned. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
2e81c0b7c0 |
filer: route a rename whose source misses locally to the write owner (#13064)
* filer.proto: mark a forwarded StreamRenameEntry with is_moved Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: send a rename whose source misses locally to the write owner Exclusive and conditional creates are stored on the path's write owner. With separate filer stores, a rename sent to another filer before it has replayed the create found no source and failed, so a mount that flushed a deferred create and renamed the file right after got EIO. Such a rename now goes to the source's write owner, which moves the entry and whose events are relayed to the caller, unless the owner runs on this filer's store. A forwarded rename is applied only by the filer its own ring names as the owner. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: send an AtomicRenameEntry whose source misses locally to the write owner The same race reaches the unary rename that S3, WebDAV, SFTP and fs.mv use: an object or file created through the owner and renamed through another filer before replication found no source. It is forwarded like the stream rename, with is_moved bounding it to one hop. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * rename: report a missing source as ENOENT A rename whose source is absent fails with the store's "no entry is found" error, which neither the filer's errno mapping nor the mount's message mapping recognized, so the client got EIO instead of ENOENT. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer.proto: report a forwarded AtomicRenameEntry's last event position Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: answer a forwarded rename once the owner's events are replayed here The rename's target is stored on the owner only until this filer replays it, so an unlink of that name sent here right after the rename would miss it and report success. The owner now reports the log position of the rename's last event, and the forwarding filer holds its answer (bounded) until its stream from the owner has delivered that far. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: refuse a forwarded no-replace rename over a target this filer has Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: wait for an owner this filer no longer follows before answering a forwarded rename PeersCaughtUpTo counts an untracked peer as caught up. An owner whose stream was down long enough to be dropped has replayed nothing here, so a forwarded rename answered then could leave a follow-up unlink through this filer missing the target. Require the owner to be tracked with a watermark at or past the rename, still bounded by ownerEventsCatchUpCap. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
96fd7fe6e2 |
volume: report mounted EC shards whose file on disk is gone, replaced or resized (#13069)
* volume: report mounted EC shards whose file on disk is gone, replaced or resized
Each EC heartbeat tick stats every mounted shard file and compares it with the
open descriptor: a missing path or a different file is a ghost, a size other
than the mounted one is stale_size. Mismatches are logged per shard and counted
in SeaweedFS_volumeServer_ec_shard_disk_mismatch{reason}.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* volume(rs): report mounted EC shards whose file on disk is gone, replaced or resized
Mirror of the Go check: each EC heartbeat tick compares every mounted shard
with its file (missing or another inode = ghost, other size = stale_size),
warns per shard and sets SeaweedFS_volumeServer_ec_shard_disk_mismatch{reason}.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* metrics: chart EC shards that disagree with their file on disk
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* volume(rs): tell a replaced EC shard file apart on non-unix hosts
Without inode numbers, compare the creation and modification times of the
path and of the open handle.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* volume: check mounted EC shards off the heartbeat loop
A stat stuck on a stalled disk no longer holds up heartbeats or shutdown; at
most one check runs at a time.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* volume(rs): check mounted EC shards off the heartbeat loop
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* volume(rs): compare file ids to tell a replaced EC shard file apart on Windows
Timestamps can match on a replacement file. Use the volume serial and
file index from GetFileInformationByHandle there, and dev/inode on
unix, the same identity Go's os.SameFile compares.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* volume(rs): copy mounted EC shard state out before checking the disk
The check held the store read guard across its file system calls, so a
stalled disk kept the guard and a waiting writer could then stall the
heartbeat's own read. Copy each shard's path, size and file id under
the guard and check them after it is released. The id is recorded when
the shard opens, so no extra handle is held for the check.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* volume(rs): run the EC shard disk check on a detached thread
Dropping the runtime waits for spawn_blocking tasks, so a stat stuck on
a hung disk could hold up shutdown. A plain thread is not waited on.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* volume(rs): stat the EC shard path instead of opening it
A replacement the server cannot read failed the open and was never
counted as a ghost. Compare device, inode and length from the path's
metadata, as the Go side does with os.Stat; on Windows open it with no
access rights.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* volume(rs): test the EC tick past a stalled disk check
The check thread start takes the check to run, so a test can stall one
after its snapshot and show that a writer still gets the store, the tick
still reports, and no second check starts.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* volume: keep VolumeServer int64 counters 8-byte aligned on 32-bit
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
|
||
|
|
8ab78a9a06 |
s3: return part checksums in ListParts (#13076)
* s3: return part checksums in ListParts UploadPart stores the part's checksum on the part entry and returns it, but ListParts built each Part from the SDK type, which has no CRC64NVME field, and never filled the checksum fields. List each part with its stored checksum so a client can verify an uploaded part after losing the UploadPart response. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3: name the upload's checksum algorithm and type in ListParts CreateMultipartUpload records the requested checksum algorithm and type on the upload, but ListParts never reported them. Return both, as AWS does, when the upload was created with a checksum. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
2ce8b75b3f |
ci: refresh the apt index before installing musl and cross toolchains (#13075)
The runner image's package index can name versions the mirrors have already dropped, so apt-get install fails with a 404 on the first security update after the image was built. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
b53f6d4b5e |
admin: warn when more than one scheduler runs the same maintenance work (#13065)
* admin/maintenance: report whether the running manager queues a task type Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * admin: list the EC balancers that are active at the same time The plugin ec_balance job, the legacy maintenance manager's ec_balance task and an admin_script job that runs ec.balance -apply each plan shard moves from the same topology without knowing about the others. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * admin: log a warning while more than one EC balancer is active The check runs on the maintenance metrics tick and logs again only when the set of active balancers changes. The legacy maintenance entry names the admin.toml switch that turns it off. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * admin: warn on the plugin pages when more than one EC balancer is active The scheduler status API returns the active EC balancers, and the scheduler banner on the plugin and lane pages lists them when there are two or more. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * admin/maintenance: count a task type only when a registered worker can run it Only legacy maintenance workers pull tasks from the legacy queue. With plugin workers alone, the queued ec_balance tasks never run, so they do not compete with the plugin ec_balance job. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * admin: parse ec.balance apply flags like the flag package A value counts only when strconv.ParseBool reads it as true, and a # token ends the arguments, as it does for the shell command's flag parser. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * admin/maintenance: skip legacy workers past their heartbeat timeout A disconnected worker keeps its queue record until the cleanup loop removes it, so the capability check also requires a heartbeat within the worker timeout. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * admin: count ec.balance only when its flags parse the way the command parses them An invalid boolean in -apply or -force fails the whole command, the last value of a flag wins, -force overrides -apply, and parsing stops at the first non-flag argument. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * shell: share ec.balance's flag set and report whether its arguments apply the plan Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * admin: count an admin_script ec.balance only when ec.balance accepts its flags Unknown flags and invalid values of any flag fail the command before it can move shards, so they no longer count as an active balancer. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * shell, plugin/worker: move admin_script command tokenizing into the shell package Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * admin: split admin_script ec.balance arguments with the executor's tokenizer A quoted value with spaces is one argument to ec.balance, so flags after it are still seen. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * shell: report through one lookup whether a command's arguments change the cluster ec.balance now also rejects an invalid -volumeIds, as its Do does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * shell: report whether volume.balance arguments apply its plan Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * shell: report whether ec.encode accepts its arguments ec.encode has no dry run, so any accepted invocation changes the cluster. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * shell: report whether volume.vacuum accepts its arguments Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * admin: report overlap for every maintenance work that more than one scheduler runs The plugin scheduler, the legacy maintenance manager, and an admin_script can each run volume balance, EC balance, EC encoding, and vacuum. Check all four from one table and report each work with two or more active runners, in the log and in the scheduler-status API as maintenance_overlaps. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * admin: show each maintenance overlap on the plugin pages Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
1e4739f97a |
s3api: count object reads that fail after the status line is sent (#13073)
* s3api: count object reads that fail after the status line is sent
A GET whose body breaks after the 200/206 was committed is recorded by
SeaweedFS_s3_request_total as a success and only shows up in the log.
SeaweedFS_s3_read_aborted_total{bucket,cause} counts these reads on the
volume-server, SSE and remote-mount stream paths, split into
client_canceled, deadline_exceeded and read_error, and is dropped with
the other per-bucket series when a bucket is deleted.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* grafana: plot aborted S3 reads by bucket and cause
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* s3api: count aborted reads of inline objects and directory content
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* s3api: count gRPC deadline failures as deadline_exceeded aborted reads
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* s3api: count an aborted read as client_canceled only when its request was canceled
A context.Canceled error under a live request context comes from an
internal cancellation, such as a shared lookup canceled by another
request, so it is recorded as read_error.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
|
||
|
|
ef633dcc4d |
admin: inspect an S3 object's versions, retention and chunk volume health (#13078)
* admin: inspect an S3 object's versions, retention and chunk volumes For a bucket and key, collect the base entry and every entry under <key>.versions, decode version id, delete marker, ETag, client checksum, Object Lock mode, retain-until, legal hold and the WORM enforcement time, and map each chunk to its volume. One filtered VolumeList then reports, per volume, replicas present versus the replica placement, or the EC shards present and missing against the data shard count. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * admin: serve the S3 object inspection at /api/s3/buckets/{bucket}/objects/inspect Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * admin: add an Inspect Object page for a bucket and key /object-store/buckets/{bucket}/inspect?key= renders the inspection: volume health per chunk volume with a link to the volume or EC volume page, then every version with size, mtime, ETag, client checksum, lock mode, retain-until, legal hold, WORM time and its chunk file ids. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * admin: link each bucket to the object inspector Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * admin: inspect a key that is also a prefix of other keys The filer keeps such an object on a directory entry marked as a prefix object, so the base entry lookup must accept it like a file. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * admin: count only S3 version entries as an object's history A sibling named <key>.versions is history only when it is a directory, and only children with a version id (attribute or v_ file name, as VersionIdFromEntry reads them) are versions. Without a base object or any such version the inspection is not found. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * admin: mark the newest version latest when the pointer is missing When the base object is gone and .versions has no latest pointer (for example after deleting a current null version), pick the latest with the S3 gateway's own version ordering, exported as SelectLatestVersionId, instead of leaving every version noncurrent. A truncated listing marks none, since it may not hold the newest version. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * admin: report the ETag the S3 gateway returns Use objectETag, exported as ObjectETag, so remote-only entries show their remote ETag and entries without a stored ETag or MD5 show the chunk-derived one. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * admin: read the buckets path with the inspection's request context Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * admin: report the filer's logical size for each inspected version filer.FileSize also covers chunk extents past a stale attribute size and a newer remote size. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * admin: drop EC shard state once a volume also reports a replica Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * admin: let the latest-version pointer outrank the null-is-latest flag Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * admin: page the inspector's version scan past non-version entries Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * admin: judge an inspected EC volume by its newest encode run Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
ebe5c8ac91 | docs: regenerate star history chart | ||
|
|
46fe0f10da |
volume: count failed EC shard copies by reason (#13068)
* volume: count failed EC shard copies by reason
Each failed VolumeEcShardsCopy now increments
SeaweedFS_volumeServer_ec_shard_copy_failures_total{collection,reason} and
logs the volume, shards, source and reason. Reasons: source_not_found,
empty_index, no_space, timeout, io_error, other.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* grafana: chart EC shard copy failures by reason
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* volume(rs): count failed EC shard copies by reason
Mirrors the Go volume server: each failed VolumeEcShardsCopy increments
SeaweedFS_volumeServer_ec_shard_copy_failures_total{collection,reason}
with the same reasons and logs the volume, shards, source and reason.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* volume: classify wrapped gRPC NotFound and DeadlineExceeded copy errors
A source status that the destination wraps as text keeps its code only as
"code = NotFound" (Go) or the code's description (Rust), so match those
too.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* volume(rs): record EC copy failures inside the copy task
The copy keeps running after the caller cancels, so its failure is
reported from the spawned task; a join error is reported by the handler.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
|
||
|
|
b6237dd8b1 |
master, admin, shell: warn about volume servers left in the default data center or rack (#13066)
* master: warn when a volume server registers in the default data center or rack A volume server started without -dataCenter or -rack lands in DefaultDataCenter/DefaultRack. Next to servers with explicit placement it becomes its own failure domain for placement and balancing. Log a warning when such a server registers while other servers name their data center, or other racks of the same data center are named. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * admin: warn about volume servers left in the default data center or rack The Volume Servers page lists the servers that fell back to DefaultDataCenter or DefaultRack while other servers name theirs, with their volume and EC shard counts, so the stray failure domain shows up before placement and balancing act on it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * shell: cluster.check warns about volume servers in the default data center or rack Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * shell: cluster.check prints placement warnings before the capacity checks A disk type with no free slots made cluster.check return before the default data center/rack warnings were printed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * admin: list each data center's rack once in the default placement check Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
8df718eaf3 |
build(deps): bump actions/dependency-review-action from 5.0.0 to 5.0.1 (#12929)
Bumps [actions/dependency-review-action](https://github.com/actions/dependency-review-action) from 5.0.0 to 5.0.1. - [Release notes](https://github.com/actions/dependency-review-action/releases) - [Commits](https://github.com/actions/dependency-review-action/compare/a1d282b36b6f3519aa1f3fc636f609c47dddb294...bbc44d14a204704ccc493733616cd1e93a0321ec) --- updated-dependencies: - dependency-name: actions/dependency-review-action dependency-version: 5.0.1 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> |
||
|
|
76bc731c69 |
feat: s3: record object path in needle Content-Location pair (#13061)
* feat: operation: pass needle pairs through chunked uploads (#12997) * feat: s3: build Content-Location needle pair from the object path (#12997) * feat: s3: record object path in needles written by putToFiler (#12997) * feat: s3: record destination object path in copied chunks (#12997) * feat: s3: record destination object path in stream-copied chunks (#12997) * test: s3: pin Content-Location in putToFiler upload options (#12997) * s3: record no path on copies of volume-encrypted chunks A chunk written with -encryptVolumeData is copied as ciphertext through the plain upload path, so the copy sent the destination path in plaintext next to encrypted data, while PutObject's cipher upload sends no pairs at all. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
bf0da715fc |
ci: keep dev builds published and document them (#13059)
* ci: keep dev builds published and document them The dev release was emptied before every build: the cleanup job deleted all weed-* assets first, and cancel-in-progress cancelled the build on the next master push. Build the platforms with one prepare timestamp, upload first, then prune assets from older builds. Queue runs instead of cancelling them, and allow manual runs from master only. Document the dev binaries and the :dev container images in the README and docker/README.md. Refs #5009 * ci: key dev build concurrency by ref A workflow_dispatch from another branch joined the single dev group and replaced the pending master run before failing its ref guard, so the newest master commit was never built. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * ci: keep newer dev builds when an older run retries A "Re-run failed jobs" of an older run keeps that run's BUILD_TIME, so its prune treated a newer complete build as stale and deleted it. Prune now deletes only assets whose stamp sorts before BUILD_TIME. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
978ff95327 |
volume(rs): reload TLS server certificates on SIGHUP (#13067)
The Go volume server re-reads its gRPC and HTTPS cert/key files on SIGHUP (certreload.ReloadAll). The Rust server built each rustls ServerConfig with a fixed cert, so a rotated pair only took effect after a restart. Serve the pair through a resolver that re-reads the files on SIGHUP and keeps the previous pair when the new files fail to load. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
b0df54aa8f |
security: reload TLS credentials on SIGHUP (#13058)
TLS certs currently refresh only on the periodic WEED_TLS_CERT_REFRESH_INTERVAL poll (5h by default), so after replacing cert/key files an operator has to wait up to one interval for the new material to be used. SIGHUP already reloads configs and JWT keys, but not TLS. Replace gRPC's pemfile.Provider with a small certprovider.Provider in weed/security/certreload that keeps the current KeyMaterial, refreshes on the same timer, and can be forced to re-read the files via Reload. A process-wide registry plus grace.OnReload(ReloadAll) makes SIGHUP apply rotated certs immediately to every gRPC and HTTPS server/client. On parse/read errors the previous material is kept, so a broken rotation does not take the listener down. Fixes #13056 Co-authored-by: whitefox <whitefox@mayflower.work> |
||
|
|
7bbb65fa80 |
master: /col/delete requires an explicit collection name (#13055)
* master: /col/delete requires an explicit collection name A /col/delete request without a collection parameter, or with an empty one, read as the empty-named default collection and deleted it. Return 400 instead, and accept collection=_default (the keyword weed shell uses) to delete the default collection deliberately. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * master: keep a collection literally named _default addressable by /col/delete collection=_default now names the empty-named collection. A collection created with that literal name would have been unreachable, and a request meant for it would have deleted the default collection instead. Resolve the keyword to the literal collection when one exists, and refuse the request when both exist. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * master: /col/delete accepts only the DELETE method A GET is expected to be safe, yet a bare GET or a link prefetch deleted the named collection. Any other method now gets 405 with an Allow header, and the docs, benchmark help and test helpers send DELETE. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * master: /col/delete accepts _default_ for the default collection When a collection literally named _default exists next to the default collection, collection=_default is refused, which left the default collection with no way to be named. Accept the _default_ spelling that weed shell collection.delete already takes; it always means the default collection. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * master: /col/delete keeps a literal _default_ collection addressable _default_ now resolves like _default: to the literal collection when one exists, to the default collection otherwise, and refuses the request when both exist. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * REST_API: /col/delete when both keyword names are literal collections Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com> |
||
|
|
96321141cc |
filer.sync: stop deleting versions on transient lookups and in-flight pointers (#13063)
* filer.sync: retry an update whose destination lookup failed transiently FilerSink.UpdateEntry reported every lookup error as a missing entry, so the replicator and filer.sync deleted the destination key and created it again. For a directory, a canceled or unavailable lookup removed it with everything under it. Only a real not-found now lets the caller recreate the key; other lookup errors are returned for retry. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3: leave a pointer to a recently minted version unrepaired When a versioned read finds a latest pointer whose version file is missing, the self-heal rescanned .versions and then either removed the directory (no version left) or rewrote the pointer to the newest version found. With filer.sync the directory and its pointer can arrive before the version file, so the heal acted on a version still in flight: the local directory removal replicated back and deleted the committed version on the source cluster, and a pointer repair would roll its latest pointer back. While the pointer names a version minted in the last ten minutes, the read now answers from the rescan without persisting anything, and the reconciler skips the key. After that window the heal works as before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer.sync: retry a failed destination lookup before giving up on an update Returning a transient lookup error leaves the retry to the caller, and filer.replicate hands a failed event to the notification input instead of replaying it. Retry the lookup in place with the shared bounded backoff; a not-found still returns at once. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer.sync: count only the not-found sentinel as a missing destination LookupEntry already maps every miss to filer_pb.ErrNotFound, plain-text ones included. Matching the sentinel's text in any error also counted an Unavailable lookup carrying that text as a miss, which let the caller delete and recreate the key. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3: requeue an in-flight versions pointer for after the grace window The reconciler dropped a key whose pointer named a version still in flight, so nothing revisited it once the window passed. Requeue it for one grace window without counting the skip as an attempt. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3: probe the latest version file before deferring an in-flight pointer A recent pointer whose version file is already present needs no repair; deferring it kept the key queued for the whole grace window and used up queue capacity. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3: retry an in-flight versions pointer when its grace runs out The reconciler waited a full grace window after the deferral, so a pointer first seen near the end of its grace stayed unrepaired for almost twice as long. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3: run the in-flight pointer grace from its local commit too The grace was measured from the version id's mint time on the origin cluster against the local clock, so a peer whose clock ran more than the grace ahead, or a filer.sync backlog longer than the grace, saw a just-synced pointer as stale and could remove or roll back the version. The .versions entry's commit time is stamped by the local filer when the pointer is stored, so it bounds the wait with the local clock. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3: repair a pointerless .versions entry despite a recent commit The in-flight grace protects a pointer whose version file has not arrived yet. A .versions entry with no pointer names no such file, so a recent commit of it must not hold back the rebuild of its pointer. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3: hold a stale-pointer repair while the live entry is still in grace The heal checked the grace on the snapshot it took before the scan. A .versions entry stored again with the same pointer during the scan restarts the grace, so check it on the live entry the CAS is conditioned on before persisting the repair. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3: recheck the live grace before removing an empty .versions The empty-directory cleanup checked the grace on the pre-scan snapshot, so a pointer stored again during the scan could still have its .versions removed. Re-read the entry and leave it while its grace lasts. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
e01133bfa3 |
ec_balance: keep node addresses out of the task ID so tasks can be persisted (#13062)
* ec_balance: keep node addresses out of the task ID The ID embedded both host:port node addresses, and the admin's task persistence rejects any ID containing ':', so every ec_balance task failed to save on each state change and lived only in memory. The volume, shard, timestamp and index already make the ID unique; the nodes stay in the task's Reason and params. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * admin: test that a detected ec_balance task saves and loads Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
77333a5578 |
s3: match copy-source ETag conditions with the shared helper (#13054)
* s3: match copy-source ETags as the read and write paths do validateSourceConditionalHeaders compared the source ETag to the header value with strings.Trim, so x-amz-copy-source-if-none-match: W/"<etag>" did not match and an unchanged source was copied instead of answered with 412. An If-Match list that contained the source's ETag was rejected for the same reason. RenameObject shares the helper, so x-amz-rename-source-if-* behaved the same way. Use util.ETagListMatches, which the GET and PUT paths already use: strong comparison for If-Match, weak for If-None-Match, and the quoted tag lists RFC 9110 allows. * s3: drop the history comment from the copy-source ETag checks Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mount: skip the truncate manifest test on freebsd like its fake filer Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
397a156104 |
security: a fips.mode setting that Go checks against GODEBUG and the Rust binaries apply to TLS (#13029)
* util: refuse to start when fips.mode in security.toml disagrees with GODEBUG security.toml gains [fips] mode = "off" | "on" | "strict", also settable as WEED_FIPS_MODE: one setting that states the FIPS 140-3 mode of every process in a deployment, so the Rust binaries, which do not run on the Go runtime, can follow it. Go processes keep taking their behaviour from GODEBUG=fips140 and now check it against the setting: LoadSecurityConfiguration and `weed worker` exit when "off" runs without fips140=off, "on" without fips140=on, or "strict" without fips140=only, naming the setting and the GODEBUG value it needs. An unknown value is refused; unset or empty changes nothing. Refs #12839 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * rust: fips.mode with FIPS-mode TLS in weed-volume, weed-worker and weed-vector seaweed-common gains a fips module: FipsMode resolved from fips.mode in the security.toml a binary uses, with WEED_FIPS_MODE over it. Each binary resolves it once at startup, logs it and installs the matching rustls provider as the process default, refusing to start on an unknown value or when another provider was installed first. Under "on" and "strict" the provider is aws-lc-rs filtered to the lists Go's crypto/tls applies in FIPS mode: TLS 1.3 AES-GCM suites and TLS 1.2 ECDHE AES-GCM suites (no ChaCha20-Poly1305), X25519MLKEM768, SecP256r1MLKEM768, P-256 and P-384 (no plain X25519), Go's ten signature schemes (no ML-DSA). Configurations SeaweedFS builds require the Extended Master Secret in that mode, and the volume server refuses a non-FIPS suite in tls.cipher_suites instead of falling back. sw-client installs the same provider instead of ring. Unset or "off" keeps aws-lc-rs's default provider unchanged. This is behavioural parity only: the provider still runs on the non-validated aws-lc-rs build. Refs #12839 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * util: refuse a fips.mode that is not a string viper's GetString turns an array or a table into "", so mode = ["strict"] under [fips] skipped the GODEBUG check while the Rust binaries refused the same file. RequireFipsMode now reads the raw value (ViperProxy.Get, under its lock) and exits when it is not a string, naming its source; an absent or empty value still means unset, and WEED_FIPS_MODE still wins. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * rust: read fips.mode with the parser that reads the JWT keys seaweed_common::fips::resolve parsed security.toml with the toml crate, while the volume server reads the rest of the file with its own lenient loader. A file with [fips] mode = "on" beside an unquoted value the loader accepts resolved to off and logged "fips.mode unset", although the JWT keys from the same file were applied. Each binary now reads fips.mode with the loader it uses for everything else and hands the value to resolve: the volume server through its line parser, the worker and vector engine through their parsed Security table, which already refuses a file that is not TOML. A security.toml the volume server finds but cannot read stops startup. A missing setting is still off, and WEED_FIPS_MODE still wins. seaweed-common no longer depends on toml. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * sw-client: offer only FIPS signature schemes with insecure_skip_verify With https.client.insecure_skip_verify, reqwest installs its own verifier, which advertises a fixed scheme list including SHA-1 and Ed448 whatever the process provider allows. In FIPS mode the volume transport now builds its rustls configuration itself on the process provider: the server certificate and host name are not checked, as the setting asks, but handshake signatures are verified with the provider's algorithms, only its schemes are offered, and TLS 1.2 requires the Extended Master Secret. Outside FIPS mode the reqwest path is unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * seaweed-common: sign only with Go 1.27's FIPS schemes, allow ML-DSA The FIPS provider kept aws-lc-rs's key provider, so a FIPS-mode listener signed handshakes with whatever scheme its key and the peer agreed on, outside the list the provider verifies with. Keys now load through a provider that limits each key to the FIPS signature schemes and refuses a key that can sign none of them, such as Ed448; the volume server and the worker's gRPC TLS name the certificate and key files in that error. The lists follow Go 1.27.4, which go.mod now requires: its defaults_fips140.go allows ML-DSA-44, -65 and -87 as signature schemes and ML-DSA certificate keys (for Go's native module only), so they are allowed here as well. Go also allows MLKEM1024 but does not enable it by default, so it stays out of the key exchange list as in Go's defaults. "off" keeps the default key provider. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mount: skip the truncate manifest test on freebsd like its fake filer Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com> |
||
|
|
977513cf35 |
build(deps): bump github/codeql-action from 4.39.3 to 4.39.4 (#12930)
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 4.39.3 to 4.39.4. - [Release notes](https://github.com/github/codeql-action/releases) - [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md) - [Commits](https://github.com/github/codeql-action/compare/v4.39.3...v4.39.4) --- updated-dependencies: - dependency-name: github/codeql-action dependency-version: 4.39.4 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> |
||
|
|
781288cf11 | s3api: ignore custom x- query parameters on bucket requests (#13046) | ||
|
|
eb655f46ba |
mount: merge a flush's folded chunks as the chunks, not as a new manifest (#13043)
* mount: merge a flush's folded chunks as the chunks, not as a new manifest A flush folds the handle's chunks into manifests before it commits, and installs the folded list in the handle. When the commit finds that a peer changed the entry, mergeContentEntry replays the handle's changes since its base onto the peer's entry: a chunk not in the base counts as the handle's own write, a base chunk missing from the handle as one it dropped. A manifest the flush just made of base chunks therefore goes in as a write of the handle's, with every chunk it holds: - after a peer rewrote the whole file (a bloat merge, stamped with the oldest data it holds) or dropped chunks, the manifest brings the old chunks back, and where their stamps are newer they hide the peer's bytes; - after a peer folded the same chunks, the entry holds both manifests. Since #12462 a flush folds every 256 small chunks, so two mounts that append to one file, as the ranks of a training job often do with its log, reach this. The flush now records what its fold packed (chunkFold). The merge sees the folded chunks instead of the new manifests, so the fold is no change at all; the merged entry goes out unfolded, and the next flush folds it again. When the commit fails, the fold is taken back out of the handle, whose base still has the chunks, so a later merge or flush does not take the manifests for writes either. Their blobs are left unreferenced, as a failed fold leaves them. * mount: rebase a merged flush onto the entry the filer stored Review follow-up. A merged commit sends the merged chunks unfolded, and the filer can fold them before it stores the entry (cleanupChunks). The flush installed the request in the handle, but took the stored entry as the handle's base (ackedBase), so the handle held flat chunks against a base that lists a manifest. A later merge, such as a peer's truncate reaching the dirty handle, would take those chunks for writes of the handle's and publish them again. The handle is now rebased onto the stored entry it takes as its base, in both flush paths. rebaseEntry still gets the request, so chunks attached after it was taken are kept. TestFlushMergeInstallsTheEntryTheFilerStored: a peer's chmod refuses the first commit, the merged retry sends 256 flat chunks, and a filer that folds them stores a manifest; the handle and its base must both hold the stored entry. It fails with the request installed. |
||
|
|
424c67ad06 |
mount: truncate a manifest the cut goes through as the chunks it holds (#13042)
* mount: truncate a manifest the cut goes through as the chunks it holds Truncating a file shortens every chunk the new size cuts through, a manifest chunk included. A manifest's span only says where its chunks lie: reads resolve the chunks inside it at their own offsets and sizes, so the bytes past the cut stay readable. Once the file grows over them again without writing them, by an extending truncate or a write past the end, they come back where zeros belong. Reproduced with weed mount on a local cluster: 700 lines appended with one close() each, so the small-chunk fold put the first 256 into a manifest; then a truncate to the first 100 lines and an ftruncate past the old end. The extended range read 8,580 bytes of the cut lines instead of zeros, through both mounts of the file. Since #12462 any file grown by a few hundred small appends has manifests; before it, only files of 10,000 chunks did. A truncate now opens each manifest the cut goes through, nested ones too, and cuts the chunks it holds. The manifest leaves the entry, and the filer deletes it with the chunks past the cut when the entry is stored. A manifest shortened by an earlier truncate first gives up the chunks past its own span. If a manifest cannot be read, the truncate fails with EIO and the file is left as it was. * mount: keep a truncate's expanded chunks from merges, read its manifests with a token Review follow-ups: - The chunks a truncate takes out of a manifest are not in the handle's base, which lists the manifest. A merge onto a peer's entry took them for writes of the handle's, so after a peer cut the file shorter and the filer queued the rest for deletion, the handle could publish references to those chunks again; the gap check passed because plain chunks covered the range. Before the expansion, the manifest across the cut refused that merge. A truncate that expands a manifest now marks the handle as having rewritten its chunks, so the merge is refused when the peer changed chunks, at the next flush and when the peer's event reaches the handle. - A truncate by path, with no open handle, read the manifest before its file id was registered for a filer-issued read token, so a mount reading with -volumeReadAuth sent the read without one and the truncate failed with EIO. The entry's chunks are registered under its path first. - All manifest reads of one truncate share one one-minute deadline, instead of a minute each. TestTruncateThroughManifestCutsItsChunks runs SetAttr with and without an open handle: it fails without the registration (no handle) and without the rewrite mark (open handle). TestMergeRefusesTruncateExpansionOverPeerTruncate shows the merge that published a peer-dropped chunk, and its refusal. * mount: answer a truncate interrupted while reading a manifest with EINTR Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
be8eb02ac0 |
util: remove multipart temp files parsed on the idle-timeout pause's request copy (#13044)
* util: remove multipart temp files parsed on the paused request copy net/http removes the temporary files of a multipart form parsed on the Request it passed to the handler. PauseIdleTimeoutWhileHandling hands the handler a shallow copy when the request has a body, so a form parsed there (ParseMultipartForm, or FormValue on a multipart body) left its temporary files behind. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * util: test that the idle-timeout pause removes multipart temp files Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * util: point the multipart temp-file test's temp dir at Windows' TMP and TEMP too Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
f2e9e49842 |
master: stop volume growth from leaking volumes into a just-deleted collection (#13035)
* topology: stop a grow once a delete fences its collection A grow request creates its volumes one after another and resolves the collection by name for each, so once the collection was deleted the rest of the request recreated it. The request now keeps the collection it started in and holds a per-collection fence shared while it creates each volume. A delete can raise the fence exclusively, which waits out the volume in flight, and the request stops at its next volume. A collection dropped only because its last layout emptied is followed to the one published under its name. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * master: fence volume growth before deleting a collection The delete listed the collection's servers, fanned out DeleteCollection, and only then dropped the collection from the topology. A grow still running created its next volumes during or after the fan-out, on servers that had already been cleaned or were not in the list, and those volumes registered a new layout for the deleted collection that nothing removed. A bucket deleted right after its first write leaked most of its initial volumes this way. The delete now raises the collection's growth fence first, so the volume in flight registers and is deleted with the rest, and the grow stops. A failed fan-out lifts the fence, since the collection stays in place. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * topology: refuse assigns from a collection being deleted The delete waits for the volume a grow is creating before it lists the collection's servers, and the collection's writable volumes stayed assignable meanwhile, so a write could land in a volume about to be deleted. The delete now raises the fence before it waits, and assigns check it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * topology: list only collections that hold a volume layout A grow request publishes its collection before its first volume registers, so one that created nothing left a collection with no volume in the list. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * topology: queue no grow for a collection being deleted PickForWrite returned the layout's shouldGrow before it checked the fence, so an assign on an empty layout of a collection being deleted still queued a grow. That grow could run after the delete finished and recreate the collection. Check the fence right after the pick, before any early return. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * topology: keep an emptied collection published while growth holds it DeleteLayout unpublished a collection as soon as its last layout emptied, even while a grow held it or a delete had fenced it. The volume in flight then registered by name into a new collection that the delete never listed servers for, and the delete's final DeleteCollection dropped it from the topology while it stayed on disk. Unpublish an empty collection only when no grow or delete holds it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * topology: fence the collection still published under the name An emptied-layout cleanup that passed its fence check could unpublish the collection while the delete waited to fence it. The delete then fenced and listed an orphaned object, while growth published a new collection under the name that no fence held. Topology.FenceGrowth re-checks publication once the fence is up and moves to the collection published since. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * topology: run one delete of a collection at a time Two deletes of one collection both fenced it and fanned out by name. Once the first removed it, a write could recreate the collection, and the second delete removed the new one's volumes and topology entry. FenceGrowth now waits for a delete already running on the collection and finds nothing once that delete removed it; a delete that failed hands the collection to the one waiting. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * topology: stop a delete another delete beat to the collection A delete that fenced the collection but had not yet checked that it was still published retried when it was not, for the collection an emptied layout drops. A delete that removed it in between also left it unpublished, so the retry fenced and returned the collection a write had recreated under the name since. finish(true) now marks the collection deleted before it unpublishes it, and the retry stops at that mark. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * master: keep the name fenced through the EC pass of a delete The normal pass unpublished the collection and let growth back in before the EC pass ran. The EC pass deletes by name on every server holding the collection's shards, and DeleteCollection on a server also drops its normal volumes, so a write recreating the bucket in between could land a volume that the EC pass then deleted. A second delete of the name, finding no collection, also ran its own EC pass by name. deleteCollection now fences the name once, before either pass, and lifts or ends the fence after both. finish(true) unpublishes the collection then. A name with EC shards only gets an empty collection to fence, so an assign under it is refused too, and a delete that finds nothing skips both passes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * topology: wait for the second delete's lock instead of sleeping The overlapping-delete tests slept before acting on the first delete. A second delete scheduled late started after the collection was replaced, or after the first delete was already over, so the tests could fail or pass without the overlap they check. They now wait until the second delete is blocked on the delete lock, read from the goroutine stacks. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * topology: empty the layout through UnRegisterVolumeLayout in the test The test called DeleteLayout, whose signature differs in builds that key layouts by more than replication, TTL and disk type. UnRegisterVolumeLayout reaches the same cleanup from a VolumeInfo and has one signature everywhere. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
8053e77813 |
s3api: decide existing-object-tag denies on the object's tags (#13038)
* s3api: report a bucket policy Deny on existing object tags HasExistingObjectTagDeny tells whether a bucket policy has a Deny statement conditioned on s3:ExistingObjectTag/<key>, so the auth layer knows when a deny may turn on tags it has not read yet. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3api: decide existing-object-tag denies on the object's tags The auth layer evaluates the bucket policy before the handler reads the object, so s3:ExistingObjectTag/<key> resolves to a missing tag. A Deny with a negated condition (StringNotEquals, StringNotLike, StringNotEqualsIgnoreCase, Null true) then matched every object and was final, even one whose tag satisfies it, as in the deny-until-scanned-clean pattern. When that early evaluation denies and the policy has such a Deny, look up the object's entry and evaluate again with its tags. A missing object or a failed lookup keeps the deny. Copy sources and per-key checks that go through authorizeObjectKeyAction get the same treatment. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3api: give identity checks the object tags a Deny was decided on With IAM integration, VerifyActionPermission evaluates the mirrored bucket policy again alongside the identity's policies, from a condition context built from the request alone. The negated existing-tag Deny matched there once more and denied an object tagged to pass it. evaluateBucketPolicy now returns the request carrying the tags it read, and RequestConditionValues reports them as s3:ExistingObjectTag/<key>. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3api: recheck in-flight tag conditions on the version served An in-flight request is authorized again when access changes. The entry lookup read the version current by then, so a newer version tagged to pass the Deny could keep a download of an older, denied version running. The handler's entry recheck now records the entry it authorized on the tracked request, and the re-check decides on that entry. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3api: load the bucket before deciding an object request on its policy On a bucket whose policy was not loaded yet, the early bucket policy check found no policy and skipped the object-tag lookup, so the identity checks saw the request without the object's tags. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3api: keep an owned copy of the entry a tracked request served Handlers change the entry's metadata after the check, for example when storing new tags, so revalidation read a map the handler was writing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
aaca5c8c0a |
s3: verify SigV4 header values with each SDK's Trimall (Go, Java, botocore) (#13036)
* s3: trim only ASCII spaces in SigV4 canonical header values
signV4TrimAll used strings.Fields, which also splits on Unicode spaces
(U+00A0, U+202F, ...). A signed header whose value holds one inside, such
as an x-amz-meta-* filename from a macOS screenshot ("... at 2.20.09 PM"),
got a different canonical request than the client signed, and the request
failed with SignatureDoesNotMatch. Trim and compress only ' ', as the AWS
SDKs do (aws-sdk-go-v2's v4.StripExcessSpaces).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* s3: verify SigV4 with both clients' Trimall for non-ASCII-space whitespace
The AWS SDK for Go v2 collapses only ASCII spaces in a signed header value and
trims the edges with strings.TrimSpace; botocore turns every whitespace
character into a space. Match the Go SDK first (now also trimming Unicode
whitespace at the edges) and, when it gives a different canonical request,
retry with the previous strings.Fields form so botocore signatures keep
verifying.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* s3: pass the header value trim to getCanonicalRequest and getCanonicalHeaders
Fold canonicalRequestWith and canonicalHeadersWith into the existing
functions instead of keeping them as wrappers.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* s3: also verify SigV4 header values with the AWS SDK for Java Trimall
The Java SDKs collapse runs of spaces and tabs but keep Unicode spaces, so
a value with both a tab and a U+00A0/U+202F matched neither the Go SDK nor
the botocore form. It is tried between the two, so a value with only one
kind of whitespace still computes at most two signatures.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Bear1110 <14165451+Bear1110@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com>
|