From c80d970d58e473804dc8aa966dcb8f16cf49705f Mon Sep 17 00:00:00 2001 From: Henry Guo Date: Mon, 24 Aug 2026 21:52:53 +0800 Subject: [PATCH] fix(table-catalog): classify storage quorum as unavailable (#6531) Co-authored-by: Henry Guo --- rustfs/src/table_catalog/mod.rs | 3 +++ rustfs/src/table_catalog/tests.rs | 27 +++++++++++++++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/rustfs/src/table_catalog/mod.rs b/rustfs/src/table_catalog/mod.rs index c43571f31..e82c9e825 100644 --- a/rustfs/src/table_catalog/mod.rs +++ b/rustfs/src/table_catalog/mod.rs @@ -383,6 +383,9 @@ fn is_missing_storage_error(err: &StorageError) -> bool { } fn storage_error_to_catalog(action: &str, err: StorageError) -> TableCatalogStoreError { + if err.is_quorum_error() { + return TableCatalogStoreError::Unavailable(format!("{action}: {err}")); + } match err { StorageError::ObjectNotFound(bucket, object) => TableCatalogStoreError::NotFound(format!("{action}: {bucket}/{object}")), StorageError::BucketNotFound(bucket) => TableCatalogStoreError::NotFound(format!("{action}: bucket {bucket}")), diff --git a/rustfs/src/table_catalog/tests.rs b/rustfs/src/table_catalog/tests.rs index 44f5a68fe..d37d4187b 100644 --- a/rustfs/src/table_catalog/tests.rs +++ b/rustfs/src/table_catalog/tests.rs @@ -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] fn reserved_table_object_key_matches_exact_prefix_and_children_only() { assert!(is_reserved_table_object_key(".rustfs-table"));