mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-12-04 18:17:16 +01:00
2fdfd8cd993149d4ddb352abe59c08b24b70098a
2
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
a963c1309c |
worker: purge the filer metadata log from a lifecycle job that keeps it past every TTL (#13101)
* worker: share the one-filer-per-store selection with other filer jobs Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * worker: add a meta_log_purge job that keeps the log past every TTL The job deletes whole metadata log days once per filer store, keeping every day that the longest filer.conf TTL, the longest S3 lifecycle rule, a registered retention floor or a running replay job's cursor still needs. A floor input that cannot be read stops the run before anything is deleted. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * worker: register meta_log_purge in the lifecycle lane Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * maintenance: stop purging the metadata log from the default scripts The meta_log_purge job now deletes old log days, keeping what TTLs, lifecycle rules and replay jobs still need. fs.log.purge stays for manual use. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * worker: let an idle filer_ttl rule's read position release the log filer_ttl no longer needs events up to read_ns, and an idle rule keeps an old ts_ns while read_ns advances, so the floor follows the later of the two. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * worker: cap min_retention_days so a huge value cannot overflow Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * worker: show the min_retention_days limit in the admin form Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * worker: give a registered retention floor the store's filer client A floor that only gets a context cannot tell which cluster or store it answers for, so it cannot ask that cluster's master or read the store's own settings. Pass the filer client the job already holds. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * worker: keep the log an unfinished lifecycle walk will replay A cold-start or recovery walk that resumes across runs rewinds its shard cursor to the walk's start minus the longest lifecycle TTL once it completes. Until then only its walk checkpoint records that start, so a walk running for more than a day let the purge delete the creation events the rewound replay reads. A checkpoint with buckets done or partly walked now holds the floor at started_ns minus that TTL. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * worker: hold the walk start until the checkpoint goes stale A walk clears its checkpoint in finish() before each of its shards saves the rewound cursor, so a purge scan that read the old shard cursor and then the cleared checkpoint saw neither. A cleared checkpoint keeps started_ns, so every live checkpoint now holds the floor at its start minus the longest lifecycle TTL. A finished one stops holding once it has not been saved for cursorStaleAfter. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * worker: read walk checkpoints before the shard cursors they rewind A purge scan that read a shard cursor, then a checkpoint that a later walk had already replaced, saw neither the earlier walk's hold nor the rewind its shards saved. A walk replaces its checkpoint only after the previous walk's rewind is on disk, so reading the checkpoints first always sees one of the two. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * lifecycle: save a fresh walk's checkpoint at its first progress A walk that progressed during its first save interval and then stalled for more than a day had no checkpoint on disk, so the metadata log purge saw nothing holding the days its completion replays. A fresh walk now saves on its first finished entry or bucket; a resumed walk already has its record on disk and keeps the interval. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * lifecycle: rewrite an unchanged shard cursor so its mtime stays fresh A shard stuck on RETRY_LATER saved identical bytes each pass, and SaveInsideFiler skips identical content, so the file's mtime aged past the meta log purge's staleness cutoff while the shard still needed it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * worker: keep the log day a reader from the cursor lists first Log files are named for their flush start, so a file from just before midnight holds events after a cursor just past it. The reader backs off one flush interval before choosing its first day; the purge now does too. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * worker: stop the meta log purge on an unreadable lifecycle policy LoadCompileInputs reports a bucket whose lifecycle XML does not parse separately from its error, so the purge used the shorter floors and deleted days that bucket's rules may need once the policy is fixed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * worker: read shard cursors with the replay's loader in the meta log purge A shard cursor the replay refuses, such as an empty object, decoded as a zero position and released the purge; it now stops the run instead. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * worker: saturate the meta log purge's TTL plus a day A lifecycle TTL near the largest duration wrapped negative once a day was added, so the purge fell back to the shorter floors; the walk hold at started_ns minus that TTL likewise dropped below zero and was lost. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * worker: leave disabled lifecycle rules out of the meta log purge floor AllActivePriorStates activates every compiled rule, so a disabled rule still held the log for its TTL, and disabling it could not release it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * worker: compute the meta log purge floor in SafeKeepFrom Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * shell: fs.log.purge keeps the logs the meta log purge floor needs unless -force Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * shell: run the fs.log.purge floor test without a master client Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
f068fe7f09 |
fix(shell): fs.log.purge purges every filer, not just one (#12524)
* fix(shell): fs.log.purge purges every filer, not just one Each filer keeps its own metadata logs in its own store, so purging a single filer leaves the chunks referenced by the others and the volume vacuum cannot reclaim anything. The shell picked that single filer at random (commands.go:208) when no -filer flag was given, and the admin script worker pinned it to filers[0] (admin_script_handler.go:574), so the same command purged a different filer on every run and never the whole cluster. fs.log.purge now resolves the filer list from the master and purges each of them, continuing when one is unreachable and reporting the failures at the end. -filer=<addr>,... restricts the purge to a subset. Also stops mutating the shared command environment per filer, so a long-lived shell keeps its original filer. * fix(shell): bound filer discovery and cover the cluster path Address review feedback: - resolveLogPurgeFilers waited on the master with context.Background(): a shell whose master connection dropped would hang before purging anything, where it used to purge the connected filer. Bound the master round trip with a timeout and fall back to the connected filer when the master cannot be reached or lists no filer. - the tests only exercised the single-filer fallback. Rename that test to what it actually covers and add one asserting every filer of the list is attempted and the shared command environment keeps its original filer. * shell: reject an fs.log.purge -filer list with no addresses A comma or whitespace only -filer value fell through to master discovery and purged every filer instead of the intended subset. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * shell: fall back to the shell's filer without a second master lookup When the master listed no filer, FilerAddress() ran filer discovery again and could wait out the shell's ConnectTimeout before failing. Also cover master discovery with the fake discovery master. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * shell: test the fs.log.purge filer loop against a fake filer The previous test looped over the addresses itself, so it passed no matter what Do did. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Martin Morez <martin@morez.org> Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |