Skip to content

Commit

Permalink
Self-review pt.2.
Browse files Browse the repository at this point in the history
  • Loading branch information
FelixMcFelix committed May 23, 2024
1 parent 2537222 commit f217bd1
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions nexus/src/app/background/vpc_routes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,20 @@ impl VpcRouteManager {
}
}

// There's a sort of eventual consistency happening here.
// ... DETAIL XX ...
// version bumps must happen AFTER other changes occur in
// children etc. to keep this sane and working. :)
// This RPW doesn't concern itself overly much with resolved router targets
// and destinations being partial wrt. the current generation, in the same
// vein as how firewall rules are handled. Gating *pushing* this update on a
// generation number can be a bit more risky, but there's a sort of eventual
// consistency happening here that keeps this safe.
//
// Any location which updates name-resolvable state follows the pattern:
// * Update state.
// * Update (VPC-wide) router generation numbers.
// * Awaken this task. This might happen indirectly via e.g. instance start.
//
// As a result, any update which accidentally sees partial state will be followed
// by re-triggering this RPW with a higher generation number, giving us a re-resolved
// route set and pushing to any relevant sleds.
impl BackgroundTask for VpcRouteManager {
fn activate<'a>(
&'a mut self,
Expand All @@ -47,7 +57,6 @@ impl BackgroundTask for VpcRouteManager {
async {
let log = &opctx.log;

// XX: copied from omicron#5566
let sleds = match self
.datastore
.sled_list_all_batched(opctx, SledFilter::InService)
Expand Down Expand Up @@ -99,7 +108,7 @@ impl BackgroundTask for VpcRouteManager {
// based on the set of VNIs reported by this sled.
// These provide the versions we'll stick with -- in the worst
// case we push newer state to a sled with an older generation
// number, which
// number, which will be fixed up on the next activation.
for set in &route_sets {
let db_vni = Vni(set.id.vni);
let maybe_vpc = vni_to_vpc.entry(set.id.vni);
Expand Down

0 comments on commit f217bd1

Please sign in to comment.