This is an automated email from the ASF dual-hosted git repository. yiguolei pushed a commit to branch branch-2.1 in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-2.1 by this push: new 9e0ece24523 branch-2.1: [enhance](mtmv)MTMV no longer generate cache when replaying logs #44283 (#44308) 9e0ece24523 is described below commit 9e0ece24523bcb1f406cd69661d6c1e9a0060bac Author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> AuthorDate: Mon Nov 25 11:06:07 2024 +0800 branch-2.1: [enhance](mtmv)MTMV no longer generate cache when replaying logs #44283 (#44308) Cherry-picked from #44283 Co-authored-by: zhangdong <zhangd...@selectdb.com> --- 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 52b6934c3a3..44b83f80654 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 @@ -957,7 +957,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 80d7f48a9ee..700a1364fdb 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 @@ -188,14 +188,18 @@ 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()) { 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