Merge maint into master (coord cache surgical invalidation)

This commit is contained in:
Johnathan Corgan
2026-05-17 00:38:47 +00:00
3 changed files with 159 additions and 9 deletions
+6 -2
View File
@@ -153,7 +153,9 @@ impl Node {
warn!(error = %e, "Failed to sign declaration after first-RTT parent eval");
return;
}
self.coord_cache.clear();
// Surgical invalidation — see CoordCache::invalidate_via_node doc.
self.coord_cache
.invalidate_via_node(self.identity.node_addr());
self.reset_discovery_backoff();
self.stats_mut().tree.parent_switched += 1;
self.stats_mut().tree.parent_switches += 1;
@@ -178,7 +180,9 @@ impl Node {
warn!(error = %e, "Failed to sign self-root declaration after first-RTT");
return;
}
self.coord_cache.clear();
// Surgical invalidation — see CoordCache::invalidate_other_roots doc.
self.coord_cache
.invalidate_other_roots(self.identity.node_addr());
self.reset_discovery_backoff();
self.stats_mut().tree.parent_switched += 1;
self.stats_mut().tree.parent_switches += 1;
+22 -7
View File
@@ -250,7 +250,9 @@ impl Node {
warn!(error = %e, "Failed to sign declaration after parent switch");
return;
}
self.coord_cache.clear();
// Surgical invalidation — see CoordCache::invalidate_via_node doc.
self.coord_cache
.invalidate_via_node(self.identity.node_addr());
self.reset_discovery_backoff();
self.stats_mut().tree.parent_switched += 1;
@@ -261,7 +263,7 @@ impl Node {
new_seq = new_seq,
new_root = %self.tree_state.root(),
depth = self.tree_state.my_coords().depth(),
"Parent switched, flushed coord cache, announcing to all peers"
"Parent switched, invalidated downstream coord cache entries, announcing to all peers"
);
if flap_dampened {
self.stats_mut().tree.flap_dampened += 1;
@@ -281,7 +283,9 @@ impl Node {
warn!(error = %e, "Failed to sign self-root declaration");
return;
}
self.coord_cache.clear();
// Surgical invalidation — see CoordCache::invalidate_other_roots doc.
self.coord_cache
.invalidate_other_roots(self.identity.node_addr());
self.reset_discovery_backoff();
self.stats_mut().tree.parent_switched += 1;
self.stats_mut().tree.parent_switches += 1;
@@ -315,7 +319,12 @@ impl Node {
warn!(error = %e, "Failed to sign declaration after loop detection");
return;
}
self.coord_cache.clear();
// handle_parent_lost may promote to root OR find new parent;
// cover both invalidation classes.
self.coord_cache
.invalidate_via_node(self.identity.node_addr());
self.coord_cache
.invalidate_other_roots(self.tree_state.root());
self.reset_discovery_backoff();
self.send_tree_announce_to_all().await;
}
@@ -350,7 +359,9 @@ impl Node {
warn!(error = %e, "Failed to sign declaration after parent update");
return;
}
self.coord_cache.clear();
// Surgical invalidation — see CoordCache::invalidate_via_node doc.
self.coord_cache
.invalidate_via_node(self.identity.node_addr());
self.reset_discovery_backoff();
let new_addrs: Vec<NodeAddr> =
@@ -439,7 +450,9 @@ impl Node {
warn!(error = %e, "Failed to sign declaration after periodic parent re-eval");
return;
}
self.coord_cache.clear();
// Surgical invalidation — see CoordCache::invalidate_via_node doc.
self.coord_cache
.invalidate_via_node(self.identity.node_addr());
self.reset_discovery_backoff();
self.stats_mut().tree.parent_switched += 1;
@@ -468,7 +481,9 @@ impl Node {
warn!(error = %e, "Failed to sign self-root declaration in periodic reeval");
return;
}
self.coord_cache.clear();
// Surgical invalidation — see CoordCache::invalidate_other_roots doc.
self.coord_cache
.invalidate_other_roots(self.identity.node_addr());
self.reset_discovery_backoff();
self.stats_mut().tree.parent_switched += 1;
self.stats_mut().tree.parent_switches += 1;