pageserver: imrpove error parity between read paths

This commit is contained in:
Vlad Lazar
2024-04-17 16:44:26 +01:00
parent e489fd7a1d
commit 2cd9b3cab5
3 changed files with 23 additions and 2 deletions

View File

@@ -336,6 +336,12 @@ impl Layer {
.get_values_reconstruct_data(keyspace, lsn_range, reconstruct_data, &self.0, ctx)
.instrument(tracing::debug_span!("get_values_reconstruct_data", layer=%self))
.await
.map_err(|err| match err {
GetVectoredError::Other(err) => GetVectoredError::Other(
err.context(format!("get_value_reconstruct_data for layer {self}")),
),
err => err,
})
}
/// Download the layer if evicted.

View File

@@ -969,6 +969,16 @@ impl Timeline {
{
return Err(GetVectoredError::MissingKey(key))
}
Err(Other(err))
if err
.chain()
.any(|cause| cause.to_string().contains("layer loading failed")) =>
{
// The intent here is to achieve error parity with the vectored read path.
// When vectored read fails to load a layer it fails the whole read, hence
// we mimic this behaviour here to keep the validation happy.
return Err(GetVectoredError::Other(err))
}
_ => {
values.insert(key, block);
key = key.next();