Breakpoint hit: "thread=mysql-nio-pool-2", org.apache.doris.qe.Coordinator.sendPipelineCtx(), line=889 bci=0
889 lock();
mysql-nio-pool-2[1] list
885 }
886 }
887
888 private void sendPipelineCtx() throws TException, RpcException, UserException {
889 => lock();
890 try {
891 Multiset<TNetworkAddress> hostCounter = HashMultiset.create();
892 for (FragmentExecParams params : fragmentExecParamsMap.values()) {
893 for (FInstanceExecParam fi : params.instanceExecParams) {
894 hostCounter.add(fi.host);
mysql-nio-pool-2[1] where
[1] org.apache.doris.qe.Coordinator.sendPipelineCtx (Coordinator.java:889)
[2] org.apache.doris.qe.Coordinator.execInternal (Coordinator.java:730)
[3] org.apache.doris.qe.Coordinator.exec (Coordinator.java:655)
[4] org.apache.doris.qe.StmtExecutor.sendResult (StmtExecutor.java:1,834)
[5] org.apache.doris.qe.StmtExecutor.handleQueryStmt (StmtExecutor.java:1,806)
[6] org.apache.doris.qe.StmtExecutor.handleQueryWithRetry (StmtExecutor.java:829)
[7] org.apache.doris.qe.StmtExecutor.executeByNereids (StmtExecutor.java:765)
[8] org.apache.doris.qe.StmtExecutor.execute (StmtExecutor.java:575)
[9] org.apache.doris.qe.StmtExecutor.execute (StmtExecutor.java:528)
[10] org.apache.doris.qe.ConnectProcessor.executeQuery (ConnectProcessor.java:368)
[11] org.apache.doris.qe.ConnectProcessor.handleQuery (ConnectProcessor.java:232)
[12] org.apache.doris.qe.MysqlConnectProcessor.handleQuery (MysqlConnectProcessor.java:176)
[13] org.apache.doris.qe.MysqlConnectProcessor.dispatch (MysqlConnectProcessor.java:205)
[14] org.apache.doris.qe.MysqlConnectProcessor.processOnce (MysqlConnectProcessor.java:258)
[15] org.apache.doris.mysql.ReadListener.lambda$handleEvent$0 (ReadListener.java:52)
[16] org.apache.doris.mysql.ReadListener$$Lambda$2026/0x00007f2028f71cc8.run (null)
[17] java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1,136)
[18] java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:635)
[19] java.lang.Thread.run (Thread.java:840)
mysql-nio-pool-2[1]
doris select explain的路径
private void handleQueryStmt() throws Exception {
if (LOG.isDebugEnabled()) {
LOG.debug("Handling query {} with query id {}",
originStmt.originStmt, DebugUtil.printId(context.queryId));
}
if (context.getConnectType() == ConnectType.MYSQL) {
context.getMysqlChannel().reset();
}
Queriable queryStmt = (Queriable) parsedStmt;
if (queryStmt.isExplain()) {
String explainString = planner.getExplainString(queryStmt.getExplainOptions());
handleExplainStmt(explainString, false);
LOG.info("Query {} finished", DebugUtil.printId(context.queryId));
return;
}
rpc 过程
private void waitPipelineRpc(List<Triple<PipelineExecContexts, BackendServiceProxy,
Future<PExecPlanFragmentResult>>> futures, long leftTimeMs,
String operation) throws RpcException, UserException {
if (leftTimeMs <= 0) {
long currentTimeMillis = System.currentTimeMillis()
long elapsed = (currentTimeMillis - timeoutDeadline) / 1000 + queryOptions.getExecutionTimeout()
String msg = String.format(
"timeout before waiting %s rpc, query timeout:%d, already elapsed:%d, left for this:%d",
operation, queryOptions.getExecutionTimeout(), elapsed, leftTimeMs)
LOG.warn("Query {} {}", DebugUtil.printId(queryId), msg)
if (!queryOptions.isSetExecutionTimeout() || !queryOptions.isSetQueryTimeout()) {
LOG.warn("Query {} does not set timeout info, execution timeout: is_set:{}, value:{}"
+ ", query timeout: is_set:{}, value: {}, "
+ "coordinator timeout deadline {}, cur time millis: {}",
DebugUtil.printId(queryId),
queryOptions.isSetExecutionTimeout(), queryOptions.getExecutionTimeout(),
queryOptions.isSetQueryTimeout(), queryOptions.getQueryTimeout(),
timeoutDeadline, currentTimeMillis)
}
throw new UserException(msg)
}
long timeoutMs = Math.min(leftTimeMs, Config.remote_fragment_exec_timeout_ms)
for (Triple<PipelineExecContexts, BackendServiceProxy, Future<PExecPlanFragmentResult>> triple : futures) {
TStatusCode code
String errMsg = null
Exception exception = null
try {
PExecPlanFragmentResult result = triple.getRight().get(timeoutMs, TimeUnit.MILLISECONDS)
code = TStatusCode.findByValue(result.getStatus().getStatusCode())
if (code == null) {
code = TStatusCode.INTERNAL_ERROR
}
if (code != TStatusCode.OK) {
if (!result.getStatus().getErrorMsgsList().isEmpty()) {
errMsg = result.getStatus().getErrorMsgsList().get(0)
} else {
errMsg = operation + " failed. backend id: " + triple.getLeft().beId
}
}
} catch (ExecutionException e) {
exception = e
code = TStatusCode.THRIFT_RPC_ERROR
triple.getMiddle().removeProxy(triple.getLeft().brpcAddr)
} catch (InterruptedException e) {
exception = e
code = TStatusCode.INTERNAL_ERROR
} catch (TimeoutException e) {
exception = e
errMsg = String.format(
"timeout when waiting for %s rpc, query timeout:%d, left timeout for this operation:%d",
operation, queryOptions.getExecutionTimeout(), timeoutMs / 1000)
LOG.warn("Query {} {}", DebugUtil.printId(queryId), errMsg)
code = TStatusCode.TIMEOUT
}
if (code != TStatusCode.OK) {
if (exception != null && errMsg == null) {
errMsg = operation + " failed. " + exception.getMessage()
}
queryStatus.updateStatus(TStatusCode.INTERNAL_ERROR, errMsg)
cancelInternal(Types.PPlanFragmentCancelReason.INTERNAL_ERROR)
switch (code) {
case TIMEOUT:
MetricRepo.BE_COUNTER_QUERY_RPC_FAILED.getOrAdd(triple.getLeft().brpcAddr.hostname)
.increase(1L)
throw new RpcException(triple.getLeft().brpcAddr.hostname, errMsg, exception)
case THRIFT_RPC_ERROR:
MetricRepo.BE_COUNTER_QUERY_RPC_FAILED.getOrAdd(triple.getLeft().brpcAddr.hostname)
.increase(1L)
SimpleScheduler.addToBlacklist(triple.getLeft().beId, errMsg)
throw new RpcException(triple.getLeft().brpcAddr.hostname, errMsg, exception)
default:
throw new UserException(errMsg, exception)
}
}
}
}