Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 21 additions & 14 deletions be/src/runtime/runtime_query_statistics_mgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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
Expand Down
Loading