Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[branch-2.0](pick 27738) Warning log to trace send fragment #27760

Merged
merged 3 commits into from
Nov 30, 2023
Merged
Show file tree
Hide file tree
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
28 changes: 26 additions & 2 deletions be/src/service/internal_service.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -458,10 +458,22 @@ Status PInternalServiceImpl::_exec_plan_fragment_impl(const std::string& ser_req
uint32_t len = ser_request.size();
RETURN_IF_ERROR(deserialize_thrift_msg(buf, &len, compact, &t_request));
}
const auto& fragment_list = t_request.paramsList;
MonotonicStopWatch timer;
timer.start();

for (const TExecPlanFragmentParams& params : t_request.paramsList) {
RETURN_IF_ERROR(_exec_env->fragment_mgr()->exec_plan_fragment(params));
}

timer.stop();
double cost_secs = static_cast<double>(timer.elapsed_time()) / 1000000000ULL;
if (cost_secs > 5) {
LOG_WARNING("Prepare {} fragments of query {} costs {} seconds, it costs too much",
fragment_list.size(), print_id(fragment_list.front().params.query_id),
cost_secs);
}

return Status::OK();
} else if (version == PFragmentRequestVersion::VERSION_3) {
TPipelineFragmentParamsList t_request;
Expand All @@ -471,9 +483,21 @@ Status PInternalServiceImpl::_exec_plan_fragment_impl(const std::string& ser_req
RETURN_IF_ERROR(deserialize_thrift_msg(buf, &len, compact, &t_request));
}

for (const TPipelineFragmentParams& params : t_request.params_list) {
RETURN_IF_ERROR(_exec_env->fragment_mgr()->exec_plan_fragment(params));
const auto& fragment_list = t_request.params_list;
MonotonicStopWatch timer;
timer.start();

for (const TPipelineFragmentParams& fragment : fragment_list) {
RETURN_IF_ERROR(_exec_env->fragment_mgr()->exec_plan_fragment(fragment));
}

timer.stop();
double cost_secs = static_cast<double>(timer.elapsed_time()) / 1000000000ULL;
if (cost_secs > 5) {
LOG_WARNING("Prepare {} fragments of query {} costs {} seconds, it costs too much",
fragment_list.size(), print_id(fragment_list.front().query_id), cost_secs);
}

return Status::OK();
} else {
return Status::InternalError("invalid version");
Expand Down
27 changes: 21 additions & 6 deletions fe/fe-core/src/main/java/org/apache/doris/qe/Coordinator.java
Original file line number Diff line number Diff line change
Expand Up @@ -875,8 +875,13 @@ private void waitRpc(List<Triple<BackendExecStates, BackendServiceProxy, Future<
long leftTimeMs,
String operation) throws RpcException, UserException {
if (leftTimeMs <= 0) {
throw new UserException("timeout before waiting for " + operation + " RPC. Elapse(sec): " + (
(System.currentTimeMillis() - timeoutDeadline) / 1000 + queryOptions.getExecutionTimeout()));
long elapsed = (System.currentTimeMillis() - timeoutDeadline) / 1000 + queryOptions.getExecutionTimeout();
String msg = String.format(
"timeout before waiting {} rpc, query timeout: {}, already elapsed:{}, left for this:{}",
operation, queryOptions.getExecutionTimeout(), elapsed, leftTimeMs);

LOG.warn("Query {} {}", DebugUtil.printId(queryId), msg);
throw new UserException(msg);
}

long timeoutMs = Math.min(leftTimeMs, Config.remote_fragment_exec_timeout_ms);
Expand Down Expand Up @@ -904,7 +909,10 @@ private void waitRpc(List<Triple<BackendExecStates, BackendServiceProxy, Future<
code = TStatusCode.INTERNAL_ERROR;
} catch (TimeoutException e) {
exception = e;
errMsg = "timeout when waiting for " + operation + " RPC. Wait(sec): " + timeoutMs / 1000;
errMsg = String.format(
"timeout when waiting for {} rpc, query timeout {}, left timeout for this operation: {}",
operation, queryOptions.getExecutionTimeout(), timeoutMs / 10000);
LOG.warn("Query {} {}", DebugUtil.printId(queryId), errMsg);
code = TStatusCode.TIMEOUT;
}

Expand Down Expand Up @@ -942,8 +950,12 @@ private void waitPipelineRpc(List<Triple<PipelineExecContexts, BackendServicePro
Future<PExecPlanFragmentResult>>> futures, long leftTimeMs,
String operation) throws RpcException, UserException {
if (leftTimeMs <= 0) {
throw new UserException("timeout before waiting for " + operation + " RPC. Elapse(sec): " + (
(System.currentTimeMillis() - timeoutDeadline) / 1000 + queryOptions.query_timeout));
long elapsed = (System.currentTimeMillis() - timeoutDeadline) / 1000 + queryOptions.getExecutionTimeout();
String msg = String.format(
"timeout before waiting {} rpc, query timeout: {}, already elapsed:{}, left for this:{}",
operation, queryOptions.getExecutionTimeout(), elapsed, leftTimeMs);
LOG.warn("Query {} {}", DebugUtil.printId(queryId), msg);
throw new UserException(msg);
}

long timeoutMs = Math.min(leftTimeMs, Config.remote_fragment_exec_timeout_ms);
Expand Down Expand Up @@ -971,7 +983,10 @@ private void waitPipelineRpc(List<Triple<PipelineExecContexts, BackendServicePro
code = TStatusCode.INTERNAL_ERROR;
} catch (TimeoutException e) {
exception = e;
errMsg = "timeout when waiting for " + operation + " RPC. Wait(sec): " + timeoutMs / 1000;
errMsg = String.format(
"timeout when waiting for {} rpc, query timeout {}, left timeout for this operation: {}",
operation, queryOptions.getExecutionTimeout(), timeoutMs / 10000);
LOG.warn("Query {} {}", DebugUtil.printId(queryId), errMsg);
code = TStatusCode.TIMEOUT;
}

Expand Down