This is an automated email from the ASF dual-hosted git repository. kxiao pushed a commit to branch branch-2.0-beta in repository https://gitbox.apache.org/repos/asf/doris.git
commit 1f273fd8560dbfb2ab9b58a8cf967955d309359b Author: wangbo <[email protected]> AuthorDate: Mon Jun 5 18:12:26 2023 +0800 Fix query hang when using queue (#20434) --- .../java/org/apache/doris/qe/StmtExecutor.java | 63 +++++++++++----------- 1 file changed, 33 insertions(+), 30 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 c5c23055ff..a06f6ee855 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 @@ -577,34 +577,40 @@ public class StmtExecutor { } int retryTime = Config.max_query_retry_time; - for (int i = 0; i < retryTime; i++) { - try { - //reset query id for each retry - if (i > 0) { - UUID uuid = UUID.randomUUID(); - TUniqueId newQueryId = new TUniqueId(uuid.getMostSignificantBits(), - uuid.getLeastSignificantBits()); - AuditLog.getQueryAudit().log("Query {} {} times with new query id: {}", - DebugUtil.printId(queryId), i, DebugUtil.printId(newQueryId)); - context.setQueryId(newQueryId); - } - handleQueryStmt(); - break; - } catch (RpcException e) { - if (i == retryTime - 1) { - throw e; - } - if (!context.getMysqlChannel().isSend()) { - LOG.warn("retry {} times. stmt: {}", (i + 1), parsedStmt.getOrigStmt().originStmt); - } else { - throw e; + try { + for (int i = 0; i < retryTime; i++) { + try { + //reset query id for each retry + if (i > 0) { + UUID uuid = UUID.randomUUID(); + TUniqueId newQueryId = new TUniqueId(uuid.getMostSignificantBits(), + uuid.getLeastSignificantBits()); + AuditLog.getQueryAudit().log("Query {} {} times with new query id: {}", + DebugUtil.printId(queryId), i, DebugUtil.printId(newQueryId)); + context.setQueryId(newQueryId); + } + handleQueryStmt(); + break; + } catch (RpcException e) { + if (i == retryTime - 1) { + throw e; + } + if (!context.getMysqlChannel().isSend()) { + LOG.warn("retry {} times. stmt: {}", (i + 1), parsedStmt.getOrigStmt().originStmt); + } else { + throw e; + } + } finally { + // The final profile report occurs after be returns the query data, and the profile cannot be + // received after unregisterQuery(), causing the instance profile to be lost, so we should wait + // for the profile before unregisterQuery(). + updateProfile(true); + QeProcessorImpl.INSTANCE.unregisterQuery(context.queryId()); } - } finally { - // The final profile report occurs after be returns the query data, and the profile cannot be - // received after unregisterQuery(), causing the instance profile to be lost, so we should wait - // for the profile before unregisterQuery(). - updateProfile(true); - QeProcessorImpl.INSTANCE.unregisterQuery(context.queryId()); + } + } finally { + if (offerRet.isOfferSuccess()) { + queryQueue.poll(); } } } @@ -645,9 +651,6 @@ public class StmtExecutor { throw e; } finally { queryAnalysisSpan.end(); - if (offerRet.isOfferSuccess()) { - queryQueue.poll(); - } } if (isForwardToMaster()) { if (isProxy) { --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
