Skip to content

Commit

Permalink
fix(query): list_dictionaries should not ignore db_id (#16587)
Browse files Browse the repository at this point in the history
* fix(query): list_dictionaries should not ignore db_id

* optimize
  • Loading branch information
TCeason authored Oct 11, 2024
1 parent a59a20b commit f8201da
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
3 changes: 1 addition & 2 deletions src/meta/api/src/schema_api_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3025,8 +3025,7 @@ impl<KV: kvapi::KVApi<Error = MetaError> + ?Sized> SchemaApi for KV {
req.tenant.clone(),
DictionaryIdentity::new(req.db_id, "dummy".to_string()),
);
let dir = DirName::new_with_level(dictionary_ident, 2);

let dir = DirName::new(dictionary_ident);
let name_id_values = self.list_id_value(&dir).await?;
Ok(name_id_values
.map(|(name, _seq_id, seq_meta)| (name.dict_name(), seq_meta.data))
Expand Down
18 changes: 18 additions & 0 deletions src/meta/api/src/schema_api_test_suite.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7387,6 +7387,24 @@ impl SchemaApiTestSuite {
assert_eq!(ErrorCode::DICTIONARY_ALREADY_EXISTS, err_code.code());
}

{
info!("--- prepare db2");
let db_name = "db2";
let mut util = Util::new(mt, tenant_name, db_name, tbl_name, "eng1");
{
util.create_db().await?;
}

let db_id = util.db_id();

{
info!("--- list dictionary from db2 with no create before");
let req = ListDictionaryReq::new(dict_tenant.clone(), *db_id);
let res = mt.list_dictionaries(req).await?;
assert!(res.is_empty());
}
}

{
info!("--- get dictionary");
let req = dict_ident1.clone();
Expand Down

0 comments on commit f8201da

Please sign in to comment.