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

englefly 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 7d89b57706 [enhancement](stats) Optimize stats pre-load logic #19138
7d89b57706 is described below

commit 7d89b57706a9ece57310ba4fafb868eaaa970b73
Author: AKIRA <33112463+kikyou1...@users.noreply.github.com>
AuthorDate: Thu Apr 27 17:01:31 2023 +0900

    [enhancement](stats) Optimize stats pre-load logic #19138
    
    1. Don't do pre-load until stats table gets ready
    2. Don't put pre-loaded unknown stats to cache
---
 .../java/org/apache/doris/statistics/StatisticsCache.java    | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/statistics/StatisticsCache.java 
b/fe/fe-core/src/main/java/org/apache/doris/statistics/StatisticsCache.java
index ea0028dbbd..4a2bb6e872 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/statistics/StatisticsCache.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/statistics/StatisticsCache.java
@@ -20,6 +20,7 @@ package org.apache.doris.statistics;
 import org.apache.doris.common.ThreadPoolManager;
 import org.apache.doris.qe.ConnectContext;
 import org.apache.doris.statistics.util.InternalQueryResult.ResultRow;
+import org.apache.doris.statistics.util.StatisticsUtil;
 
 import com.github.benmanes.caffeine.cache.AsyncLoadingCache;
 import com.github.benmanes.caffeine.cache.Caffeine;
@@ -146,6 +147,14 @@ public class StatisticsCache {
     private void doPreHeat() {
         List<ResultRow> recentStatsUpdatedCols = null;
         long retryTimes = 0;
+        while (!StatisticsUtil.statsTblAvailable()) {
+            try {
+                Thread.sleep(100L);
+            } catch (InterruptedException e) {
+                // IGNORE
+            }
+        }
+
         while (retryTimes < StatisticConstants.PRELOAD_RETRY_TIMES) {
             try {
                 recentStatsUpdatedCols = 
StatisticsRepository.fetchRecentStatsUpdatedCol();
@@ -194,6 +203,9 @@ public class StatisticsCache {
                         return Optional.of(c);
                     }
                 };
+                if (c == ColumnStatistic.UNKNOWN) {
+                    continue;
+                }
                 columnStatisticsCache.put(k, f);
             } catch (Throwable t) {
                 LOG.warn("Error when preheating stats cache", t);


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

Reply via email to