You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by mo...@apache.org on 2023/12/27 01:59:42 UTC
(doris) branch master updated: [improvement](statistics)Remove retry load when load stats cache fail (#28904)
This is an automated email from the ASF dual-hosted git repository.
morningman 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 a4e69f7272e [improvement](statistics)Remove retry load when load stats cache fail (#28904)
a4e69f7272e is described below
commit a4e69f7272ea2c99c6db552d6b7e9150a0e3ed00
Author: Jibing-Li <64...@users.noreply.github.com>
AuthorDate: Wed Dec 27 09:59:34 2023 +0800
[improvement](statistics)Remove retry load when load stats cache fail (#28904)
Remove retry load when load stats cache fail. This case usually happens when BE is down or BE OOM, retry doesn't work in these cases and may increase BE work load.
---
.../statistics/ColumnStatisticsCacheLoader.java | 42 ++--------------------
.../apache/doris/statistics/StatisticsCache.java | 4 ---
2 files changed, 2 insertions(+), 44 deletions(-)
diff --git a/fe/fe-core/src/main/java/org/apache/doris/statistics/ColumnStatisticsCacheLoader.java b/fe/fe-core/src/main/java/org/apache/doris/statistics/ColumnStatisticsCacheLoader.java
index 22f0cad9d00..08a410b8599 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/statistics/ColumnStatisticsCacheLoader.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/statistics/ColumnStatisticsCacheLoader.java
@@ -17,7 +17,6 @@
package org.apache.doris.statistics;
-import org.apache.doris.catalog.Env;
import org.apache.doris.catalog.TableIf;
import org.apache.doris.common.ThreadPoolManager;
import org.apache.doris.qe.InternalQueryExecutionException;
@@ -64,7 +63,8 @@ public class ColumnStatisticsCacheLoader extends StatisticsCacheLoader<Optional<
try {
columnResults = StatisticsRepository.loadColStats(key.tableId, key.idxId, key.colName);
} catch (InternalQueryExecutionException e) {
- retryLoad(key);
+ LOG.info("Failed to load stats for table {} column {}. Reason:{}",
+ key.tableId, key.colName, e.getMessage());
return Optional.empty();
}
ColumnStatistic columnStatistics;
@@ -80,42 +80,4 @@ public class ColumnStatisticsCacheLoader extends StatisticsCacheLoader<Optional<
return Optional.of(columnStatistics);
}
}
-
- private void retryLoad(StatisticsCacheKey key) {
- singleThreadPool.submit(new RetryTask(key, 1));
- }
-
- private static class RetryTask implements Runnable {
- StatisticsCacheKey key;
- int retryTimes;
-
- public RetryTask(StatisticsCacheKey key, int retryTimes) {
- this.key = key;
- this.retryTimes = retryTimes;
- }
-
- @Override
- public void run() {
- List<ResultRow> columnResults = null;
- try {
- columnResults = StatisticsRepository.loadColStats(key.tableId, key.idxId, key.colName);
- } catch (InternalQueryExecutionException e) {
- if (this.retryTimes < StatisticConstants.LOAD_RETRY_TIMES) {
- retryTimes++;
- singleThreadPool.submit(this);
- }
- return;
- }
- ColumnStatistic columnStatistics;
- try {
- columnStatistics = StatisticsUtil.deserializeToColumnStatistics(columnResults);
- } catch (Exception e) {
- LOG.warn("Exception to deserialize column statistics", e);
- return;
- }
- if (columnStatistics != null) {
- Env.getCurrentEnv().getStatisticsCache().putCache(key, columnStatistics);
- }
- }
- }
}
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 d4b91b07364..fbec9a60fa0 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
@@ -39,9 +39,7 @@ import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import java.time.Duration;
-import java.util.HashMap;
import java.util.List;
-import java.util.Map;
import java.util.Optional;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ThreadPoolExecutor;
@@ -201,7 +199,6 @@ public class StatisticsCache {
if (CollectionUtils.isEmpty(recentStatsUpdatedCols)) {
return;
}
- Map<StatisticsCacheKey, ColumnStatistic> keyToColStats = new HashMap<>();
for (ResultRow r : recentStatsUpdatedCols) {
try {
StatsId statsId = new StatsId(r);
@@ -211,7 +208,6 @@ public class StatisticsCache {
final StatisticsCacheKey k =
new StatisticsCacheKey(tblId, idxId, colId);
final ColumnStatistic c = ColumnStatistic.fromResultRow(r);
- keyToColStats.put(k, c);
putCache(k, c);
} catch (Throwable t) {
LOG.warn("Error when preheating stats cache", t);
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org