[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 ```
This commit is contained in:
@ -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()) {
|
||||
|
||||
Reference in New Issue
Block a user