mirror of
https://github.com/neondatabase/neon.git
synced 2026-05-24 16:40:38 +00:00
global vectored get error class
This commit is contained in:
@@ -183,6 +183,9 @@ impl From<PageReconstructError> for ApiError {
|
||||
PageReconstructError::Cancelled => ApiError::Cancelled,
|
||||
PageReconstructError::AncestorLsnTimeout(e) => ApiError::Timeout(format!("{e}").into()),
|
||||
PageReconstructError::WalRedo(pre) => ApiError::InternalServerError(pre),
|
||||
PageReconstructError::VectoredGetGlobalError(e) => {
|
||||
ApiError::InternalServerError(anyhow::anyhow!(e))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1814,6 +1814,7 @@ impl<'a> DatadirModification<'a> {
|
||||
n_files = dir.files.len();
|
||||
aux_files.dir = Some(dir);
|
||||
}
|
||||
Err(PageReconstructError::VectoredGetGlobalError(_)) => todo!(),
|
||||
Err(
|
||||
e @ (PageReconstructError::Cancelled
|
||||
| PageReconstructError::AncestorLsnTimeout(_)),
|
||||
|
||||
@@ -526,6 +526,9 @@ pub(crate) enum PageReconstructError {
|
||||
|
||||
#[error("{0}")]
|
||||
MissingKey(MissingKeyError),
|
||||
|
||||
#[error("vectored get error: {0}")]
|
||||
VectoredGetGlobalError(VectoredGetGlobalError),
|
||||
}
|
||||
|
||||
impl From<anyhow::Error> for PageReconstructError {
|
||||
@@ -604,7 +607,11 @@ impl PageReconstructError {
|
||||
use PageReconstructError::*;
|
||||
match self {
|
||||
Cancelled => true,
|
||||
Other(_) | AncestorLsnTimeout(_) | WalRedo(_) | MissingKey(_) => false,
|
||||
Other(_)
|
||||
| AncestorLsnTimeout(_)
|
||||
| WalRedo(_)
|
||||
| MissingKey(_)
|
||||
| VectoredGetGlobalError(_) => false,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -818,6 +825,22 @@ impl From<GetVectoredError> for PageReconstructError {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(thiserror::Error, Debug)]
|
||||
#[error("{0}")]
|
||||
pub(crate) struct VectoredGetGlobalError(&'static str);
|
||||
impl<'a> From<&'a GetVectoredError> for VectoredGetGlobalError {
|
||||
fn from(e: &'a GetVectoredError) -> Self {
|
||||
match e {
|
||||
GetVectoredError::Oversized(_) => VectoredGetGlobalError("oversized"),
|
||||
GetVectoredError::InvalidLsn(_) => VectoredGetGlobalError("invalid LSN"),
|
||||
GetVectoredError::MissingKey(_) => VectoredGetGlobalError("missing key"),
|
||||
GetVectoredError::GetReadyAncestorError(_) => VectoredGetGlobalError("ancestor LSN"),
|
||||
GetVectoredError::Cancelled => VectoredGetGlobalError("cancelled"),
|
||||
GetVectoredError::Other(_) => VectoredGetGlobalError("other"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<GetReadyAncestorError> for PageReconstructError {
|
||||
fn from(e: GetReadyAncestorError) -> Self {
|
||||
use GetReadyAncestorError::*;
|
||||
|
||||
Reference in New Issue
Block a user