Skip to content

Commit

Permalink
chore(meta): remove tenant for table info (#14647)
Browse files Browse the repository at this point in the history
* chore(executor): remove catalog ident name for profile

* chore(meta): remove tenant for table info

* chore(meta): remove tenant for table info

* chore(meta): remove tenant for table info
  • Loading branch information
zhang2014 authored Feb 8, 2024
1 parent 3382953 commit ec91213
Show file tree
Hide file tree
Showing 2 changed files with 81 additions and 33 deletions.
15 changes: 12 additions & 3 deletions src/meta/api/src/schema_api_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2184,7 +2184,10 @@ impl<KV: kvapi::KVApi<Error = MetaError> + ?Sized> SchemaApi for KV {
table_id: tbid.table_id,
seq: tb_meta_seq,
},
desc: tenant_dbname_tbname.to_string(),
desc: format!(
"'{}'.'{}'",
tenant_dbname.db_name, tenant_dbname_tbname.table_name
),
name: tenant_dbname_tbname.table_name.clone(),
// Safe unwrap() because: tb_meta_seq > 0
meta: tb_meta.unwrap(),
Expand Down Expand Up @@ -2307,7 +2310,10 @@ impl<KV: kvapi::KVApi<Error = MetaError> + ?Sized> SchemaApi for KV {
table_id,
seq: tb_meta_seq,
},
desc: tenant_dbname_tbname.to_string(),
desc: format!(
"'{}'.'{}'",
tenant_dbname.db_name, tenant_dbname_tbname.table_name
),
name: table_id_list_key.table_name.clone(),
meta: tb_meta,
tenant: tenant_dbname.tenant.clone(),
Expand Down Expand Up @@ -4580,7 +4586,10 @@ async fn batch_filter_table_info(
table_id,
seq: *tb_meta_seq,
},
desc: tenant_dbname_tbname.to_string(),
desc: format!(
"'{}'.'{}'",
tenant_dbname.db_name, tenant_dbname_tbname.table_name
),
name: table_name.clone(),
meta: tb_meta,
tenant: tenant_dbname.tenant.clone(),
Expand Down
99 changes: 69 additions & 30 deletions src/meta/api/src/schema_api_test_suite.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1759,7 +1759,7 @@ impl SchemaApiTestSuite {

let want = TableInfo {
ident,
desc: format!("'{}'.'{}'.'{}'", tenant, db_name, tbl_name),
desc: format!("'{}'.'{}'", db_name, tbl_name),
name: tbl_name.into(),
meta: table_meta(created_on),
tenant: tenant.to_string(),
Expand Down Expand Up @@ -1788,7 +1788,7 @@ impl SchemaApiTestSuite {
let got = mt.get_table((tenant, db_name, tbl_name).into()).await?;
let want = TableInfo {
ident: tb_ident_2,
desc: format!("'{}'.'{}'.'{}'", tenant, db_name, tbl_name),
desc: format!("'{}'.'{}'", db_name, tbl_name),
name: tbl_name.into(),
meta: table_meta(created_on),
tenant: tenant.to_string(),
Expand Down Expand Up @@ -1825,7 +1825,7 @@ impl SchemaApiTestSuite {
let got = mt.get_table((tenant, "db1", "tb2").into()).await.unwrap();
let want = TableInfo {
ident: tb_ident_2,
desc: format!("'{}'.'{}'.'{}'", tenant, db_name, tbl_name),
desc: format!("'{}'.'{}'", db_name, tbl_name),
name: tbl_name.into(),
meta: table_meta(created_on),
tenant: tenant.to_string(),
Expand Down Expand Up @@ -2247,7 +2247,7 @@ impl SchemaApiTestSuite {
let got = mt.get_table((tenant, db1_name, tb3_name).into()).await?;
let want = TableInfo {
ident: tb_ident,
desc: format!("'{}'.'{}'.'{}'", tenant, db1_name, tb3_name),
desc: format!("'{}'.'{}'", db1_name, tb3_name),
name: tb3_name.into(),
meta: table_meta(created_on),
tenant: tenant.to_string(),
Expand Down Expand Up @@ -2383,7 +2383,7 @@ impl SchemaApiTestSuite {
let got = mt.get_table((tenant, db2_name, tb3_name).into()).await?;
let want = TableInfo {
ident: tb_ident2,
desc: format!("'{}'.'{}'.'{}'", tenant, db2_name, tb3_name),
desc: format!("'{}'.'{}'", db2_name, tb3_name),
name: tb3_name.into(),
meta: table_meta(created_on),
tenant: tenant.to_string(),
Expand Down Expand Up @@ -2465,7 +2465,7 @@ impl SchemaApiTestSuite {

let want = TableInfo {
ident,
desc: format!("'{}'.'{}'.'{}'", tenant, db_name, tbl_name),
desc: format!("'{}'.'{}'", db_name, tbl_name),
name: tbl_name.into(),
meta: table_meta(created_on),
tenant: tenant.to_string(),
Expand Down Expand Up @@ -3054,7 +3054,7 @@ impl SchemaApiTestSuite {

let want = TableInfo {
ident,
desc: format!("'{}'.'{}'.'{}'", tenant, db_name, tbl_name),
desc: format!("'{}'.'{}'", db_name, tbl_name),
name: tbl_name.into(),
meta: table_meta(created_on),
tenant: tenant.to_string(),
Expand Down Expand Up @@ -4174,9 +4174,9 @@ impl SchemaApiTestSuite {
assert_eq!(sort_drop_ids, drop_ids_1);

let expected: BTreeSet<String> = [
"'tenant1'.'db1'.'tb1'".to_string(),
"'tenant1'.'db2'.'tb1'".to_string(),
"'tenant1'.'db3'.'tb1'".to_string(),
"'db1'.'tb1'".to_string(),
"'db2'.'tb1'".to_string(),
"'db3'.'tb1'".to_string(),
]
.iter()
.cloned()
Expand Down Expand Up @@ -4206,12 +4206,12 @@ impl SchemaApiTestSuite {
assert_eq!(sort_drop_ids, drop_ids_2);

let expected: BTreeSet<String> = [
"'tenant1'.'db1'.'tb1'".to_string(),
"'tenant1'.'db2'.'tb1'".to_string(),
"'tenant1'.'db2'.'tb2'".to_string(),
"'tenant1'.'db2'.'tb3'".to_string(),
"'tenant1'.'db3'.'tb1'".to_string(),
"'tenant1'.'db3'.'tb2'".to_string(),
"'db1'.'tb1'".to_string(),
"'db2'.'tb1'".to_string(),
"'db2'.'tb2'".to_string(),
"'db2'.'tb3'".to_string(),
"'db3'.'tb1'".to_string(),
"'db3'.'tb2'".to_string(),
]
.iter()
.cloned()
Expand Down Expand Up @@ -4519,7 +4519,10 @@ impl SchemaApiTestSuite {

calc_and_compare_drop_on_table_result(res, vec![DroponInfo {
name: tbl_name.to_string(),
desc: tbl_name_ident.to_string(),
desc: format!(
"'{}'.'{}'",
tbl_name_ident.db_name, tbl_name_ident.table_name
),
drop_on_cnt: 0,
non_drop_on_cnt: 1,
}]);
Expand Down Expand Up @@ -4558,7 +4561,10 @@ impl SchemaApiTestSuite {
.await?;
calc_and_compare_drop_on_table_result(res, vec![DroponInfo {
name: tbl_name.to_string(),
desc: tbl_name_ident.to_string(),
desc: format!(
"'{}'.'{}'",
tbl_name_ident.db_name, tbl_name_ident.table_name
),
drop_on_cnt: 1,
non_drop_on_cnt: 0,
}]);
Expand All @@ -4583,7 +4589,10 @@ impl SchemaApiTestSuite {
.await?;
calc_and_compare_drop_on_table_result(res, vec![DroponInfo {
name: tbl_name.to_string(),
desc: tbl_name_ident.to_string(),
desc: format!(
"'{}'.'{}'",
tbl_name_ident.db_name, tbl_name_ident.table_name
),
drop_on_cnt: 0,
non_drop_on_cnt: 1,
}]);
Expand Down Expand Up @@ -4615,7 +4624,10 @@ impl SchemaApiTestSuite {
.await?;
calc_and_compare_drop_on_table_result(res, vec![DroponInfo {
name: tbl_name.to_string(),
desc: tbl_name_ident.to_string(),
desc: format!(
"'{}'.'{}'",
tbl_name_ident.db_name, tbl_name_ident.table_name
),
drop_on_cnt: 1,
non_drop_on_cnt: 0,
}]);
Expand Down Expand Up @@ -4645,7 +4657,10 @@ impl SchemaApiTestSuite {

calc_and_compare_drop_on_table_result(res, vec![DroponInfo {
name: tbl_name.to_string(),
desc: tbl_name_ident.to_string(),
desc: format!(
"'{}'.'{}'",
tbl_name_ident.db_name, tbl_name_ident.table_name
),
drop_on_cnt: 1,
non_drop_on_cnt: 1,
}]);
Expand Down Expand Up @@ -4675,7 +4690,10 @@ impl SchemaApiTestSuite {
.await?;
calc_and_compare_drop_on_table_result(res, vec![DroponInfo {
name: tbl_name.to_string(),
desc: tbl_name_ident.to_string(),
desc: format!(
"'{}'.'{}'",
tbl_name_ident.db_name, tbl_name_ident.table_name
),
drop_on_cnt: 2,
non_drop_on_cnt: 0,
}]);
Expand All @@ -4700,7 +4718,10 @@ impl SchemaApiTestSuite {

calc_and_compare_drop_on_table_result(res, vec![DroponInfo {
name: tbl_name.to_string(),
desc: tbl_name_ident.to_string(),
desc: format!(
"'{}'.'{}'",
tbl_name_ident.db_name, tbl_name_ident.table_name
),
drop_on_cnt: 1,
non_drop_on_cnt: 1,
}]);
Expand Down Expand Up @@ -4742,13 +4763,19 @@ impl SchemaApiTestSuite {
calc_and_compare_drop_on_table_result(res, vec![
DroponInfo {
name: tbl_name.to_string(),
desc: tbl_name_ident.to_string(),
desc: format!(
"'{}'.'{}'",
tbl_name_ident.db_name, tbl_name_ident.table_name
),
drop_on_cnt: 1,
non_drop_on_cnt: 1,
},
DroponInfo {
name: new_tbl_name.to_string(),
desc: new_tbl_name_ident.to_string(),
desc: format!(
"'{}'.'{}'",
new_tbl_name_ident.db_name, new_tbl_name_ident.table_name
),
drop_on_cnt: 0,
non_drop_on_cnt: 1,
},
Expand Down Expand Up @@ -4782,13 +4809,19 @@ impl SchemaApiTestSuite {
calc_and_compare_drop_on_table_result(res, vec![
DroponInfo {
name: tbl_name.to_string(),
desc: tbl_name_ident.to_string(),
desc: format!(
"'{}'.'{}'",
tbl_name_ident.db_name, tbl_name_ident.table_name
),
drop_on_cnt: 1,
non_drop_on_cnt: 1,
},
DroponInfo {
name: new_tbl_name.to_string(),
desc: new_tbl_name_ident.to_string(),
desc: format!(
"'{}'.'{}'",
new_tbl_name_ident.db_name, new_tbl_name_ident.table_name
),
drop_on_cnt: 1,
non_drop_on_cnt: 0,
},
Expand Down Expand Up @@ -4818,13 +4851,19 @@ impl SchemaApiTestSuite {
calc_and_compare_drop_on_table_result(res, vec![
DroponInfo {
name: tbl_name.to_string(),
desc: tbl_name_ident.to_string(),
desc: format!(
"'{}'.'{}'",
tbl_name_ident.db_name, tbl_name_ident.table_name
),
drop_on_cnt: 1,
non_drop_on_cnt: 0,
},
DroponInfo {
name: new_tbl_name.to_string(),
desc: new_tbl_name_ident.to_string(),
desc: format!(
"'{}'.'{}'",
new_tbl_name_ident.db_name, new_tbl_name_ident.table_name
),
drop_on_cnt: 1,
non_drop_on_cnt: 1,
},
Expand Down Expand Up @@ -4905,7 +4944,7 @@ impl SchemaApiTestSuite {

let want = TableInfo {
ident,
desc: format!("'{}'.'{}'.'{}'", tenant, db_name, tbl_name),
desc: format!("'{}'.'{}'", db_name, tbl_name),
name: tbl_name.into(),
meta: table_meta(created_on),
tenant: tenant.to_string(),
Expand Down

0 comments on commit ec91213

Please sign in to comment.