Skip to content

Commit

Permalink
feat(catalog): ignore error when listing databases (#16514)
Browse files Browse the repository at this point in the history
  • Loading branch information
BohuTANG committed Sep 25, 2024
1 parent b4e3025 commit 9c4735a
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions src/query/service/src/catalogs/default/mutable_catalog.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ use databend_common_meta_types::seq_value::SeqV;
use databend_common_meta_types::MetaId;
use fastrace::func_name;
use log::info;
use log::warn;

use crate::catalogs::default::catalog_context::CatalogContext;
use crate::databases::Database;
Expand Down Expand Up @@ -250,11 +251,18 @@ impl Catalog for MutableCatalog {
})
.await?;

dbs.iter().try_fold(vec![], |mut acc, item| {
let db = self.build_db_instance(item)?;
acc.push(db);
Ok(acc)
})
dbs.iter()
.try_fold(vec![], |mut acc, item: &Arc<DatabaseInfo>| {
let db_result = self.build_db_instance(item);
match db_result {
Ok(db) => acc.push(db),
Err(err) => {
// Ignore the error and continue, allow partial failure.
warn!("Failed to build database '{:?}': {:?}", item, err);
}
}
Ok(acc)
})
}

#[async_backtrace::framed]
Expand Down

0 comments on commit 9c4735a

Please sign in to comment.