Skip to content

Cap GC threshold at store filesystem capacity#394

Open
vlast3k wants to merge 1 commit into
cloudfoundry:developfrom
vlast3k:cap-gc-threshold-at-store-capacity
Open

Cap GC threshold at store filesystem capacity#394
vlast3k wants to merge 1 commit into
cloudfoundry:developfrom
vlast3k:cap-gc-threshold-at-store-capacity

Conversation

@vlast3k
Copy link
Copy Markdown

@vlast3k vlast3k commented May 6, 2026

ai-assisted=yes

Summary

The thresholder computes threshold_bytes from disk available space, but doesn't check whether that value exceeds the actual GrootFS XFS store capacity. After a redeploy with a smaller disk, the store keeps its original (smaller) capacity while the threshold is recalculated against the new disk — can end up with threshold > store, so GC never fires and the store fills up.

This adds a statfs check on the store path after threshold calculation and caps at Blocks * Bsize if the computed threshold would exceed the store's total capacity.

Tests: new integration test creates a 100M XFS store inside the 20G test filesystem, verifies the cap kicks in. All 25 existing specs still pass.

Backward Compatibility

Breaking Change? No

Only fires when the store already exists at a smaller capacity than the computed threshold. Normal deploys unaffected.

When a cell is redeployed with a smaller disk, the thresholder computes
a GC threshold from the new disk's available space that can exceed the
existing GrootFS XFS backing store capacity. This results in the
threshold never being reached and garbage collection never firing,
eventually leading to ENOSPC.

After computing the threshold via the calculator, cap it at the actual
store filesystem total capacity obtained via statfs(2). This ensures
threshold_bytes <= store size regardless of disk resize history.

Adds Meter.GetTotalCapacity() using Blocks*Bsize from statfs, with
unit tests and an integration test that creates a small XFS store
inside the test filesystem to verify the cap fires correctly.

Closes: CFAR-1378
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

1 participant