Skip to content

Commit

Permalink
chore: remove empty reply struct
Browse files Browse the repository at this point in the history
  • Loading branch information
drmingdrmer committed Aug 29, 2024
1 parent 8a43c72 commit b473c21
Show file tree
Hide file tree
Showing 16 changed files with 51 additions and 127 deletions.
18 changes: 3 additions & 15 deletions src/meta/api/src/schema_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ use databend_common_meta_app::schema::CreateIndexReply;
use databend_common_meta_app::schema::CreateIndexReq;
use databend_common_meta_app::schema::CreateLockRevReply;
use databend_common_meta_app::schema::CreateLockRevReq;
use databend_common_meta_app::schema::CreateTableIndexReply;
use databend_common_meta_app::schema::CreateTableIndexReq;
use databend_common_meta_app::schema::CreateTableReply;
use databend_common_meta_app::schema::CreateTableReq;
Expand All @@ -43,14 +42,12 @@ use databend_common_meta_app::schema::DropDatabaseReq;
use databend_common_meta_app::schema::DropIndexReply;
use databend_common_meta_app::schema::DropIndexReq;
use databend_common_meta_app::schema::DropTableByIdReq;
use databend_common_meta_app::schema::DropTableIndexReply;
use databend_common_meta_app::schema::DropTableIndexReq;
use databend_common_meta_app::schema::DropTableReply;
use databend_common_meta_app::schema::DropVirtualColumnReply;
use databend_common_meta_app::schema::DropVirtualColumnReq;
use databend_common_meta_app::schema::ExtendLockRevReq;
use databend_common_meta_app::schema::GcDroppedTableReq;
use databend_common_meta_app::schema::GcDroppedTableResp;
use databend_common_meta_app::schema::GetDatabaseReq;
use databend_common_meta_app::schema::GetDictionaryReply;
use databend_common_meta_app::schema::GetIndexReply;
Expand Down Expand Up @@ -259,25 +256,16 @@ pub trait SchemaApi: Send + Sync {
req: SetTableColumnMaskPolicyReq,
) -> Result<SetTableColumnMaskPolicyReply, KVAppError>;

async fn create_table_index(
&self,
req: CreateTableIndexReq,
) -> Result<CreateTableIndexReply, KVAppError>;
async fn create_table_index(&self, req: CreateTableIndexReq) -> Result<(), KVAppError>;

async fn drop_table_index(
&self,
req: DropTableIndexReq,
) -> Result<DropTableIndexReply, KVAppError>;
async fn drop_table_index(&self, req: DropTableIndexReq) -> Result<(), KVAppError>;

async fn get_drop_table_infos(
&self,
req: ListDroppedTableReq,
) -> Result<ListDroppedTableResp, KVAppError>;

async fn gc_drop_tables(
&self,
req: GcDroppedTableReq,
) -> Result<GcDroppedTableResp, KVAppError>;
async fn gc_drop_tables(&self, req: GcDroppedTableReq) -> Result<(), KVAppError>;

async fn list_lock_revisions(
&self,
Expand Down
26 changes: 7 additions & 19 deletions src/meta/api/src/schema_api_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ use databend_common_meta_app::schema::CreateIndexReq;
use databend_common_meta_app::schema::CreateLockRevReply;
use databend_common_meta_app::schema::CreateLockRevReq;
use databend_common_meta_app::schema::CreateOption;
use databend_common_meta_app::schema::CreateTableIndexReply;
use databend_common_meta_app::schema::CreateTableIndexReq;
use databend_common_meta_app::schema::CreateTableReply;
use databend_common_meta_app::schema::CreateTableReq;
Expand All @@ -106,15 +105,13 @@ use databend_common_meta_app::schema::DropDatabaseReq;
use databend_common_meta_app::schema::DropIndexReply;
use databend_common_meta_app::schema::DropIndexReq;
use databend_common_meta_app::schema::DropTableByIdReq;
use databend_common_meta_app::schema::DropTableIndexReply;
use databend_common_meta_app::schema::DropTableIndexReq;
use databend_common_meta_app::schema::DropTableReply;
use databend_common_meta_app::schema::DropVirtualColumnReply;
use databend_common_meta_app::schema::DropVirtualColumnReq;
use databend_common_meta_app::schema::DroppedId;
use databend_common_meta_app::schema::ExtendLockRevReq;
use databend_common_meta_app::schema::GcDroppedTableReq;
use databend_common_meta_app::schema::GcDroppedTableResp;
use databend_common_meta_app::schema::GetDatabaseReq;
use databend_common_meta_app::schema::GetDictionaryReply;
use databend_common_meta_app::schema::GetIndexReply;
Expand Down Expand Up @@ -3290,10 +3287,7 @@ impl<KV: kvapi::KVApi<Error = MetaError> + ?Sized> SchemaApi for KV {

#[logcall::logcall]
#[fastrace::trace]
async fn create_table_index(
&self,
req: CreateTableIndexReq,
) -> Result<CreateTableIndexReply, KVAppError> {
async fn create_table_index(&self, req: CreateTableIndexReq) -> Result<(), KVAppError> {
debug!(req :? =(&req); "SchemaApi: {}", func_name!());

let tbid = TableId {
Expand Down Expand Up @@ -3326,7 +3320,7 @@ impl<KV: kvapi::KVApi<Error = MetaError> + ?Sized> SchemaApi for KV {
)));
}
CreateOption::CreateIfNotExists => {
return Ok(CreateTableIndexReply {});
return Ok(());
}
CreateOption::CreateOrReplace => {}
}
Expand Down Expand Up @@ -3393,17 +3387,14 @@ impl<KV: kvapi::KVApi<Error = MetaError> + ?Sized> SchemaApi for KV {
);

if succ {
return Ok(CreateTableIndexReply {});
return Ok(());
}
}
}

