scripts: add script to clean up stale bazel output bases#166331
scripts: add script to clean up stale bazel output bases#166331trunk-io[bot] merged 1 commit intocockroachdb:masterfrom
Conversation
|
😎 Merged successfully - details. |
michae2
left a comment
There was a problem hiding this comment.
Awesome, I'm going to try this out! Thanks for creating it!
@michae2 reviewed all commit messages and made 4 comments.
Reviewable status:complete! 1 of 0 LGTMs obtained (waiting on dt and stevendanna).
scripts/tidy_bazel_bases.sh line 120 at r1 (raw file):
# Opt-in: dedup only runs if the user has created ~/.cache/bazel-tidy/dedupe # and fclones is installed. if ! command -v fclones >/dev/null 2>&1 || [ ! -d "${HOME}/.cache/bazel-tidy/dedupe" ]; then
Based on the comment below, is the special patched fclones needed to make this work? Should we check for thats specific version of fclones?
scripts/tidy_bazel_bases.sh line 140 at r1 (raw file):
return fi
nit: trailing spaces
scripts/tidy_bazel_bases.sh line 163 at r1 (raw file):
# bazel binaries and clear the output bases so it stops propagating to output # files where it becomes uncopyable, but this is less ideal as it means that # provenance information is no longer tracked. dt has a patched fclones.
nit: trailing space
|
A couple more notes from Claude, which I don't feel too strongly about, but might be worth considering. Additional Findings from Correctness ReviewTOCTOU race in Between checking the PID file locking should match The existing Dedup runs on actively-used bases
|
fd18f87 to
94966d8
Compare
|
Ugh. These bazel read-only permissions are so annoying. That |
Added a chmod +w before the |
it previously wasn't using assign-if-empty so wasn't customizable at invocation. updated now. |
Bazel output bases for workspaces that no longer exist (e.g. deleted git worktrees) or that haven't been used recently can waste significant disk space. An idle workspace typically accumulates enough changes that most of its cached build is invalidated on next use, so the output base isn't worth keeping. Pruning orphaned and stale bases reclaims this space with limited downside, since rebuilds still leverage the remote LRU cache maintained by dev. Additionally, when using multiple worktrees with similar content, the same build artifacts are often duplicated across output bases. These duplicates can be replaced with copy-on-write links using `fclones`. The script supports this on an opt-in basis: create the directory ~/.cache/bazel-tidy/dedupe and ensure `fclones` is available on PATH. Release note: none. Epic: none.
|
TFTR! /trunk merge |
|
/trunk merge |
Bazel output bases for workspaces that no longer exist (e.g. deleted git worktrees) or that haven't been used recently can waste significant disk space. An idle workspace typically accumulates enough changes that most of its cached build is invalidated on next use, so the output base isn't worth keeping. Pruning orphaned and stale bases reclaims this space with limited downside, since rebuilds still leverage the remote LRU cache maintained by dev.
Additionally, when using multiple worktrees with similar content, the same build artifacts are often duplicated across output bases. These duplicates can be replaced with copy-on-write links using
fclones. The script supports this on an opt-in basis: create the directory ~/.cache/bazel-tidy/dedupe and ensurefclonesis available on PATH.Release note: none.
Epic: none.