This is an automated email from the ASF dual-hosted git repository.

yiguolei pushed a commit to branch branch-4.0
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/branch-4.0 by this push:
     new 43460b2eaba branch-4.0: [Chore](thrift) add reopen thrift connection 
on RuntimeQueryStatisticsMgr::report_runtime_query_statistics #56744 (#56776)
43460b2eaba is described below

commit 43460b2eaba4ab5cfd837ca01d489b7f02300a41
Author: github-actions[bot] 
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Sat Oct 11 16:25:30 2025 +0800

    branch-4.0: [Chore](thrift) add reopen thrift connection on 
RuntimeQueryStatisticsMgr::report_runtime_query_statistics #56744 (#56776)
    
    Cherry-picked from #56744
    
    Co-authored-by: Pxl <[email protected]>
---
 be/src/runtime/runtime_query_statistics_mgr.cpp | 35 +++++++++++++++----------
 1 file changed, 21 insertions(+), 14 deletions(-)

diff --git a/be/src/runtime/runtime_query_statistics_mgr.cpp 
b/be/src/runtime/runtime_query_statistics_mgr.cpp
index f8f6361e09f..e1f97b8cdc0 100644
--- a/be/src/runtime/runtime_query_statistics_mgr.cpp
+++ b/be/src/runtime/runtime_query_statistics_mgr.cpp
@@ -397,6 +397,13 @@ void 
RuntimeQueryStatisticsMgr::report_runtime_query_statistics() {
             continue;
         }
 
+        auto reopen_coord = [&coord]() -> Status {
+            std::this_thread::sleep_for(
+                    
std::chrono::milliseconds(config::thrift_client_retry_interval_ms * 2));
+            // just reopen to disable this connection
+            return coord.reopen(config::thrift_rpc_timeout_ms);
+        };
+
         // 2.2 send report
         TReportWorkloadRuntimeStatusParams report_runtime_params;
         report_runtime_params.__set_backend_id(be_id);
@@ -413,44 +420,44 @@ void 
RuntimeQueryStatisticsMgr::report_runtime_query_statistics() {
                 coord->reportExecStatus(res, params);
                 rpc_result[addr] = true;
             } catch (apache::thrift::transport::TTransportException& e) {
+                rpc_status = reopen_coord();
 #ifndef ADDRESS_SANITIZER
                 LOG_WARNING(
                         "[report_query_statistics] report to fe {} failed, 
reason:{}, try reopen.",
                         add_str, e.what());
-                rpc_status = coord.reopen(config::thrift_rpc_timeout_ms);
-                if (!rpc_status.ok()) {
-                    LOG_WARNING(
-                            "[report_query_statistics]reopen thrift client 
failed when report "
-                            "workload runtime statistics to {}, reason: {}",
-                            add_str, rpc_status.to_string());
-                } else {
-                    coord->reportExecStatus(res, params);
-                    rpc_result[addr] = true;
-                }
 #else
                 std::cerr << "thrift error, reason=" << e.what();
 #endif
+                if (rpc_status.ok()) {
+                    coord->reportExecStatus(res, params);
+                    rpc_result[addr] = true;
+                }
             }
         } catch (apache::thrift::TApplicationException& e) {
             LOG_WARNING(
                     "[report_query_statistics]fe {} throw exception when 
report statistics, "
                     "reason:{}, you can see fe log for details.",
                     add_str, e.what());
+            rpc_status = reopen_coord();
         } catch (apache::thrift::TException& e) {
             LOG_WARNING(
                     "[report_query_statistics]report workload runtime 
statistics to {} failed,  "
                     "reason: {}",
                     add_str, e.what());
-            std::this_thread::sleep_for(
-                    
std::chrono::milliseconds(config::thrift_client_retry_interval_ms * 2));
-            // just reopen to disable this connection
-            static_cast<void>(coord.reopen(config::thrift_rpc_timeout_ms));
+            rpc_status = reopen_coord();
         } catch (std::exception& e) {
             LOG_WARNING(
                     "[report_query_statistics]unknown exception when report 
workload runtime "
                     "statistics to {}, reason:{}. ",
                     add_str, e.what());
         }
+
+        if (!rpc_status.ok()) {
+            LOG_WARNING(
+                    "[report_query_statistics]reopen thrift client failed when 
report "
+                    "workload runtime statistics to {}, reason: {}",
+                    add_str, rpc_status.to_string());
+        }
     }
 
     //  3 when query is finished and (last rpc is send success), remove 
finished query statistics


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to