You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by wa...@apache.org on 2023/06/05 10:12:34 UTC

[doris] branch master updated: Fix query hang when using queue (#20434)

This is an automated email from the ASF dual-hosted git repository.

wangbo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/master by this push:
     new c7dd7c2eba Fix query hang when using queue (#20434)
c7dd7c2eba is described below

commit c7dd7c2eba2aae1925497be3db34972b84203408
Author: wangbo <wa...@apache.org>
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 b7c4591e4d..5b1a0dece3 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
@@ -578,34 +578,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();
             }
         }
     }
@@ -646,9 +652,6 @@ public class StmtExecutor {
                     throw e;
                 } finally {
                     queryAnalysisSpan.end();
-                    if (offerRet.isOfferSuccess()) {
-                        queryQueue.poll();
-                    }
                 }
                 if (isForwardToMaster()) {
                     if (isProxy) {


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org