From be9ebbc14d05abaadd8bab96c9bd59b37820fa4a Mon Sep 17 00:00:00 2001 From: weizuo93 Date: Mon, 24 Jan 2022 21:11:45 +0800 Subject: [PATCH] [fix] Fix bug that wrong exception message returned by insert statement (#7832) `insert` statement may return exception message `Execute timeout` after load data failed. But the real reason is that there exists unhealthy backend, not execute timeout. ``` MySQL [ssb]> insert into lineorder_flat select * from lineorder_flat; ERROR 1105 (HY000): errCode = 2, detailMessage = Execute timeout ``` --- .../src/main/java/org/apache/doris/qe/StmtExecutor.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/fe/fe-core/src/main/java/org/apache/doris/qe/StmtExecutor.java b/fe/fe-core/src/main/java/org/apache/doris/qe/StmtExecutor.java index 975ad36bcc..37c188377e 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/qe/StmtExecutor.java +++ b/fe/fe-core/src/main/java/org/apache/doris/qe/StmtExecutor.java @@ -1248,10 +1248,15 @@ public class StmtExecutor implements ProfileWriter { coord.exec(); - coord.join(context.getSessionVariable().getQueryTimeoutS()); + boolean notTimeout = coord.join(context.getSessionVariable().getQueryTimeoutS()); if (!coord.isDone()) { coord.cancel(); - ErrorReport.reportDdlException(ErrorCode.ERR_EXECUTE_TIMEOUT); + if (notTimeout) { + errMsg = coord.getExecStatus().getErrorMsg(); + ErrorReport.reportDdlException("There exists unhealthy backend. " + errMsg, ErrorCode.ERR_FAILED_WHEN_INSERT); + } else { + ErrorReport.reportDdlException(ErrorCode.ERR_EXECUTE_TIMEOUT); + } } if (!coord.getExecStatus().ok()) {