diff --git a/be/src/util/ref_count_closure.h b/be/src/util/ref_count_closure.h index 14a136fcfd..7bbcfb7da3 100644 --- a/be/src/util/ref_count_closure.h +++ b/be/src/util/ref_count_closure.h @@ -68,6 +68,19 @@ public: // std::unique_ptr a(b); // brpc_call(a.release()); +template +concept HasStatus = requires(T* response) { response->status(); }; + +template +void process_status(Response* response) {} + +template +void process_status(Response* response) { + if (auto status = Status::create(response->status()); !status) { + LOG(WARNING) << "RPC meet error status: " << status; + } +} + template class AutoReleaseClosure : public google::protobuf::Closure { using Weak = typename std::shared_ptr::weak_type; @@ -91,6 +104,11 @@ public: if (auto tmp = callback_.lock()) { tmp->call(); } + if (cntl_->Failed()) { + LOG(WARNING) << "RPC meet failed: " << cntl_->ErrorText(); + } else { + process_status(response_.get()); + } } // controller has to be the same lifecycle with the closure, because brpc may use