From 3afec731dc7963a0fd3bb92da54d81900b299b57 Mon Sep 17 00:00:00 2001 From: John Spray Date: Tue, 24 Oct 2023 18:14:03 +0100 Subject: [PATCH] pageserver: add a CancellationToken to Tenant --- pageserver/src/tenant.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pageserver/src/tenant.rs b/pageserver/src/tenant.rs index b6059a9a63..dfa1fd02c1 100644 --- a/pageserver/src/tenant.rs +++ b/pageserver/src/tenant.rs @@ -286,6 +286,8 @@ pub struct Tenant { pub(crate) delete_progress: Arc>, pub(crate) heatmap_hook: Mutex, + + pub(crate) cancel: CancellationToken, } impl std::fmt::Debug for Tenant { @@ -2073,6 +2075,7 @@ impl Tenant { // we just ignore the failure to stop tracing::debug!("shutting down..."); + self.cancel.cancel(); match self.set_stopping(shutdown_progress, false, false).await { Ok(()) => {} Err(SetStoppingError::Broken) => { @@ -2620,6 +2623,7 @@ impl Tenant { eviction_task_tenant_state: tokio::sync::Mutex::new(EvictionTaskTenantState::default()), delete_progress: Arc::new(tokio::sync::Mutex::new(DeleteTenantFlow::default())), heatmap_hook: Mutex::default(), + cancel: CancellationToken::new(), } }