mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-12-04 18:17:16 +01:00
576eb98ce936abb01ff02a2da4ecf4e1b49b4416
16609
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
576eb98ce9 |
mount: leave -cacheMinFreeSpace free on the chunk cache's disk (#13124)
* mount: leave -cacheMinFreeSpace free on the chunk cache's disk weed mount sizes its on-disk chunk cache by -cacheCapacityMB alone and preallocates each cache file in full when it creates it. With a capacity larger than the free space of the disk holding -cacheDir, the cache takes that disk down to nothing: the preallocations run until fallocate fails, and chunk writes fill the rest. The mount's metadata cache (a leveldb store under -cacheDir) and the swap files of dirty pages (-cacheDirWrite, which defaults to -cacheDir) live on the same disk, so once it is full their writes fail with ENOSPC, and writes whose dirty pages spill to swap return EIO to the application. The same happens when several mounts share a cache disk and together are configured beyond it. -cacheMinFreeSpace is the free space the cache leaves on that disk, written like the volume server's -minFreeSpace: a percentage like 1 or a size like 10GiB, 1 by default, as for volume servers. - When the cache opens, its disk layers shrink to the space above the floor, counting the cache files already in the directory as the cache's own. With no room the disk tier keeps no files. - Each new cache file preallocates only what the disk holds above the floor at that moment, so the files of one cache, or the caches of several mounts opening together, stop reserving at the floor. - A chunk write that lands in blocks its file already holds, preallocated or written, goes ahead as before, even with the disk under the floor. A write that takes new disk space, into a file a rotation truncated or where nothing could be preallocated, goes ahead only while the space above the floor covers it. The disk is read at most once a second, and the cache counts what it takes in between, so it cannot run past the floor between readings. A rotation gives the truncated file's blocks back, so the write after it reads the disk again. A chunk the cache cannot place is not cached, like any other miss. The webdav server's cache passes no floor and behaves as before. * mount: read the cache disk on every write that takes space, leave the index files room Review follow-ups. - take reads the disk each time, instead of once a second less what the cache took since, so a write sees what other mounts sharing the disk wrote, and what a rotation gave back. It runs only for writes past the blocks a file already holds, and a statfs costs little next to the write. - The index files (.idx and the leveldb maps) grow by a few dozen bytes a chunk beside the data files that the cache size counts. Sizing leaves them a sixteenth of the room above the floor. - The cache's own files count as room by the blocks they hold, so a file that was preallocated but not yet written when the mount exited counts in full when the cache reopens. - weed fuse checks -o cacheMinFreeSpace in the parent as well: the parent waits for the child's signal, and a child that rejects the value never sends it. * mount: keep the resolveCacheDirs doc comment on resolveCacheDirs Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mount: say -cacheMinFreeSpace stops new disk space, not every chunk Under the floor the cache still fills the blocks its files already hold. 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> |
||
|
|
7a5c12a8b0 |
filer: order finished reader cache downloads by a counter (#13125)
Eviction picked the oldest finished download by the wall clock time it finished at, and only counted downloads that finished before time.Now(). A download that finished in the same clock tick as the eviction didn't count, so the loop fell back to a chunk a stream was still reading, and two pinned downloads that finished in the same tick tied. After a wall clock step back, downloads that finished before the step didn't count either, and with none of them pinned nothing was evicted and the cache grew past its limit. Finished downloads now take the next value of a counter on the cache, which never ties or steps back. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
ecd0493906 |
mount: keep following the metadata log when the cache refuses an event (#13141)
* mount: keep following the metadata log when the cache refuses an event The mount applies each event of the filer's metadata log to its local metadata cache, a leveldb store under -cacheDir. Once that disk is full every write to the store fails, and an event the cache refuses goes one of two ways: - An event the stream delivers fails the follow, which the mount runs with FatalOnError: glog.Fatalf ends the process, every file open on the mount goes with it, and the mount does not come back when the disk has room again. - An event replayed from the persisted log is returned to the follow loop, which resubscribes from it and fails on it again: the mount stays up, but no later event reaches its cache, so its listings stop changing. A local change whose apply fails (create, mkdir, unlink, rmdir) drops its directory's cached listing with InvalidateChildrenCache and goes on. An event from the log now does the same: the cached listings it changes, the parents it leaves and enters and a directory it creates, moves or deletes, are dropped, so the next lookup reads the filer and the next listing rebuilds them, and the event's kernel invalidations still go out. The follow goes on. A warning reports the first such event and then at most one a minute. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mount: handle a refused event in the apply step that refused it Review of the previous commit found two gaps. A rename into a directory whose listing is being built applies the part leaving the source at once and keeps the part entering the building directory for the build to replay. When the part applied at once was refused, the other part was not kept, and the build published its listing without the renamed file. It is now kept whatever happens to the part applied at once. The listings a refused event changes were dropped, and its kernel invalidations sent, by the follow's event function after the apply returned. By then the apply loop could have taken a later request, such as this mount's own create of the name a rename left, and the rename's invalidation would then move the new file. The apply step that fails now does both before it returns, as it sends the side effects of an event the store takes, and on the apply loop, which owns buildingDirs and is the only one to feed the invalidate worker. A local change whose apply fails gets the same; its caller still drops its directory's listing as before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
3c7b3fc16f |
mount: fail an unlink or rename the filer did not apply (#13140)
* mount: fail an unlink the filer did not apply * mount: hold an unlinked handle's flushes until the filer answers * mount: mark a rename's replaced handle once the filer answers * mount: read a draining handle's unlink mark under its lock Unlink now sets the mark after the delete answers, while a close queued before it can be draining, so the worker's bare read raced the write. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mount: drop the unlink comment about marking before the delete Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mount: wait for the close to block on the handle lock in the unlink and rename tests Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mount: wait on the handle lock with the untagged helper in the rename close test waitAttributeReadFrame lives in a !freebsd test file, so the FreeBSD test build failed on weedfs_rename_publish_test.go. 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> |
||
|
|
d4a21cef59 |
weed: flush buffered log lines when a command exits (#13151)
exit() ends the process with os.Exit, which skips deferred calls, and glog writes its files only every 30s. A short-lived command such as a piped weed shell session lost every log line it buffered, including the daily_run summary of s3.lifecycle.run-shard. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
edbcc718d3 |
iceberg: read remote-only metadata files, and fail a table whose metadata cannot be read (#13134)
* iceberg: read remote-only metadata files, and fail a table whose metadata cannot be read ## Problem In a remote-mounted bucket (`remote.mount` + `filer.remote.sync`), a table's `metadata.json` that is not cached locally is a filer entry holding only its `RemoteEntry`: no inline content, no chunks. The Iceberg REST catalog read metadata files as inline content (and, for a register, chunks), so such a file read as empty bytes, and an empty read was then treated as "no metadata": - a table stored with its metadata location alone (registered, or created through the S3 Tables API) loaded as an empty table: no schema, no snapshots, and clients read no rows; - a commit to it was refused on a table UUID mismatch for ever, and a commit without requirements replaced the table's history with an empty one; - registering such a file failed with `unexpected end of JSON input`. The same empty stand-ins were served when the file was gone or unreadable, and a synthetic empty table when stored metadata did not parse, with the same consequences. ## Fix - `loadMetadataFile` (and through it `currentMetadataBytes` and RegisterTable) reads a remote-only file of a mounted bucket: its remote size is checked against a 64 MiB bound before anything is fetched, it is cached into the cluster with `CacheRemoteObjectToLocalCluster` (one retry: a cache can race an uncache or a write-back), then inline content or chunks are read. - An empty file is `errEmptyMetadataFile`. A staged create's empty placeholder is still treated as absent where the staged commit reads it. - A location whose file is gone or unreadable, or stored metadata that does not parse, fails load, commit and transaction instead of serving an empty stand-in a writer could commit over. A table created without a location (no metadata yet) still loads as a new empty table, and a catalog-only record (Lance) is never read as Iceberg. - RegisterTable refuses, before anything is read, a metadata location that is not a file directly in a table's `metadata/` directory (a deeper path was read as the same-named file there), and refuses metadata whose own `location` is not the table location it is registered from (a file copied from another table names that table's files). - The table UUID a commit or a transaction stores is the base metadata's, not a record's that disagrees with it. `loadTableMetadataBlob` (used only by the manifest repair) is unchanged. ## Tests - New `iceberg_register_load_test.go` (inline and remote-only files; a location-only table loads from its file and fails with the file gone; commits and transactions keep the history, and fail leaving the table unchanged when the file is gone; oversized remote files and nested locations refused) and `TestACommitStoresTheBaseMetadatasUUID`. Each rule is red with it undone, except the refusal of an entry still remote-only after two cache calls, which fails closed anyway (it reads as an empty file). - Adapted: the fixtures of `iceberg_register_table_test.go` (`seedRegistrableMetadata`, `seedOversizedMetadata`) give the metadata the table's own location; `TestLoadTableResultOmitsConfigForCredentialVendingClients` and `seedOwnedTable` store the table with its metadata; `TestBuildLoadTableResultNeverReturnsNilMetadata` now expects an error for a location whose file cannot be read and for unparseable metadata, and keeps the empty-metadata and no-location cases. - `go vet ./weed/s3api/iceberg/`, `go test -race ./weed/s3api/iceberg/` pass, and `weed` builds. No unit test reads a chunked `metadata.json` (the in-memory filer has no volume servers); that path was checked against a real cluster with a remote-mounted bucket. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * iceberg: refuse commits to catalog-only tables A Lance table loads as an empty Iceberg table, and a commit built on that placeholder wrote Iceberg metadata and repointed the record's location (the Lance dataset root) to it. Both commit paths now answer 400. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * iceberg: pass the metadata size limit to the remote cache request The size check ran on the entry the lookup returned. A remote refresh between the lookup and the cache call could swap in a larger object, which the filer then downloaded whole. With MaxSize the filer checks the entry it actually downloads. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * iceberg: apply the metadata size limit to inline content 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> |
||
|
|
f4931605e0 |
s3tables: say why a write the table bucket layout refuses is refused (#13133)
* s3tables: say why a write the table bucket layout refuses is refused
## Problem
A table bucket accepts only Iceberg files under `<namespace>/<table>/(data|metadata)/`. A PutObject, CopyObject or CreateMultipartUpload of any other key is refused with a bare 403 AccessDenied, which a client that put a plain file there (a README, a CSV next to the table) reads as a permissions problem and goes looking for a missing grant.
## Fix
Those three refusals now carry a message:
table buckets accept only Iceberg files under <namespace>/<table>/data/ or <namespace>/<table>/metadata/; put other objects in a general purpose bucket
Status and code are unchanged (403 AccessDenied).
The message tells the caller that the bucket is a table bucket, so it goes only to a caller the bucket policy lets write that key (`checkPolicyWithEntry`). A caller the policy denies gets the policy's own refusal, identical to the one for a key the layout accepts, so the answer never tells a table bucket from another bucket to someone who could not write there.
A PUT of the volume verification key that the layout accepts but `volumeVerifyPutAllowed` refuses (outside its window, too large, stored headers) is not a layout refusal and keeps the bare AccessDenied.
## Tests
`weed/s3api/table_bucket_layout_message_test.go`:
- `TestTableBucketLayoutRefusalExplainsItself`: PUT, copy and multipart initiation of `ns/t/data/notes.txt` answer 403 AccessDenied with the message. Fails without the change.
- `TestTableBucketLayoutRefusalIsBareWhenPolicyDenies`: with a bucket policy denying the write, the refusal of a layout-refused key is byte-for-byte the refusal of a valid `.parquet` key.
- `TestTableBucketVerifyRefusalIsNotALayoutRefusal`: a stale verification key keeps the bare refusal.
`go vet ./weed/s3api/` reports nothing in the touched files; `go test ./weed/s3api/`: ok. `go build ./weed`: ok.
* s3api: load the bucket before a layout refusal checks its policy
With authentication off nothing loads the bucket before the handler, so a
stored Deny was not in the engine yet and the first layout-refused write
after a restart got the table-bucket explanation.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* s3api: apply existing-object tag conditions before a layout refusal explains itself
A Deny on s3:ExistingObjectTag is deferred by the first policy check and
applied only by the later lookup recheck, which the layout refusal skipped,
so a tag-denied writer still learned the bucket is a table bucket.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* s3api: name the format-owned directories in the table layout refusal
Table buckets also accept a table format's own _-prefixed directories
(Lance's _versions, _transactions, _indices), so telling a Lance writer that
only Iceberg data/ and metadata/ files are accepted misleads it.
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>
|
||
|
|
bf14326c3c |
iceberg maintenance: apply deletion vectors in compaction; optionally rewrite delete-heavy files (#13131)
* iceberg maintenance: recognise deletion vectors whose format is written in lowercase Iceberg maintenance tells a Puffin deletion vector from a Parquet position-delete file by its `file_format`, compared exactly with iceberg-go's constant `PUFFIN`. DuckDB records the format in lowercase, `puffin` (as it records `parquet`, which compaction already compares without case). Such a vector was never taken for a vector: - the data file it covers was not kept out of compaction bins, and - the vector itself was handed to the Parquet position-delete reader, which cannot read a Puffin file, so compacting any table holding one failed (and the position-delete rewrite tried to read it the same way). The fix adds `isPuffin`, a case-insensitive comparison, and uses it at the four places that compared the format. Test: `TestLowercasePuffinDeletionVector` wraps a deletion-vector entry so its format reads `puffin` (as the Avro reader passes it through) and checks that the data file it covers is excluded and that `collectPositionDeletes` does not try to read the vector. It fails without the change (`dv paths = map[]`). `go vet ./weed/worker/tasks/iceberg` and `go test ./weed/worker/tasks/iceberg` pass; `go build ./weed` builds. * iceberg maintenance: apply deletion vectors in compaction; optionally rewrite delete-heavy files Compaction has no reader for Puffin deletion vectors (DVs), so every data file a vector covers is kept out of compaction for good (`excludeDeletionVectorFiles`). A format-version 3 table that is reloaded with DELETE + INSERT (DuckDB writes a vector hiding all of the old file) keeps the old file and its vector forever, and every reader pays for both. Bins also form only from `min_input_files` small files per partition, so deleted rows never enter the decision. This builds on #13127 (the case-insensitive `puffin` format check); the first commit on this branch is that PR. Changes: - **Vectors are applied.** The vectors of the compaction candidates are read with iceberg-go's `table/dv` (length, magic and CRC checked, and the decoded cardinality checked against the manifest's `record_count`) and joined with the Parquet position deletes the merge already applies. A vector that does not decode keeps its file out of every bin, as before, so a file never merges without its deletes. One Puffin file is read once per run even when it holds several vectors. - **A consumed vector leaves with its data file.** When the snapshot removes a data file, the delete manifests holding its vector are rewritten (that vector `DELETED`, the other entries `EXISTING`); manifests without one are carried as they are. Vectors are matched by the data file they cover, never by the Puffin file path, because one Puffin file may hold the vectors of several data files (Spark writes them that way) and the vectors of files left in place must stay. - **A bin whose deletes leave no row writes no empty file**; its files are just removed. - **New setting `delete_ratio_threshold_percent`** (default 0 = off, so bin selection is unchanged unless set; Iceberg's own `rewrite_data_files` uses 30%). When set, a Parquet file whose vector deletes at least that share of its rows is rewritten in a bin of its own, whatever `min_input_files` says, packed by live bytes up to the target size. A file whose decoded vector deletes exactly positions 0..n-1 is dropped without being read; a manifest count that says "all" with positions that do not is rewritten row by row instead. Only files under the target file size are taken (the merge reads a file whole into memory), except a file dropped unread. - **Detection reads no vector**: a DV's `record_count` is its cardinality, which is all the ratio needs. With `apply_deletes` off, planning ignores vectors (execution skips tables with deletes then). The planning-index cache key includes the ratio. Tests (`deletion_vector_test.go`): - a vector with a lowercase `puffin` format is matched to its data file under either path spelling; - a merge with a vector and a Parquet position delete: every file merges minus its deleted rows, row ids kept, and the delete files leave the table (ratio off); - a reloaded table: the wholly deleted file and its vector are dropped without the file being read (it is not even present), the new file untouched; - ratio past / under / vector not decodable / manifest count says all but positions do not / partly deleted file past the target size left alone; - two vectors in one Puffin file, only one data file compacted: the other file's vector stays; - detection with the ratio on and off. Each was checked red against a mutation of the rule it covers (exact format compare, vectors not applied, vector consumed by Puffin path, size check skipped, whole-file check skipped). `go vet ./weed/worker/tasks/iceberg` and `go test ./weed/worker/tasks/iceberg` pass; `go build ./weed` builds. * iceberg compact: check a deletion vector's blob range without overflow Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * iceberg detection: key the cached compaction plan on apply_deletes Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * iceberg detection: skip a table with deletes while apply_deletes is off Execution already skips it, so detection proposed a job that never ran. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * iceberg compact: a drop-only bin is not held to the sort input cap Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * iceberg compact: split delete-heavy bins at the sort input cap The packer counted live bytes only, so two partly deleted files could share a bin the sort input cap then dropped on every run. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * iceberg compact: compare the delete ratio in whole rows Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * iceberg compact: merge delete-heavy files in the order of their bounds Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * iceberg compact: read only the vectors of files a bin can take Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * iceberg compact: pack a vector whose count and positions disagree by its whole size 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> |
||
|
|
347f1cf705 |
deps: bump parquet-go to v0.33.0 (#13130)
* deps: bump parquet-go to v0.33.0
parquet-go v0.33.0 fixes several bugs that Iceberg compaction runs into:
- BOOLEAN columns that Arrow and parquet-mr write with data page v2 are
RLE-encoded. v0.32.0 decoded such runs wrong (a run's value byte expanded
bit by bit, runs taken as multiples of 8 values), so compaction rewrote the
flags wrong, and it wrote its own runs of trues with the value byte 0xFF,
which DuckDB refuses to read ("Payload value bigger than allowed")
(parquet-go/parquet-go#617, fixed by parquet-go/parquet-go#620).
- A column chunk without a dictionary lists the level encoding RLE next to
PLAIN. v0.32.0 took RLE as the column's encoding, so the schema derived from
a non-dictionary INT32 or DATE file could not write ("RLE: cannot encode
INT32 with invalid bit-width=0") and such files never compacted
(parquet-go/parquet-go#603, fixed by parquet-go/parquet-go#611).
- The sorting writer dropped the row groups' geospatial statistics when a
bin fit in its sort buffer, so a sorted rewrite of a geometry table wrote
files without a geometry bound (parquet-go/parquet-go#627, fixed by parquet-go/parquet-go#693 and parquet-go/parquet-go#700).
- A null in a list of required values wrote no value and shifted the rest of
the page (parquet-go/parquet-go#616, fixed by parquet-go/parquet-go#618); a short data page read leftover
values from a pooled buffer instead of failing (parquet-go/parquet-go#624, fixed by
parquet-go/parquet-go#731).
- A geometry or geography column declared without a CRS is now written
without one rather than with OGC:CRS84 spelled out (parquet-go/parquet-go#628, fixed
by parquet-go/parquet-go#688).
Changes that follow from the bump:
- A corrupt data page now fails with an error rather than a panic. The
position and equality delete readers returned that error without the file
name; they now name the file, as the data file merge already does.
- The default-CRS tests built their "spelled out" inputs with
parquet.Geometry(""), which now writes no CRS; they declare OGC:CRS84
explicitly. The footer rewrite in geometry_crs.go is still needed when an
input spells the default out, since the output schema comes from an input.
Tests:
- compact_rle_boolean_test.go with four pyarrow fixtures: two files with
v2-page RLE booleans (with nulls) read back and compacted with every flag
kept, and two non-dictionary INT32/DATE files compacted with every value
kept. All three tests fail on v0.32.0 (3005 of 6000 flags wrong; "no bins
successfully compacted").
- TestCompactSortedGeometryBoundCoversEveryRow only checked a bound when
there was one, so it passed with the statistics dropped. It now requires a
geometry bound on the data file and geometry statistics in the footer; it
fails on v0.32.0 and passes on v0.33.0.
- go vet and go test of every package that imports parquet-go
(weed/admin/dash, weed/mq/logstore, weed/mq/schema, weed/query/engine,
weed/worker/tasks/iceberg) pass; -race on weed/worker/tasks/iceberg and
weed/mq/logstore passes; go build ./weed passes.
* iceberg: fail the Arrow fixture tests on a read error
Both row-reading loops ended on any error, so rows decoded next to an
error could still pass the value checks.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* iceberg: check each fixture row comes out of compaction exactly once
A row replaced by a copy of another kept the row count and passed the
value checks, which use the row's own id.
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>
|
||
|
|
5017a07475 |
iceberg maintenance: whole-pass tests of equality deletes on a partitioned table (#13132)
* iceberg maintenance: whole-pass tests of equality deletes on a partitioned table The equality-delete tests call the pieces (`collectEqualityDeletes`, `eqDeleteGroupsForBin`, `mergeParquetFiles`) one at a time. These run `compactDataFiles` end to end and check what a reader sees after the commit, including the deletes carried for files left uncompacted and the sequence numbers of the merged files. Tests only; no code changes. The table has three partition specs: 0 unpartitioned, and 1 and 2 both `identity(name)` on the same partition field, so only the spec ID tells their deletes apart. It is written as a writer commits it: one snapshot per data sequence number, its manifests carrying the number and their ADDED entries inheriting it. Its equality deletes come in every scope: partition-scoped, global, by another column, and with keys that live in other partitions or specs. Each test reads the table before and after the pass with its own merge-on-read (each delete applies to data files with a lower data sequence number, under an unpartitioned spec or the same spec and partition) and compares the rows. - Every two-file bin compacts, bin-packed and sorted; one partition's single file does not. The live rows are unchanged and the deletes are carried for the file left as it was (a merged file given an input's lower sequence number would lose rows to the carried deletes). - Every file compacts: the rows are unchanged and the deletes leave the table. - An unreadable partition delete fails the pass, names the file, and commits nothing; once the file is back the table reads as before. - A delete under a spec the table does not list fails the pass and commits nothing. Checked red against a mutation of the sequence-number rule (equality deletes applied whatever the sequence numbers): the first two tests fail. `go vet` and `go test ./weed/worker/tasks/iceberg` pass. * iceberg maintenance: whole-pass table snapshot IDs differ from its sequence numbers The fixture gave each commit's snapshot the ID of its data sequence number, so a compaction that read an entry's snapshot ID in place of its sequence number still kept the right rows. The IDs now count down as the sequence numbers count up. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * iceberg maintenance: a whole-pass name-keyed delete that removes a live row The only name-keyed delete matched no row, so a pass that ignored deletes keyed by name still kept the right rows. u1 now holds a "zz" row that a global name-keyed delete removes. 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> |
||
|
|
2acd49ba27 |
s3api: end a vended table session no later than the caller's credential (#13161)
* s3api: record the verified credential's expiry in the request context Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3api: cap a vended table session at the caller's credential expiry Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * sts: let a principal session request cap the session's expiry AssumeRoleForPrincipal takes an absolute NotAfter. issueSession caps both the credentials and the signed token at it, so a cap computed before the trust-policy lookup is not stretched by the time that lookup takes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3api: hand the caller's credential expiry to STS as an absolute cap Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
df59c81a8c |
master: record when the cluster started (#13121)
* topology: record when the cluster started StartedAt rides on MaxVolumeIdCommand; the first non-zero value wins so replayed or racing entries cannot move it, and the max volume id mirror file keeps it across raft state loss. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * master: carry StartedAt through raft apply and snapshots Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * master: leader records StartedAt once per cluster The leader records it right after the topology id. A cluster that predates the record gets the time its first upgraded leader runs. /dir/status shows it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test: use current StartedAt values Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * topology: never lower the mirrored max volume id A mirror rewrite for a StartedAt change could carry a bound older than one already persisted. Keep the highest bound, and read StartedAt under the file lock. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * topology: let the latest applied StartedAt win With first-wins, a master that restored an older-version snapshot without the field could record a second value while the others kept the first. Following the raft order makes every master converge on the same value. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
d49876a7aa |
filer: every filer store reads KV keys in batches (#13119)
* filer: read KV keys a few at a time for a store without batch reads Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * abstract_sql: read KV keys with one query Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * redis: read KV keys in one pipeline Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * etcd: read KV keys in read-only transactions Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mongodb: read KV keys with one query Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * cassandra: read KV keys concurrently Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * hbase: read KV keys concurrently Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * elastic: read KV keys concurrently Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * arangodb: read KV keys with one request Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * foundationdb: read KV keys in one transaction Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * ydb: read KV keys with one query Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * tarantool: send KV reads before waiting for any Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: every filer store reads KV keys in batches KvBatchGet moves from the optional KvBatchReader onto FilerStore. A listing now reads the hard link records of its waiting entries together from any store, a path-specific one included. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * tikv: count only the record reads of a listing in its test Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: return every batched key that pads to the same stored row SQL, MongoDB and YDB pad a short KV key with zero bytes, so "short" and "short\x00" read the same row. KvBatchGet kept only the last such key. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: read keys in a plain loop when KvGetEach runs one at a time Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
604d391012 | 4.56 4.56 | ||
|
|
689e98ea4c |
test: fall back to a Maven Central mirror for the S3 Spark suite (#13120)
Spark resolved hadoop-aws and the AWS SDK bundle through Ivy from Maven Central only, so a refused Central request failed the suite with "module not found" before any test ran. spark.jars.repositories adds the Google mirror after Central in Ivy's resolver chain. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
f905b33f19 |
tikv: read a key from TiKV once per transaction (#13115)
* tikv: read a key from TiKV once per transaction Inside one store transaction the filer reads the same key more than once: a rename looks its source up when it starts and again to delete it, and its target before the create and again in it. On TiKV a second read cannot differ from the first. A transaction reads the store as it was when the transaction began, and its own writes are answered from its buffer. Each of those reads was still a request to TiKV, because the client keeps what a batch get read with the transaction's snapshot and not what a get read. Inside a caller's transaction a key is now read as a batch get of that one key, and the next read of it is answered from the snapshot. A read outside a caller's transaction is a transaction of its own and keeps the plain get. With the store on the client library's in-process TiKV, a rename of a file to a new name sends 4 reads instead of 7, and one over an existing file 4 instead of 6. The tests run the store on that in-process TiKV, which needs pingcap/goleveldb as an indirect dependency. * tikv: shorten the comment on the transaction read Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: MapleWhiteZZZ <18653045+MapleWhiteZZZ@users.noreply.github.com> Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
cb958290c8 |
filer: read the hard link records of a listing in batches (#13117)
* filer: read the hard link records of a listing in batches A hard-linked entry keeps its attributes and chunks in a record the file's names share, and a listing reads that record for every hard-linked entry it lists. It read them one at a time from the callback of the store's listing: a round trip to the store for each such name, each waiting for the one before, so a directory of hard-linked files listed far slower than one of as many plain files. A store may now say that it reads several KV keys in one round trip (KvBatchReader). For a listing by such a store the wrapper holds the entries back from the first hard-linked one on, up to 256 of them, reads their records together and hands them on. The caller of the listing gets the same entries in the same order, and the name of the entry it ended the listing at. TiKV implements it with the client's batch get. With the store on the client library's in-process TiKV, the records of a directory of 200 hard-linked names take one batch get instead of 200 gets. The TiKV tests run the store on that in-process TiKV, which needs pingcap/goleveldb as an indirect dependency. * filer: end a listing where its caller ended it, whatever the store met behind The store goes on past the entry its caller ends the listing at, to the entries that wait for their records with it, and may fail there. The listing then returned the store's error, though a caller handed each entry as it arrived would have stopped the store before it got that far. The listing now ends at the entry its caller ended it at, and a caller that fails among the waiting entries gets its own error, not the store's. The same holds for the step a store takes after it is told to stop, when the caller ended the listing at an entry the store had already passed. At the last entry that waited the step's error is still returned, as it is from a store that hands each entry on as it arrives. * filer: finish a hard link listing on every return of the listing The listing hands on the entries that wait from a deferred finish, so a return path that lists from elsewhere with the same callback hands them on too. The callback keeps the adjustedEntryFunc shape the prefixed listing already had. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: MapleWhiteZZZ <18653045+MapleWhiteZZZ@users.noreply.github.com> Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
3d076dfcdf |
filer: aggregated metadata stream reads the log files of peers with their own store (#13116)
* filer: pass the reader's context to persisted metadata log listings The day and minute listings behind ReadPersistedLogBuffer used context.Background(), so nothing scoped to the subscription reached them. List through one helper that takes the caller's context. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: aggregated metadata stream reads the log files of peers with their own store A filer with its own store never holds another filer's persisted metadata log: log file writes emit no events and the bootstrap traverse skips the log directory. The aggregated stream read history from the local log directory and the in-memory aggregate ring only, and the ring restarts empty, refilled from each peer's saved offset. A subscriber whose cursor was older than that missed every event a peer recorded before it, for example the S3 lifecycle worker replaying expirations. Aggregated reads now also list the log directories of followed peers not known to share this filer's store, merged by file name, so the existing ordered reader and chunk-ref path serve their history. Local streams, which peers aggregate from, stay local. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: bound peer log listings and fail the read when one fails Each peer listing gets its own deadline, so a peer that stalls mid-listing cannot hold the read. A failed listing now fails the read instead of silently hiding that peer's persisted files; peers already retired as unreachable are left out. Peers are asked from the same start name the caller uses for its own store instead of the whole directory. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: keep a still-unreachable peer out of log listings after its mark expires A followed peer that keeps refusing connections is marked removed once, and the mark is dropped with its resume point an hour later. It was then listed again and its failing listing ended every aggregated persisted-log read. Leave out any peer refusing connections for peerUnreachableRemovalAfter, marked or not. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: subscribe tests track their peers on the test filer's store Aggregated reads now list the log files of followed peers with their own store. The subscribe tests' peers have no server and share the test filer's store, so record that instead of dialing them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
12ef22477a |
filer: read a missing path once when a rename or a delete looks it up (#13114)
* filer: read a missing path once when a rename or a delete looks it up A rename looks its target up with FindEntryForOverwrite, and DeleteEntryMetaAndData looks up the path it deletes the same way. Inside a store transaction an ordinary lookup hides an expired S3 entry and leaves its row for the commit. A write over the path still owes that row its chunks and its hard link, so the store was read again whenever the lookup came back with nothing. It comes back with nothing far more often because the store holds nothing at the path, which is what a rename to a new name finds. The second read then repeats the first. Filer.findEntry already tells whether its answer is what the store holds at the path, so the store is read again only for a row the lookup found and kept from its caller. Around 20 renames of a file to a new name on leveldb2 the store counter shows 7 finds per rename before and 6 after. * filer: shorten the overwrite-lookup comments Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: MapleWhiteZZZ <18653045+MapleWhiteZZZ@users.noreply.github.com> Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
bd9e9a37c2 |
mount: send an open's truncate to the write owner as a conditional update (#13113)
An open with O_TRUNC over an existing file stored the empty entry with an unconditional UpdateEntry. The filer only routes conditional writes to the path's write owner, so the truncate landed on the filer the mount talks to, which deleted the chunks it dropped, while a peer's conditional chmod could still commit at the owner over the entry it had not yet seen truncated. The owner's write then brought the deleted chunks back into the entry. The truncate now goes through saveEntryAttributes: guarded by the entry the open found, routed to the owner, and replayed on the owner's entry when refused. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
7d1ad72e74 | docs: regenerate star history chart | ||
|
|
89dbcb44c7 |
security: fips.mode follow-ups from the #13029 review (header comments, EMS on verified HTTPS, CA and read checks) (#13110)
* volume: read security.toml section headers that carry a trailing comment The volume server's own security.toml parser compared each whole trimmed line with the section headers it knows, so `[fips] # policy`, valid TOML that Go's viper reads, fell through to an unknown section and its `mode` was dropped: Go enforced the mode while weed-volume ran with FIPS mode off and logged nothing. The same held for `[jwt.signing]` and every other section. Header lines now have a trailing `#` comment removed before they are matched. Refs #13029 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * sw-client: require the Extended Master Secret on verified HTTPS in FIPS mode In FIPS mode only the `insecure_skip_verify` client configuration, which sw-client builds itself, set `require_ems`. With certificate checks on, reqwest built the configuration and left `require_ems` at rustls's default, which is off for a provider that is not FIPS-validated, so a trusted TLS 1.2 volume server without EMS was accepted where the insecure path refused it. Go requires EMS in FIPS mode. Both FIPS-mode paths now go through one rustls configuration built here: certificates checked against `https.client.ca` or the system roots (loaded with rustls-native-certs, as reqwest loads them), or not checked with `insecure_skip_verify`, and EMS required either way. Off mode keeps reqwest's configuration. Refs #13029 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * volume: refuse a FIPS mode from a security.toml parse that did not read the file resolve_fips_setting reads security.toml once to check that it can, then parses it. The parse falls back to defaults when its own read fails and reports that only in `file_read`, which was not checked, so a file that became unreadable between the two reads resolved to FIPS mode off. A parse without `file_read` is now the same FipsModeError::File as a failed first read. Refs #13029 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * sw-client: refuse a malformed https.client.ca with insecure_skip_verify in FIPS mode The FIPS-mode insecure_skip_verify configuration never parsed `https.client.ca`, so a CA file whose certificate does not parse was accepted there and refused on every other path, where reqwest or the verified configuration load it. The CA is now parsed, and refused when malformed, before it is set aside. Refs #13029 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * seaweed-vector: lock sw-client's rustls-native-certs dependency sw-client depends on rustls-native-certs since the FIPS-mode HTTPS configuration; seaweed-vector depends on sw-client by path, so a --locked build there refused to update its lockfile. The crate was already locked in seaweed-vector; only the edge was missing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
276be51d04 |
volume(rs): require the Extended Master Secret on outgoing HTTPS in FIPS mode (#13111)
The outgoing client took reqwest's rustls configuration, which leaves require_ems at rustls's default: off for a provider that is not FIPS-validated. A TLS 1.2 peer without EMS was accepted where Go's FIPS mode refuses it. In FIPS mode the configuration is now built with the same roots, CA and identity, and require_ems set. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
760f88e294 |
filer: bind scoped POSIX locks to the verified token id (#13047)
* filer/posixlock: key lock owners and leases by principal A lock's owner becomes (Principal, Sid, Owner). The principal is server-side state, empty for unscoped callers, so owners with equal client-chosen sid and owner under different principals conflict and never match on unlock, release, reassertion or coalescing. The session index and leases key on (Principal, Sid). Scoped sessions are leased per key from their first acquisition: the lease ends at the earlier of TTL after the last acquisition or renewal on that key and Lease.NotAfter. Expired scoped locks are dropped before any operation on their key as well as by ReapExpired. Unscoped sessions keep their current whole-session lease, started by the first keepalive. The handler passes the unscoped session for now, so behaviour is unchanged. NewManagerWithClock lets tests drive lease boundaries. * filer: bind scoped POSIX locks to the verified token id PosixLock trusted the client-supplied sid. GET_LK reports a conflicting lock's sid and owner, so a scoped caller with a write grant on the same path could reuse them to unlock or release another holder's lock, keep it alive, or replace it through a KEEP_ALIVE reassertion. A tokenless request with the same identity could do the same. A request admitted for a scoped token now acts for that token's verified jti, derived in posixLockAuthority from the interceptor's authority. It controls only the locks it took, whatever sid or owner it names. Its lease on each key ends at the earlier of the 15s TTL after its last acquisition or renewal and the token's expiry plus the clock leeway. Each renewal passes admission for its key, so a narrower token cannot extend keys outside its grant. Tokenless and unscoped calls keep the unscoped namespace and behaviour, and can no longer match a scoped lock. Scoped TRY_LOCK and reassertion ranges must be well-formed read or write ranges, checked before any state changes. GET_LK, the protobuf and forwarding are unchanged; the principal is never returned or logged. A renewed token with a new jti is a new owner: the old locks expire and are reacquired. * filer/posixlock: release an expired session once, however many ranges it holds * posix locks: report a lock lost on re-assertion to the mount A mount whose lease lapsed, for example when its scoped token expired or was replaced by one with a new id, kept re-asserting locks that another session had since taken. The filer logged the loss but returned success, and the mount discarded the reply, so nothing on the mount side showed it. KEEP_ALIVE now returns the first conflicting lock in the existing has_conflict and conflict fields, which older mounts ignore. The mount warns once per key when it learns of a loss and forgets it once a re-assertion succeeds or the key is no longer held. Writes are not fenced. * filer/posixlock: drop every expired session's ranges in one pass * filer/posixlock: renew a scoped session's same-grant leases together Scoped leases expire per key and a keepalive renewed only the key it named. A mount renews its keys one keepalive at a time, so with many keys and slow keepalives a round could outlast the 15s lease and a healthy mount lost locks; unscoped sessions never had this problem because any keepalive renews the whole session. Each scoped lease now records a fingerprint of the verified grants it was acquired or re-asserted under: a SHA-256 over the sorted, deduplicated (access level, path) entries. A keepalive, bare or re-assertion, extends every live lease of the same session (principal and sid) held under the same fingerprint, each to the request's lease (the earlier of the TTL and the token's expiry plus leeway). Leases taken under other grants, such as a narrower token reusing the jti, are still renewed only by name, and a lease that already ended is not revived before the sweep drops it. No extra filer lookups; unscoped sessions are unchanged. * filer/posixlock: bound same-grant renewal and refuse ended-lease grants A scoped keepalive scanned every key of its session to renew those held under the same grant, so a mount renewing N keys one by one did N^2 lease visits per round under the manager's mutex. The scan now runs at most once per quarter lease TTL per grant; every key under the grant still ends no earlier than three quarters of a TTL after the latest renewal, and the named key is always renewed in full. TryLock now refuses a scoped grant whose lease has already ended, such as a request admitted just before its token expired that then waited on the manager, instead of granting a lock the next operation would drop. The filer returns Unauthenticated, which the mount reports as EIO. * filer/posixlock: skip same-grant scans by deadline floor, not by time The scan throttle remembered when a grant was last renewed, not how long that renewal made its keys last. A replacement token with the same id and grants but a later expiry could then renew one key while the others kept ending at the old token's expiry. Each session now keeps, per grant, the deadline the last scan gave every live key under it, lowered whenever a key is leased for less. A renewal skips the scan only while that floor already reaches the earlier of its own deadline and three quarters of a TTL from now, so a mount renewing keys one by one still costs linear work. A keepalive from a session holding no leases records nothing, and a session's floors go with its last lease, so lock-less keepalives with changing session ids no longer accumulate state the sweeper never sees. * filer/posixlock: never move a scoped lease's deadline earlier Renew, a re-assertion, a same-grant scan and a re-lock all set the key's deadline to the request's own bound. A request under the old token of a principal that already renews under a replacement (same id and grants, later expiry) can land after the replacement's renewal, for example one of the 32 concurrent keepalives in flight when the mount switched credentials. It then cut the key back to the old token's expiry, and the lock was dropped before the next round although the replacement had renewed it. Keep the later of the current and the requested deadline: every deadline still comes from an admitted request of the same principal, so a lease never outlives the latest of its tokens. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer/posixlock: keep each session's index and leases in one map bySession, lastSeen, leases and floors were four maps keyed by Session that had to be created and pruned together. They become one sessions map whose sessionState holds the session's keys (with each key's lease), its last keepalive and its grant floors, so a session's state is dropped in one place. The release loop shared by ReapExpired and ReleaseSession becomes releaseOn. ReleaseSession now also forgets an unscoped session's last keepalive, so a session it released is not reported again by the next sweep. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
46b10efcce |
mount: refuse a stale truncate over a peer's chunks and keep later times when merging a flush (#13100)
* mount: refuse a merge whose local truncate cuts chunks a peer wrote A flush refused by IF_ENTRY_EQUAL replays the handle's truncate onto the stored entry. The truncate was made over the handle's base, so a chunk a peer committed after that base was dropped or clipped silently, losing data the peer had already fsynced. Like a stale whole-file rewrite over a peer's chunk change, it now fails the merge. A base chunk the peer only shortened carries no peer data and is still cut. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mount: keep the later mtime and ctime when merging a delayed flush The merge took every attribute the handle changed from the handle, so a flush that waited behind a peer's commit moved mtime and ctime back to the handle's older write. Each time is now merged as one value (seconds and nanoseconds were merged field by field, so a moved second could take the peer's nanoseconds): the handle's time stands unless a peer moved it too and later. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mount: let a truncate merge pass the handle's own committed chunks A flush whose commit answer was lost finds its own chunks in the stored entry while its base is still the older one. Those chunks are the handle's writes, not a peer's, so they do not refuse the merge. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mount: do not keep a stored copy of a chunk the merge re-adds from the handle A stored chunk the base lacks but the handle holds is the handle's own commit whose answer was lost. The merge appends the handle's chunks after the stored ones, so keeping the stored copy referenced the chunk twice. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mount: take the manifests of a failed flush's fold for the handle's own chunks A flush can commit its folded manifests and lose the answer. The handle reverts to the member chunks and keeps its old base, so the next merge found the stored manifest, knew neither its file id nor its key, and refused it as a peer write across the handle's truncate. The handle now remembers the folds of flushes that failed over its base, and a merge unfolds them in the stored entry before comparing, so the members match the handle's chunks. A peer's manifest is still refused. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mount: take a retried flush's own stored fold for its own chunks The client retries a request whose connection dropped, and the first try may have stored the flush's folded manifests. The retry is then refused over them before the fold is recorded as failed, and the merge took the manifest for a peer's write across the handle's truncate. The merge now unfolds the flush's own fold in the stored entry as well; the condition still names the entry as stored. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mount: keep every fold the filer may hold instead of the last four Dropping the oldest of four could forget the fold the filer committed, and the merge then refused that manifest again. A fold is now kept only when the flush failed without the filer's answer, or when the refusal lookup shows it stored, so a refused flush no longer adds one, and the list ends with the base. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mount: keep a flush's fold when its first request may have been stored A precondition verdict on a retried send does not prove the first send stored nothing, and a failed refusal lookup then hid that it had. The create now counts the sends of the request that carries the fold and keeps the fold whenever the flush fails and that request was sent more than once or never got the filer's answer. That covers both flush paths, so revert is back to only restoring the chunks. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mount: drop the failed folds a refused create shows were not stored A refusal means the stored entry moved off the handle's base, so no request guarded by that base can store another fold. After the refusal lookup the handle keeps only the folds whose manifests the stored entry holds, at most one, which bounds the list over a base. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mount: bound the failed folds a handle keeps over one base Flushes that keep failing with no filer answer each saved a new fold the filer may hold, so the list grew for as long as the outage lasted. Once a handle keeps maxFailedFolds folds over its base, its flushes send their chunks unfolded for the filer to fold, and no kept fold is dropped. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mount: keep the failed folds a refusal lookup does not show The refusal comes from the file's write owner, but the lookup after it can read a filer that lags behind and still shows the base. Pruning the folds against that read forgot a fold the owner had stored, and once its manifest showed up a pending truncate took it for a peer's chunk on every flush. The maxFailedFolds limit bounds the list, so the folds stay until the base moves. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mount: drop the chunks a failed flush sent that the handle has cut since A flush that commits with its answer lost, then a truncate of the handle, left the next merge with the handle's own committed chunks in the stored entry, outside both base and the handle. The truncate check took them for a peer's writes and refused every later flush over the base. A failed flush now records the file ids of the chunks it sent that base lacks, and the merge drops those the handle no longer holds: it cut or replaced them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mount: copy the failed flush's sent set with a loop Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mount: keep folding past maxFailedFolds instead of sending chunks unfolded The filer folds a flat chunk list itself, into manifests the handle does not know: a lost answer then left one of them across a pending truncate, and an acknowledged one gave the handle flat chunks under a folded base. Flushes fold as before, and the handle stops keeping folds past the limit while it still records the chunks they sent. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mount: read the stored manifests a refused merge cannot name A fold changes no content, but a manifest the handle does not know sat in the stored entry as one chunk: across a pending truncate it refused the merge, though it can hold the handle's own chunks (a fold it did not keep, or one the filer made). When the merge is refused, the flush reads those manifests, replaces them with the chunks they hold and merges again. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mount: hold the chunks the filer stored after a plain acknowledged flush The filer folds a flat chunk list (the mount's own fold failed), and the acknowledgement makes the stored entry the base while the handle kept the flat chunks. A later merge took them for writes of the handle, which can bring back chunks a peer's truncate removed. As after a merge, the handle now takes the stored chunks, keeping those attached since the request. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mount: keep a bounded record per failed flush instead of a growing set The set of chunk ids failed flushes sent grew with every overwrite while commits failed, and each failure copied it whole. Each failed flush the filer may have stored (a send got no verdict) now keeps one record, its fold and the ids it sent, built once and at most maxFailedFlushes over a base. Past that, a merge refuses the chunks of a flush it did not keep that the handle has cut since, as a peer's. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mount: register the chunks a rebase or install gives the handle for reads A handle that takes the stored chunks after a flush (or a peer's, after a merge) can get manifests the filer made, and resolving them needs the file's read token. rebaseEntry and installRewrittenChunks now record the chunks under the file's path before the read view resolves them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mount: keep every chunk id a failed flush sent, cap only the folds Past four failed flushes over one base the handle stopped recording what a later flush sent. If that flush was stored with its answer lost, a truncate of its chunks was refused as a peer's write and kept failing after the filer came back. The ids now go into one set shared by the base's marks, each kept once and never copied, until the base moves. Only the folds stay capped: a stored manifest past the cap is read when a refused merge cannot place it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mount: fail a flush over a peer's chunk change unless -concurrentWriteMerge A content flush refused because another mount committed first used to merge the handle's writes onto the stored entry. That merge now runs only with the new -concurrentWriteMerge mount option (off by default). By default a stored chunk change that neither the base nor the handle holds fails the flush with EIO, and a peer's chunk event no longer rebases a dirty handle. Attribute-only changes and the handle's own commits (a lost answer, its own truncate) still merge. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mount: recognize the shortened references a failed flush sent A truncate shrinks a base chunk in place, keeping its file id. A failed flush that may have stored such a reference recorded only file ids base lacks, so a later truncate saw its own stored reference as a peer's change and failed with EIO by default. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
a963c1309c |
worker: purge the filer metadata log from a lifecycle job that keeps it past every TTL (#13101)
* worker: share the one-filer-per-store selection with other filer jobs Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * worker: add a meta_log_purge job that keeps the log past every TTL The job deletes whole metadata log days once per filer store, keeping every day that the longest filer.conf TTL, the longest S3 lifecycle rule, a registered retention floor or a running replay job's cursor still needs. A floor input that cannot be read stops the run before anything is deleted. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * worker: register meta_log_purge in the lifecycle lane Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * maintenance: stop purging the metadata log from the default scripts The meta_log_purge job now deletes old log days, keeping what TTLs, lifecycle rules and replay jobs still need. fs.log.purge stays for manual use. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * worker: let an idle filer_ttl rule's read position release the log filer_ttl no longer needs events up to read_ns, and an idle rule keeps an old ts_ns while read_ns advances, so the floor follows the later of the two. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * worker: cap min_retention_days so a huge value cannot overflow Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * worker: show the min_retention_days limit in the admin form Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * worker: give a registered retention floor the store's filer client A floor that only gets a context cannot tell which cluster or store it answers for, so it cannot ask that cluster's master or read the store's own settings. Pass the filer client the job already holds. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * worker: keep the log an unfinished lifecycle walk will replay A cold-start or recovery walk that resumes across runs rewinds its shard cursor to the walk's start minus the longest lifecycle TTL once it completes. Until then only its walk checkpoint records that start, so a walk running for more than a day let the purge delete the creation events the rewound replay reads. A checkpoint with buckets done or partly walked now holds the floor at started_ns minus that TTL. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * worker: hold the walk start until the checkpoint goes stale A walk clears its checkpoint in finish() before each of its shards saves the rewound cursor, so a purge scan that read the old shard cursor and then the cleared checkpoint saw neither. A cleared checkpoint keeps started_ns, so every live checkpoint now holds the floor at its start minus the longest lifecycle TTL. A finished one stops holding once it has not been saved for cursorStaleAfter. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * worker: read walk checkpoints before the shard cursors they rewind A purge scan that read a shard cursor, then a checkpoint that a later walk had already replaced, saw neither the earlier walk's hold nor the rewind its shards saved. A walk replaces its checkpoint only after the previous walk's rewind is on disk, so reading the checkpoints first always sees one of the two. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * lifecycle: save a fresh walk's checkpoint at its first progress A walk that progressed during its first save interval and then stalled for more than a day had no checkpoint on disk, so the metadata log purge saw nothing holding the days its completion replays. A fresh walk now saves on its first finished entry or bucket; a resumed walk already has its record on disk and keeps the interval. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * lifecycle: rewrite an unchanged shard cursor so its mtime stays fresh A shard stuck on RETRY_LATER saved identical bytes each pass, and SaveInsideFiler skips identical content, so the file's mtime aged past the meta log purge's staleness cutoff while the shard still needed it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * worker: keep the log day a reader from the cursor lists first Log files are named for their flush start, so a file from just before midnight holds events after a cursor just past it. The reader backs off one flush interval before choosing its first day; the purge now does too. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * worker: stop the meta log purge on an unreadable lifecycle policy LoadCompileInputs reports a bucket whose lifecycle XML does not parse separately from its error, so the purge used the shorter floors and deleted days that bucket's rules may need once the policy is fixed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * worker: read shard cursors with the replay's loader in the meta log purge A shard cursor the replay refuses, such as an empty object, decoded as a zero position and released the purge; it now stops the run instead. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * worker: saturate the meta log purge's TTL plus a day A lifecycle TTL near the largest duration wrapped negative once a day was added, so the purge fell back to the shorter floors; the walk hold at started_ns minus that TTL likewise dropped below zero and was lost. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * worker: leave disabled lifecycle rules out of the meta log purge floor AllActivePriorStates activates every compiled rule, so a disabled rule still held the log for its TTL, and disabling it could not release it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * worker: compute the meta log purge floor in SafeKeepFrom Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * shell: fs.log.purge keeps the logs the meta log purge floor needs unless -force Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * shell: run the fs.log.purge floor test without a master client Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
3836311f8f |
filer: end a listing at a short page, and make every store fill its pages (#13105)
* filer: end a listing at a short page from a store that fills its pages ListEntries read a directory a page at a time and stopped at the first empty page, so every listing the caller's limit did not cut ended with one more scan of the store, from the last name on, that returned nothing: two scans for a directory smaller than a page. A page that comes back short of its limit now ends the listing when the store says it fills its pages (the new optional FullPageListingStore). leveldb, leveldb2, leveldb3 and TiKV do: they iterate the directory's keys until the limit is handed over or the keys end. A store that cuts a page of names to the limit and then drops some (the Redis stores, for a name whose entry is gone or expired) can end a page short with names behind it; it does not declare the interface and is asked until a page comes back empty, as before. TiKV's listing swallowed an iterator error while it skipped the start name or an expired entry, and ended the page there. It returns the error now: a page that ends short must mean the keys ended. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> * filer: see through the path translator for a store that fills its pages A path-specific store is wrapped in FilerStorePathTranslator, which does not implement FullPageListingStore, so its directories kept the extra empty scan. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: keep the last listed name when a refill lists nothing A page that lost entries to expiry is refilled from its last name. A refill that found nothing returned an empty last name, so the next page of a store that does not fill its pages started over at the top of the directory and listed every entry again. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: name the stores that fill their pages instead of an interface A short list of store names in Filer.ListsFullPages replaces the FullPageListingStore interface, the wrapper method and the per-store declarations. A path translator reports its backend's name, so it needs no unwrapping. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * foundationdb: read a listing in batches until it fills the page Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * redis: fill a listing page past orphaned and expired members Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * redis2: fill a listing page past orphaned and expired members Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mongodb: report a cursor error that ends a listing Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * tarantool: fail a listing on a malformed reply Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: test the last listed name after a refill that lists nothing Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: end a listing at a short page from any store Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * rocksdb: build the tests against the current NewFiler Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * rocksdb: count only listed entries toward the page limit Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * rocksdb: return the decode error instead of ending the listing Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: MapleWhiteZZZ <18653045+MapleWhiteZZZ@users.noreply.github.com> Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com> Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com> |
||
|
|
5a9287642f |
filer: cap list snapshots at the peers' delivery watermark (#13109)
A listing's snapshot only accounted for this filer's in-flight writes. A peer on the same store can have stamped a write below it that is not committed yet; the listing misses it and the client drops its event as already listed, leaving a stale entry (a mount reads a just-closed file as empty) until the next listing. |
||
|
|
f9b494c576 |
filer, s3: give an entry without chunks the ETag of its inline content (#13106)
* filer, s3: give an entry without chunks the ETag of its inline content A file written through a mount stores no MD5. With no chunks either (an empty file, or a small one kept inline) S3 answered HEAD, GET and listings with an empty ETag, and the filer's HTTP API with the chunk form for zero chunks, "d41d8cd98f00b204e9800998ecf8427e-0". Both now answer with the MD5 of the inline content, which for an empty file is what AWS gives an empty object and what the same file gets once it is written through S3. An entry whose size reaches past its inline content (a hole that no chunk covers) keeps the ETag it had. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> * filer: match If-Match on an entry without chunks against its inline-content ETag The gateway now answers the MD5 of the inline bytes for an entry with no stored MD5 and no chunks; the filer's conditional check still saw an empty ETag, so a PUT with If-Match set to the ETag HEAD returned failed with 412. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: MapleWhiteZZZ <18653045+MapleWhiteZZZ@users.noreply.github.com> Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com> Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com> |
||
|
|
db0ec9e9b3 |
filer: count and time the gRPC requests by method (#13107)
* filer: count and time the gRPC requests by method
The filer's request metrics cover its HTTP API. The mounts and the S3
gateway reach it over gRPC, so on a cluster used through them the filer
reported its store operations and nothing about the requests behind
them: how many lookups, creates, renames or listings arrive, how long
each kind takes, how many end in an error.
Two metrics for the gRPC port, filled by a unary and a stream
interceptor: SeaweedFS_filer_grpc_request_total{method, code} and
SeaweedFS_filer_grpc_request_seconds{method}. A stream is counted when
it ends, and timed unless the client holds it open (a subscription, a
client stream). A lookup that finds nothing returns ErrNotFound without
a status; it is labelled NotFound rather than Unknown.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
* filer: label a call ending in its context's error as gRPC reports it
A handler that returns ctx.Err() reaches the client as Canceled or
DeadlineExceeded; status.Code labelled it Unknown.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* filer: count a health watch without timing it
grpc.health.v1.Health/Watch stays open until the client leaves, so its
duration is the connection's lifetime, like a subscription's.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* metrics: dashboard panels for the filer's gRPC requests
Calls, errors by code, and p99/p50 durations by method, in the Filer row.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: MapleWhiteZZZ <18653045+MapleWhiteZZZ@users.noreply.github.com>
Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>
Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com>
|
||
|
|
207aa69a9d |
filer: keep the metadata log in its own collection, with room reserved for it (#13102)
* filer: grow the metadata log collection on its own, fall back when it is full metaLog.volumeGrowthCount (default 2) is sent with assigns into the metadata log collection, so it grows by a few volumes instead of the master's default growth. When that collection cannot take the piece, the assign falls back to the collection the log uses without the override, so a full cluster does not stall the log. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: keep the metadata log in its own collection by default metaLog.collection now defaults to filer-meta, so purging old log days empties whole volumes instead of leaving log chunks scattered across the default collection's volumes. Setting it to "" keeps the log in the filer's -collection as before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * volume: default -max to 10 to leave room for the metadata log collection The default collection still grows by 7 volumes; the extra slots keep the filer's metadata log collection (2 volumes by default) from taking them. Go and Rust volume servers share the new default. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: bound the meta log collection's share of the assign budget A meta log collection that cannot grow (for example a replication the cluster cannot place) keeps answering with retryable errors, so the first assign used the whole shared budget and the fallback was never tried. Give it 10s, then fall back, and skip it for a minute after a failure instead of waiting on it at every flush. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: name the default meta log collection so no bucket maps to it A bucket named filer-meta mapped to the same collection, and deleting it from the admin page or weed shell drops the collection directly at the master, taking the metadata log with it. Bucket names cannot contain "_", and filer group buckets map to "<group>_<bucket>". Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: clear the meta log overrides after the viper test Setting the collection back to its default value kept an explicit override, so the defaults test passed even without the SetDefault. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: retry the meta log collection once its fallback also fails The pause after a failed meta collection assign kept pieces on the shared collection for a full minute even when that assign failed too, so meta volumes that finished growing stayed unused while every flush failed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: pick a default meta log collection no grouped bucket maps to Filer group "_filer" with bucket "meta" maps to "_filer_meta". The default now keeps its only "_" in front, and the test checks every group and bucket split of it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: default the meta log collection to _meta Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: keep the default meta log collection on bucket delete A filer that logs elsewhere did not treat _meta as reserved, so deleting a bucket a storage rule maps to _meta dropped the collection other filers write their logs to. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
036d1117d2 |
fix(s3api): refuse a "dir/" PUT body larger than a directory marker holds (#13104)
* s3api: refuse a "dir/" PUT body larger than a directory marker holds A key ending in "/" whose body had no Content-Length took the marker branch, was read whole into memory and stored inline in the directory entry. One declaring more than 1024 bytes took the regular path, which wrote it to the object "dir/dir". Both now get EntityTooLarge: a declared length is checked before the body is read, an unknown one is read at most 1025 bytes. An aws-chunked body counts by its decoded length. * s3api: size an aws-chunked "dir/" body without a decoded length as unknown Without X-Amz-Decoded-Content-Length the marker check fell back to the encoded Content-Length, whose chunk framing pushed a marker of up to 1024 bytes past the limit. Such a body is now read through the limit instead. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3api: keep a "dir/" body past a marker as a version in a versioned bucket A versioning-enabled bucket stores a trailing-slash key larger than a marker as a versioned object under its .versions directory, so refusing it broke that write. Only the unversioned and suspended paths, which would land on "dir/dir", refuse it now. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3api: recheck a large "dir/" PUT against the versioning state its write uses The size check and the write path each read the versioning state, so versioning suspended in between sent the body to the suspended path, which writes "dir/dir". Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
7092edfb06 |
webhook: keep the bearer token on the configured endpoint's host (#13103)
* webhook: send the bearer token only to the configured endpoint's host A redirect to another host or port, or from https to http, now gets the request without the Authorization header. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * webhook: test the token scope across redirects Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * webhook: compare effective ports when scoping the token An omitted default port and an explicit :443 or :80 are the same endpoint; http on port 80 upgrading to https on 443 keeps the token. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
4ff3147ee5 |
worker: filer_ttl job removes expired rows from stores without native TTL (#13084)
* worker: add a filer_ttl job that walks filer.conf TTL paths A filer store without native TTL keeps the rows of expired entries until something looks them up or lists their directory. The job lists every TTL path subtree once per filer store, so the filer drops the expired rows it meets. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * worker: register the filer_ttl job in the lifecycle lane Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: re-check an expired entry under its path lock before a listing deletes it A listing deleted the expired entries it collected by path after the page was read, so a write that replaced one in between lost its new row. The delete now re-reads the row under the lock writers take, and in one conflict-checked transaction on stores that refuse a commit over another writer's change; anything but a still-expired row is kept. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * worker: read each filer store's own filer.conf, chunk-backed included Filers with separate stores keep separate filer.conf files, so one filer's rules could hide another store's TTL paths. A config stored in chunks read as empty. An unreadable config now fails the detection instead of reading as no rules. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * command: count filer_ttl among the mini default job types Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * worker: resume an unfinished filer_ttl walk from its checkpoint The walk position is saved in the job's filer store every 30s and at the first failure, keyed by store signature, and cleared when a pass completes. The next run skips the prefixes and subtrees already walked, unless the TTL prefix set changed or the pass is over 7 days old. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * worker: save the filer_ttl checkpoint as soon as a walk fails The first failure froze the checkpoint but only the end of the run saved it, so a worker killed while walking later prefixes lost it. stop now saves it at once; the end of the run saves again only if that save failed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * worker: keep a path TTL rule from expiring the filer_ttl checkpoint A filer.conf TTL rule over /etc/ gave the checkpoint that rule's TTL, so an interrupted pass could lose its record long before checkpointMaxAge. The checkpoint is now written with its own TTL of checkpointMaxAge, which the filer keeps instead of the rule's. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * worker: remove a filer_ttl checkpoint the new pass will not resume from An overwrite keeps the stored entry's Crtime, and the checkpoint's TTL counts from it, so a pass that replaced a rejected record could lose its own record before checkpointMaxAge. load now deletes a record it rejects, and the new pass creates a fresh one. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * worker: expire filer_ttl entries from metadata events per TTL rule Each run replays every filer.conf TTL rule's metadata events from that rule's cursor up to the run start, and looks up each entry whose TTL has passed so the filer removes its row. The first entry not yet due holds the rule's cursor, so a later run replays it. A rule without a cursor, or whose TTL changed, is listed once to reach rows older than its replay window. The periodic full walk and its checkpoint are gone. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: re-check an S3-expired entry under its path lock before a listing deletes it A listing deleted an S3-expired object by the row it had read, so an upload that replaced it after the page was read was removed. The delete now re-reads the row under the path lock and removes it only if it is still S3-expired. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: remove an expired row a lookup meets in a conflict-checked transaction A lookup that met an expired row deleted it by path, so a replacement written through another filer between the read and the delete was lost, even on stores that refuse conflicting commits; a failed delete was hidden behind not found. The lookup now re-reads and deletes through deleteIfExpired and returns the delete error. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * worker: keep a failed filer_ttl lookup that ties a done event When the first event at a timestamp was done and the second one's lookup failed, the cursor already stood at that timestamp, so the retry subscribed after it and skipped the failed event. A failed lookup now holds the cursor below a tie, as a waiting entry does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * worker: hold a filer_ttl event whose entry the filer still serves A lookup that returned the live entry counted as done, so when the worker's clock ran ahead of the filer's near the deadline the event was skipped and the row stayed. An entry the filer still serves with the same deadline now holds the cursor like one not yet due. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * worker: keep a path TTL rule from expiring the filer_ttl cursors The cursors were written without a TTL, so a filer.conf TTL rule covering /etc/seaweedfs/filer_ttl gave them the rule's TTL and every rule was listed again once they expired. When a rule covers them they are now written with a TTL of their own, which the filer keeps. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * worker: list a filer_ttl rule again for a live entry its replay cannot reach A new rule nested under a longer one started its replay one TTL back, so a live entry the enclosing rule had stamped with its longer TTL, written before that, was in neither rule's replay: the nested rule now owns it and the enclosing rule skips it. The listing of a new rule now records the earliest deadline of such entries, and the rule is listed again then. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * worker: hand a removed filer_ttl rule's replay to the rule enclosing it When a nested rule was removed, its entries became the enclosing rule's, but that rule's cursor could already be past their events, so they were never replayed. The enclosing rule now replays from the earlier of both cursors. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * worker: list a filer_ttl rule whose unfinished events the filer no longer keeps When fs.log.purge removed the event of an entry still waiting for its TTL, the rule's cursor matched, so the rule was never listed and the replay never met the entry again. A rule whose cursor is older than the oldest kept metadata log is now listed, and its cursor moves to that log. The cursor also records how far a replay read with nothing left waiting, so a quiet rule is not listed just because old logs were purged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * worker: leave S3 lifecycle expiry to the s3_lifecycle job in filer_ttl An entry whose TTL an S3 lifecycle rule set carries the S3 expiry flag; s3_lifecycle evaluates and removes it. filer_ttl no longer looks such entries up, and their deadline no longer holds a TTL rule's cursor. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
0ea67a4438 | docs: regenerate star history chart | ||
|
|
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> |