Skip to content

Commit b653a72

Browse files
committed
fix reviewer's suggestions
1 parent bf5f95c commit b653a72

File tree

10 files changed

+20
-39
lines changed

10 files changed

+20
-39
lines changed

src/query/catalog/src/catalog/interface.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ use common_meta_app::schema::CountTablesReq;
2121
use common_meta_app::schema::CreateDatabaseReply;
2222
use common_meta_app::schema::CreateDatabaseReq;
2323
use common_meta_app::schema::CreateTableReq;
24-
use common_meta_app::schema::DatabaseType;
2524
use common_meta_app::schema::DropDatabaseReq;
2625
use common_meta_app::schema::DropTableReply;
2726
use 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

src/query/service/src/catalogs/default/database_catalog.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ use common_meta_app::schema::CountTablesReq;
2323
use common_meta_app::schema::CreateDatabaseReply;
2424
use common_meta_app::schema::CreateDatabaseReq;
2525
use common_meta_app::schema::CreateTableReq;
26-
use common_meta_app::schema::DatabaseType;
2726
use common_meta_app::schema::DropDatabaseReq;
2827
use common_meta_app::schema::DropTableReply;
2928
use 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

src/query/service/src/catalogs/default/immutable_catalog.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ use common_meta_app::schema::CountTablesReq;
2323
use common_meta_app::schema::CreateDatabaseReply;
2424
use common_meta_app::schema::CreateDatabaseReq;
2525
use common_meta_app::schema::CreateTableReq;
26-
use common_meta_app::schema::DatabaseType;
2726
use common_meta_app::schema::DropDatabaseReq;
2827
use common_meta_app::schema::DropTableReply;
2928
use 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!(

src/query/service/src/catalogs/default/mutable_catalog.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff 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
}

src/query/service/tests/it/storages/fuse/operations/commit.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ use common_meta_app::schema::CountTablesReq;
3838
use common_meta_app::schema::CreateDatabaseReply;
3939
use common_meta_app::schema::CreateDatabaseReq;
4040
use common_meta_app::schema::CreateTableReq;
41-
use common_meta_app::schema::DatabaseType;
4241
use common_meta_app::schema::DropDatabaseReq;
4342
use common_meta_app::schema::DropTableReply;
4443
use 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

src/query/storages/fuse/fuse/src/fuse_table.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff 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
),

src/query/storages/fuse/fuse/src/operations/commit.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff 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() {

src/query/storages/fuse/fuse/src/operations/revert.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff 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(|| {

src/query/storages/fuse/fuse/src/operations/truncate.rs

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff 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

src/query/storages/hive/hive/src/hive_catalog.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ use common_meta_app::schema::CountTablesReq;
3232
use common_meta_app::schema::CreateDatabaseReply;
3333
use common_meta_app::schema::CreateDatabaseReq;
3434
use common_meta_app::schema::CreateTableReq;
35-
use common_meta_app::schema::DatabaseType;
3635
use common_meta_app::schema::DropDatabaseReq;
3736
use common_meta_app::schema::DropTableReply;
3837
use 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(

0 commit comments

Comments
 (0)