File tree Expand file tree Collapse file tree 10 files changed +20
-39
lines changed
tests/it/storages/fuse/operations Expand file tree Collapse file tree 10 files changed +20
-39
lines changed Original file line number Diff line number Diff line change @@ -21,7 +21,6 @@ use common_meta_app::schema::CountTablesReq;
2121use common_meta_app:: schema:: CreateDatabaseReply ;
2222use common_meta_app:: schema:: CreateDatabaseReq ;
2323use common_meta_app:: schema:: CreateTableReq ;
24- use common_meta_app:: schema:: DatabaseType ;
2524use common_meta_app:: schema:: DropDatabaseReq ;
2625use common_meta_app:: schema:: DropTableReply ;
2726use common_meta_app:: schema:: DropTableReq ;
@@ -143,8 +142,7 @@ pub trait Catalog: DynClone + Send + Sync {
143142
144143 async fn update_table_meta (
145144 & self ,
146- tenant : & str ,
147- db_type : DatabaseType ,
145+ table_info : & TableInfo ,
148146 req : UpdateTableMetaReq ,
149147 ) -> Result < UpdateTableMetaReply > ;
150148
Original file line number Diff line number Diff line change @@ -23,7 +23,6 @@ use common_meta_app::schema::CountTablesReq;
2323use common_meta_app:: schema:: CreateDatabaseReply ;
2424use common_meta_app:: schema:: CreateDatabaseReq ;
2525use common_meta_app:: schema:: CreateTableReq ;
26- use common_meta_app:: schema:: DatabaseType ;
2726use common_meta_app:: schema:: DropDatabaseReq ;
2827use common_meta_app:: schema:: DropTableReply ;
2928use common_meta_app:: schema:: DropTableReq ;
@@ -462,12 +461,11 @@ impl Catalog for DatabaseCatalog {
462461
463462 async fn update_table_meta (
464463 & self ,
465- tenant : & str ,
466- db_type : DatabaseType ,
464+ table_info : & TableInfo ,
467465 req : UpdateTableMetaReq ,
468466 ) -> Result < UpdateTableMetaReply > {
469467 self . mutable_catalog
470- . update_table_meta ( tenant , db_type , req)
468+ . update_table_meta ( table_info , req)
471469 . await
472470 }
473471
Original file line number Diff line number Diff line change @@ -23,7 +23,6 @@ use common_meta_app::schema::CountTablesReq;
2323use common_meta_app:: schema:: CreateDatabaseReply ;
2424use common_meta_app:: schema:: CreateDatabaseReq ;
2525use common_meta_app:: schema:: CreateTableReq ;
26- use common_meta_app:: schema:: DatabaseType ;
2726use common_meta_app:: schema:: DropDatabaseReq ;
2827use common_meta_app:: schema:: DropTableReply ;
2928use common_meta_app:: schema:: DropTableReq ;
@@ -249,8 +248,7 @@ impl Catalog for ImmutableCatalog {
249248
250249 async fn update_table_meta (
251250 & self ,
252- _tenant : & str ,
253- _db_type : DatabaseType ,
251+ _table_info : & TableInfo ,
254252 req : UpdateTableMetaReq ,
255253 ) -> Result < UpdateTableMetaReply > {
256254 Err ( ErrorCode :: Unimplemented ( format ! (
Original file line number Diff line number Diff line change @@ -282,14 +282,15 @@ impl Catalog for MutableCatalog {
282282
283283 async fn update_table_meta (
284284 & self ,
285- tenant : & str ,
286- db_type : DatabaseType ,
285+ table_info : & TableInfo ,
287286 req : UpdateTableMetaReq ,
288287 ) -> Result < UpdateTableMetaReply > {
289- match db_type {
288+ match table_info . db_type . clone ( ) {
290289 DatabaseType :: NormalDB => Ok ( self . ctx . meta . update_table_meta ( req) . await ?) ,
291290 DatabaseType :: ShareDB ( share_ident) => {
292- let db = self . get_database ( tenant, & share_ident. share_name ) . await ?;
291+ let db = self
292+ . get_database ( & share_ident. tenant , & share_ident. share_name )
293+ . await ?;
293294 db. update_table_meta ( req) . await
294295 }
295296 }
Original file line number Diff line number Diff line change @@ -38,7 +38,6 @@ use common_meta_app::schema::CountTablesReq;
3838use common_meta_app:: schema:: CreateDatabaseReply ;
3939use common_meta_app:: schema:: CreateDatabaseReq ;
4040use common_meta_app:: schema:: CreateTableReq ;
41- use common_meta_app:: schema:: DatabaseType ;
4241use common_meta_app:: schema:: DropDatabaseReq ;
4342use common_meta_app:: schema:: DropTableReply ;
4443use common_meta_app:: schema:: DropTableReq ;
@@ -544,14 +543,13 @@ impl Catalog for FakedCatalog {
544543
545544 async fn update_table_meta (
546545 & self ,
547- tenant : & str ,
548- db_type : DatabaseType ,
546+ table_info : & TableInfo ,
549547 req : UpdateTableMetaReq ,
550548 ) -> Result < UpdateTableMetaReply > {
551549 if let Some ( e) = & self . error_injection {
552550 Err ( e. clone ( ) )
553551 } else {
554- self . cat . update_table_meta ( tenant , db_type , req) . await
552+ self . cat . update_table_meta ( table_info , req) . await
555553 }
556554 }
557555
Original file line number Diff line number Diff line change @@ -100,7 +100,7 @@ impl FuseTable {
100100 DatabaseType :: ShareDB ( share_ident) => create_share_table_operator (
101101 ShareTableConfig :: share_endpoint_address ( ) ,
102102 ShareTableConfig :: share_endpoint_token ( ) ,
103- & share_ident. share_name ,
103+ & share_ident. tenant ,
104104 & share_ident. share_name ,
105105 & table_info. name ,
106106 ) ,
Original file line number Diff line number Diff line change @@ -354,10 +354,7 @@ impl FuseTable {
354354 } ;
355355
356356 // 3. let's roll
357- let tenant = ctx. get_tenant ( ) ;
358- let reply = catalog
359- . update_table_meta ( & tenant, table_info. db_type . clone ( ) , req)
360- . await ;
357+ let reply = catalog. update_table_meta ( table_info, req) . await ;
361358 match reply {
362359 Ok ( _) => {
363360 if let Some ( snapshot_cache) = CacheManager :: instance ( ) . get_table_snapshot_cache ( ) {
Original file line number Diff line number Diff line change @@ -53,10 +53,7 @@ impl FuseTable {
5353 } ;
5454
5555 // 4. let's roll
56- let tenant = ctx. get_tenant ( ) ;
57- let reply = catalog
58- . update_table_meta ( & tenant, self . table_info . db_type . clone ( ) , req)
59- . await ;
56+ let reply = catalog. update_table_meta ( & self . table_info , req) . await ;
6057 if reply. is_ok ( ) {
6158 // try keep the snapshot hit
6259 let snapshot_location = table_reverting_to. snapshot_loc ( ) . await ?. ok_or_else ( || {
Original file line number Diff line number Diff line change @@ -72,15 +72,11 @@ impl FuseTable {
7272 let db_name = ctx. get_current_database ( ) ;
7373
7474 catalog
75- . update_table_meta (
76- & tenant,
77- self . table_info . db_type . clone ( ) ,
78- UpdateTableMetaReq {
79- table_id,
80- seq : MatchSeq :: Exact ( table_version) ,
81- new_table_meta,
82- } ,
83- )
75+ . update_table_meta ( & self . table_info , UpdateTableMetaReq {
76+ table_id,
77+ seq : MatchSeq :: Exact ( table_version) ,
78+ new_table_meta,
79+ } )
8480 . await ?;
8581
8682 catalog
Original file line number Diff line number Diff line change @@ -32,7 +32,6 @@ use common_meta_app::schema::CountTablesReq;
3232use common_meta_app:: schema:: CreateDatabaseReply ;
3333use common_meta_app:: schema:: CreateDatabaseReq ;
3434use common_meta_app:: schema:: CreateTableReq ;
35- use common_meta_app:: schema:: DatabaseType ;
3635use common_meta_app:: schema:: DropDatabaseReq ;
3736use common_meta_app:: schema:: DropTableReply ;
3837use common_meta_app:: schema:: DropTableReq ;
@@ -360,8 +359,7 @@ impl Catalog for HiveCatalog {
360359
361360 async fn update_table_meta (
362361 & self ,
363- _tenant : & str ,
364- _db_type : DatabaseType ,
362+ _table_info : & TableInfo ,
365363 _req : UpdateTableMetaReq ,
366364 ) -> Result < UpdateTableMetaReply > {
367365 Err ( ErrorCode :: Unimplemented (
You can’t perform that action at this time.
0 commit comments