This is an automated email from the ASF dual-hosted git repository. starocean999 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 946b4ae9d02 [enhance](mtmv)MTMV no longer generate cache when replaying logs (#44283) 946b4ae9d02 is described below commit 946b4ae9d0201042e02f956938baa68973dc522f Author: zhangdong <zhangd...@selectdb.com> AuthorDate: Wed Nov 20 10:58:06 2024 +0800 [enhance](mtmv)MTMV no longer generate cache when replaying logs (#44283) ### What problem does this PR solve? When replaying logs, cache will no longer be generated because the catalog may not have been initialized or the dependent environment may not be connected, causing it to freeze here and preventing FE from starting The cost is that after the materialized view is refreshed, the cache of the follower node will be empty, and a cache will be generated when the query is first used Problem Summary: MTMV no longer generate cache when replaying logs --- fe/fe-core/src/main/java/org/apache/doris/alter/Alter.java | 3 ++- fe/fe-core/src/main/java/org/apache/doris/catalog/MTMV.java | 10 +++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/fe/fe-core/src/main/java/org/apache/doris/alter/Alter.java b/fe/fe-core/src/main/java/org/apache/doris/alter/Alter.java index 2b213d05583..15c8df9195d 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/alter/Alter.java +++ b/fe/fe-core/src/main/java/org/apache/doris/alter/Alter.java @@ -1022,7 +1022,8 @@ public class Alter { mtmv.alterMvProperties(alterMTMV.getMvProperties()); break; case ADD_TASK: - mtmv.addTaskResult(alterMTMV.getTask(), alterMTMV.getRelation(), alterMTMV.getPartitionSnapshots()); + mtmv.addTaskResult(alterMTMV.getTask(), alterMTMV.getRelation(), alterMTMV.getPartitionSnapshots(), + isReplay); break; default: throw new RuntimeException("Unknown type value: " + alterMTMV.getOpType()); diff --git a/fe/fe-core/src/main/java/org/apache/doris/catalog/MTMV.java b/fe/fe-core/src/main/java/org/apache/doris/catalog/MTMV.java index b0d25ad2b25..955bfd4279f 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/catalog/MTMV.java +++ b/fe/fe-core/src/main/java/org/apache/doris/catalog/MTMV.java @@ -190,15 +190,19 @@ public class MTMV extends OlapTable { } public void addTaskResult(MTMVTask task, MTMVRelation relation, - Map<String, MTMVRefreshPartitionSnapshot> partitionSnapshots) { + Map<String, MTMVRefreshPartitionSnapshot> partitionSnapshots, boolean isReplay) { MTMVCache mtmvCache = null; boolean needUpdateCache = false; if (task.getStatus() == TaskStatus.SUCCESS && !Env.isCheckpointThread() && !Config.enable_check_compatibility_mode) { needUpdateCache = true; try { - // shouldn't do this while holding mvWriteLock - mtmvCache = MTMVCache.from(this, MTMVPlanUtil.createMTMVContext(this), true); + // The replay thread may not have initialized the catalog yet to avoid getting stuck due + // to connection issues such as S3, so it is directly set to null + if (!isReplay) { + // shouldn't do this while holding mvWriteLock + mtmvCache = MTMVCache.from(this, MTMVPlanUtil.createMTMVContext(this), true); + } } catch (Throwable e) { mtmvCache = null; LOG.warn("generate cache failed", e); --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org