@@ -33,6 +33,7 @@ use common_meta_app::schema::DatabaseIdent;
3333use common_meta_app:: schema:: DatabaseInfo ;
3434use common_meta_app:: schema:: DatabaseMeta ;
3535use common_meta_app:: schema:: DatabaseNameIdent ;
36+ use common_meta_app:: schema:: DatabaseType ;
3637use common_meta_app:: schema:: DbIdList ;
3738use common_meta_app:: schema:: DbIdListKey ;
3839use common_meta_app:: schema:: DropDatabaseReply ;
@@ -1602,6 +1603,11 @@ impl<KV: KVApi> SchemaApi for KV {
16021603 "get_table"
16031604 ) ;
16041605
1606+ let db_type = match db_meta. from_share {
1607+ Some ( share_ident) => DatabaseType :: ShareDB ( share_ident) ,
1608+ None => DatabaseType :: NormalDB ,
1609+ } ;
1610+
16051611 let tb_info = TableInfo {
16061612 ident : TableIdent {
16071613 table_id : tbid. table_id ,
@@ -1612,7 +1618,7 @@ impl<KV: KVApi> SchemaApi for KV {
16121618 // Safe unwrap() because: tb_meta_seq > 0
16131619 meta : tb_meta. unwrap ( ) ,
16141620 tenant : req. tenant . clone ( ) ,
1615- from_share : db_meta . from_share . clone ( ) ,
1621+ db_type ,
16161622 } ;
16171623
16181624 return Ok ( Arc :: new ( tb_info) ) ;
@@ -1698,6 +1704,11 @@ impl<KV: KVApi> SchemaApi for KV {
16981704 table_name : table_id_list_key. table_name . clone ( ) ,
16991705 } ;
17001706
1707+ let db_type = match db_meta. from_share . clone ( ) {
1708+ Some ( share_ident) => DatabaseType :: ShareDB ( share_ident) ,
1709+ None => DatabaseType :: NormalDB ,
1710+ } ;
1711+
17011712 let tb_info = TableInfo {
17021713 ident : TableIdent {
17031714 table_id : * table_id,
@@ -1707,7 +1718,7 @@ impl<KV: KVApi> SchemaApi for KV {
17071718 name : table_id_list_key. table_name . clone ( ) ,
17081719 meta : tb_meta,
17091720 tenant : tenant_dbname. tenant . clone ( ) ,
1710- from_share : db_meta . from_share . clone ( ) ,
1721+ db_type ,
17111722 } ;
17121723
17131724 tb_info_list. push ( Arc :: new ( tb_info) ) ;
@@ -2633,7 +2644,7 @@ async fn get_tableinfos_by_ids(
26332644 ids : & [ u64 ] ,
26342645 tenant_dbname : & DatabaseNameIdent ,
26352646 dbid_tbnames_opt : Option < Vec < DBIdTableName > > ,
2636- share_name : Option < ShareNameIdent > ,
2647+ db_type : DatabaseType ,
26372648) -> Result < Vec < Arc < TableInfo > > , KVAppError > {
26382649 let mut tb_meta_keys = Vec :: with_capacity ( ids. len ( ) ) ;
26392650 for id in ids. iter ( ) {
@@ -2671,7 +2682,7 @@ async fn get_tableinfos_by_ids(
26712682 meta : tb_meta,
26722683 name : tbnames[ i] . clone ( ) ,
26732684 tenant : tenant_dbname. tenant . clone ( ) ,
2674- from_share : share_name . clone ( ) ,
2685+ db_type : db_type . clone ( ) ,
26752686 } ;
26762687 tb_infos. push ( Arc :: new ( tb_info) ) ;
26772688 } else {
@@ -2700,7 +2711,14 @@ async fn list_tables_from_unshare_db(
27002711
27012712 let ( dbid_tbnames, ids) = list_u64_value ( kv_api, & dbid_tbname) . await ?;
27022713
2703- get_tableinfos_by_ids ( kv_api, & ids, tenant_dbname, Some ( dbid_tbnames) , None ) . await
2714+ get_tableinfos_by_ids (
2715+ kv_api,
2716+ & ids,
2717+ tenant_dbname,
2718+ Some ( dbid_tbnames) ,
2719+ DatabaseType :: NormalDB ,
2720+ )
2721+ . await
27042722}
27052723
27062724async fn list_tables_from_share_db (
@@ -2739,5 +2757,12 @@ async fn list_tables_from_share_db(
27392757 ids. push ( table_id) ;
27402758 }
27412759 }
2742- get_tableinfos_by_ids ( kv_api, & ids, tenant_dbname, None , Some ( share) ) . await
2760+ get_tableinfos_by_ids (
2761+ kv_api,
2762+ & ids,
2763+ tenant_dbname,
2764+ None ,
2765+ DatabaseType :: ShareDB ( share) ,
2766+ )
2767+ . await
27432768}
0 commit comments