Skip to content

Commit

Permalink
branch-2.1: [enhance](mtmv)MTMV no longer generate cache when replayi…
Browse files Browse the repository at this point in the history
…ng logs #44283 (#44308)

Cherry-picked from #44283

Co-authored-by: zhangdong <[email protected]>
  • Loading branch information
github-actions[bot] and zddr authored Nov 25, 2024
1 parent 766f964 commit 9e0ece2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
3 changes: 2 additions & 1 deletion fe/fe-core/src/main/java/org/apache/doris/alter/Alter.java
Original file line number Diff line number Diff line change
Expand Up @@ -957,7 +957,8 @@ public void processAlterMTMV(AlterMTMV alterMTMV, boolean isReplay) {
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());
Expand Down
10 changes: 7 additions & 3 deletions fe/fe-core/src/main/java/org/apache/doris/catalog/MTMV.java
Original file line number Diff line number Diff line change
Expand Up @@ -188,14 +188,18 @@ public MTMVStatus alterStatus(MTMVStatus newStatus) {
}

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);
Expand Down

0 comments on commit 9e0ece2

Please sign in to comment.