diff --git a/Cargo.lock b/Cargo.lock index bddd661cdc27..7247e40508f5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -9455,9 +9455,9 @@ dependencies = [ [[package]] name = "logcall" -version = "0.1.5" +version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d369db60a3256a6d47b13adcfff7ce37588d8b670bb3e334fa1cc8886cdfaa9" +checksum = "4bb377687ad730d661a29ee17ca44644d388c72f0d8a83d69a75744a6041b1c3" dependencies = [ "proc-macro-error 1.0.4", "proc-macro2", diff --git a/Cargo.toml b/Cargo.toml index a9762d4c24a6..cb0197c2fcc2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -251,7 +251,7 @@ http = "1" itertools = "0.10.5" jsonb = "0.4.0" log = { version = "0.4.21", features = ["serde", "kv_unstable_std"] } -logcall = "0.1.5" +logcall = "0.1.9" match-template = "0.0.1" minitrace = { version = "0.6.5", features = ["enable"] } minitrace-opentelemetry = "0.6.5" diff --git a/src/meta/api/src/schema_api_impl.rs b/src/meta/api/src/schema_api_impl.rs index c671fb6d35c7..c1d67dcac113 100644 --- a/src/meta/api/src/schema_api_impl.rs +++ b/src/meta/api/src/schema_api_impl.rs @@ -260,7 +260,7 @@ pub const ORPHAN_POSTFIX: &str = "orphan"; /// Thus every type that impl kvapi::KVApi impls SchemaApi. #[tonic::async_trait] impl + ?Sized> SchemaApi for KV { - #[logcall::logcall("debug")] + #[logcall::logcall] #[minitrace::trace] async fn create_database( &self, @@ -384,7 +384,7 @@ impl + ?Sized> SchemaApi for KV { } } - #[logcall::logcall("debug")] + #[logcall::logcall] #[minitrace::trace] async fn drop_database(&self, req: DropDatabaseReq) -> Result { debug!(req :? =(&req); "SchemaApi: {}", func_name!()); @@ -427,7 +427,7 @@ impl + ?Sized> SchemaApi for KV { } } - #[logcall::logcall("debug")] + #[logcall::logcall] #[minitrace::trace] async fn undrop_database( &self, @@ -531,7 +531,7 @@ impl + ?Sized> SchemaApi for KV { } } - #[logcall::logcall("debug")] + #[logcall::logcall] #[minitrace::trace] async fn rename_database( &self, @@ -673,7 +673,7 @@ impl + ?Sized> SchemaApi for KV { } } - #[logcall::logcall("debug")] + #[logcall::logcall] #[minitrace::trace] async fn get_database(&self, req: GetDatabaseReq) -> Result, KVAppError> { debug!(req :? =(&req); "SchemaApi: {}", func_name!()); @@ -695,7 +695,7 @@ impl + ?Sized> SchemaApi for KV { Ok(Arc::new(db)) } - #[logcall::logcall("debug")] + #[logcall::logcall] #[minitrace::trace] async fn get_database_history( &self, @@ -846,7 +846,7 @@ impl + ?Sized> SchemaApi for KV { return Ok(db_info_list); } - #[logcall::logcall("debug")] + #[logcall::logcall] #[minitrace::trace] async fn list_databases( &self, @@ -901,7 +901,7 @@ impl + ?Sized> SchemaApi for KV { Ok(db_infos) } - #[logcall::logcall("debug")] + #[logcall::logcall] #[minitrace::trace] async fn create_index(&self, req: CreateIndexReq) -> Result { debug!(req :? =(&req); "SchemaApi: {}", func_name!()); @@ -1007,7 +1007,7 @@ impl + ?Sized> SchemaApi for KV { } } - #[logcall::logcall("debug")] + #[logcall::logcall] #[minitrace::trace] async fn drop_index(&self, req: DropIndexReq) -> Result { debug!(req :? =(&req); "SchemaApi: {}", func_name!()); @@ -1056,7 +1056,7 @@ impl + ?Sized> SchemaApi for KV { Ok(DropIndexReply {}) } - #[logcall::logcall("debug")] + #[logcall::logcall] #[minitrace::trace] async fn get_index(&self, req: GetIndexReq) -> Result { debug!(req :? =(&req); "SchemaApi: {}", func_name!()); @@ -1095,7 +1095,7 @@ impl + ?Sized> SchemaApi for KV { }) } - #[logcall::logcall("debug")] + #[logcall::logcall] #[minitrace::trace] async fn update_index(&self, req: UpdateIndexReq) -> Result { debug!(req :? =(&req); "SchemaApi: {}", func_name!()); @@ -1122,7 +1122,7 @@ impl + ?Sized> SchemaApi for KV { } } - #[logcall::logcall("debug")] + #[logcall::logcall] #[minitrace::trace] async fn list_indexes( &self, @@ -1168,7 +1168,7 @@ impl + ?Sized> SchemaApi for KV { Ok(index_metas) } - #[logcall::logcall("debug")] + #[logcall::logcall] #[minitrace::trace] async fn list_index_ids_by_table_id( &self, @@ -1207,7 +1207,7 @@ impl + ?Sized> SchemaApi for KV { Ok(index_ids) } - #[logcall::logcall("debug")] + #[logcall::logcall] #[minitrace::trace] async fn list_indexes_by_table_id( &self, @@ -1247,6 +1247,7 @@ impl + ?Sized> SchemaApi for KV { // virtual column + #[logcall::logcall] #[minitrace::trace] async fn create_virtual_column( &self, @@ -1333,6 +1334,7 @@ impl + ?Sized> SchemaApi for KV { Ok(CreateVirtualColumnReply {}) } + #[logcall::logcall] #[minitrace::trace] async fn update_virtual_column( &self, @@ -1397,6 +1399,7 @@ impl + ?Sized> SchemaApi for KV { Ok(UpdateVirtualColumnReply {}) } + #[logcall::logcall] #[minitrace::trace] async fn drop_virtual_column( &self, @@ -1446,6 +1449,7 @@ impl + ?Sized> SchemaApi for KV { Ok(DropVirtualColumnReply {}) } + #[logcall::logcall] #[minitrace::trace] async fn list_virtual_columns( &self, @@ -1479,7 +1483,7 @@ impl + ?Sized> SchemaApi for KV { Ok(virtual_column_list) } - #[logcall::logcall("debug")] + #[logcall::logcall] #[minitrace::trace] async fn create_table(&self, req: CreateTableReq) -> Result { // Make an error if table exists. @@ -1820,14 +1824,14 @@ impl + ?Sized> SchemaApi for KV { } } - #[logcall::logcall("debug")] + #[logcall::logcall] #[minitrace::trace] async fn undrop_table(&self, req: UndropTableReq) -> Result { debug!(req :? =(&req); "SchemaApi: {}", func_name!()); handle_undrop_table(self, req).await } - #[logcall::logcall("debug")] + #[logcall::logcall] #[minitrace::trace] async fn undrop_table_by_id( &self, @@ -1837,7 +1841,7 @@ impl + ?Sized> SchemaApi for KV { handle_undrop_table(self, req).await } - #[logcall::logcall("debug")] + #[logcall::logcall] #[minitrace::trace] async fn rename_table(&self, req: RenameTableReq) -> Result { debug!(req :? =(&req); "SchemaApi: {}", func_name!()); @@ -2034,7 +2038,7 @@ impl + ?Sized> SchemaApi for KV { } } - #[logcall::logcall("debug")] + #[logcall::logcall] #[minitrace::trace] async fn get_table(&self, req: GetTableReq) -> Result, KVAppError> { debug!(req :? =(&req); "SchemaApi: {}", func_name!()); @@ -2129,7 +2133,7 @@ impl + ?Sized> SchemaApi for KV { return Ok(Arc::new(tb_info)); } - #[logcall::logcall("debug")] + #[logcall::logcall] #[minitrace::trace] async fn get_table_history( &self, @@ -2265,7 +2269,7 @@ impl + ?Sized> SchemaApi for KV { return Ok(tb_info_list); } - #[logcall::logcall("debug")] + #[logcall::logcall] #[minitrace::trace] async fn list_tables(&self, req: ListTableReq) -> Result>, KVAppError> { debug!(req :? =(&req); "SchemaApi: {}", func_name!()); @@ -2308,7 +2312,7 @@ impl + ?Sized> SchemaApi for KV { Ok(tb_infos) } - #[logcall::logcall("debug")] + #[logcall::logcall] #[minitrace::trace] async fn get_table_by_id( &self, @@ -2322,7 +2326,7 @@ impl + ?Sized> SchemaApi for KV { Ok(seq_table_meta) } - #[logcall::logcall("debug")] + #[logcall::logcall] #[minitrace::trace] async fn mget_table_names_by_ids( &self, @@ -2368,7 +2372,7 @@ impl + ?Sized> SchemaApi for KV { Ok(table_names) } - #[logcall::logcall("debug")] + #[logcall::logcall] #[minitrace::trace] async fn get_db_name_by_id(&self, db_id: u64) -> Result { debug!(req :? =(&db_id); "SchemaApi: {}", func_name!()); @@ -2389,7 +2393,7 @@ impl + ?Sized> SchemaApi for KV { Ok(db_name.unwrap().database_name().to_string()) } - #[logcall::logcall("debug")] + #[logcall::logcall] #[minitrace::trace] async fn mget_database_names_by_ids( &self, @@ -2435,7 +2439,7 @@ impl + ?Sized> SchemaApi for KV { Ok(db_names) } - #[logcall::logcall("debug")] + #[logcall::logcall] #[minitrace::trace] async fn get_table_name_by_id(&self, table_id: MetaId) -> Result, MetaError> { debug!(req :? =(&table_id); "SchemaApi: {}", func_name!()); @@ -2512,6 +2516,7 @@ impl + ?Sized> SchemaApi for KV { // make table meta visible by: // 1. move table id from orphan table id list to table id list // 2. set table meta.drop_on as None + #[logcall::logcall] #[minitrace::trace] async fn commit_table_meta( &self, @@ -2680,6 +2685,7 @@ impl + ?Sized> SchemaApi for KV { } } + #[logcall::logcall] #[minitrace::trace] async fn get_table_copied_file_info( &self, @@ -2688,9 +2694,7 @@ impl + ?Sized> SchemaApi for KV { debug!(req :? =(&req); "SchemaApi: {}", func_name!()); let table_id = req.table_id; - let tbid = TableId { table_id }; - let (tb_meta_seq, tb_meta): (_, Option) = get_pb_value(self, &tbid).await?; if tb_meta_seq == 0 { @@ -2736,7 +2740,7 @@ impl + ?Sized> SchemaApi for KV { }) } - #[logcall::logcall("debug")] + #[logcall::logcall] #[minitrace::trace] async fn truncate_table( &self, @@ -2846,7 +2850,7 @@ impl + ?Sized> SchemaApi for KV { Ok(TruncateTableReply {}) } - #[logcall::logcall("debug")] + #[logcall::logcall] #[minitrace::trace] async fn upsert_table_option( &self, @@ -2921,7 +2925,7 @@ impl + ?Sized> SchemaApi for KV { } } - #[logcall::logcall("debug")] + #[logcall::logcall] #[minitrace::trace] async fn update_table_meta( &self, @@ -3260,7 +3264,7 @@ impl + ?Sized> SchemaApi for KV { } } - #[logcall::logcall("debug")] + #[logcall::logcall] #[minitrace::trace] async fn set_table_column_mask_policy( &self, @@ -3353,7 +3357,7 @@ impl + ?Sized> SchemaApi for KV { } } - #[logcall::logcall("debug")] + #[logcall::logcall] #[minitrace::trace] async fn create_table_index( &self, @@ -3463,7 +3467,7 @@ impl + ?Sized> SchemaApi for KV { } } - #[logcall::logcall("debug")] + #[logcall::logcall] #[minitrace::trace] async fn drop_table_index( &self, @@ -3525,7 +3529,7 @@ impl + ?Sized> SchemaApi for KV { } } - #[logcall::logcall("debug")] + #[logcall::logcall] #[minitrace::trace] async fn get_drop_table_infos( &self, @@ -3748,6 +3752,7 @@ impl + ?Sized> SchemaApi for KV { Ok(reply) } + #[logcall::logcall] #[minitrace::trace] async fn create_lock_revision( &self, @@ -3818,6 +3823,7 @@ impl + ?Sized> SchemaApi for KV { Ok(CreateLockRevReply { revision }) } + #[logcall::logcall] #[minitrace::trace] async fn extend_lock_revision(&self, req: ExtendLockRevReq) -> Result<(), KVAppError> { debug!(req :? =(&req); "SchemaApi: {}", func_name!()); @@ -3881,6 +3887,7 @@ impl + ?Sized> SchemaApi for KV { Ok(()) } + #[logcall::logcall] #[minitrace::trace] async fn delete_lock_revision(&self, req: DeleteLockRevReq) -> Result<(), KVAppError> { debug!(req :? =(&req); "SchemaApi: {}", func_name!()); @@ -3928,6 +3935,7 @@ impl + ?Sized> SchemaApi for KV { Ok(()) } + #[logcall::logcall] #[minitrace::trace] async fn list_locks(&self, req: ListLocksReq) -> Result, KVAppError> { let mut reply = vec![]; @@ -3959,7 +3967,7 @@ impl + ?Sized> SchemaApi for KV { Ok(reply) } - #[logcall::logcall("debug")] + #[logcall::logcall] #[minitrace::trace] async fn create_catalog( &self, @@ -4038,7 +4046,7 @@ impl + ?Sized> SchemaApi for KV { } } - #[logcall::logcall("debug")] + #[logcall::logcall] #[minitrace::trace] async fn get_catalog(&self, req: GetCatalogReq) -> Result, KVAppError> { debug!(req :? =(&req); "SchemaApi: {}", func_name!()); @@ -4057,7 +4065,7 @@ impl + ?Sized> SchemaApi for KV { Ok(Arc::new(catalog)) } - #[logcall::logcall("debug")] + #[logcall::logcall] #[minitrace::trace] async fn drop_catalog(&self, req: DropCatalogReq) -> Result { debug!(req :? =(&req); "SchemaApi: {}", func_name!()); @@ -4133,7 +4141,7 @@ impl + ?Sized> SchemaApi for KV { Ok(DropCatalogReply {}) } - #[logcall::logcall("debug")] + #[logcall::logcall] #[minitrace::trace] async fn list_catalogs( &self, @@ -4186,6 +4194,7 @@ impl + ?Sized> SchemaApi for KV { Ok(catalog_infos) } + #[logcall::logcall] #[minitrace::trace] async fn set_table_lvt(&self, req: SetLVTReq) -> Result { debug!(req :? =(&req); "SchemaApi: {}", func_name!()); @@ -4232,6 +4241,7 @@ impl + ?Sized> SchemaApi for KV { } } + #[logcall::logcall] #[minitrace::trace] async fn get_table_lvt(&self, req: GetLVTReq) -> Result { debug!(req :? =(&req); "SchemaApi: {}", func_name!()); @@ -4934,7 +4944,7 @@ fn set_update_expire_operation( Ok(()) } -#[logcall::logcall("debug")] +#[logcall::logcall(input = "")] #[minitrace::trace] async fn batch_filter_table_info( kv_api: &(impl kvapi::KVApi + ?Sized), @@ -4996,7 +5006,7 @@ async fn batch_filter_table_info( type TableFilterInfoList<'a> = Vec<(&'a TableInfoFilter, &'a Arc, u64, String)>; -#[logcall::logcall("debug")] +#[logcall::logcall(input = "")] #[minitrace::trace] async fn get_gc_table_info( kv_api: &(impl kvapi::KVApi + ?Sized), @@ -5056,7 +5066,7 @@ async fn get_gc_table_info( Ok(filter_tb_infos) } -#[logcall::logcall("debug")] +#[logcall::logcall(input = "")] #[minitrace::trace] async fn do_get_table_history( kv_api: &(impl kvapi::KVApi + ?Sized), diff --git a/src/meta/api/src/share_api_impl.rs b/src/meta/api/src/share_api_impl.rs index 4475c0a52c44..2054cda69cf7 100644 --- a/src/meta/api/src/share_api_impl.rs +++ b/src/meta/api/src/share_api_impl.rs @@ -82,7 +82,7 @@ use crate::ShareApi; /// Thus every type that impl kvapi::KVApi impls ShareApi. #[async_trait::async_trait] impl> ShareApi for KV { - #[logcall::logcall("debug")] + #[logcall::logcall] #[minitrace::trace] async fn show_shares(&self, req: ShowSharesReq) -> Result { debug!(req :? =(&req); "ShareApi: {}", func_name!()); @@ -93,7 +93,7 @@ impl> ShareApi for KV { Ok(ShowSharesReply { outbound_accounts }) } - #[logcall::logcall("debug")] + #[logcall::logcall] #[minitrace::trace] async fn create_share(&self, req: CreateShareReq) -> Result { debug!(req :? =(&req); "ShareApi: {}", func_name!()); @@ -179,6 +179,7 @@ impl> ShareApi for KV { // iterator all the granted objects(from ShareMeta.{database|entries}), // remove share id from ObjectSharedByShareIds // drop all the databases created from the share(from ShareMeta.share_from_db_ids), + #[logcall::logcall] async fn drop_share(&self, req: DropShareReq) -> Result { debug!(req :? =(&req); "ShareApi: {}", func_name!()); @@ -306,6 +307,7 @@ impl> ShareApi for KV { } } + #[logcall::logcall] async fn add_share_tenants( &self, req: AddShareAccountsReq, @@ -414,6 +416,7 @@ impl> ShareApi for KV { } } + #[logcall::logcall] async fn remove_share_tenants( &self, req: RemoveShareAccountsReq, @@ -530,6 +533,7 @@ impl> ShareApi for KV { } } + #[logcall::logcall] async fn grant_share_object( &self, req: GrantShareObjectReq, @@ -650,6 +654,7 @@ impl> ShareApi for KV { } } + #[logcall::logcall] async fn revoke_share_object( &self, req: RevokeShareObjectReq, @@ -786,6 +791,7 @@ impl> ShareApi for KV { } } + #[logcall::logcall] async fn get_share_grant_objects( &self, req: GetShareGrantObjectReq, @@ -971,6 +977,7 @@ impl> ShareApi for KV { Ok(GetObjectGrantPrivilegesReply { privileges }) } + #[logcall::logcall] async fn create_share_endpoint( &self, req: CreateShareEndpointReq, @@ -1070,6 +1077,7 @@ impl> ShareApi for KV { } } + #[logcall::logcall] async fn upsert_share_endpoint( &self, req: UpsertShareEndpointReq, @@ -1221,6 +1229,7 @@ impl> ShareApi for KV { }) } + #[logcall::logcall] async fn drop_share_endpoint( &self, req: DropShareEndpointReq, diff --git a/src/meta/service/src/network.rs b/src/meta/service/src/network.rs index 6d0563af8052..cac8fce32b94 100644 --- a/src/meta/service/src/network.rs +++ b/src/meta/service/src/network.rs @@ -410,7 +410,7 @@ impl RaftNetwork for NetworkConnection { self.parse_grpc_resp(grpc_res) } - #[logcall::logcall(err = "debug")] + #[logcall::logcall(err = "debug", input = "")] #[minitrace::trace] async fn full_snapshot( &mut self,