From b45c1b596527d04e953228fdd3e0d87859592ec9 Mon Sep 17 00:00:00 2001 From: Joonas Koivunen Date: Tue, 23 Jan 2024 09:48:30 +0000 Subject: [PATCH] feat: add similar is_stopping to PageReconstructError --- pageserver/src/tenant/timeline.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/pageserver/src/tenant/timeline.rs b/pageserver/src/tenant/timeline.rs index 69d0d0b320..86b5b5d514 100644 --- a/pageserver/src/tenant/timeline.rs +++ b/pageserver/src/tenant/timeline.rs @@ -404,6 +404,19 @@ pub(crate) enum PageReconstructError { WalRedo(anyhow::Error), } +impl PageReconstructError { + /// Returns true if this error indicates a tenant/timeline shutdown alike situation + pub(crate) fn is_stopping(&self) -> bool { + use PageReconstructError::*; + match self { + Other(_) => false, + AncestorLsnTimeout(_) => false, + Cancelled | AncestorStopping(_) => true, + WalRedo(_) => false, + } + } +} + #[derive(thiserror::Error, Debug)] enum FlushLayerError { /// Timeline cancellation token was cancelled