Support bundle: automatic deletion to maintain free dataset buffer #9662
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
Implements automatic deletion of support bundles to maintain a buffer of free debug datasets for new allocations.
target_free_datasetsandmin_bundles_to_keep(Option<NonZeroU32>)support_bundle_auto_delete()CTE + unit testsauto_delete_bundles()phase before existing phasesHow it works
The
SupportBundleCollectorbackground task now runs three phases:Deletion respects
min_bundles_to_keepto protect small systems from aggressive cleanup.Tests
test_auto_deletion_no_bundles- No deletion when there are enough free datasets and no bundles existtest_auto_deletion_enough_free_datasets- No deletion when free datasets already meet the targettest_auto_deletion_deletes_oldest_first- Verifies oldest bundles (by time_created) are selected for deletiontest_auto_deletion_respects_min_bundles_to_keep- Deletion is limited when it would leave fewer thanmin_bundles_to_keepbundlestest_auto_deletion_min_bundles_prevents_all_deletion- No deletion whenmin_bundles_to_keepexceeds active bundle counttest_auto_deletion_only_selects_active_bundles- Only Active bundles are deleted; Collecting/Destroying bundles are skipped but still count as occupying datasetstest_auto_deletion_verifies_state_transition- Verifies bundles are actually transitioned to Destroying state in the databasetest_auto_deletion_failed_bundles_dont_occupy_datasets- Failed bundles don't count toward used dataset count (their dataset was expunged)test_auto_delete_query_explains- Validates the CTE is valid SQL via EXPLAINexpectorate_auto_delete_query- Captures SQL output for inspection/change detectiontest_support_bundle_auto_deletion()Fixes #9660