mirror of
https://github.com/neondatabase/neon.git
synced 2026-05-31 12:00:42 +00:00
[PRE-MERGE] hlinnaka/walingest-simplify-vm-flag-clearing-2
Squashed commit of the following: commitb1d701dc06Author: Heikki Linnakangas <heikki@neon.tech> Date: Thu Jan 4 18:23:59 2024 +0200 Refactor generation of ClearVisibilityMapFlags records. With fewer mutable variables, for sake of clarity. commitaa95a07d27Author: Heikki Linnakangas <heikki@neon.tech> Date: Thu Jan 4 18:20:03 2024 +0200 Refactor code to apply ClearVisibilityMapFlags records a little. To reduce the repetition. commit18e9208158Author: John Spray <john@neon.tech> Date: Thu Jan 4 10:40:03 2024 +0000 pageserver: improved error handling for shard routing error, timeline not found (#6262) ## Problem - When a client requests a key that isn't found in any shard on the node (edge case that only happens if a compute's config is out of date), we should prompt them to reconnect (as this includes a backoff), since they will not be able to complete the request until they eventually get a correct pageserver connection string. - QueryError::Other is used excessively: this contains a type-ambiguous anyhow::Error and is logged very verbosely (including backtrace). ## Summary of changes - Introduce PageStreamError to replace use of anyhow::Error in request handlers for getpage, etc. - Introduce Reconnect and NotFound variants to QueryError - Map the "shard routing error" case to PageStreamError::Reconnect -> QueryError::Reconnect - Update type conversions for LSN timeouts and tenant/timeline not found errors to use PageStreamError::NotFound->QueryError::NotFound
This commit is contained in:
@@ -31,6 +31,9 @@ pub enum ApiError {
|
||||
#[error("Shutting down")]
|
||||
ShuttingDown,
|
||||
|
||||
#[error("Timeout")]
|
||||
Timeout(Cow<'static, str>),
|
||||
|
||||
#[error(transparent)]
|
||||
InternalServerError(anyhow::Error),
|
||||
}
|
||||
@@ -67,6 +70,10 @@ impl ApiError {
|
||||
err.to_string(),
|
||||
StatusCode::SERVICE_UNAVAILABLE,
|
||||
),
|
||||
ApiError::Timeout(err) => HttpErrorBody::response_from_msg_and_status(
|
||||
err.to_string(),
|
||||
StatusCode::REQUEST_TIMEOUT,
|
||||
),
|
||||
ApiError::InternalServerError(err) => HttpErrorBody::response_from_msg_and_status(
|
||||
err.to_string(),
|
||||
StatusCode::INTERNAL_SERVER_ERROR,
|
||||
|
||||
Reference in New Issue
Block a user