mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-12-04 18:17:16 +01:00
52ca644866b8baf4712e145ae2c74ebca3a963f2
16725
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
52ca644866 |
ci: run the postgres_flat tests on pull requests to any branch
Like the S3 workflows, so a stacked pull request runs them too, and only when the code they reach changes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011UpvafvK8JpagF94MHWqwK |
||
|
|
e0251b2d54 |
ci: run the postgres_flat S3 and FUSE tests against Postgres
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011UpvafvK8JpagF94MHWqwK |
||
|
|
bfd9e84c16 |
test/postgres_flat: a FUSE mount against the postgres_flat store
Files, a directory longer than a listing page, renames, hard and symbolic links, tree removal and a bucket made through the mount, checked against the rows, then read back by a second mount with an empty metadata cache. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011UpvafvK8JpagF94MHWqwK |
||
|
|
d4ae1f5e05 |
test/postgres_flat: S3 against a filer on the postgres_flat store
A weed mini whose filer.toml enables postgres_flat in a schema of its own. Objects, listings, copies, multipart uploads, versions and bucket deletion are checked through S3 and against the rows of the bucket's table. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011UpvafvK8JpagF94MHWqwK |
||
|
|
2fddcae20e |
filer/postgres_flat: name a missing filemeta table instead of a foreign layout
With createTable = false and no filemeta table, the layout check said the table had no path column and blamed a postgres2 layout. Report the missing table and the key-value table that also has to be created. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
6df73344ca |
filer: register postgres_flat and add it to the filer.toml scaffold
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011UpvafvK8JpagF94MHWqwK |
||
|
|
cb1356f7f1 |
filer: postgres_flat store
Entries are keyed by their full path, the object key inside a bucket's table; buckets get tables of their own as in postgres2. Key-value records keep the postgres2 layout in filemeta_kv. The store refuses a filemeta table of another layout, so it needs a schema of its own. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011UpvafvK8JpagF94MHWqwK |
||
|
|
cba6549067 |
filer/postgres: SQL generator keyed by the full path
Rows have path as their primary key; a (directory, name) unique constraint serves the directory listings. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011UpvafvK8JpagF94MHWqwK |
||
|
|
a341909a81 |
filer/sql: key-value records may live in a table of their own
A store whose entry tables have another layout keeps its key-value records in KvTable, written by KvSqlGenerator; its scans then read only entries and need not tell the records apart. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011UpvafvK8JpagF94MHWqwK |
||
|
|
19573691ca |
filer/postgres: postgres and postgres2 share their connection setup
ReadConnection reads the settings and their defaults, Connection.Open opens the store's pools. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011UpvafvK8JpagF94MHWqwK |
||
|
|
cb9f2095c9 |
filer/postgres: build the connection string with pgxutil.BuildDSN
The credential store already does; it quotes values per libpq, so a password or certificate path with spaces or quotes no longer breaks the connection string. The OpenPGXDB alias has no callers left. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011UpvafvK8JpagF94MHWqwK |
||
|
|
69d88eb385 |
filer/sql: scan pages take the row key of the last row as their cursor
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011UpvafvK8JpagF94MHWqwK |
||
|
|
34e0271181 |
filer/sql: batch lookup takes row keys and matches rows by name and directory
A key-value key's directory column already determines its dirhash, so the batch read no longer selects dirhash to match its rows. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011UpvafvK8JpagF94MHWqwK |
||
|
|
38aa347c35 |
filer/sql: generators bind the arguments of directory statements
Listing and deleting a directory's children take the directory and return their arguments with the query. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011UpvafvK8JpagF94MHWqwK |
||
|
|
4ae00a4728 |
filer/sql: generators bind the arguments of row statements
Insert, update, find and delete now take the row key and return their arguments with the query, so a generator decides how a key maps to its columns. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011UpvafvK8JpagF94MHWqwK |
||
|
|
88fb3c60eb |
ci: give the go test job Postgres and MySQL services
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011UpvafvK8JpagF94MHWqwK |
||
|
|
6c6cd81b89 |
filer: run postgres2 and mysql2 through the conformance suite
RUN_POSTGRES_TESTS and RUN_MYSQL_TESTS enable them, as RUN_REDIS_TESTS does the Redis stores; each test gets a schema or database of its own. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011UpvafvK8JpagF94MHWqwK |
||
|
|
e67a7b3752 |
filer/store_test: conformance suite for filer stores
Entries in and out of buckets, byte-ordered and prefixed listings, key-value records, transactions, bucket tables and the snapshot scan. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011UpvafvK8JpagF94MHWqwK |
||
|
|
d715c4e28f |
mount: buffer a write in memory when the swap file cannot take it (#13205)
* mount: buffer a write in memory when the swap file cannot take it The dirty pages of a random write, or of more files than the memory budget holds, go to a swap file under -cacheDirWrite (by default -cacheDir). On a full cache disk the swap file cannot be created, or a write into it fails, and the FUSE write failed with EIO (#12655; before it the mount panicked or acknowledged a write it had not kept). The data was still in hand. Such a chunk now stays in memory. A chunk whose swap write fails is sealed with what it holds, so its upload keeps that, and the data goes into a chunk in memory. The file then keeps chunks in memory for a 10s backoff before it tries its swap file again. The sealed chunk uploads through the swap read-back of #13198: if its earlier bytes cannot be read back either, the flush fails, while the data written again into memory still uploads. Memory stays bounded, as the sequential path bounds it: past 8 writable chunks in the file, or past the shared memory-chunk ceiling, the file seals a chunk before it creates another. Sealing waits for an upload slot, so a writer that outpaces its uploads slows down instead of filling memory. The #12655 tests made a write fail through an unusable swap directory. They now make the dirty pages refuse the write directly, and a new test checks that an unusable swap directory no longer fails it. A pipeline test covers a sealed chunk whose swap file can no longer be read. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mount: move a refused swap chunk into memory instead of sealing it When the swap file refused a write, the first commit sealed the swap chunk with what it held and wrote the data again into a new chunk in memory at the same index. Two chunks at one index fail in two ways: - A disk that takes part of an overwrite, as a full copy-on-write disk can, leaves the swap chunk with the new first half and the old second half. Its upload joins the two under the overwrite's timestamp, and the memory chunk uploads the new bytes under the same timestamp. Equal timestamps resolve to the chunk the entry lists last, so when the swap upload finished last the old bytes came back. - Sealing the memory chunk while the swap chunk was still uploading replaced the swap chunk in the sealed slot. Until its upload finished, reads of the bytes only it held found nothing. Now the swap chunk's ranges are read back into the new memory chunk, each under its own timestamp, before the write goes in. The swap chunk then gives back its slot without an upload, so the index keeps one chunk. When the swap file cannot be read back either, or memory holds the shared ceiling of chunks, the write stores only what the swap file took and reports a short write, as master does. Memory now stays under the shared ceiling of memory chunks. Before, a file with no chunk of its own to seal allocated a new chunk past the ceiling anyway, so memory grew with the number of open files writing sparse chunks. Now that write fails. A file that has a chunk seals it to make room for the new one, as before. The per-file bound is also checked again after each seal, since a seal releases the lock. refusingDirtyPages moves to a test file built on every platform, because the copy range test also uses it on FreeBSD. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mount: seal a memory chunk at the shared ceiling and recheck both bounds At the shared ceiling, a file made room for a new chunk in memory by sealing any one of its writable chunks. A swap chunk left by a refused write frees no memory when it uploads, so memory went past the ceiling by one chunk for each file in that state. At the ceiling a file now seals one of its memory chunks, and if it has none the write fails. Sealing releases the lock, and other writers may create chunks meanwhile. The per-file bound was checked again after a seal made for it, but not after a seal made for the shared ceiling. One loop now checks both bounds again after every seal. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mount: drop an empty swap chunk the swap file refused at the shared ceiling At the shared ceiling, a swap chunk created for a write that the swap file then refuses cannot move into memory. It was left in place, holding nothing. Such chunks count against the file's bound, but nothing can seal an empty chunk, so after enough refused writes a later write found nothing to seal and created a chunk past the bound anyway. The empty chunk is now dropped, giving back its slot and its write budget. A write that still finds nothing to seal at the bound fails instead of going past it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mount: seal a memory chunk of the file before moving a refused swap chunk at the ceiling At the shared memory ceiling a new chunk seals one of the file's memory chunks and carries on, but a swap chunk whose write the swap file refused failed the write instead. That is the first write after every backoff on a full cache disk, and every write into an existing swap chunk. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mount: keep the per-file bound when a refused swap chunk moves into memory A file may hold more swap chunks than swapRefusedWritableChunks. When the swap file refuses a write into a chunk created past that count, moving it into memory left the file over the bound with every chunk in memory. Seal another chunk of the file first, as a new chunk does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mount: write again when a refused swap chunk is sealed during a seal Moving a refused swap chunk into memory may first seal another chunk, which releases the lock. If another writer or the flusher sealed the swap chunk meanwhile, the write failed although a new chunk could take it. Write into the chunk now at the index instead. 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> |
||
|
|
44b016b991 |
helm: run the S3 gateway's message queue broker with grpc.msg_broker TLS (#13240)
* helm: pass the S3 gateway's message queue broker port Every S3 gateway now runs a message queue broker on 17777. s3.mqBrokerPort and filer.s3.mqBrokerPort set the port for the standalone gateway and the filer's, and allInOne.s3.mqBrokerPort falls back to s3.mqBrokerPort when null. A port of 0 renders the off flag, since leaving the flag out would let weed start the broker on its default. The all-in-one inherits through a helper that tells null from 0, which default cannot. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * helm: admit the message queue broker port in the NetworkPolicy Clients and other brokers learn a broker's address from the master and dial the pod directly, so a Service does not help them. Under a default-deny namespace the policy has to admit the port on the s3, filer and all-in-one pods that run a broker, or publishing and inter-broker replication stall. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * helm: list the message queue broker port on the S3 pods and Services The s3, filer and all-in-one pods declare a swfs-mq-broker containerPort when they run a broker, and their Services carry it the way they carry the Iceberg and Lance ports. Brokers are reached by pod IP, so this is for visibility and for anything that addresses the port by name. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * helm: document the S3 gateway's message queue broker port Describe the three port values, that 0 turns the broker off, and that clients reach brokers by pod IP, so under the NetworkPolicy anything outside the release needs its own ingress rule. The chart version is left alone; it moves with the release commits. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * helm: leave the broker port flag out when it is weed's default 17777 is already the binary's default and the broker is on by default, so rendering -mq.broker.port=17777 only breaks a release pinned to an image that predates the broker flags. The port flag now appears only for a non-default port and the off flag only for 0; the containerPort, Service port and NetworkPolicy entry still follow the configured port. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * helm: give the gateway brokers mTLS through grpc.msg_broker weed starts the broker beside an S3 gateway on its own only when grpc.msg_broker has a cert and key. With enableSecurity the chart now writes that section with the internal client certificate grpc.s3 already uses, so the brokers serve and dial each other with mutual TLS against the grpc.ca the chart sets, and every pod running a gateway already mounts both. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * helm: choose the gateway broker with mqBroker auto, true or false weed now starts the broker beside an S3 gateway unflagged only when grpc.msg_broker TLS is configured. s3.mqBroker, filer.s3.mqBroker and allInOne.s3.mqBroker (null inherits s3's) pick it: auto passes no flag and so runs it under enableSecurity, true passes -mq.broker=true (-s3.mq.broker=true on the filer) and runs it without TLS when security is off, false passes the off flag. One helper decides the flags and whether the broker runs for all three, and the containerPort, Service ports and NetworkPolicy entry now appear only when it does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * helm: document mqBroker and the broker's TLS default The gateway broker no longer runs everywhere: describe auto, true and false, that auto means enableSecurity and its mTLS, that true without security serves any client that reaches the port, and that the ports only appear when the broker runs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * helm: test the gateway broker's flags, ports and TLS section Render s3, filer.s3 and allInOne across auto with and without security, true, false, port 0 and a custom port, plus allInOne.s3 inheriting and overriding the s3 values. Each case checks the broker and port flags together with the containerPort, Service port and NetworkPolicy entry, so a broker that runs with its port blocked fails. Also check that [grpc.msg_broker] is written only with enableSecurity, and that an unknown mqBroker value fails the render. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * helm: keep the broker port off the Services Brokers register with the master under the pod address, and other brokers and publishers find them there and dial the pod, never a Service. The swfs-mq-broker Service port only made a LoadBalancer or NodePort s3, filer or all-in-one Service publish the broker outside the cluster, in plaintext with mqBroker true and no security. Drop it; the containerPort and NetworkPolicy entry stay, and the test now fails if any Service carries the broker port. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
3ea924d39f |
filer: take every log fence from the event stamp sequence (#13239)
* filer: take the log fence without registering an in-flight stamp LogFenceTsNs stamped and released at once, so each fence briefly sat in the in-flight registry, where a concurrent claim could be capped below it, and took the registry mutex twice. Draw the fence from the same sequence under one lock acquisition without registering it. Lookups are about to take one per read. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: fence CreateEntry and UpdateEntry from the event stamp sequence Both stamped their pre-write fence from the raw wall clock, so after a backwards clock step the fence could sit below events the acknowledged state already reflects, including the previous write's event on the same key. A mount that versions a no-op ack by that fence would then accept an older event over it. Take the fence from the same sequence the events use, so it lands above every earlier event and below the write's own. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: fence a remote-object cache commit from the event stamp sequence CacheRemoteObjectToLocalCluster stamped its commit fence from the raw wall clock under the path lock. After a backwards clock step that fence fell below events the cached entry already reflects, the same as the old CreateEntry and UpdateEntry fences. Take it from the event stamp sequence. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: fence lookups from the event stamp sequence fencedFindEntry, behind LookupDirectoryEntry and LookupDirectoryEntries, stamped its read fence from the raw wall clock under the shared path lock. After a backwards clock step the fence fell below events the returned entry already reflects, so a client versioning the entry by it could take an older event as newer. Draw it from the event stamp sequence instead. The fence registers nothing in flight, so it never caps flush or delivery claims; it costs one short critical section on the stamp registry's mutex per lookup. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: keep the stamp sequence above renumbered log positions The meta log buffer renumbers an event appended out of stamp order past the last position it holds, and that position is what subscribers see. Concurrent writers append in whatever order their notify work finishes, and with the wall clock behind the sequence every renumbered position lands past the last stamp, so a later fence could sit below an event the fenced state already reflects. Feed each delivered position back into the sequence stamps and fences draw from. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: draw a lookup's fence after the read FindEntry can log an event of its own on the path it reads: importing a remote object under a mount creates the entry, and an expired entry is deleted. Both stamp above a fence drawn before the read, while the returned state reflects them. Draw the fence after the read with the shared path lock still held; a locked writer on the path cannot land in between. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: draw the remote cache commit's fence after its re-read The re-read can import the object from the remote and log that event; an entry changed during the download is returned with this fence, which has to cover the import. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: take the exclusive path lock for a lookup that writes Fenced lookups share the path lock, and FindEntry can write under it: it deletes an expired S3 object and imports an object from a remote mount, logging an event either way. A lookup that read the old state just before could then draw its fence above that event and return the old state, so a client skipped the event as already reflected. A fenced lookup now reads with FindEntry reporting such a write instead of making it, and redoes the read under the exclusive path lock when it does. The shared lock is released first, so nothing holding it waits on the exclusive one. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: escalate a fenced lookup only when the remote has the object Refusing the lazy fetch before the remote stat sent every fenced lookup that missed under a remote mount to the exclusive lock, so concurrent lookups of one missing key ran their stats one after another instead of sharing one. A lookup that may not write now stats in a flight of its own and asks for the exclusive lock only when there is an object to import. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: require the live object from the first lookup in the expiry race test The fence check was skipped when the first lookup errored or found nothing, so a run that took either path passed without checking anything. The store hands that lookup its copy before the hook expires the object, so it always returns the live object; require that, then compare its fence against the delete. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: release the shared remote stat only after every lookup joined it The test let the stat sleep and assumed all eight lookups joined within that window, so a lookup scheduled late could start a second, correct flight and fail the count. The stat now waits on a gate the test opens once the other seven lookups wait on the in-flight call. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
185cefc652 |
filer: keep the server digest tests passing under fips140=only (#13243)
GODEBUG=fips140=only refuses MD5, and the filer then digests with SHA-256 cut to MD5's size. Tests that compared stored or reported digests against crypto/md5 or hard-coded MD5 hex panicked or failed there; they now compute the expected digest with util.Md5, which follows the process mode. Tests that exercise a client's Content-Md5, which only exists with MD5, are skipped under fips140=only as the digest test already is. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
0d3f81b771 |
volume(rs): refuse short JWT keys and skip Content-MD5 under fips.mode strict (#13206)
* volume(rs): refuse short JWT keys and skip Content-MD5 under fips.mode strict Under fips.mode = strict the Rust volume server now does what the Go volume server does under GODEBUG=fips140=only: - At startup it exits when a JWT key in security.toml (any of the eleven jwt.signing* and jwt.filer_signing* settings Go checks) is shorter than the 14 characters FIPS 140 needs for HMAC keys, naming each one. Outside strict mode it warns about each such key but the previous ones. - On SIGHUP, short current keys keep the keys in effect, and a short previous key is dropped, as in Go's Guard.UpdateSigningKeys. - An upload's Content-MD5 is kept as the client sent it, unchecked, since strict mode computes no MD5. The key rule and its messages live in seaweed-common's jwt_keys, so the worker can use the same one. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * ci: run the fips140only cells in fips.mode strict, check strict refusals The fips140only cells of the S3 digest matrix set WEED_FIPS_MODE=strict beside GODEBUG=fips140=only, so the Rust volume server runs in the same mode as the Go processes. A new job, test/s3/digest_matrix/negative_config.sh, checks that master, filer and both volume servers refuse a 10-byte JWT key at startup, that both volume servers keep a mismatched Content-MD5 unchecked, and that S3 answers a request signed with an 8-character secret with an error. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test: check the strict-mode Content-MD5 rule against both volume servers TestWriteMD5MismatchKeptUncheckedUnderStrictFIPS starts the volume cluster under GODEBUG=fips140=only and WEED_FIPS_MODE=strict and checks that an upload with a mismatched Content-MD5 is stored with the client's value. It sits in test/volume_server/http, so it runs against the Go volume server and, with VOLUME_SERVER_IMPL=rust, against the Rust one. The same check leaves negative_config.sh, which keeps the startup refusals. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * volume(rs): say which keys the strict-mode checks cover and what they do The doc comments of the startup check, the reload rule and the jwt_keys helpers now say which keys they check and what happens in each mode. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * volume(rs): an empty WEED_ variable leaves the security.toml value in place env_string returned an empty variable as a value, so WEED_JWT_SIGNING_KEY= replaced the key from security.toml with an empty one: the volume server then checked no JWTs, and under fips.mode strict a short file key was not refused, while Go's volume server exits with the same files. Go's viper ignores empty variables; env_string now does the same for every WEED_ override. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * volume(rs): read security.toml with the TOML parser The line reader missed quoted key names, multiline strings, dotted keys, inline tables and spaced or quoted table headers, all of which Go's viper reads, so a short JWT key written that way escaped the strict-mode check and was not used at all. Settings are now looked up in the parsed table, case-insensitively as viper does. A file that is not valid TOML is still read line by line, as before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * volume(rs): prefer the longest literal security.toml key, as viper does Viper looks a dotted setting up longest name first, so a quoted "jwt.filer_signing.key" key, at the top or under [jwt], wins over the nested [jwt.filer_signing] key. The volume server read only the nested one, so a short literal key passed the strict-mode check here while the Go servers refused it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * volume(rs): resolve security.toml key case collisions as viper does Viper lowercases every key of a config file, and when two spellings collide (key and KEY, or [jwt] and [JWT]) the one that is not lowercase wins. The volume server matched names case-insensitively but took the exact spelling first, so a short KEY next to a compliant key passed the strict-mode check here while the Go servers refused it. The parsed table is now lowercased the same way before any lookup. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * volume(rs): read an array or table security.toml setting as unset Viper's GetString reads an array or a table as "", so the Go servers skip a jwt key written as key = ["x"]. The volume server read its TOML text instead, used it as the key and refused strict-mode startup over it. fips.mode is still read as text: Go refuses a mode that is not a string, and so does this server. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * volume(rs): keep each lenient security.toml line under its full name A security.toml that is not valid TOML is read line by line, and those lines went into nested tables, so a later scalar such as signing = "x" under [jwt] replaced the [jwt.signing] table and erased its key. The line reader ignored such lines before, and a SIGHUP reload of that file would have installed an empty write key. Each line now goes in under its full dotted name, which the longest-name lookup finds first. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * volume(rs): take the FIPS mode from the read that gives the JWT keys Startup read security.toml once for the JWT keys and again for fips.mode, so a file replaced between the two reads could pair the keys of one version with the mode of the other and refuse to start over keys that version never ran in strict mode with. The mode now comes from the same parse as the keys; a file that exists but was not read is still an error. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * volume(rs): read a float security.toml setting as Go's GetString does GetString formats a float with the shortest digits and no exponent, so key = 1234567890123.0 is a 13-byte key to the Go servers. The volume server kept the TOML spelling with its .0 and measured 15 bytes, which passed the strict-mode check the Go servers refuse. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * volume(rs): skip array-of-tables sections in a lenient security.toml A file that is not valid TOML is read line by line, and lines under a [[jwt.signing]] header went in under the same names as [jwt.signing], so an empty key there replaced the real one, and a SIGHUP reload would install it. The line reader now skips such sections up to the next ordinary header, as the earlier reader did. 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> |
||
|
|
04bbf1ae0f |
filer: keep the default broker off the debug port (#13242)
weed filer -s3 checked the broker port against the filer, metrics, read-only, WebDAV, IAM and SFTP ports but not -debug.port, which the debug server binds before the broker starts. weed server already includes it. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
52afabbf1b |
mq: avoid a deadlock when retiring a partition with a full flush queue (#13225)
* mq: let partition retirement drain a full flush queue outside broker locks * log_buffer: queue the final flush from ShutdownLogBuffer itself Every ShutdownLogBuffer caller already waits afterwards with WaitForShutdown or IsAllFlushed, so queueing the final flush in the background changes no caller's outcome and lets every caller holding a lock a flush callback needs avoid the full-queue deadlock, without a second shutdown entry point. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
45458336e1 |
s3: run a message queue broker beside every S3 gateway (#13235)
* mq broker: let an embedding command own the broker's start failure and shutdown startQueueServer now returns an error when the broker cannot start instead of exiting, binds its port before creating the broker so one that cannot serve never registers with the master, and stops when an optional shutdownCtx is cancelled. Profiling setup moves to weed mq.broker, since an embedded broker read the standalone command's profile flags. weed mq.broker and weed server -mq.broker still exit on a start failure. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3: run a message queue broker beside the gateway by default weed s3 now starts a broker on -mq.broker.port (17777) once it has reached its filer, using the masters and filer group the filer reports. The broker is its own gRPC server: it binds the gateway's -ip.bind, advertises the address the gateway registers with the master, and joins the cluster like any other broker. It stops with the gateway. A broker that cannot start, say because the port is taken, is logged and the gateway keeps serving. -mq.broker=false turns it off. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * server: start the message queue broker with the S3 gateway weed server -s3 now runs a broker beside its gateway, started by the gateway once it reaches the filer. -mq.broker=false leaves it out. An explicit -mq.broker or -mq.agent still starts the broker on its own, and then the gateway does not start a second one. Only that explicit broker exits the server when it cannot start; the one that comes with -s3 is logged, so a host already running a broker on the port keeps its gateway. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mini: run the message queue broker beside the S3 gateway weed mini now starts a broker with its S3 gateway on -mq.broker.port (17777, below the Linux ephemeral range), binding and advertising mini's -ip.bind and -ip like the other services. The port joins mini's port layout, so a taken port moves to the next free one unless it was given explicitly. The broker stops with the gateway, before the filer it flushes to. -mq.broker=false or -s3=false leaves it out. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: start the message queue broker with the S3 gateway weed filer -s3 now runs a broker beside its gateway on -s3.mq.broker.port (17777), the same way weed server -s3 does: it binds and advertises where the gateway does, takes the filer's -dataCenter and -rack, stops with the gateway, and a broker that cannot start is logged while the gateway keeps serving. -s3.mq.broker=false leaves it out. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mini: list the message queue broker when it is running The S3 gateway now binds its broker's port before it starts serving, as it does for the Iceberg and Lance listeners, and records whether the bind worked. Once mini sees the S3 port answer, the result is final: the progress board shows the broker ready or failed, and the welcome banner lists its address only when it bound. With -mq.broker=false or -s3=false neither shows it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3: keep the default broker off the gateway's own ports The broker binds before the gateway binds its ports, so a gateway started with -port=17777, -port.grpc=17777 or -port=7777 (gRPC port 17777) lost its port to the default broker and exited. weed s3, weed server -s3 and weed filer -s3 now compare the broker port with the gateway's HTTP, HTTPS, gRPC, Iceberg, Lance and metrics ports first. A default broker port that clashes skips the broker with a warning; a broker port given on the command line that clashes is an error. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mini: reserve explicitly set gRPC ports before placing other ports Mini only kept derived gRPC ports free while it placed the other services, so the broker's default port could take an explicit -s3.port.grpc=17777 and push the S3 gRPC server to another port. An explicit gRPC port is now reserved too: the default broker moves off it, and an explicit broker port on it is rejected. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * server: keep the default broker off the ports of the servers it starts With -volume.port=7777 the volume gRPC port is 17777, the default broker port. The volume server binds its gRPC port only after a master answers, so the broker could take it first and the whole process exited. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mini: keep an explicit gRPC reservation when a derived one moves When the filer's HTTP port was taken and moved, dropping its old derived gRPC port also dropped an explicit -s3.port.grpc on the same port, so an explicit -mq.broker.port could share it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * server: bind the broker beside S3 where the gateway binds With -ip.bind=0.0.0.0 -s3.ip.bind=127.0.0.1 the broker that comes with the gateway listened on every interface. It now takes the gateway's bind and advertised address, as under weed s3 and weed filer -s3. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * server: keep the default broker off the volume public port Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mq broker: report a bad TLS config instead of exiting The embedded broker loaded grpc.msg_broker TLS through LoadClientTLS and LoadServerTLS, which exit on a bad config, so a cert without a key or without grpc.ca took the whole S3 gateway down. The broker now loads TLS before binding through the error-returning loaders, exported from the security package as TryLoadClientTLS and TryLoadServerTLS, and returns the error like any other start failure: the gateway logs it and keeps serving, while weed mq.broker and weed server -mq.broker still exit. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3: start the gateway's broker by default only with broker TLS Without grpc.msg_broker TLS the broker accepts any peer, so the broker beside weed s3, weed server -s3 and weed filer -s3 now starts on its own only when grpc.msg_broker has a cert and key in security.toml. Otherwise it stays off and the gateway logs one line saying so and that -mq.broker=true (-s3.mq.broker=true for the filer) runs it without TLS. An explicit true starts it either way and an explicit false keeps it off. weed mini, a single-process dev setup, keeps its broker on. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: keep the default broker off the ports of the servers it starts weed filer -s3 checked the broker port only against the gateway's ports, so with -webdav -webdav.port=17777 the broker could bind 17777 first and WebDAV then took the whole filer down. The check now also covers the filer's own HTTP, gRPC and read-only ports, its metrics port, and the WebDAV, IAM and SFTP ports when those run, as weed server does. A default broker port that clashes skips the broker with a warning; a clashing -s3.mq.broker.port is an error before the servers start. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * server: keep the default broker off the filer read-only and debug ports The port check beside -s3 left out -filer.port.public and, with -debug, -debug.port, so a broker on 17777 could still take a port the filer or the debug server binds. Both are now in the list. WebDAV, SFTP and IAM were already covered when enabled. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
6b2e22950a |
s3: bucket notification configuration API and target registry (#13236)
* s3: add the bucket notification target registry Notification destinations are defined by the operator in /etc/s3/notification/targets.json and referred to by name from bucket configurations, so a bucket owner cannot make the server connect anywhere new. The registry parses and validates that file: unique names that fit in an ARN segment and an MQ topic name, known types (topic and webhook now, kafka, aws_sqs, google_pub_sub and pubsub accepted for later), the fields each type needs, and no unknown keys. A target serves only the buckets its allowed_buckets globs match, and none when the list is empty. Parse errors never carry credential values. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3api: hot-reload the notification target registry Every gateway reads /etc/s3/notification/targets.json at startup and reloads it from the /etc metadata subscription it already runs for the IAM and circuit breaker files. A write reloads it, a delete or rename away empties it, and a file that does not parse leaves the previous registry in place so a bad edit does not cut every bucket off its destinations. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3: parse and validate bucket notification configurations The full PutBucketNotificationConfiguration document is parsed: topic, queue and cloud function configurations with their Id, destination ARN, events and key filter. Event names are checked against the AWS list, wildcards and names for things that never happen here included, plus the multipart and retention events this server emits. A filter takes at most one prefix and one suffix rule, a document at most 100 configurations, and overlapping rules are allowed. EventBridge stays NotImplemented. A destination resolves by the last segment of its ARN to a target, which must exist, be enabled and allow the bucket; the error does not say which of those failed. A rule without an Id gets one derived from its content, so every gateway reports the same configurationId for it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3: match an event against a bucket's notification rules Configuration.Match takes an event name such as s3:ObjectCreated:Put and an object key and returns each rule that covers them, with its configurationId and target, in configuration order. Category wildcards cover every event in the category, prefix and suffix are case-sensitive and checked independently, and an event that several rules cover matches each of them, as AWS delivers one record per rule. Publishing calls this; it is a pure function of the stored configuration. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3api: store bucket notification configurations PutBucketNotificationConfiguration used to accept only an empty document and answer NotImplemented for any destination. It now parses the full document, checks every destination against the target registry for this bucket, and stores the XML exactly as sent in one Extended key on the bucket entry through updateBucketConfig, which patches that key alone on the bucket's owner filer. An empty document removes the key. GET returns the stored bytes unchanged, so tools comparing ARNs see no diff, and the bucket config cache carries the parsed rules for publishing to match. x-amz-skip-destination-validation is parsed and must be true or false. It only skips the test event, which publishing will send; the registry check always runs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3notification: reject content after the configuration's root element The stored document is served back unchanged by GET, so anything after the root other than whitespace, comments or processing instructions is refused. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3notification: reject unknown elements inside rules and filters A misspelled Filter, S3Key, FilterRule or Value was dropped by decoding and left an unfiltered rule; it is now MalformedXML like an unknown root child. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3notification: URL-decode prefix and suffix filter values AWS has special characters in filter values percent-encoded and a space written as +, so reports+2026/ selects reports 2026/a. A value that is not valid encoding is still matched as written. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3api: refuse a notification targets file stored in chunks Only inline content is read, so a targets.json kept in chunks (written by a mount, for one) read as an empty registry and dropped every target. It is now refused with a warning and the loaded registry stays. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3notification: refuse overlapping rules as AWS does AWS answers InvalidArgument ("Configuration is ambiguously defined") when two rules share an event type and both their prefixes and suffixes overlap, so an event for a key matches at most one rule. Such configurations were accepted and matched every rule. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
6a6208e42f |
mq: a leader-only partition gains a follower, and cold partitions are purged (#13232)
* mq balancer: start a new generation when a partition's follower changes EnsureAssignmentsToActiveBrokers gave a leader-only partition a follower once a second broker was live, and replaced a lost follower, but kept the epoch. A leader starts replicating only when it takes the fence, so a loaded leader never saw the new follower: its copy at the same epoch was never retired, and the partition stayed unreplicated, acking from memory, until something reloaded it. Any change of the pair now bumps the epoch, so the leader retires its copy after the last flush and reloads under the new generation with a replicator to the new follower. Re-spelling the same broker's address still keeps the epoch, so an unchanged pair is not churned. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mq broker: hand a repaired assignment's new generation to its leader When the balancer repaired a topic's assignments it only saved topic.conf. A leader learned of a new generation only when a new publish or subscribe stream asked for the partition after its own cached topic.conf expired, so a loaded partition kept serving the old generation, without the follower it had just been given, for as long as its clients stayed connected. Once the repair is saved, the balancer now sends every assignment whose epoch moved to its leader, which retires the old copy after its last flush and reloads under the new fence, replicating to the new follower. The handoff runs outside topicConfLock, since the leader may wait for that flush. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mq balancer: repair every topic's assignments once a broker joins The balancer repaired a topic's assignments only when a lookup missed its cached topic.conf. A partition placed while its leader was the only broker kept no follower after a second broker joined for as long as its clients stayed connected and never looked it up again. The balancer now counts brokers joining it and, once settled, repairs every stored topic after a join, handing any new generation to its leader. A sweep that fails is retried on the next tick; one that finds nothing to change saves nothing, so a reconnect does not churn partitions. A repair that saves topic.conf also drops the balancer's cached copy, which lookups would otherwise keep answering with the old pair. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mq broker: purge a partition past retention when its leader loads it Files past a topic's retention were deleted only by the periodic purge, which visits partitions that are loaded when it runs. A partition loaded for a short read or write and unloaded once idle could miss every pass, keeping its expired files. A leader now purges a partition as soon as it has loaded it, under the fence it has just taken and after seeding its offsets, so every load deletes what has expired. The purge runs once the partition is registered, outside the broker's access lock. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mq balancer: load partitions whose files are past retention A partition that nothing publishes to or reads from is never loaded, so neither the periodic purge nor a purge on load ever reached it, and a cold topic kept its expired files indefinitely. Every purge interval the balancer now lists each topic with retention, works out per partition what a purge would delete, and hands only the partitions with something to delete to their leaders. The leader's load purges them under the fence it takes, so deletes stay fenced. A partition with nothing to delete, such as one holding only its newest file, is not loaded, so cold partitions are not churned. The planning half of purgeExpiredLogFiles moves into expiredLogFiles, which the purge and the balancer share. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mq balancer: resend a new generation until its leader takes it After a repair saved a new generation, the balancer told the leader once and only logged a failure. The repair loop still counted the join as done, and later sweeps found nothing to change, so a leader whose publish stream kept its old partition went on acking without the follower it had been given. Saved generations are now kept as pending, one per partition with a newer one replacing an older, and the repair loop hands each due one to its leader, backing off after each refusal, until the leader takes it or topic.conf has moved past it. A join counts as repaired only once nothing is pending. Sending runs in the repair loop, off topicConfLock, which a save now wakes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mq balancer: hand pending generations to leaders in parallel under one deadline The repair loop handed pending generations over one at a time, each with its own 30 second timeout, so a broker that stopped answering held the loop for that long per partition it led: with a hundred of them, healthy leaders and later joins waited most of an hour. A pass now reads each topic.conf once, groups the generations still current by leader and topic into one request each, and sends up to eight leaders at once under a single deadline for the whole pass. A leader that does not answer delays only its own generations, which keep their backoff, and the pass returns once the deadline passes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mq balancer: key a pending generation by the partition's full identity Pending generations were keyed by topic and range alone. A topic repartitioned away from a range and back gets a new partition for that range, with a new creation time and epochs starting over, so a pending generation of the old partition at a higher epoch made the new one look older and it was never queued. The key now includes the ring size and creation time, so epochs are compared only within one partition; the old entry is dropped as superseded when it next comes due. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mq balancer: hand over generations a previous balancer left undelivered Pending generations live only in the balancer's memory. A balancer that saved a new generation and stopped before its leader took it lost it: the next balancer's sweep found topic.conf already repaired, recorded the join as done, and a leader whose clients kept its old copy served that generation without its new follower indefinitely. Once settled under a new lease, the balancer now queues the current generation of every partition a leader reports loaded and hands them over through the same batched delivery, so joins are not done until those are taken too. A leader already on that generation keeps its copy, as an assignment at the epoch it holds is a no-op, and an unloaded partition is skipped since it reads topic.conf when it loads. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer_client: track a filer's backoff atomically Every call through one FilerClientAccessor records the filer's health, and those calls run concurrently, but the backoff deadline was a plain time.Time read and written without synchronization. The broker now reads topic.conf from background purges and repairs while serving requests through the same accessor, which the race detector caught. The deadline is now an atomic Unix-nanosecond value, and the failure time it was stored beside, which nothing read, is dropped. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mq balancer: keep generations pending when the pass ends before sending them A batch still waiting for a sender when the pass deadline passed took the cancellation branch with its error still nil, so its generations were dropped as delivered although nothing was sent, and their leaders kept serving the old generation. Such a batch now fails with the pass's deadline and keeps its backoff, like a batch whose send timed out. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mq balancer: give each leader one sender, not each of its topics The limit on concurrent sends applied to per-topic batches, so a stalled leader with as many due topics as there are senders took every slot and a healthy leader waited out the pass deadline. A pass now groups due generations by leader; each leader takes one sender and sends its topics in turn, so a stalled leader holds only its own slot, and its topics not reached before the deadline stay pending. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer_client: keep backing off a filer that has failed many times The backoff doubled with a shift of the failure count, which wraps once a filer has failed 64 times in a row, so its backoff dropped to nothing and it was retried on every call. The doubling now stops at 16 seconds and the backoff stays at 30 seconds after that. * mq balancer: requeue each broker's held generations once its stats arrive A new balancer requeued the generations of loaded partitions once per lease, from whatever stats it had at that moment. A leader that had connected but not yet sent its first stats looked as if it held nothing, and since the scan never ran again under that lease, a generation an earlier balancer saved but never handed over stayed undelivered. The balancer now records which brokers have reported and, on each pass, scans the brokers whose first stats arrived since the last scan under the current lease, queuing their held partitions' current generations for the same batched delivery. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mq balancer: scan each broker connection, judged by the stats it reported The handoff scan took the reported brokers' addresses, then looked each one's stats up again while matching partitions, and marked the address scanned. A broker that disconnected in between was looked up as holding nothing yet still marked scanned, so when it reconnected under the same lease it was never scanned again and a generation it never took stayed undelivered. The scan now judges each broker by the stats it was listed with and records connections, not addresses, as scanned; a reconnect brings new stats and is scanned again. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mq balancer: register each broker connection separately AddBroker reused the stats already registered under a broker's address, and a stream's cleanup removed whatever was registered under it. A broker that reconnected before its old stream ended shared that stream's stats, and the old stream's cleanup then dropped it from the live set while the new stream kept reporting, so the balancer treated a live broker as gone, and the handoff scan, which already counted that stats object as scanned, skipped the reconnect. Each connection now registers fresh stats, and its cleanup removes the broker only while those are still the registered ones. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mq broker: record an assignment only on a connected broker's stats After handing a partition to its leader, the balancer recorded the assignment on the leader's stats and, when the leader had none, created and registered stats for it. A leader not connected to the balancer, as one still reconnecting or one that only answered the assignment, was thereby added to the live set without a connection whose cleanup would ever remove it, and assignments could then pick a broker the balancer could not see. The assignment is now recorded only when the leader's connection has registered it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mq balancer: sweep topics from a listing that reports its failures The repair sweep, the handoff scan and the retention scan took their topics from ListTopics, which serves what it can: a failed namespace listing, a failed topic listing or a failed topic.conf lookup is only logged. A sweep could therefore see some topics, or none, and still succeed, recording a join as repaired with topics never looked at. ListTopics' filer scan is now listStoredTopics, which lists all it can and reports every failure. The repair sweep and the handoff scan fail on it, so the join stays pending until a sweep lists every topic, while an empty listing that succeeded is still complete. The retention scan purges what was listed and logs the rest. ListTopics keeps serving partial results to its gRPC callers and only logs the failure. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mq broker: list every namespace and topic, not the first thousand The topic listing asked the filer for at most 1000 namespaces and at most 1000 topics per namespace and never asked again, so anything past the first thousand was missing from ListTopics, never repaired after a broker joined, never handed over by a new balancer, and never purged past retention. Both listings now ask for everything, which the filer pages through itself, as the partition offset scan already does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mq balancer: forget the scan record of a broker connection that ended The handoff scan remembered every broker connection it had scanned until the balancer lease changed. Each reconnect is a new connection, so a long-running balancer kept one record, holding that connection's stats, for every reconnect of every broker. Each pass now drops the records of connections no longer reported; a broker that reconnects brings new stats and is scanned again either way. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mq broker: give the stored-topic listing a deadline The shared topic listing ran under the broker's long-lived context, so a filer that accepted a listing and stopped answering held the repair loop and the retention sweep indefinitely; ListTopics used to give its scan two seconds. Each listing now gives up after 30 seconds and returns the error, so the scan is retried on a later pass. * mq balancer: give a retention hand-over a deadline A leader that took the hand-over of a partition past retention and never answered held the balancer's retention loop on it, so later topics and the next tick never ran. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
a1f3f9aaa1 |
filer: return the commit stamp from ObjectTransaction (#13234)
* filer: add log_ts_ns to ObjectTransactionResponse CreateEntry and UpdateEntry return the filer log position stamped under the path lock; a conditional write through ObjectTransaction had no such field. Add it as field 4 so callers can order one key's commits the same way regardless of which RPC applied them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: return the commit's log position from ObjectTransaction A committed transaction now stamps log_ts_ns under its lock_key lock after its last mutation, the same wall-clock source CreateEntry and UpdateEntry use. All mutations of one transaction sit between that stamp and the next writer's, so one stamp orders the transaction against every other write of the key. A refused or failed transaction leaves it 0, and a replayed request returns the stamp recorded with its first outcome. A non-owner forwards the owner's response unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: stamp ObjectTransaction's log_ts_ns from the meta-log clock The wall clock can step back between two transactions on one key, or sit below stamps already bumped past it, giving a later transaction a smaller stamp than an earlier one or than its own event. Take the response stamp from the same monotonic allocator the events use, released at once. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
42a39099e0 |
mq broker: keep one request id across filers for a topic.conf save (#13237)
A save that applied but lost its answer was retried on the next filer under a new request id, refused as changed by its own write, and redone from the saved topic.conf: a balance move then found the target already leading and failed after saving. The same id lets the owner replay the recorded outcome. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
5213f4c1b0 |
worker(rs): write in the filer's digest and send a CRC32C with each upload (#13221)
* worker(rs): write ETags and chunk digests in the filer's digest The worker's Lance store (weed-worker, and weed-vector, which links it) wrote MD5 chunk ETags, MD5 object digests and MD5 multipart ETags whatever the filer's digest (#12913), so a cluster on -digest=sha256 held MD5 digests for every file the worker wrote. It now reads the digest the filer reports and writes in it, as the Go writers do: SHA-256 cut to 16 bytes under sha256. A filer that reports no digest leaves the worker in its own mode, sha256 under fips.mode strict and md5 otherwise, with Go's warning; under strict mode a filer using md5 is refused, as the Go clients refuse it under GODEBUG=fips140=only. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * worker(rs): send the CRC32C of each upload to the volume server The worker uploaded chunks with no checksum header, so a volume server could not tell a chunk damaged in transit from a good one. Each upload now carries X-Seaweed-Content-Crc32c (#12999) over the bytes it sends, as Go's uploader does; volume servers check it before storing the chunk, and those that predate the header ignore it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * worker(rs): read the whole upload request in the CRC32C header test The test's server read the request once, so a request TCP split before the checksum header failed the test although the client sent it. It now reads up to the end of the head, fails on a connection closed before it, drains the body by its Content-Length, and matches the header name in any case. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * worker(rs): digest a chunk's ETag before the volume encryption Go's uploader records the caller's digest of the bytes it hands to the volume encryption as the chunk ETag; the worker digested the ciphertext, so under cipher its chunk ETags and the multipart ETags derived from them differed from the gateway's. 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> |
||
|
|
ec1032d642 |
filer.remote.sync: a source chunk gone for good no longer wedges the write-back (#13220)
* filer.remote.sync: a source chunk gone for good no longer wedges the write-back
An entry whose chunk the volume servers answer 404 for, even with
readDeleted=true, can never be uploaded: the bytes no longer exist in the
cluster. A volume lost with its disk leaves such entries behind (for
example a filer restored from a metadata backup onto a new volume server
while some chunks had not been written back yet). filer.remote.sync
retried the create event forever, every ~2 s, and since a failing event
holds the directory's processed watermark, no later change under the
mount was ever written back again. We hit this in production: one photo's
chunk answered 404 for hours and more than 11,000 later changes waited
behind it.
Now, once the filer confirms the entry is still the one the event
described (the existing supersession check), the upload ends with
errSourceGone when:
- every location answered 404 for sourceGoneGrace (5 min) over
sourceGoneMinAnswers (3) attempts in a row, or
- the master cannot locate the chunk's volume at all ("failed to locate",
the whole volume lost with its disk) for sourceGoneLookupGrace (30 min,
the filer deletion retry's figure for "volume not found").
It logs one ERROR line naming the path, the chunk's fid and the
destination, with a per-process count, and every caller treats the event
as handled so the offset advances. A path found gone is remembered with
its fid (bounded to 10,000), so later events of the same entry are skipped
at once; any other outcome (success, superseded, another error, a failed
supersession lookup) forgets it and starts the grace again, so a volume
server that has not loaded its volume yet, or a stale location, is not
mistaken for lost data.
Only the source decides. The upload body is wrapped in a recorder that
keeps the first error the chunk reader returned, because remote clients
wrap a body read failure in their own errors (the AWS SDK's RequestError
has no Unwrap). The recorder forwards ReadAt and Seek, so s3manager keeps
reading parts in place. A 404, 5xx, timeout or any other error from the
remote itself never reaches the recorder and keeps retrying as before.
A rename of an entry that was written back now deletes the old key only
after the new one is written: when the entry's local data is gone, the old
key keeps the last remote copy (logged) instead of being deleted before an
upload that can never succeed. The gateway's rename path, which deletes
first, does not acknowledge errSourceGone and keeps failing visibly.
util/http:
- GetAuthenticated (the encrypted chunk read) reports a 404 as ErrNotFound,
as the unencrypted read paths already do, with the same error text;
readEncryptedUrl wraps with %w instead of %v and treats a 404 as
retryable, like the plain read, so it tries the other locations.
- A chunk read is ErrNotFound only when no location of the pass failed
differently (NotFoundEverywhere): a 404 from one replica while another is
down, answers 5xx or is throttled does not mean the chunk is gone. This
is applied once in hedgedChunkPass (both RetriedFetchChunkData paths) and
in the manifest's retriedStreamFetchChunkData loop.
Tests:
- filer_remote_sync_gone_test.go: a plain and an encrypted chunk served 404
by a test volume server end in errSourceGone on the third attempt and are
counted once; a remote that answers 404 with readable chunks never does;
the tracker's grace, answer count, reset, fid change and remembered path;
the lookup-miss grace; ReaderAt kept by the recorder; a rename keeps the
old key when the entry is gone and deletes it after the write otherwise.
- TestGetAuthenticatedNotFound; TestRetriedFetchChunkDataNotFoundEverywhere
(plain direct, plain stream, encrypted; a 404 and a 503 in either order
is not ErrNotFound).
- Mutation checks: each fails with readEncryptedUrl back on %v, with the
write error classified instead of the body's read error, with
NotFoundEverywhere dropped from hedgedChunkPass, with the old key deleted
first, and with the recorder hiding ReadAt.
- go vet and go test of weed/util/http, weed/command, weed/filer and
weed/replication/... pass; weed/util/http also with -race.
* filer.remote.sync: renames keep the old key until the new one holds the content; gone is per entry; missing volumes opt-in
- A sighting is counted per entry content (the sorted chunk file ids),
not per failing chunk. An uploader reads the parts of a ReaderAt body in
parallel, so the chunk that fails first changes between attempts; keyed
on it, the grace restarted every time and a large file missing several
chunks held the offset forever. The tracker's `seen` map is bounded, and
the log names the first chunk "and N more" instead of every fid.
- On every rename the old key is deleted only after the new one holds the
content: also when the event's old entry carries no stamp (an upload
whose stamp a rename in between refused leaves an unstamped copy), and
in the superseded branch, where the old key is what uploadCurrentEntry
copies a remote-only entry from. uploadCurrentEntry reports when the
current entry's data is gone, and the old key stays then. A multipart or
system path whose old key cannot be deleted no longer skips the stamp.
- A volume the master cannot locate counts only with
-sourceGoneVolumeMissing=<duration> (default 0: never): a volume server
that is down or in maintenance looks the same, and an entry written off
is not retried. It suits a deployment whose master and volume server run
as one process.
- filer.remote.gateway's rename writes the new key first, deletes the old
object after, and keeps it when the source data is gone.
Tests: TestRetriedWriteFileSourceGoneAcrossChunks (two lost chunks read in
turn), TestSupersededRenameUploadsCurrentEntry "uncached between the check
and the upload" and "current entry's chunks gone: the old key stays",
TestRenameOfGoneEntryKeepsTheOldKey "old entry unstamped",
TestSourceGoneGraceFor (lookup miss off by default, on with the flag);
each fails with its fix undone. The test remote's DeleteFile removes the
object, as a real remote does.
* filer.remote.sync: evidence kinds apart, a gone entry counted once, the copy owns its source's cleanup; gateway keeps the old object on a superseded rename
- Lookup misses and 404s no longer share one run of sightings
(sightingKey = content + grace): with -sourceGoneVolumeMissing set, a few
minutes of "failed to locate" followed by one 404 met the 404 grace with
the misses' start and answers.
- observe reports whether this call found the entry gone; a replayed event
of an entry already gone is skipped without another log line or count.
- A superseded rename whose current entry is remote-only leaves the old key
to completeRemoteOnlyRename, which removes its source only while it is
the object the stamp describes; an unconditional delete after it could
remove a replacement.
- filer.remote.gateway: a superseded rename keeps the old object (logged)
instead of deleting it before the superseding event has written the new
key.
Tests: TestSourceGoneTrackerCountsOnceAndKeepsEvidenceApart,
TestSupersededRenameUploadsCurrentEntry "the old key replaced during the
copy"; each fails with its fix undone. The gateway change has no test of its
own (its rename path needs a reachable filer).
* filer.remote.sync: drop -sourceGoneVolumeMissing, a lookup miss keeps retrying
A volume the master cannot locate looks the same whether it was lost or
its server is down, so no default can write such an entry off safely, and
a flag for the one-process layout is not worth carrying. Only a 404 from
every location counts as gone; a lookup miss retries as before.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* filer.remote.gateway: a superseded rename settles its old object
A rename the filer has moved past kept the renamed-from object for good,
so every rename followed by a delete or a rewrite before the gateway
reached it left an orphan on the remote. Settle it the way
filer.remote.sync's uploadCurrentEntry does: copy from it when the entry
has become remote-only, and otherwise delete it, since it no longer holds
the entry's content.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* filer.remote.sync, filer.remote.gateway: a superseded rename copied from a later rename's source settles its own old key
When the entry became remote-only through another rename onto it, the copy
reads that rename's source and removes it, and nothing read or removed the
event's own old key any more. Delete it then, in both commands.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* filer.remote.gateway: reset cached remote clients after the superseded-rename test
A cached client kept the previous run's recorder, so the test failed under
-count above one.
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>
|
||
|
|
3363f4a318 |
mq: disk and parquet reads stop when asked, resume inside earlier files, and order new stamps after stored ones (#13230)
* mq logstore: stop a disk read when the callback is done GenLogOnDiskReadFunc ignored the isDone the per-entry callback returned, so it kept fetching and delivering every later entry, chunk and file, and the merged read then went on into the parquet files. The chunked offset read and the query scanner's close path both return true and expect the read to stop. The reader now stops at that entry, skips the remaining chunks and files, and returns done with a position just past the entry: the next offset for an offset read, its time for a timestamp read. The merged read returns there instead of reading parquet. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mq logstore: stop a parquet read when the callback is done The parquet reader also ignored the callback's isDone and delivered every remaining row of every compacted file, and the merged read cleared any done it reported. It now stops at that row and skips the remaining files, which it lists before reading instead of reading inside the listing. Its done now means only that the callback asked to stop, so the merged read passes it on; the no-op readers and a file starting at or after stopTsNs no longer report done, which the merged read used to clear anyway. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mq logstore: read parquet files named before a timestamp resume A parquet file is named after its first source log, and that log can start seconds before rows the file holds, so listing parquet files from the resume second skipped a file named earlier that still held later rows. The reader now keeps the same sparse logFileIndex the log reader uses and lists from the last mark before which every file ends before the resume time, deciding each file by its ts_max. Rows are not in time order once windows flushed across a reload are compacted together, so stopping at the first row past stopTsNs dropped later rows still inside it. Each row is now kept or skipped on its own, and the returned position is the latest row delivered rather than the last row looked at. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * query: take MIN and MAX of _ts from the files' recorded time range MIN and MAX of _ts without column statistics were computed from file names, which are only the start second of a file's first source log: MIN rounded down to that second and MAX was the start of the latest file rather than its last row. Each file's stats already carry ts_min and ts_max as MinTimestampNs and MaxTimestampNs, so those are used when set, and names only for files that record no range. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mq broker: stamp a loaded partition's messages after the newest stored one Within one LogBuffer timestamps only increase, but a new buffer starts LastTsNs at 0, so a leader whose clock is behind the previous leader's stamped new messages earlier than what was already stored, and a subscriber resuming by timestamp from the last stored message dropped them. OffsetRange now also records the newest ts_max of the partition's log and parquet files, and loading a partition seeds LastTsNs with it, so the buffer bumps new messages past it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mq logstore: read parquet rows at the stop time The log reader treats stopTsNs as inclusive, delivering an entry at it and reading a file whose first entry is at it, but the parquet reader stopped at a row equal to it and skipped a file starting at it, so the same bounded read returned that message from a log file and dropped it once compacted. Both checks are now inclusive. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mq logstore: drop a debug print from the disk read A disk read bounded by stopTsNs printed the stop time and the first entry past it to stdout on every such read. It was a leftover debug line. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mq logstore: start an offset read of parquet files at the offset An offset read of the parquet files delivered every row from the first one on, and the stateless fetch fills a disk chunk with a callback that stops after a chunk's worth of entries outside it. Now that the reader honors that stop, a fetch at 1000 from a partition stored only in parquet stopped after rows 0-999 and returned nothing. An offset read now skips files whose recorded range ends below the offset or that record none, reads the rest in offset order, and skips rows below the offset before they reach the callback. It returns the offset after the last row delivered, not a timestamp position. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mq logstore: read parquet files first in a merged offset read The merged read took the live log files first and, now that it honors the callback's done, returned without reading parquet when the callback stopped. The stateless fetch stops after a chunk's worth of entries outside the chunk it fills, so with offsets 0-999 only in parquet and 1000-1999 in log files, a fetch at 0 stopped on the log files' entries and never reached parquet. Compaction turns the oldest windows into parquet, so an offset read now takes the parquet files first and the log files after: the lower offsets arrive first, and since each source skips what lies below its start, a bounded caller only stops on entries past what it wants. Compaction leaves a parquet file's source logs in place until retention removes them, so the log files are read from the offset after the last one parquet delivered, and each offset is delivered once. Timestamp reads keep their order. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mq logstore: serve merged offset reads from log files where they exist A merged offset read took parquet first and the log files from the offset after the last row parquet delivered. Compaction keeps a parquet file's source logs until retention removes them and drops messages with no key or no data, so that skipped those messages although their logs were still there, and delivered compacted rows in place of the messages as written. The log reader now lists its files before reading them, and an offset read finds the lowest offset the listed log files record. Parquet serves only the offsets from the requested one up to that, and the log files everything from there, so each offset is read once and from a log file whenever one holds it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mq logstore: read schemaless parquet rows back as their published bytes Compaction stores a schemaless message's bytes in the _value column, but the parquet reader handed out the whole row marshaled as a RecordValue, with _key, _ts_ns and _offset wrapped around it, so a consumer reading compacted offsets got different bytes than it would from the log files, and the query engine showed that wrapping as the value. A schemaless topic's rows now carry the _value bytes as Data; schematized topics keep the marshaled row. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mq logstore: fail a read that needs parquet when its reader cannot be set up A topic whose schema cannot be laid out as parquet left the parquet reader nil, and a merged read that reached parquet called it and panicked. Such a read now returns the setup error; skipping the parquet rows silently would hide stored messages. * mq logstore: a stopped log read returns the last delivered time A later-named log file can hold earlier messages, so the latest time a stopped read delivered can be past one it never reached. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mq logstore: compact a group's rows in offset order Source logs list by name, which sorts out of offset order under clock skew, so a compacted file could hold offsets 2,3,0,1. An offset read delivers a file's rows as stored and then reports a next offset past ones it never delivered. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mq: floor a reload's stamps by the newest legacy log file name Log files record ts_max only since this release, so after an upgrade a reload saw no newest time and seeded the stamps at zero. A log file that records no times is named by its first message, so its second still bounds the newest stored time. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
e84c3f9ada |
mount, filer: a content change clears the stored content MD5 (#13238)
* mount: a content change clears the stored content MD5 Attributes.Md5 is the whole content's MD5: the S3 and WebDAV ETags and WebDAV's oc:checksums report it. A write, a size change, a grown fallocate, an O_TRUNC open or a copy_file_range into the file kept it, so those reported the old content's MD5 and an ETag that did not change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: AppendToEntry clears the stored content MD5 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mount: copy_file_range clears the MD5 once it buffers bytes A cancelled copy or a later read error returned before the clear, leaving the bytes already buffered under the old MD5. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: an empty AppendToEntry keeps the content MD5 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
484e16e30c |
webdav: keep X-OC-Mtime and report oc:checksums (#13226)
* webdav: keep X-OC-Mtime and report oc:checksums
ownCloud and Nextcloud sync clients, and rclone's webdav backend in those
vendor modes, send a file's modification time in X-OC-Mtime and read its
hash from the oc:checksums property. Without them every upload gets the
upload time as mtime and clients can only compare sizes, so syncs re-upload
unchanged files.
- PUT stores X-OC-Mtime (Unix seconds, fractions dropped) as the entry's
mtime, at create and at commit, and answers "X-OC-Mtime: accepted"
- a file created and written front to back stores its content MD5; any
other write clears it, so no stale MD5 outlives a partial rewrite
- PROPFIND reports oc:checksums ("MD5:<hex>") for files whose MD5 is known;
PROPPATCH is still refused
Checked with rclone (vendor=owncloud): sync keeps mtimes, md5sum matches
local files, including an 8-chunk file.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* webdav: only report an inline MD5 for whole inline content; test commits
- contentMd5 hashes inline content only when it is the whole file
(filer.ETagOfInlineContent): content next to chunks, or shorter than the
file size, is only part of it and must not be advertised as its checksum
- test a PUT that crosses a buffer flush end to end: the committed entry
carries the X-OC-Mtime and the MD5 of the whole body
- test that writing into an existing file clears its stored MD5
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* webdav: ignore a NaN X-OC-Mtime
int64 of NaN is implementation-specific (the most negative value on amd64,
the largest on riscv64), so a NaN header could store an arbitrary mtime.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* webdav: group the oc test imports
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Denis Maier <denis@dAir.lab>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com>
|
||
|
|
c8cd1a7d77 |
volume: refuse a batch delete while a replica is offline (#12311)
* volume: refuse a batch delete while a replica is offline BatchDelete now applies the replica check the HTTP delete path already uses: when the master lists fewer replicas than the volume's copy count, the delete is refused with 503 instead of applied to the replicas that remain. The caller retries, so the replica that was offline still gets the delete once it returns. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: retry deletes refused for an offline replica Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * volume(rust): refuse a batch delete while a replica is offline Mirrors the Go volume server: batch_delete checks that the master lists every replica of a replicated volume before deleting, and answers 503 with the replica count error otherwise. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: move exhausted deletion retries to dead letter queues A deletion that still fails after the backed-off retries is no longer dropped. It moves to a dead letter queue retried after 24 hours, then to a second one retried after 48 hours, and is dropped only if that fails too. The id stays in the durable deletion ledger the whole time, so a restart replays it instead of losing it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * volume: report a low-disk volume as read-only but deletable A volume is read-only while its disk is low on space, but it still applies deletes; only noWriteOrDelete refuses them. The heartbeat set readOnlyCanDelete from the operator mark alone, so the master listed a low-disk replica as refusing deletes and the replica count check rejected every delete on its volumes, on the healthy replicas too. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * volume(rust): report a low-disk volume as read-only but deletable Mirrors the Go heartbeat: readOnlyCanDelete is set whenever the volume is read-only without no_write_or_delete, which includes low disk space. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: retry deletes a low-disk replica could not record A low-disk volume now counts as deletable, but appending the tombstone can still fail with no space left on device. Treat that as retryable so the deletion stays queued instead of being dropped after the other replicas applied it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * master: keep under-replicated volumes out of empty-volume cleanup The cleanup only looked at the copies the master lists. With a replica offline the listed copies can be empty and quiet while the missing one still holds data, and deleting them would leave that copy as the only one when it returns. Low-disk replicas now report readOnlyCanDelete and pass the eligibility check, which made this reachable for more volumes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * master: finish a partly deleted empty volume in the next sweep When one copy's VolumeDelete succeeded and another failed, the vid was left with fewer copies than its replica placement, so every later sweep skipped it as under-replicated and the empty copy kept its slot. The vid now stays marked deleting after a partial delete, and the next sweep finishes it. The mark is cleared once the vid is gone or stops being an empty, quiet candidate. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * master: keep the cleanup mark while a survivor is only read-only A partly deleted empty volume lost its deleting mark when the next sweep found a surviving copy read-only. Later sweeps then skipped the vid as under-replicated, so the empty copy kept its slot after it became deletable again. Only a copy that gained data or was written recently clears the mark now; a read-only or missing copy just postpones the cleanup. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * shell: delete an empty volume only when every copy is empty volume.deleteEmpty judged each copy on its own, so it removed an empty copy while another copy still held data or was offline, leaving that one as the volume's only copy. Low-disk copies now report readOnlyCanDelete and passed the check as well. Apply the master sweep's rule: every copy is listed and every copy is empty. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * shell: name the copies a partial empty-volume delete leaves behind Once some copies of a volume are deleted, a rerun of volume.deleteEmpty skips the rest as under-replicated, and the shell keeps no state to finish them. Log each copy whose delete failed with the volume.delete command that removes it once it is empty. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * shell: keep the gRPC port in the printed volume.delete command ServerAddress.String() drops a custom gRPC port, so the printed -node would dial the HTTP port plus 10000. Print the full address. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: let manifest retries pass through the dead letter queues The manifest retry queue reuses DeletionRetryQueue, so a manifest that does not resolve now waits through both dead letter queues before it is deleted alone. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * volume(rust): look up a batch delete's replicas over the master's gRPC port lookup_volume now dials the master's gRPC port, as Go's LookupVolumeIds does; the replica check and its test follow. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * volume: let a batch delete through on a volume grown degraded A volume the master grew with fewer copies than its placement reports min_writable_copies in the lookup. Go's replica check already uses it; Rust now does too, so deletes on such a volume are not refused forever. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * volume, shell: let volume.merge write deletes into its merged copy volume.merge marks the source copies read-only and writes the merged records, deletes included, into a temporary copy that replaces them. The batch delete replica check counts only the temporary copy there and refused every delete, so the merge stopped at its first tombstone. BatchDeleteRequest.skip_replica_check lets a caller that updates the other copies itself skip the check; volume.merge sets it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
25b9278d60 |
mq: conditional topic.conf saves, bounded topic.conf I/O, and mq.balance moves that save their assignment (#13231)
* mq broker: give up topic.conf filer calls with the caller's context The topic.conf read and save helpers took no context, so a filer that took the call and never answered kept the balancer inside topicConfLock for good, and every ConfigureTopic, lookup repair and EndPartitionGeneration queued behind it on a plain mutex. reportGenerationEnded's per-attempt deadline could not bound any of it. The helpers now take a context, the RPC paths pass their request context, and topicConfLock is a one-slot semaphore whose wait ends with the caller's context. Calls made while holding it are also bounded by topicConfTimeout, so a caller without a deadline cannot hold it forever. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mq broker: save topic.conf only if it is still what was read Every topic.conf update is a read-modify-write on the balancer, but the save was unconditional, so a balancer whose lease ran out between its read and its save wrote its stale assignments over a successor's newer epoch. topicConfLock only orders writers within one broker. A failed read in ConfigureTopic could also recreate an existing topic from scratch. The read now returns the topic.conf entry, and the save is an ObjectTransaction requiring that entry unchanged, or the file still absent for a new topic. A refused save is redone from a fresh read a few times, so a report for an epoch a successor already ended finds it moved on, and then gives up with Unavailable for the caller to retry. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mq broker: save mq.balance moves to topic.conf before assigning them A balance move only told the target to load the partition and the source to drain it. It never touched topic.conf, so lookups kept sending publishers to the source, and since partitions are fenced by epoch the target was asked to lead at epoch 0 and refused before anything moved. The balancer now runs the move itself: it saves the target as leader at the next epoch through the conditional topic.conf save, tells the source about the new epoch so it retires its copy, flushing what it holds under its own fence and sealing it, and then assigns the target, which takes the fence at the new epoch. A follower that becomes the leader swaps places with the old leader. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mq broker: keep a retiring leader's fence renewed until it seals A leader told of a newer epoch, as a balance move's source is, retires its copy by shutting it down and waiting for its last flush before sealing the fence, but it did not renew the fence meanwhile. A flush outlasting fenceSealWait left an aged unsealed fence the new leader could take, and the pending flush then failed its fence check and dropped acknowledged messages. The fence is now renewed for as long as the flush takes. Loaders retiring the same copy at once share one renewal, which the first to return stops before any seal, so no renewal lands on a sealed fence. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mq broker: save a configure's assignment repair with its update ConfigureTopic saved the repair of assignments on dead brokers on its own, then saved the requested schema or retention change against the entry it had read before that repair. The second save was always refused, so the update went round a full reread, and a resize first drained brokers for nothing. The repair is now applied in memory and saved together with the requested change in one conditional save. A resize replaces the assignments anyway, so it no longer saves a repair first. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mq broker: report a balance move the target refused assignTopicPartitionsToBrokers logged each broker that refused its assignment and returned nil, so mq.balance reported success for a move whose target never took the partition, after topic.conf had already moved and the source had retired its copy. It now returns the refusals, and BalanceTopics passes them to its caller. The saved move stands: a retry assigns the target again, and the target also loads the partition on first use. ConfigureTopic keeps logging a refused assignment of a topic it has saved, as before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mq broker: give up a topic.conf cache miss with the caller's context getTopicConfFromCache waited for topicConfLock and read the filer under context.Background(), so a lookup whose caller had already given up stayed queued behind whatever held the lock and then did up to topicConfTimeout of filer work for nobody. It now takes the caller's context, which LookupTopicBrokers and the retention purge pass along and the partition loaders pass as Background; cache hits are unchanged. A waiter whose context has already ended no longer takes a free lock either, since a select with both cases ready picks one at random. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mq broker: require exactly one moved partition in the balance tests The move tests took the last partition led by the target as the moved one, so a move that handed both partitions to the target would pass. They now fail unless exactly one partition moved. --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
40bb214b3f |
s3api: store a re-copied multipart part as a new attempt so the earlier copy's data is freed (#13216)
* s3api: replace a re-copied multipart part in place so the old part's data is deleted UploadPartCopy into a part number that already held a part removed the old part entry with isDeleteData=false and then wrote the new one. The filer deletes the chunks an entry replaced only when it overwrites that entry, as UploadPart does, so the old part's chunks were left on the volume servers with no entry referencing them, for every retried or repeated copy of a part. The same applied to an empty-range copy. The part entry is now written over the existing one: the filer deletes the chunks the new entry does not hold, and the part is never missing between the two writes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3api: store each UploadPartCopy as a new attempt of the part instead of replacing it Replacing a copied part in place deletes the replaced part's chunks while the upload is open. A CompleteMultipartUpload that listed the part before the replacement builds the object from those chunks and can commit it after they are deleted. UploadPart never replaces a part: each upload is a new attempt with its own name (genPartUploadPath). copyPartLocation now names each copy the same way, and nothing is replaced or deleted when a part is copied again. Completion already uses the latest attempt of each part number and frees the data of the others after it commits, and abort frees them all, so the earlier copy's data is still reclaimed, without a window against a completion in progress. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3api: trim the UploadPartCopy attempt comments Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com> |
||
|
|
0872953b81 |
mount: resolve NFS file handles across a weed mount restart (-nfsExport) (#13020)
* mount: persist a created file's entry at create time under -nfsExport A file created over NFS gets a handle at create time. With creation deferred to flush, a mount that stops before the flush leaves no entry for the next mount to resolve that handle to. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mount: resolve NFS file handles of files an earlier mount had open With -nfsExport, the mount records on the filer the path of each file it has open, keyed by inode, and drops the record a minute after the last close. A "." lookup on a node id the mount does not know reads that record, so the NFS server can reopen its files after the mount restarts or another mount takes over. A failed read answers EIO rather than ESTALE. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mount: record NFS handles at open, not on every path refresh A writeback close flushes after the last release, and the flush refreshes the handle's path. Recording there renewed the record of a file no longer open, so it was never removed. Opens and creates now record, and a path refresh only moves an existing record. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mount: leave writeback creates deferred under -nfsExport With writeback caching an eager create runs as an async filer RPC that an unlink does not wait for, so a quick create+unlink could bring the name back. Writeback mounts already accept losing unflushed files on a crash. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mount: retain a recorded handle path only once it matches the file A path read from the filer record was retained before the lookup checked it, so a stale one kept answering ESTALE without reading the record again. It is now retained right before LookupHandle, and never over a forgotten inode or path the table already holds. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mount: count NFS handle opens, keep other mounts' records, retry writes A reopen that attached a new handle before the close registered its release left a removal pending for an open file; opens are now counted. Records carry the writing mount's signature, so a delayed removal leaves a record another mount wrote since. A failed write is retried while the inode's state is unchanged, and the put runs under the attempt context. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mount: keep one NFS handle registration per mount in an inode's record Two mounts with the same file open shared one record, so the one that closed last removed the path the other still had open. Each mount now replaces or drops only its own registration, and a lookup uses the newest. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mount: name a mount's NFS handle registrations by host and mount directory A restarted mount drew a new random signature, so it never replaced or removed the registrations its predecessor left for files it had open. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mount: take turns on an NFS handle record through the lock manager under -dlm Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mount: retry an NFS handle record update when its lock is not granted Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mount: renew an NFS handle record's lock for the whole update Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mount: resolve an NFS handle record to the newest path under the mount root Another mount rooted elsewhere could hold the newest registration of a hard-linked inode, hiding this mount's own valid path. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mount: register an NFS handle at the path the mount knows now A rename could move the inode after an opener read its path but before the new handle was registered, so the record kept the old path; a stale opener could also move an existing record back. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mount: keep no NFS handle records with -filer.tokenFile The filer refuses KvGet and KvPut to scoped tokens, so the records would only fail: log at startup instead, and keep the in-process handle support. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
f9157933f0 |
volume: refuse a write the local volume already rejects before forwarding it to the replicas (#13214)
* volume: refuse a write the local volume already rejects before the replica fan-out ReplicatedWrite runs the local needle write and the replica fan-out concurrently. When the local volume is read-only (noWriteOrDelete or noWriteCanDelete), unavailable, or on a disk below -minFreeSpace, the local leg fails, but the replicas have already stored the needle. The client writes to a new file id, so the replica copy is referenced by nothing, and the copies of the volume differ in file count and size until volume.fsck purges it. Ask the volume whether it accepts writes (Volume.CheckWritable, the same check Store.WriteVolumeNeedle applies first) before the fan-out starts, and fail the request without contacting the replicas. The error, its metrics and the ErrorWriteRefused rule are those of a failed local write. A type=replicate request, and a write with no local copy, are unchanged. A volume that turns read-only after the check, during the write, still leaves a replica copy. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * volume: observe a write refused before the fan-out in the local write histogram The local write that the up-front refusal replaces observed the refusal in the WriteToLocalDisk request histogram next to the error counter. Observe it there too, so a refused write is counted as before. The replication metrics do not record it, since it no longer reaches the replicas. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * volume(rs): refuse a write the local volume already rejects before forwarding it to the replicas Mirror the Go up-front check: when the local volume refuses writes, the replicated upload fails with the local refusal and never spawns the replica fan-out, so no replica keeps a needle nothing references. 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> |
||
|
|
f65234685a |
filer.sync: check the stream bottleneck test by peak jobs in flight (#13233)
TestConcurrencyIneffectiveOnStreamBottleneck compared the wall-clock rates of separate runs at concurrency 32 and 512 and failed on a loaded 32-bit runner when one run took 1.6x longer than the other. The ratio measured runner load, not the processor. Record the most jobs that ran at once instead. While it stays below the smallest limit, the limit never holds back an event, which is why a larger -concurrency cannot help a stream-limited sync. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
76cae100de |
filer: leave the manifests an update keeps unread when finding its garbage (#13224)
MinusChunks finds the chunks an update drops by resolving every manifest of the old entry and of the new one. A manifest both entries list is the same needle on both sides: all it holds is held by both, so none of it can be dropped, yet it was read from a volume server twice on every update. A file whose older chunks are folded into manifests paid that on each chmod, utimes, setxattr and append. Manifests listed on both sides are now taken out of both lists before the others are resolved. They are read only when something else the old entry holds might still be held through one of them, and then subtracted, so the result is the one resolving everything gives. An attribute change or an append that keeps the manifests reads none of them, and a kept manifest that cannot be read no longer fails an update that drops nothing. Co-authored-by: MapleWhiteZZZ <18653045+MapleWhiteZZZ@users.noreply.github.com> |
||
|
|
0b0f54381d |
s3api: list every entry of the upload directory when completing a multipart upload (#13219)
prepareMultipartCompletionState read the upload directory with one listing of MaxS3MultipartParts+1 entries and ignored whether more remained. The directory holds one entry per attempt of a part, as each UploadPart gets its own name, so an upload with many parts and some retries can hold more, and the parts that sort after the first page were never found: completion answered InvalidPart for parts that exist. The cleanup listing of an already committed completion was capped the same way. listUploadEntries lists the directory page by page until the listing reports its last entry, and both listings use it. The completion test filer now pages like the filer, which its map-order listing had hidden. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
e8fef6bdfd |
mount: fail a read of dirty pages that cannot be read back from the swap file (#13215)
Dirty pages that weed mount buffers in the swap file (non-sequential writes, or when the memory chunks run out) also serve reads until they upload. SwapFileChunk.ReadDataAt logged a read error and stopped, returning only how far it had read; UploadPipeline.MaybeReadDataAt and DirtyPages.ReadDirtyDataAt passed that offset up. The mount read path then served the rest of the range from the stored chunks or from zeros, and the read returned OK. A read error on the cache disk, or a swap file truncated by an outside cleanup, is enough: the application reads back bytes it was told were written and gets other bytes, with no error anywhere. This is the read-side twin of #13198, which made the upload of those bytes fail. PageChunk.ReadDataAt, UploadPipeline.MaybeReadDataAt and DirtyPages.ReadDirtyDataAt now return an error besides the offset. A swap chunk that cannot read back an interval overlapping the requested range returns it, wrapping the new ErrDirtyDataUnreadable and the read error (a short read is io.ErrUnexpectedEOF). Intervals outside the range are not read, so a read that does not touch the lost bytes still succeeds. MemChunk cannot fail. The read handler and copy_file_range turn the error into EIO. Read does not refresh the filer entry and retry for this error, since the entry has no say over bytes that only exist in the swap file. A failed read does not mark the handle failed. Reads of other ranges and writes keep working, and the upload path already records the failure when it cannot read the same bytes, so flush, fsync and close return EIO. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
30d7f484aa |
s3api: delete the chunks a failed CopyObject or UploadPartCopy wrote (#13217)
* s3api: delete the chunks a failed CopyObject or UploadPartCopy wrote A copy writes new needles for the destination before any entry references them. copyChunks and copyChunksForRange returned on the first failed chunk without waiting for the copies still running, and nothing deleted the chunks already written. The running copies went on to write needles after the request was over; the written ones were never referenced. The same happened when the copy succeeded and the later write of the entry failed or a destination precondition refused it, and in the per-chunk loops of the SSE copy paths. The concurrent copies now go through copyChunksConcurrently: no further copy is started after a failure, every started copy is waited for, and the chunks the others wrote are deleted with deleteOrphanedChunks. The sequential SSE loops delete what they wrote when they fail part-way. A chunk a failed copy returned is not kept anywhere, so nothing is left for volume.fsck. CopyObject and UploadPartCopy delete the copied chunks when a precondition or the lock refuses the write, or when the write of the entry fails and no filer holds an entry at that path that references them: a failed write can have committed (the answer lost), and chunks deleted under a stored entry would break the object. An answer the lookups cannot settle keeps the chunks. Chunks the source entry also holds (the SSE-KMS same-key rotation hands them back) are never deleted. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3api: keep a failed copy's chunks when any entry exists at the destination After a failed write of the destination entry, the copied chunks were deleted when the first entry the lookup found did not hold them. That entry can be an older one on one filer while the copy's own entry committed on another, for example a part written to a filer the routing failed over to, so the delete could reclaim chunks a stored entry holds. Delete them only when no filer holds an entry at the path and every filer answered, as putToFiler does. A copy that fails over an existing object therefore still leaves its chunks. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3api: keep a copy's chunks when its failed write may still commit A write of the destination entry that fails without the filer's answer (a transport failure, a timeout or a cancel) can still be running on the filer. A lookup that finds no entry then proves nothing: the write can commit after it, and an entry would reference the chunks the cleanup deleted. Keep the copied chunks after such a failure without a lookup; these are the errors filerErrorToS3Error keeps retryable for the same reason. The lookup now runs only after the filer answered the write with an error. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3api: keep a copy's chunks whenever its write of the entry fails A failed write of the destination entry can have committed with its answer lost, or still commit: after a transport failure, or when a failover replay that another filer refused hides an ambiguous first attempt. A lookup cannot tell these apart, and chunks deleted under a stored entry break the object, which is worse than the leak. CopyObject and UploadPartCopy therefore keep the copied chunks when the write fails. They still delete them when the lock or a precondition refuses the write, or the old part cannot be removed, before any entry write is attempted. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3api: size the copy-owned chunk set without adding slice lengths CodeQL flags the summed capacity hint as a possible allocation overflow; the map grows as needed anyway. 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> |
||
|
|
3809cfe4cf |
mq: fetched messages carry their log offset (#13229)
* mq: carry the log offset on fetched messages FetchMessage answers with DataMessages that have no offset, so a client can only number them by position from its start offset. That is wrong as soon as the stored range has a hole or an entry the log cannot place. DataMessage gains an optional offset; presence tells a broker that sets it apart from one that predates it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mq broker: send each fetched message's log offset FetchMessage dropped the offset of every log entry it read, leaving clients to number the messages by position. Each DataMessage now carries its LogEntry offset, including -1 for an entry the log could not place. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mq/kafka: number fetched records by the broker's offsets The gateway numbered the records of a fetch as start offset plus position, and moved the next fetch past them by count. A hole in the stored range, such as offsets 10, 11 and 13, put record 13 at 12 and fetched it again at 13. Records now take the offset the broker sends, the batch offset deltas and the next offset follow those offsets, and an entry the broker reports at -1 is left out rather than given a guessed offset. A broker that sends no offsets is still numbered from the start offset. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
abd2587f9e |
s3api: send user metadata headers in lowercase (#13228)
GET/HEAD returned user metadata as X-Amz-Meta-<key>. AWS sends x-amz-meta-<key>, and older aws-sdk-kotlin releases match the prefix case-sensitively, so they saw no metadata at all. Airbyte's S3 destination reads ab-generation-id that way at the end of an Overwrite sync, treats a missing id as generation 0, and deleted the files it had just written. |
||
|
|
d6dee41f00 |
ec: do not place shards on a volume server in maintenance mode (#13227)
* master: report a volume server's maintenance mode in DataNodeInfo Planners that work from VolumeList had no way to tell a volume server in maintenance mode from any other, so they kept choosing it as a target. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * admin: give a volume server in maintenance mode no free capacity It refuses new data, so EC encode and balance planning must not pick it as a destination; it stays listed so it can still be a source. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * ec_balance: never move shards to a volume server in maintenance mode It refuses every shard copy, and right after an evacuate it is the emptiest server, so the planner kept targeting it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * shell: count no free EC shard slots on a volume server in maintenance mode Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * ec: report the volume server's error when it refuses a shard upload A refused ReceiveFile ends the stream, so Send returns only io.EOF and the job logged "failed to send file content: EOF" instead of the reason. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * ec: test that a refused shard upload reports the server's error Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * shell: never plan EC shard moves onto a volume server in maintenance mode Zero free slots alone did not keep it out: a shard the planner moves off the node credits a slot back, and a later move could take it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * ec: test that ReceiveFileSendError reports a refusal in the response's Error field Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * ec_balance: move the maintenance-target test to the end of the file Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
76aa922d06 |
shell: let fs.du print subdirectory totals and list directories in parallel (#13212)
* shell: let fs.du print subdirectory totals and list directories in parallel fs.du prints one total and walks the tree one directory at a time. Finding where the data of a large bucket sits takes one fs.du per directory, each a full walk, and every listing waits on the filer and its store in turn. -depth N also prints the total of each directory down to N levels below the given one, like du -d N. Directories come in du's order: each one after the directories below it, siblings by name, and the given directory's total last, as before. One walk now gives the whole breakdown. -concurrency N lists up to N directories at a time. A subdirectory gets a goroutine of its own while the limit allows one and is walked in place otherwise, so memory grows with depth and concurrency, not with the number of directories. filer_pb.TraverseBfs is not used because it remembers every directory it visits and queues whole levels: on a tree of 200k directories it held 49 MB more live heap than this walk at the same speed, and weed shell often runs in a small container. A directory's listing is complete before its subdirectories are walked, so no listing stream stays open while a subtree is walked. A directory that cannot be listed used to drop out of the totals silently. It is still left out, but the command now fails at the end with the number of such directories and the first of them. fs.du took its last argument as the path, or the current directory when that argument started with a dash, so "fs.du /dir -depth=1" would have walked the current directory. Flags now go before the path, and anything else is an error. With a prefix (fs.du /dir/name_prefix) and no -depth, the directories the prefix matches are no longer walked, because nothing below them is printed. The defaults, -depth=0 and -concurrency=1, print what fs.du printed before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * shell: fs.du walks a page of subdirectories before listing the next one fs.du collected the names of all subdirectories of a directory before it walked any of them, so a directory with millions of subdirectories held millions of names. It now lists 1024 entries at a time and walks the subdirectories of a page before it asks for the next page. A directory holds at most one page of names, and still no listing stream stays open while its subdirectories are walked. On one directory with 200k subdirectories the walk holds 0.5 MB of live heap with -concurrency=1 and 2.5 MB with -concurrency=5. When a page of a listing fails, the pages before it still count and the failed page is dropped. The help and the error said that such a directory was left out of the totals; they now say that the totals are incomplete. When the given directory itself cannot be listed, fs.du cancels the walks under way and waits for them before it returns the error. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * shell: fs.du tests refuse a listing the way a failing filer store does An Unavailable without details makes pb close the shared connection, so the listings running beside the refused one failed with "the client connection is closing" and the error named another directory (6 of 30 runs with -race). A store error reaches the client as Unknown and leaves the connection up. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * shell: fs.du lists directories in parallel without a -concurrency flag The walk prints the same totals in the same order at any concurrency, so there is nothing for a user to choose: list up to DefaultMaxParallelization directories at a time, like the other shell commands that fan out. 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> |
||
|
|
13d9f3b104 |
mini: run weed-vector and weed-worker by default, continuing without either if missing (#13207)
* mini: start weed-worker with the vector engine With -vector, mini now also starts weed-worker, the Lance maintenance worker that builds vector and metadata indexes, finding it the way it finds weed-vector: beside weed, then on PATH. -vector.worker=false leaves it out and -vector.worker.binary names another binary. The Lance Namespace trusts the worker only by a token derived from jwt.filer_signing.key. A cluster with that key hands it to the worker through security.toml as before. Without one, mini makes a key for the run, gives it to the worker in its environment, and lets the namespace accept it while no cluster key is set. The filer and the other services are unaffected, so unauthenticated filer writes keep working. * mini: run the vector engine by default, without failing when it is missing -vector now defaults to true, so a plain weed mini starts weed-vector and weed-worker whenever they are installed. Both binaries are looked up before ports are reserved; one that is not found is logged and left out, and mini runs without it. A vector engine that fails to start is logged the same way instead of shutting mini down. -vector=false still leaves vector search out. * mini: clear the vector state a previous in-process run prepared prepareMiniVector returned early without clearing the paths and key an earlier run in the same process had set, so a rerun with -vector.worker=false still started that run's weed-worker. * mini: pass the [grpc.worker] certificates to weed-worker weed-worker takes its admin TLS only from --tls-ca, --tls-cert and --tls-key, not from security.toml, so behind an admin secured with [grpc.admin] the worker mini started dialed in plaintext and never connected. Mini now passes the certificates its Go workers dial admin with, chosen as security.LoadClientTLS chooses them. * mini: find weed-worker without new flags Drop -vector.worker and -vector.worker.binary. weed-worker is looked up beside weed, then beside the weed-vector mini starts (so an explicit -vector.binary also locates it), then on PATH; -vector=false leaves both out. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docker/s3vectors: keep mini from starting a second engine and worker The demo runs weed-vector and weed-worker in their own containers. With -vector on by default, mini in an image that ships both binaries would start another engine and worker beside them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mini: look for weed-worker beside a relative -vector.binary filepath.Join drops the "." of ./weed-vector, so the sibling candidate became a bare name and LookPath searched PATH instead. Resolve the directory first. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |