[reconfigurator] Add "pruneable zones" to PlanningInput#9730
[reconfigurator] Add "pruneable zones" to PlanningInput#9730jgallagher wants to merge 30 commits intomainfrom
PlanningInput#9730Conversation
| // We have no way to confirm that this zone is "unreferenced" - that's a | ||
| // property of the system at large, mostly CRDB state - but we can | ||
| // confirm that it's expunged and ready for cleanup by looking at the | ||
| // parent blueprint. |
There was a problem hiding this comment.
I was originally going to add a couple blippy lints that any zone in expunged_and_unreferenced is (a) present and (b) actually expunged, but with the guard in this method and the fact that PlanningInput's fields are private, I don't believe it's actually possible to construct a PlanningInput with any such zone IDs in expunged_and_unreferenced, so it was impossible to write a test to confirm the blippy lints triggered.
davepacheco
left a comment
There was a problem hiding this comment.
Nice! This is really clean. I've commented on one possible bug here and the rest is nitty feedback.
nexus/reconfigurator/preparation/src/expunged_and_unreferenced.rs
Outdated
Show resolved
Hide resolved
nexus/reconfigurator/preparation/src/expunged_and_unreferenced.rs
Outdated
Show resolved
Hide resolved
nexus/reconfigurator/preparation/src/expunged_and_unreferenced.rs
Outdated
Show resolved
Hide resolved
nexus/reconfigurator/preparation/src/expunged_and_unreferenced.rs
Outdated
Show resolved
Hide resolved
nexus/reconfigurator/preparation/src/expunged_and_unreferenced.rs
Outdated
Show resolved
Hide resolved
nexus/reconfigurator/preparation/src/expunged_and_unreferenced.rs
Outdated
Show resolved
Hide resolved
| clickhouse_config.keepers.contains_key(&zone_id) | ||
| || clickhouse_config.servers.contains_key(&zone_id) |
There was a problem hiding this comment.
I don't know enough about this to evaluate this case -- may want to ask @karencfv or @andrewjstone to double-check.
There was a problem hiding this comment.
I think it should be fine? I'd like to get @andrewjstone's thoughts on this though just to be sure
There was a problem hiding this comment.
This looks good to me. I just read some of the code to remind me what is going on, and if there is no zone there, it means it must have been expunged. Since that's mainly what this PR is about, the same zone with random uuid is not coming back magically.
nexus/reconfigurator/preparation/src/expunged_and_unreferenced.rs
Outdated
Show resolved
Hide resolved
nexus/reconfigurator/preparation/src/expunged_and_unreferenced.rs
Outdated
Show resolved
Hide resolved
|
Bunch of changes here (enough it's probably easier to rereview than look at the diff?):
|
PlanningInputPlanningInput
davepacheco
left a comment
There was a problem hiding this comment.
Still looks great. Just minor suggestions here.
There was a problem hiding this comment.
Sorry for racing with the change here. Let me know if you want help merging it.
There was a problem hiding this comment.
No problem; it was not a bad merge at all.
| opctx, | ||
| &single_item_pagparams(), | ||
| zone_id, | ||
| vec![ |
There was a problem hiding this comment.
nit (as I write this, I'm really not sure it's better): what do you think of using strum to iterate SupportBundleState variants so that you can use the match at L315 to actually construct this Vec? Just making it a little less likely that somebody would update one and not the other.
There was a problem hiding this comment.
Done in 40916cd; I do think it's better.
This builds on the
BlueprintExpungedZoneAccessReasonadded in #9608, and adds a new set of zone IDs toPlanningInputfor "pruneable zones". These are zones that the planner is safe to prune in a future planning iteration, because they are:This PR only adds the new set of zones to
PlanningInput. It will be nearly trivial to add a step to the planner to "prune all zones present in the planning input'spruneable_zonesset", but out of an abundance of caution I'd prefer to land this first, collect a reconfigurator state from some deployed racks, and confirm the contents match what we'd expect on some real systems.This is a little weird in that the logic for whether a zone can be pruned lives in the "prepare a planning input" crate rather than the planner itself, but I think this is reasonable given the implementation of several of the checks (e.g., "query CRDB for this expunged zone specifically" to see whether it's still referenced, which the planner can't do since it doesn't have access to CRDB). Happy to discuss alternatives if this seems wrong upon review.
(We may also want to wait on #7278 before adding the actual prune step?)