Skip to content

Commit

Permalink
[opt](brpc) Make the timeout of brpc checking configurable
Browse files Browse the repository at this point in the history
  • Loading branch information
mrhhsg committed Nov 23, 2024
1 parent 31d51d1 commit cee0e5b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
2 changes: 2 additions & 0 deletions be/src/common/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -554,6 +554,8 @@ DEFINE_Bool(enable_brpc_builtin_services, "true");
// Enable brpc connection check
DEFINE_Bool(enable_brpc_connection_check, "false");

DEFINE_mInt64(brpc_connection_check_timeout_ms, "1000");

// The maximum amount of data that can be processed by a stream load
DEFINE_mInt64(streaming_load_max_mb, "102400");
// Some data formats, such as JSON, cannot be streamed.
Expand Down
2 changes: 2 additions & 0 deletions be/src/common/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -1018,6 +1018,8 @@ DECLARE_Bool(enable_brpc_builtin_services);

DECLARE_Bool(enable_brpc_connection_check);

DECLARE_mInt64(brpc_connection_check_timeout_ms);

// Max waiting time to wait the "plan fragment start" rpc.
// If timeout, the fragment will be cancelled.
// This parameter is usually only used when the FE loses connection,
Expand Down
5 changes: 4 additions & 1 deletion be/src/runtime/fragment_mgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1062,12 +1062,15 @@ void FragmentMgr::_check_brpc_available(const std::shared_ptr<PBackendService_St
const std::string message = "hello doris!";
std::string error_message;
int32_t failed_count = 0;
const int64_t check_timeout_ms =
std::max<int64_t>(100, config::brpc_connection_check_timeout_ms);

while (true) {
PHandShakeRequest request;
request.set_hello(message);
PHandShakeResponse response;
brpc::Controller cntl;
cntl.set_timeout_ms(500 * (failed_count + 1));
cntl.set_timeout_ms(check_timeout_ms);
cntl.set_max_retry(10);
brpc_stub->hand_shake(&cntl, &request, &response, nullptr);

Expand Down

0 comments on commit cee0e5b

Please sign in to comment.