fix(table-catalog): classify storage quorum as unavailable (#6531)

Co-authored-by: Henry Guo <marshawcoco@users.noreply.github.com>
This commit is contained in:
Henry Guo
2026-08-24 21:52:53 +08:00
committed by GitHub
parent 1f40c3ecd0
commit c80d970d58
2 changed files with 30 additions and 0 deletions
+3
View File
@@ -383,6 +383,9 @@ fn is_missing_storage_error(err: &StorageError) -> bool {
} }
fn storage_error_to_catalog(action: &str, err: StorageError) -> TableCatalogStoreError { fn storage_error_to_catalog(action: &str, err: StorageError) -> TableCatalogStoreError {
if err.is_quorum_error() {
return TableCatalogStoreError::Unavailable(format!("{action}: {err}"));
}
match err { match err {
StorageError::ObjectNotFound(bucket, object) => TableCatalogStoreError::NotFound(format!("{action}: {bucket}/{object}")), StorageError::ObjectNotFound(bucket, object) => TableCatalogStoreError::NotFound(format!("{action}: {bucket}/{object}")),
StorageError::BucketNotFound(bucket) => TableCatalogStoreError::NotFound(format!("{action}: bucket {bucket}")), StorageError::BucketNotFound(bucket) => TableCatalogStoreError::NotFound(format!("{action}: bucket {bucket}")),
+27
View File
@@ -59,6 +59,33 @@ fn catalog_lock_authority_failures_are_typed_as_unavailable() {
); );
} }
#[test]
fn catalog_storage_quorum_failures_are_typed_as_unavailable() {
for error in [
StorageError::ErasureReadQuorum,
StorageError::ErasureWriteQuorum,
StorageError::InsufficientReadQuorum(".rustfs.sys".to_string(), "snapshot.json".to_string()),
StorageError::InsufficientWriteQuorum(".rustfs.sys".to_string(), "snapshot.json".to_string()),
StorageError::NamespaceLockQuorumUnavailable {
mode: "read",
bucket: ".rustfs.sys".to_string(),
object: "s3tables/catalog/strong-backing/snapshot.json".to_string(),
required: 2,
achieved: 0,
},
] {
assert_matches!(
storage_error_to_catalog("stat catalog object", error),
TableCatalogStoreError::Unavailable(_)
);
}
assert_matches!(
storage_error_to_catalog("stat catalog object", StorageError::FileCorrupt),
TableCatalogStoreError::Internal(_)
);
}
#[test] #[test]
fn reserved_table_object_key_matches_exact_prefix_and_children_only() { fn reserved_table_object_key_matches_exact_prefix_and_children_only() {
assert!(is_reserved_table_object_key(".rustfs-table")); assert!(is_reserved_table_object_key(".rustfs-table"));