From 6ce02086a1775170e2c4d5d525f8f478ce478ffd Mon Sep 17 00:00:00 2001 From: Jerry Hu Date: Tue, 26 Nov 2024 12:34:55 +0800 Subject: [PATCH] [opt](brpc) Make the timeout of brpc checking configurable (#44481) --- be/src/common/config.cpp | 2 ++ be/src/common/config.h | 2 ++ be/src/runtime/fragment_mgr.cpp | 5 ++++- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/be/src/common/config.cpp b/be/src/common/config.cpp index 0cffa30cdca443..63989a76261bb6 100644 --- a/be/src/common/config.cpp +++ b/be/src/common/config.cpp @@ -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, "10000"); + // 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. diff --git a/be/src/common/config.h b/be/src/common/config.h index caee1f320c103e..29e55e6406390e 100644 --- a/be/src/common/config.h +++ b/be/src/common/config.h @@ -1016,6 +1016,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, diff --git a/be/src/runtime/fragment_mgr.cpp b/be/src/runtime/fragment_mgr.cpp index 47b007edf5dc9b..1e72fa756d3dd3 100644 --- a/be/src/runtime/fragment_mgr.cpp +++ b/be/src/runtime/fragment_mgr.cpp @@ -1062,12 +1062,15 @@ void FragmentMgr::_check_brpc_available(const std::shared_ptr(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);