fix: enforce RotatingWriter retention across restarts#414
Merged
Conversation
85696b2 to
26803ca
Compare
rcoh
reviewed
May 18, 2026
| return None; | ||
| } | ||
| Some(SegmentArtifact::Retained { | ||
| index: index.parse().ok()?, |
Contributor
There was a problem hiding this comment.
this won't happen currently but because of how the code works if we ever started producing something like 01 as an index, that could never be deleted.
yulnr
approved these changes
May 19, 2026
Collaborator
|
LGTM. I'll follow up with @rcoh comments |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
RotatingWriterenforcesmax_total_sizefrom its in-memoryclosed_filesqueue. After a process restart that queue starts empty, so existingtrace.N.bin/trace.N.bin.gzartifacts are not counted toward the disk budget and the writer can start again attrace.0.bin.active.That means repeated daemon restarts can grow the trace directory past the configured cap.
This makes startup discover retained artifacts for the same base path, seed
closed_filesoldest-first, and continue writing at the next segment index. Eviction now removes the whole artifact family for a segment (.bin,.bin.gz, and future write-back suffixes), so background-processed files stay under the same budget.Stale
.activefiles from dead writers are discarded on startup because the worker cannot process them.