From 0678febff87cafd6d6579b2196b723518cfba2cb Mon Sep 17 00:00:00 2001 From: Joonas Koivunen Date: Mon, 5 Feb 2024 11:12:13 +0200 Subject: [PATCH] fix: close semaphore on stop if not already closed --- pageserver/src/tenant/remote_timeline_client.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pageserver/src/tenant/remote_timeline_client.rs b/pageserver/src/tenant/remote_timeline_client.rs index 6fb56143a2..f91779ccb5 100644 --- a/pageserver/src/tenant/remote_timeline_client.rs +++ b/pageserver/src/tenant/remote_timeline_client.rs @@ -1709,6 +1709,13 @@ impl RemoteTimelineClient { // Tear down queued ops for op in qi.queued_operations.into_iter() { self.calls_unfinished_metric_end(&op); + + if let UploadOp::Shutdown { since } = &op { + // just in case we have a waiter on the RemoteTimelineClient::shutdown + assert!(qi.shutting_down); + Self::communicate_shutdown(&qi.shutdown_ready, since); + } + // Dropping UploadOp::Barrier() here will make wait_completion() return with an Err() // which is exactly what we want to happen. drop(op);