#[logcall::logcall]
#[fastrace::trace]
async fn drop_table_index(
&self,
req: DropTableIndexReq,
) -> Result<DropTableIndexReply, KVAppError> {
async fn drop_table_index(&self, req: DropTableIndexReq) -> Result<(), KVAppError> {
debug!(req :? =(&req); "SchemaApi: {}", func_name!());

let tbid = TableId {
Expand Down Expand Up @@ -3455,7 +3446,7 @@ impl<KV: kvapi::KVApi<Error = MetaError> + ?Sized> SchemaApi for KV {
);

if succ {
return Ok(DropTableIndexReply {});
return Ok(());
}
}
}
Expand Down Expand Up @@ -3638,10 +3629,7 @@ impl<KV: kvapi::KVApi<Error = MetaError> + ?Sized> SchemaApi for KV {
}

#[fastrace::trace]
async fn gc_drop_tables(
&self,
req: GcDroppedTableReq,
) -> Result<GcDroppedTableResp, KVAppError> {
async fn gc_drop_tables(&self, req: GcDroppedTableReq) -> Result<(), KVAppError> {
for drop_id in req.drop_ids {
match drop_id {
DroppedId::Db(db_id, db_name) => {
Expand All @@ -3652,7 +3640,7 @@ impl<KV: kvapi::KVApi<Error = MetaError> + ?Sized> SchemaApi for KV {
}
}
}
Ok(GcDroppedTableResp {})
Ok(())
}

#[fastrace::trace]
Expand Down
3 changes: 0 additions & 3 deletions src/meta/app/src/schema/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,20 +88,17 @@ pub use ownership::Ownership;
pub use sequence::*;
pub use table::CommitTableMetaReply;
pub use table::CommitTableMetaReq;
pub use table::CreateTableIndexReply;
pub use table::CreateTableIndexReq;
pub use table::CreateTableReply;
pub use table::CreateTableReq;
pub use table::DBIdTableName;
pub use table::DatabaseType;
pub use table::DropTableByIdReq;
pub use table::DropTableIndexReply;
pub use table::DropTableIndexReq;
pub use table::DropTableReply;
pub use table::DroppedId;
pub use table::EmptyProto;
pub use table::GcDroppedTableReq;
pub use table::GcDroppedTableResp;
pub use table::GetTableCopiedFileReply;
pub use table::GetTableCopiedFileReq;
pub use table::GetTableReq;
Expand Down
43 changes: 11 additions & 32 deletions src/meta/app/src/schema/table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -826,35 +826,20 @@ pub struct CreateTableIndexReq {

impl Display for CreateTableIndexReq {
fn fmt(&self, f: &mut Formatter) -> std::fmt::Result {
match self.create_option {
CreateOption::Create => {
write!(
f,
"create_table_index: {} ColumnIds: {:?}, SyncCreation: {:?}, Options: {:?}",
self.name, self.column_ids, self.sync_creation, self.options,
)
}
CreateOption::CreateIfNotExists => {
write!(
f,
"create_table_index_if_not_exists: {} ColumnIds: {:?}, SyncCreation: {:?}, Options: {:?}",
self.name, self.column_ids, self.sync_creation, self.options,
)
}
CreateOption::CreateOrReplace => {
write!(
f,
"create_or_replace_table_index: {} ColumnIds: {:?}, SyncCreation: {:?}, Options: {:?}",
self.name, self.column_ids, self.sync_creation, self.options,
)
}
}
let typ = match self.create_option {
CreateOption::Create => "create_table_index",
CreateOption::CreateIfNotExists => "create_table_index_if_not_exists",
CreateOption::CreateOrReplace => "create_or_replace_table_index",
};

write!(
f,
"{}: {} ColumnIds: {:?}, SyncCreation: {:?}, Options: {:?}",
typ, self.name, self.column_ids, self.sync_creation, self.options,
)
}
}

#[derive(Clone, Debug, Eq, PartialEq)]
pub struct CreateTableIndexReply {}

#[derive(Clone, Debug, PartialEq, Eq)]
pub struct DropTableIndexReq {
pub if_exists: bool,
Expand All @@ -872,9 +857,6 @@ impl Display for DropTableIndexReq {
}
}

#[derive(Clone, Debug, PartialEq, Eq)]
pub struct DropTableIndexReply {}

#[derive(Clone, Debug, PartialEq, Eq)]
pub struct GetTableReq {
pub inner: TableNameIdent,
Expand Down Expand Up @@ -967,9 +949,6 @@ pub struct GcDroppedTableReq {
pub drop_ids: Vec<DroppedId>,
}

#[derive(Clone, Debug, PartialEq, Eq)]
pub struct GcDroppedTableResp {}

#[derive(Clone, Debug, Default, Eq, PartialEq)]
pub struct TableIdToName {
pub table_id: u64,
Expand Down
9 changes: 3 additions & 6 deletions src/query/catalog/src/catalog/interface.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ use databend_common_meta_app::schema::CreateLockRevReply;
use databend_common_meta_app::schema::CreateLockRevReq;
use databend_common_meta_app::schema::CreateSequenceReply;
use databend_common_meta_app::schema::CreateSequenceReq;
use databend_common_meta_app::schema::CreateTableIndexReply;
use databend_common_meta_app::schema::CreateTableIndexReq;
use databend_common_meta_app::schema::CreateTableReply;
use databend_common_meta_app::schema::CreateTableReq;
Expand All @@ -49,15 +48,13 @@ use databend_common_meta_app::schema::DropIndexReq;
use databend_common_meta_app::schema::DropSequenceReply;
use databend_common_meta_app::schema::DropSequenceReq;
use databend_common_meta_app::schema::DropTableByIdReq;
use databend_common_meta_app::schema::DropTableIndexReply;
use databend_common_meta_app::schema::DropTableIndexReq;
use databend_common_meta_app::schema::DropTableReply;
use databend_common_meta_app::schema::DropVirtualColumnReply;
use databend_common_meta_app::schema::DropVirtualColumnReq;
use databend_common_meta_app::schema::DroppedId;
use databend_common_meta_app::schema::ExtendLockRevReq;
use databend_common_meta_app::schema::GcDroppedTableReq;
use databend_common_meta_app::schema::GcDroppedTableResp;
use databend_common_meta_app::schema::GetDictionaryReply;
use databend_common_meta_app::schema::GetIndexReply;
use databend_common_meta_app::schema::GetIndexReq;
Expand Down Expand Up @@ -273,7 +270,7 @@ pub trait Catalog: DynClone + Send + Sync + Debug {
))
}

async fn gc_drop_tables(&self, _req: GcDroppedTableReq) -> Result<GcDroppedTableResp> {
async fn gc_drop_tables(&self, _req: GcDroppedTableReq) -> Result<()> {
Err(ErrorCode::Unimplemented("'gc_drop_tables' not implemented"))
}

Expand Down Expand Up @@ -414,9 +411,9 @@ pub trait Catalog: DynClone + Send + Sync + Debug {
req: SetTableColumnMaskPolicyReq,
) -> Result<SetTableColumnMaskPolicyReply>;

async fn create_table_index(&self, req: CreateTableIndexReq) -> Result<CreateTableIndexReply>;
async fn create_table_index(&self, req: CreateTableIndexReq) -> Result<()>;

async fn drop_table_index(&self, req: DropTableIndexReq) -> Result<DropTableIndexReply>;
async fn drop_table_index(&self, req: DropTableIndexReq) -> Result<()>;

async fn get_table_copied_file_info(
&self,
Expand Down
6 changes: 2 additions & 4 deletions src/query/ee/src/inverted_index/inverted_index_handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@ use std::sync::Arc;
use databend_common_base::base::GlobalInstance;
use databend_common_catalog::catalog::Catalog;
use databend_common_exception::Result;
use databend_common_meta_app::schema::CreateTableIndexReply;
use databend_common_meta_app::schema::CreateTableIndexReq;
use databend_common_meta_app::schema::DropTableIndexReply;
use databend_common_meta_app::schema::DropTableIndexReq;
use databend_enterprise_inverted_index::InvertedIndexHandler;
use databend_enterprise_inverted_index::InvertedIndexHandlerWrapper;
Expand All @@ -33,7 +31,7 @@ impl InvertedIndexHandler for RealInvertedIndexHandler {
&self,
catalog: Arc<dyn Catalog>,
req: CreateTableIndexReq,
) -> Result<CreateTableIndexReply> {
) -> Result<()> {
catalog.create_table_index(req).await
}

Expand All @@ -42,7 +40,7 @@ impl InvertedIndexHandler for RealInvertedIndexHandler {
&self,
catalog: Arc<dyn Catalog>,
req: DropTableIndexReq,
) -> Result<DropTableIndexReply> {
) -> Result<()> {
catalog.drop_table_index(req).await
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@ use std::sync::Arc;
use databend_common_base::base::GlobalInstance;
use databend_common_catalog::catalog::Catalog;
use databend_common_exception::Result;
use databend_common_meta_app::schema::CreateTableIndexReply;
use databend_common_meta_app::schema::CreateTableIndexReq;
use databend_common_meta_app::schema::DropTableIndexReply;
use databend_common_meta_app::schema::DropTableIndexReq;

#[async_trait::async_trait]
Expand All @@ -28,13 +26,13 @@ pub trait InvertedIndexHandler: Sync + Send {
&self,
catalog: Arc<dyn Catalog>,
req: CreateTableIndexReq,
) -> Result<CreateTableIndexReply>;
) -> Result<()>;

async fn do_drop_table_index(
&self,
catalog: Arc<dyn Catalog>,
req: DropTableIndexReq,
) -> Result<DropTableIndexReply>;
) -> Result<()>;
}

pub struct InvertedIndexHandlerWrapper {
Expand All @@ -51,7 +49,7 @@ impl InvertedIndexHandlerWrapper {
&self,
catalog: Arc<dyn Catalog>,
req: CreateTableIndexReq,
) -> Result<CreateTableIndexReply> {
) -> Result<()> {
self.handler.do_create_table_index(catalog, req).await
}

Expand All @@ -60,7 +58,7 @@ impl InvertedIndexHandlerWrapper {
&self,
catalog: Arc<dyn Catalog>,
req: DropTableIndexReq,
) -> Result<DropTableIndexReply> {
) -> Result<()> {
self.handler.do_drop_table_index(catalog, req).await
}
}
Expand Down
9 changes: 3 additions & 6 deletions src/query/service/src/catalogs/default/database_catalog.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ use databend_common_meta_app::schema::CreateLockRevReply;
use databend_common_meta_app::schema::CreateLockRevReq;
use databend_common_meta_app::schema::CreateSequenceReply;
use databend_common_meta_app::schema::CreateSequenceReq;
use databend_common_meta_app::schema::CreateTableIndexReply;
use databend_common_meta_app::schema::CreateTableIndexReq;
use databend_common_meta_app::schema::CreateTableReply;
use databend_common_meta_app::schema::CreateTableReq;
Expand All @@ -54,15 +53,13 @@ use databend_common_meta_app::schema::DropIndexReq;
use databend_common_meta_app::schema::DropSequenceReply;
use databend_common_meta_app::schema::DropSequenceReq;
use databend_common_meta_app::schema::DropTableByIdReq;
use databend_common_meta_app::schema::DropTableIndexReply;
use databend_common_meta_app::schema::DropTableIndexReq;
use databend_common_meta_app::schema::DropTableReply;
use databend_common_meta_app::schema::DropVirtualColumnReply;
use databend_common_meta_app::schema::DropVirtualColumnReq;
use databend_common_meta_app::schema::DroppedId;
use databend_common_meta_app::schema::ExtendLockRevReq;
use databend_common_meta_app::schema::GcDroppedTableReq;
use databend_common_meta_app::schema::GcDroppedTableResp;
use databend_common_meta_app::schema::GetDictionaryReply;
use databend_common_meta_app::schema::GetIndexReply;
use databend_common_meta_app::schema::GetIndexReq;
Expand Down Expand Up @@ -534,12 +531,12 @@ impl Catalog for DatabaseCatalog {
}

#[async_backtrace::framed]
async fn create_table_index(&self, req: CreateTableIndexReq) -> Result<CreateTableIndexReply> {
async fn create_table_index(&self, req: CreateTableIndexReq) -> Result<()> {
self.mutable_catalog.create_table_index(req).await
}

#[async_backtrace::framed]
async fn drop_table_index(&self, req: DropTableIndexReq) -> Result<DropTableIndexReply> {
async fn drop_table_index(&self, req: DropTableIndexReq) -> Result<()> {
self.mutable_catalog.drop_table_index(req).await
}

Expand Down Expand Up @@ -721,7 +718,7 @@ impl Catalog for DatabaseCatalog {
self.mutable_catalog.get_drop_table_infos(req).await
}

async fn gc_drop_tables(&self, req: GcDroppedTableReq) -> Result<GcDroppedTableResp> {
async fn gc_drop_tables(&self, req: GcDroppedTableReq) -> Result<()> {
self.mutable_catalog.gc_drop_tables(req).await
}

Expand Down
Loading

0 comments on commit b473c21

Please sign in to comment.