Repository navigation
git-mirror: fstrim the mirror sticky disk before unmount at commit - #63
Open
magma-beef wants to merge 3 commits into
Open
magma-beef wants to merge 3 commits into
magma-beef wants to merge 3 commits into
Conversation
Deleted packs keep their RBD extents allocated on the backing store until the guest discards them. Run a best-effort fstrim on the mirror mount after sync and before unmount, only when the run will commit and only when the host enabled it: the VM agent returns GetStickyDiskResponse.fstrim_timeout_secs (fa live config guest_fstrim_timeout_secs), saved in action state at mount time; 0 means no trim. Any failure or timeout only logs. Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…oto package predates it The bundled GetStickyDiskResponse has no fstrim_timeout_secs yet, and protobuf-es keeps fields it does not know in the message's unknown-field list (the gRPC transport is binary), so decode field 8 from there when the typed field is absent. Releases built before the field existed therefore honour the host budget once the agent sends it. Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Contributor
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
|
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.
Summary
Feature — git-mirror cleanup runs a best-effort
fstrimon the mirror sticky disk right before unmounting a disk it is about to commit, for at most the number of seconds the VM agent sends. Nothing changes until a host is configured: the agent sends 0 today, and the hypervisor does not negotiate discard yet.Start here:
src/blacksmith-cache.ts(fstrimTimeoutSecsFrom, the trim in cleanup);src/state-helper.ts,src/git-source-provider.ts,src/main.tsonly carry the budget from mount to cleanup.dist/is generated.Why
The git-mirror sticky disk is an RBD image; packs that
git gc/maintenance deletes stay allocated in Ceph until the guest discards them. Same change as useblacksmith/stickydisk#82 for the bare action and useblacksmith/setup-docker-builder#143 for buildkit.What
shouldCommit) and the host enabled the trim, runtimeout <secs> sudo fstrim -v -- <mount>after sync/maintenance and beforeumount. Any exit code or exception only logs ([git-mirror] fstrim ...: <output> | timed out after Ns | failed: ...).GetStickyDiskResponse.fstrim_timeout_secs(FastActions/fa#6600, live configguest_fstrim_timeout_secs), saved in action state at mount time. 0/absent = no trim, so this release does nothing until the agent sends a budget — the rollout and its tuning are agent-side.fstrimTimeoutSecsFrom()reads the typed field when the bundled proto package has it, else unknown field 8 vialistUnknownFields()(protobuf-es keeps unknown binary fields; the transport is gRPC), so this version keeps working once the agent starts sending the field without a package bump.Evidence
npm run lint,npm run format-check,npm run builddist/committednpm testparseFstrimTimeoutSecs,fstrimTimeoutSecsFrom,decodeVarintRisks
Verdict: Ship. With the agent sending 0 (current default) cleanup only reads one state value; the trim path is reachable only after a host is configured.
Worry about: once a host is configured and discard is negotiated, the first trim of a large never-trimmed mirror runs until the budget expires and cleanup is longer by up to that budget; later trims are incremental.
Checked, not worried: every trim failure mode (unsupported discard, missing binary, timeout) logs and continues; the trim happens after maintenance/sync so it describes the committed state; non-commit runs skip it.
If it goes wrong: cleanup logs
[git-mirror] fstrim ...: failed|timed out; setguest_fstrim_timeout_secsback to 0 on the host — no action release needed.Related: useblacksmith/stickydisk#82, useblacksmith/setup-docker-builder#143, FastActions/fa#6600, useblacksmith/web#18629.
Link to Devin session: https://app.devin.ai/sessions/2e17815c306b4c3cb7af4f6bce008a66
Open in Devin Desktop: https://app.devin.ai/desktop/session/2e17815c306b4c3cb7af4f6bce008a66?variant=devin
Requested by: @magma-beef
Need help on this PR? Tag
@codesmith-botwith what you need.Need help on this PR? Tag
@codesmith-botwith what you need. (Staging)