diff --git a/pageserver/src/http/routes.rs b/pageserver/src/http/routes.rs index 750a242361..a7802f3cbe 100644 --- a/pageserver/src/http/routes.rs +++ b/pageserver/src/http/routes.rs @@ -87,9 +87,7 @@ fn apierror_from_prerror(err: PageReconstructError) -> ApiError { PageReconstructError::NeedsDownload(_, _) => { // This shouldn't happen, because we use a RequestContext that requests to // download any missing layer files on-demand. - ApiError::InternalServerError(anyhow::anyhow!( - "would need to download remote layer file" - )) + ApiError::InternalServerError(anyhow::anyhow!("need to download remote layer file")) } PageReconstructError::Cancelled => { ApiError::InternalServerError(anyhow::anyhow!("request was cancelled")) diff --git a/pageserver/src/tenant/timeline.rs b/pageserver/src/tenant/timeline.rs index ad68770404..7b796a0749 100644 --- a/pageserver/src/tenant/timeline.rs +++ b/pageserver/src/tenant/timeline.rs @@ -15,6 +15,7 @@ use pageserver_api::models::{ use tokio::sync::{oneshot, watch, Semaphore, TryAcquireError}; use tokio_util::sync::CancellationToken; use tracing::*; +use utils::id::TenantTimelineId; use std::cmp::{max, min, Ordering}; use std::collections::HashMap; @@ -382,7 +383,7 @@ pub enum PageReconstructError { Other(#[from] anyhow::Error), // source and Display delegate to anyhow::Error /// The operation would require downloading a layer that is missing locally. - NeedsDownload(Weak, Weak), + NeedsDownload(TenantTimelineId, LayerFileName), /// The operation was cancelled Cancelled, @@ -396,7 +397,14 @@ impl std::fmt::Debug for PageReconstructError { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> { match self { Self::Other(err) => err.fmt(f), - Self::NeedsDownload(_tli, _layer) => write!(f, "needs download"), + Self::NeedsDownload(tenant_timeline_id, layer_file_name) => { + write!( + f, + "layer {}/{} needs download", + tenant_timeline_id, + layer_file_name.file_name() + ) + } Self::Cancelled => write!(f, "cancelled"), Self::WalRedo(err) => err.fmt(f), } @@ -407,7 +415,14 @@ impl std::fmt::Display for PageReconstructError { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> { match self { Self::Other(err) => err.fmt(f), - Self::NeedsDownload(_tli, _layer) => write!(f, "needs download"), + Self::NeedsDownload(tenant_timeline_id, layer_file_name) => { + write!( + f, + "layer {}/{} needs download", + tenant_timeline_id, + layer_file_name.file_name() + ) + } Self::Cancelled => write!(f, "cancelled"), Self::WalRedo(err) => err.fmt(f), } @@ -1879,8 +1894,8 @@ impl Timeline { } (DownloadBehavior::Error, false) => { return Err(PageReconstructError::NeedsDownload( - timeline.myself.clone(), - Arc::downgrade(&remote_layer), + TenantTimelineId::new(self.tenant_id, self.timeline_id), + remote_layer.file_name.clone(), )) } }