Skip to content

Commit 57769f6

Browse files
[fm] GC sweep for FM creation-marker tables (#10762)
The "creation marker" tables, `rendezvous_alert_created` and `rendezvous_support_bundle_created`, contain a row for each alert and support bundle created by FM respectively, written by `SitrepGuardedInsert`. These prevent FM rendezvous from resurrecting a resource the user has deleted, so it must live for as long as some sitrep that requests the resource might still be executed. Once no current or future sitrep can request the resource, its marker is safe to delete. This PR adds garbage collection for these creation marker tables. This comprises: - A generic page query (`RendezvousMarkerGcPage`), parameterized by `FmRendezvousResource` (see PR #10721), that emits the same two-CTE SQL for both tables, varying only the marker table, resource-id column, and request table. - Datastore wrappers driving the sweep for both resources. - Wiring into the `fm_rendezvous` background task, with stats surfaced through the internal API and omdb. - Datastore tests against the dummy resource (deletion predicate, cursor advance, expectorated SQL), plus GC assertions in the existing background-task tests covering both real resources. Fixes #10248.
1 parent fbb1c1d commit 57769f6

9 files changed

Lines changed: 899 additions & 63 deletions

File tree

dev-tools/omdb/src/bin/omdb/nexus.rs

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3759,6 +3759,8 @@ fn print_task_fm_rendezvous(details: &serde_json::Value) {
37593759
alerts,
37603760
support_bundles,
37613761
ereport_marking: marking,
3762+
alert_marker_gc,
3763+
support_bundle_marker_gc,
37623764
} = match serde_json::from_value::<FmRendezvousStatus>(details.clone()) {
37633765
Err(error) => {
37643766
eprintln!(
@@ -3936,6 +3938,36 @@ fn print_task_fm_rendezvous(details: &serde_json::Value) {
39363938
}
39373939
},
39383940
);
3941+
print_op(
3942+
"garbage collecting alert creation markers",
3943+
&alert_marker_gc,
3944+
print_marker_gc_details,
3945+
);
3946+
print_op(
3947+
"garbage collecting support bundle creation markers",
3948+
&support_bundle_marker_gc,
3949+
print_marker_gc_details,
3950+
);
3951+
}
3952+
3953+
fn print_marker_gc_details(status: &fm_rendezvous::MarkerGcStatus) {
3954+
let fm_rendezvous::MarkerGcStatus { rows_deleted, batches, errors } =
3955+
status;
3956+
const ROWS_DELETED: &str = "rows deleted:";
3957+
const BATCHES: &str = "batches:";
3958+
const ERRORS: &str = "errors:";
3959+
const WIDTH: usize = const_max_len(&[ROWS_DELETED, BATCHES, ERRORS]) + 1;
3960+
const NUM_WIDTH: usize = 4;
3961+
println!(" {ROWS_DELETED:<WIDTH$}{rows_deleted:>NUM_WIDTH$}");
3962+
println!(" {BATCHES:<WIDTH$}{batches:>NUM_WIDTH$}");
3963+
println!(
3964+
"{} {ERRORS:<WIDTH$}{:>NUM_WIDTH$}",
3965+
warn_if_nonzero(errors.len()),
3966+
errors.len()
3967+
);
3968+
for error in errors {
3969+
println!(" > {error}");
3970+
}
39393971
}
39403972

39413973
fn print_task_trust_quorum_manager(details: &serde_json::Value) {

dev-tools/omdb/tests/successes.out

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -750,6 +750,16 @@ task: "fm_rendezvous"
750750
batch size: 1000
751751
batches: 0
752752
errors: 0
753+
garbage collecting alert creation markers:
754+
started at <REDACTED_TIMESTAMP> (<REDACTED DURATION>s ago) and ran for <REDACTED DURATION>ms
755+
rows deleted: 0
756+
batches: 1
757+
errors: 0
758+
garbage collecting support bundle creation markers:
759+
started at <REDACTED_TIMESTAMP> (<REDACTED DURATION>s ago) and ran for <REDACTED DURATION>ms
760+
rows deleted: 0
761+
batches: 1
762+
errors: 0
753763

754764
task: "fm_sitrep_gc"
755765
configured period: every <REDACTED_DURATION>s
@@ -1450,6 +1460,16 @@ task: "fm_rendezvous"
14501460
batch size: 1000
14511461
batches: 0
14521462
errors: 0
1463+
garbage collecting alert creation markers:
1464+
started at <REDACTED_TIMESTAMP> (<REDACTED DURATION>s ago) and ran for <REDACTED DURATION>ms
1465+
rows deleted: 0
1466+
batches: 1
1467+
errors: 0
1468+
garbage collecting support bundle creation markers:
1469+
started at <REDACTED_TIMESTAMP> (<REDACTED DURATION>s ago) and ran for <REDACTED DURATION>ms
1470+
rows deleted: 0
1471+
batches: 1
1472+
errors: 0
14531473

14541474
task: "fm_sitrep_gc"
14551475
configured period: every <REDACTED_DURATION>s

0 commit comments

Comments
 (0)