Skip to content

Commit

Permalink
[bugfix](brpc) Should use status to generate protobuf message, becaus…
Browse files Browse the repository at this point in the history
…e it will encoding Backend Info
  • Loading branch information
Doris-Extras committed Oct 1, 2024
1 parent f9bd4ef commit c3a0796
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions be/src/service/internal_service.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,18 +41,20 @@ class RuntimeState;
template <typename T>
concept CanCancel = requires(T* response) { response->mutable_status(); };

template <typename T>
void offer_failed(T* response, google::protobuf::Closure* done, const FifoThreadPool& pool) {
brpc::ClosureGuard closure_guard(done);
LOG(WARNING) << "fail to offer request to the work pool, pool=" << pool.get_info();
}
//template <typename T>
//void offer_failed(T* response, google::protobuf::Closure* done, const FifoThreadPool& pool) {
// brpc::ClosureGuard closure_guard(done);
// LOG(WARNING) << "fail to offer request to the work pool, pool=" << pool.get_info();
//}

template <CanCancel T>
void offer_failed(T* response, google::protobuf::Closure* done, const FifoThreadPool& pool) {
brpc::ClosureGuard closure_guard(done);
response->mutable_status()->set_status_code(TStatusCode::CANCELLED);
response->mutable_status()->add_error_msgs("fail to offer request to the work pool, pool=" +
pool.get_info());
// Should use status to generate protobuf message, because it will encoding Backend Info
// into the error message and then we could know which backend's pool is full.
Status st = Status::Error<TStatusCode::CANCELLED>(
"fail to offer request to the work pool, pool={}", pool.get_info());
st.to_protobuf(response->mutable_status());
LOG(WARNING) << "cancelled due to fail to offer request to the work pool, pool="
<< pool.get_info();
}
Expand Down

0 comments on commit c3a0796

Please sign in to comment.