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

dataroaring 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 dc7fcd0032b [fix](cloud) fix auto analyze triggering failure (#32139)
dc7fcd0032b is described below

commit dc7fcd0032b7069bbcf656e8cbc934f73e964c5f
Author: zhengyu <freeman.zhang1...@gmail.com>
AuthorDate: Tue Mar 12 22:12:45 2024 +0800

    [fix](cloud) fix auto analyze triggering failure (#32139)
    
    * [fix](cloud) fix auto analyze triggering failure
    
    StatisticsCollector only collect when replicas are normal. In cloud
    mode, this check needs setCloudCluster before execution. Otherwise,
    check will be a dead-end failure.
    
    Signed-off-by: freemandealer <freeman.zhang1...@gmail.com>
---
 .../doris/statistics/util/StatisticsUtil.java      | 27 ++++++++++++++++++----
 1 file changed, 22 insertions(+), 5 deletions(-)

diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/statistics/util/StatisticsUtil.java 
b/fe/fe-core/src/main/java/org/apache/doris/statistics/util/StatisticsUtil.java
index 8ee08d57e69..3df7385d970 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/statistics/util/StatisticsUtil.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/statistics/util/StatisticsUtil.java
@@ -139,6 +139,9 @@ public class StatisticsUtil {
             return Collections.emptyList();
         }
         try (AutoCloseConnectContext r = StatisticsUtil.buildConnectContext()) 
{
+            if (Config.isCloudMode()) {
+                r.connectContext.getCloudCluster();
+            }
             StmtExecutor stmtExecutor = new StmtExecutor(r.connectContext, 
sql);
             r.connectContext.setExecutor(stmtExecutor);
             return stmtExecutor.executeInternalQuery();
@@ -447,11 +450,25 @@ public class StatisticsUtil {
         } catch (Throwable t) {
             return false;
         }
-        for (OlapTable table : statsTbls) {
-            for (Partition partition : table.getPartitions()) {
-                if (partition.getBaseIndex().getTablets().stream()
-                        .anyMatch(t -> 
t.getNormalReplicaBackendIds().isEmpty())) {
-                    return false;
+        if (Config.isCloudMode()) {
+            try (AutoCloseConnectContext r = buildConnectContext()) {
+                r.connectContext.getCloudCluster();
+                for (OlapTable table : statsTbls) {
+                    for (Partition partition : table.getPartitions()) {
+                        if (partition.getBaseIndex().getTablets().stream()
+                                .anyMatch(t -> 
t.getNormalReplicaBackendIds().isEmpty())) {
+                            return false;
+                        }
+                    }
+                }
+            }
+        } else {
+            for (OlapTable table : statsTbls) {
+                for (Partition partition : table.getPartitions()) {
+                    if (partition.getBaseIndex().getTablets().stream()
+                            .anyMatch(t -> 
t.getNormalReplicaBackendIds().isEmpty())) {
+                        return false;
+                    }
                 }
             }
         }


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

Reply via email to