Compare commits

..

1 Commits

Author SHA1 Message Date
Christian Schwarz
7bb1fbf424 global vectored get error class 2024-09-12 16:39:13 +01:00
5 changed files with 28 additions and 25 deletions

View File

@@ -1 +0,0 @@
FROM neondatabase/build-tools:pinned

View File

@@ -1,23 +0,0 @@
// https://containers.dev/implementors/json_reference/
{
"name": "Neon",
"build": {
"context": "..",
"dockerfile": "Dockerfile.devcontainer"
},
"postCreateCommand": {
"build neon": "BUILD_TYPE=debug CARGO_BUILD_FLAGS='--features=testing' mold -run make -s -j`nproc`",
"install python deps": "./scripts/pysync"
},
"customizations": {
"vscode": {
"extensions": [
"charliermarsh.ruff",
"github.vscode-github-actions",
"rust-lang.rust-analyzer"
]
}
}
}

View File

@@ -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))
}
}
}
}

View File

@@ -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(_)),

View File

@@ -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::*;