Speed up compute shutdown

This commit is contained in:
Bojan Serafimov
2023-08-05 13:03:09 -04:00
parent ba9df27e78
commit 481808e215
3 changed files with 13 additions and 0 deletions

View File

@@ -294,6 +294,14 @@ fn main() -> Result<()> {
info!("synced safekeepers at lsn {lsn}");
}
// Change status to GracefulShutdown
{
let mut state = compute.state.lock().unwrap();
if matches!(state.status, ComputeStatus::Running) {
state.status = ComputeStatus::GracefulShutdown;
}
}
if let Err(err) = compute.check_for_core_dumps() {
error!("error while checking for core dumps: {err:?}");
}

View File

@@ -568,6 +568,7 @@ impl Endpoint {
}
ComputeStatus::Empty
| ComputeStatus::ConfigurationPending
| ComputeStatus::GracefulShutdown
| ComputeStatus::Configuration => {
bail!("unexpected compute status: {:?}", state.status)
}

View File

@@ -52,6 +52,10 @@ pub enum ComputeStatus {
// compute will exit soon or is waiting for
// control-plane to terminate it.
Failed,
// Wrapping up without blocking the next compute
// start, which might be scheduled on a different
// compute node
GracefulShutdown,
}
fn rfc3339_serialize<S>(x: &Option<DateTime<Utc>>, s: S) -> Result<S::Ok, S::Error>