fix(#2398): graceful restart as one atomic DAG, not compose-and-await
mara's review on #2436: no submit-await-submit composition, even server-side. Adds Template::GracefulRestart (Signal -> Drain -> StopForUpdate -> Reconcile, wanted=Up) mirroring how Restart already does StopForUpdate -> Reconcile, plus submit::graceful_restart and templates::graceful_restart. handle_restart_scoped now submits exactly one DAG per agent up front for both the graceful and non-graceful case -- no await_dags in the loop anymore.
This commit is contained in:
parent
4cfa040154
commit
901ab6a779
8 changed files with 103 additions and 40 deletions
|
|
@ -657,39 +657,30 @@ async fn handle_restart_scoped(
|
|||
let mut errors: Vec<String> = Vec::new();
|
||||
let mut queued: Vec<u64> = Vec::new();
|
||||
|
||||
if graceful {
|
||||
let mut stop_ids = Vec::new();
|
||||
for agent in &agents {
|
||||
stop_ids.push(crate::job_queue::submit::graceful_stop(
|
||||
// One atomic DAG per agent, submitted up front — `Restart`
|
||||
// (mechanical stop + reconcile) or, with `--graceful`,
|
||||
// `GracefulRestart` (signal → drain → mechanical stop → reconcile).
|
||||
// No client- or server-side "submit a stop DAG, await it, then
|
||||
// submit a start DAG" composition: that window is exactly the
|
||||
// dropped-connection gap this DAG-based path exists to close.
|
||||
for agent in &agents {
|
||||
let id = if graceful {
|
||||
crate::job_queue::submit::graceful_restart(
|
||||
coord,
|
||||
agent,
|
||||
crate::job_queue::Source::Manual,
|
||||
"manual via hivectl restart --graceful".to_owned(),
|
||||
));
|
||||
}
|
||||
// Graceful drains can take a while; bound the wait generously —
|
||||
// same shape as `handle_stop`'s hard-stop-before-infra wait, just
|
||||
// a longer ceiling since drains are minutes, not seconds.
|
||||
await_dags(coord, &stop_ids, std::time::Duration::from_mins(10)).await;
|
||||
for agent in &agents {
|
||||
queued.push(crate::job_queue::submit::start(
|
||||
coord,
|
||||
agent,
|
||||
crate::job_queue::Source::Manual,
|
||||
"manual via hivectl restart --graceful".to_owned(),
|
||||
));
|
||||
ok_items.push(agent.clone());
|
||||
}
|
||||
} else {
|
||||
for agent in &agents {
|
||||
queued.push(crate::job_queue::submit::restart(
|
||||
)
|
||||
} else {
|
||||
crate::job_queue::submit::restart(
|
||||
coord,
|
||||
agent,
|
||||
crate::job_queue::Source::Manual,
|
||||
"manual restart via hivectl restart".to_owned(),
|
||||
));
|
||||
ok_items.push(agent.clone());
|
||||
}
|
||||
)
|
||||
};
|
||||
queued.push(id);
|
||||
ok_items.push(agent.clone());
|
||||
}
|
||||
|
||||
for &container in &infra {
|
||||
|
|
|
|||
Loading…
Reference in a new issue