gavinchou commented on code in PR #51708:
URL: https://github.com/apache/doris/pull/51708#discussion_r2164545801
##########
cloud/src/meta-service/meta_service_helper.h:
##########
@@ -226,24 +227,57 @@ inline MetaServiceCode cast_as(TxnErrorCode code) {
}
}
-#define RPC_PREPROCESS(func_name)
\
- StopWatch sw;
\
- auto ctrl = static_cast<brpc::Controller*>(controller);
\
- begin_rpc(#func_name, ctrl, request);
\
- brpc::ClosureGuard closure_guard(done);
\
- [[maybe_unused]] std::stringstream ss;
\
- [[maybe_unused]] MetaServiceCode code = MetaServiceCode::OK;
\
- [[maybe_unused]] std::string msg;
\
- [[maybe_unused]] std::string instance_id;
\
- [[maybe_unused]] bool drop_request = false;
\
- DORIS_CLOUD_DEFER {
\
- response->mutable_status()->set_code(code);
\
- response->mutable_status()->set_msg(msg);
\
- finish_rpc(#func_name, ctrl, response);
\
- closure_guard.reset(nullptr);
\
- if (config::use_detailed_metrics && !instance_id.empty() &&
!drop_request) { \
- g_bvar_ms_##func_name.put(instance_id, sw.elapsed_us());
\
- }
\
+// don't use these macro it just for defer count, reduce useless variable(some
rpc just need one of rw op)
+// If we have to write separate code for each RPC, it would be quite
troublesome
+// After all, adding put, get, and del after the RPC_PREPROCESS macro is
simpler than writing a long string of code
+#define RPCKVCOUNTHELPER(func_name, op) \
Review Comment:
is these MACROs are mandatory? they are very hard to understand
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]