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

dataroaring pushed a commit to branch branch-3.0
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/branch-3.0 by this push:
     new d3da2bf6552 branch-3.0: [fix](bug) Fix `Config.max_query_retry_time=1` 
analysis planner is null #47287 (#47480)
d3da2bf6552 is described below

commit d3da2bf6552e0b215dee5830820680e913c0113c
Author: github-actions[bot] 
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Wed Jan 29 09:09:58 2025 +0800

    branch-3.0: [fix](bug) Fix `Config.max_query_retry_time=1` analysis planner 
is null #47287 (#47480)
    
    Cherry-picked from #47287
    
    Co-authored-by: deardeng <deng...@selectdb.com>
---
 .../java/org/apache/doris/qe/StmtExecutor.java     |  5 ++--
 .../suites/control_p0/test_set_max_retry.groovy    | 29 ++++++++++++++++++++++
 2 files changed, 32 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 798bdb5d0c1..7f3f5543dea 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
@@ -891,7 +891,8 @@ public class StmtExecutor {
     private void handleQueryWithRetry(TUniqueId queryId) throws Exception {
         // queue query here
         int retryTime = Config.max_query_retry_time;
-        for (int i = 0; i <= retryTime; i++) {
+        retryTime = retryTime <= 0 ? 1 : retryTime + 1;
+        for (int i = 0; i < retryTime; i++) {
             try {
                 // reset query id for each retry
                 if (i > 0) {
@@ -1356,7 +1357,7 @@ public class StmtExecutor {
             int analyzeTimes = 2;
             if (Config.isCloudMode()) {
                 // be core and be restarted, need retry more times
-                analyzeTimes = Config.max_query_retry_time / 2;
+                analyzeTimes = Math.max(Config.max_query_retry_time / 2, 2);
             }
             for (int i = 1; i <= analyzeTimes; i++) {
                 MetaLockUtils.readLockTables(tables);
diff --git a/regression-test/suites/control_p0/test_set_max_retry.groovy 
b/regression-test/suites/control_p0/test_set_max_retry.groovy
new file mode 100644
index 00000000000..8569499c920
--- /dev/null
+++ b/regression-test/suites/control_p0/test_set_max_retry.groovy
@@ -0,0 +1,29 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+suite('test_set_max_retry', 'nonConcurrent') {
+    setFeConfigTemporary([max_query_retry_time:1]) {
+        sql """set enable_sql_cache=true"""
+        def ret = sql_return_maparray """show variables where variable_name = 
'insert_timeout';"""
+        assertEquals("insert_timeout" ,ret[0].Variable_name)
+        assertTrue(ret[0].Value as int > 0);
+        sql """set enable_sql_cache=false"""
+        ret = sql_return_maparray """show variables where variable_name = 
'insert_timeout';"""
+        assertEquals("insert_timeout" ,ret[0].Variable_name)
+        assertTrue(ret[0].Value as int > 0);
+    }
+}


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

Reply via email to