refactor(#2815): drop the imperative transient path entirely
mara on !2910: "also remove imperative path for the things that are not nodes yet, file follow up issue to fix that". `TransientGuard`, the stored map and both manual set/clear are gone. `transient_snapshot()` is derived and nothing else — destroy and migration show no pill, because there is no node to derive one from. The pill returns for free when they become nodes. What those three guards were actually doing, though, was suppressing the crash watcher, not drawing a pill. `migrate.rs` said so in its own comment: without it, `crash_watch` fires `ContainerCrash` for every migrated agent and the manager tries to recover containers that were stopped on purpose. Destroy is the same — the container disappears deliberately and nothing in the graph says so. Deleting them outright would therefore have traded a dashboard pill for false crash alerts on every destroy and every migration. So the suppression survives as its own thing, `suppress_crash_watch`, with a name that says what it is. It is still RAII, and still held for the operation rather than stamped once, because the crash watcher's grace window is finite and a destroy is not — a single tombstone would expire mid-operation. The drop stamps the tombstone, covering the poll that lands just after. That leaves RAII in the codebase for exactly one purpose instead of two. Untangling the pill from the suppression is what made the transient layer deletable at all. Follow-up issue for making destroy + migration real queue nodes to follow; at that point this guard goes too. Checked with clippy (`--all-targets -D warnings`), `cargo test -p hive-c0re -p hive-jobq` (322 + 41 passed) and `nix fmt`.
This commit is contained in:
parent
884e39ba63
commit
7f920718f2
4 changed files with 80 additions and 84 deletions
|
|
@ -109,9 +109,8 @@ pub async fn run(coord: &Arc<Coordinator>) -> Result<()> {
|
|||
// would fire ContainerCrash for every agent here and the
|
||||
// manager would spuriously try to recover them.
|
||||
// No queue node behind this one — migration repoints containers
|
||||
// directly — so the label is supplied here. `true`: the repoint takes
|
||||
// the container down, which is the whole reason for the guard.
|
||||
let guard = coord.transient_guard(name.as_str(), "rebuilding", true);
|
||||
// directly — so nothing in the graph marks the stop as intended.
|
||||
let guard = coord.suppress_crash_watch(name.as_str());
|
||||
let result = repoint_container(name.as_str()).await;
|
||||
drop(guard);
|
||||
if let Err(e) = result {
|
||||
|
|
@ -203,8 +202,8 @@ async fn rename_manager_container(coord: &Arc<Coordinator>) {
|
|||
return;
|
||||
}
|
||||
tracing::info!("migration phase 5: renaming root container to h-root");
|
||||
// `true`: the old container is stopped immediately below.
|
||||
let _guard = coord.transient_guard(MANAGER_NAME, "rebuilding", true);
|
||||
// The old container is stopped immediately below, on purpose.
|
||||
let _guard = coord.suppress_crash_watch(MANAGER_NAME);
|
||||
|
||||
// Stop the old container. Abort if stop fails — continuing with a
|
||||
// running `root` and then starting `h-root` risks two manager
|
||||
|
|
|
|||
Loading…
Reference in a new issue