fix(admin): classify missing kms config by error variant (#6196)

This commit is contained in:
Zhengchao An
2026-08-18 13:40:10 +08:00
committed by GitHub
parent 60eb139db9
commit 355c8d2e22
3 changed files with 15 additions and 3 deletions
@@ -1783,7 +1783,7 @@ impl TransitionState {
.await; .await;
} }
global_metrics().record_scanner_transition_failed(1); global_metrics().record_scanner_transition_failed(1);
if !is_err_version_not_found(&err) && !is_err_object_not_found(&err) && !is_network_or_host_down(&err.to_string(), false) && !err.to_string().contains("use of closed network connection") { if !is_err_version_not_found(&err) && !is_err_object_not_found(&err) && !is_network_or_host_down(&err.to_string(), false) {
error!( error!(
event = EVENT_LIFECYCLE_TIER_OPERATION_FAILED, event = EVENT_LIFECYCLE_TIER_OPERATION_FAILED,
component = LOG_COMPONENT_ECSTORE, component = LOG_COMPONENT_ECSTORE,
+8
View File
@@ -1116,6 +1116,14 @@ mod tests {
assert!(encoder_source.is::<reed_solomon_erasure::Error>()); assert!(encoder_source.is::<reed_solomon_erasure::Error>());
} }
// The lifecycle transition worker relies on this arm alone to suppress the
// closed-connection noise (`bucket_lifecycle_ops.rs`); dropping it here would
// silently turn shutdown races back into `error!` log spam.
#[test]
fn is_network_or_host_down_covers_closed_network_connection() {
assert!(is_network_or_host_down("transition failed: use of closed network connection", false));
}
// Regression for #952 (ECA-11): an all-`DiskNotFound` slice (every drive in // Regression for #952 (ECA-11): an all-`DiskNotFound` slice (every drive in
// every set unreachable) must NOT be classified as "all not found", // every set unreachable) must NOT be classified as "all not found",
// otherwise ListObjects silently returns an empty listing and masks a full // otherwise ListObjects silently returns an empty listing and masks a full
+6 -2
View File
@@ -22,6 +22,7 @@ use crate::admin::runtime_sources::{
current_object_store_handle_for_context, current_or_init_kms_runtime_service_manager, current_object_store_handle_for_context, current_or_init_kms_runtime_service_manager,
}; };
use crate::admin::storage_api::config::{read_admin_config, save_admin_config}; use crate::admin::storage_api::config::{read_admin_config, save_admin_config};
use crate::admin::storage_api::error::StorageError;
use crate::auth::{check_key_valid, get_session_token}; use crate::auth::{check_key_valid, get_session_token};
use crate::server::{ADMIN_PREFIX, RemoteAddr}; use crate::server::{ADMIN_PREFIX, RemoteAddr};
use hyper::{Method, StatusCode}; use hyper::{Method, StatusCode};
@@ -278,8 +279,11 @@ pub async fn load_kms_config() -> Option<KmsConfig> {
} }
}, },
Err(e) => { Err(e) => {
// Config not found is normal on first run // Config not found is normal on first run: `read_config` maps a missing or
if e.to_string().contains("ConfigNotFound") || e.to_string().contains("not found") { // empty config object to `ConfigNotFound`, so that variant is the only
// "absent" signal reaching here. Every other not-found variant (disk,
// volume, bucket) means degraded storage and must stay a warning.
if matches!(e, StorageError::ConfigNotFound) {
info!( info!(
component = LOG_COMPONENT_ADMIN, component = LOG_COMPONENT_ADMIN,
subsystem = LOG_SUBSYSTEM_KMS, subsystem = LOG_SUBSYSTEM_KMS,