This is an automated email from the ASF dual-hosted git repository.
morningman pushed a commit to branch branch-4.0
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-4.0 by this push:
new b7dd363c587 branch-4.0: [fix](mtmv) Avoid mutating excluded trigger
tables (#62984) (#64517)
b7dd363c587 is described below
commit b7dd363c5872523c291fa1fb3951109821d3dc76
Author: seawinde <[email protected]>
AuthorDate: Thu Jun 18 23:43:39 2026 +0800
branch-4.0: [fix](mtmv) Avoid mutating excluded trigger tables (#62984)
(#64517)
pr: #62984
---
.../org/apache/doris/mtmv/MTMVPartitionUtil.java | 5 ++--
.../apache/doris/mtmv/MTMVPartitionUtilTest.java | 29 ++++++++++++++++++++++
2 files changed, 32 insertions(+), 2 deletions(-)
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/mtmv/MTMVPartitionUtil.java
b/fe/fe-core/src/main/java/org/apache/doris/mtmv/MTMVPartitionUtil.java
index f84e339a512..4f30f193216 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/mtmv/MTMVPartitionUtil.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/mtmv/MTMVPartitionUtil.java
@@ -93,6 +93,7 @@ public class MTMVPartitionUtil {
Set<TableName> excludedTriggerTables) throws AnalysisException {
MTMV mtmv = refreshContext.getMtmv();
Map<MTMVRelatedTableIf, Set<String>> partitionMappings =
refreshContext.getByPartitionName(partitionName);
+ Set<TableName> excludedTriggerTablesToCheck =
Sets.newHashSet(excludedTriggerTables);
if (mtmv.getMvPartitionInfo().getPartitionType() !=
MTMVPartitionType.SELF_MANAGE) {
if (MapUtils.isEmpty(partitionMappings)) {
LOG.warn("can not found pct partition, partitionName: {},
mtmvName: {}",
@@ -103,7 +104,7 @@ public class MTMVPartitionUtil {
for (MTMVRelatedTableIf pctTable : pctTables) {
Set<String> relatedPartitionNames =
partitionMappings.getOrDefault(pctTable, Sets.newHashSet());
// if follow base table, not need compare with related table,
only should compare with related partition
- excludedTriggerTables.add(new TableName(pctTable));
+ excludedTriggerTablesToCheck.add(new TableName(pctTable));
if (!isSyncWithPartitions(refreshContext, partitionName,
relatedPartitionNames, pctTable)) {
return false;
}
@@ -111,7 +112,7 @@ public class MTMVPartitionUtil {
}
return isSyncWithAllBaseTables(refreshContext, partitionName, tables,
- excludedTriggerTables);
+ excludedTriggerTablesToCheck);
}
diff --git
a/fe/fe-core/src/test/java/org/apache/doris/mtmv/MTMVPartitionUtilTest.java
b/fe/fe-core/src/test/java/org/apache/doris/mtmv/MTMVPartitionUtilTest.java
index 17439adb289..bceddc8e16f 100644
--- a/fe/fe-core/src/test/java/org/apache/doris/mtmv/MTMVPartitionUtilTest.java
+++ b/fe/fe-core/src/test/java/org/apache/doris/mtmv/MTMVPartitionUtilTest.java
@@ -28,6 +28,7 @@ import org.apache.doris.common.AnalysisException;
import org.apache.doris.datasource.CatalogIf;
import org.apache.doris.mtmv.MTMVPartitionInfo.MTMVPartitionType;
+import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
@@ -240,6 +241,34 @@ public class MTMVPartitionUtilTest {
Assert.assertFalse(isSyncWithPartition);
}
+ @Test
+ public void testIsMTMVPartitionSyncWithImmutableExcludedTriggerTables()
throws AnalysisException {
+ Map<MTMVRelatedTableIf, Set<String>> partitionMappings =
Maps.newHashMap();
+ partitionMappings.put(baseOlapTable, Sets.newHashSet("name2"));
+ new Expectations() {
+ {
+ context.getByPartitionName("name1");
+ minTimes = 0;
+ result = partitionMappings;
+
+ mtmvPartitionInfo.getPartitionType();
+ minTimes = 0;
+ result = MTMVPartitionType.FOLLOW_BASE_TABLE;
+
+ mtmvPartitionInfo.getPctTables();
+ minTimes = 0;
+ result = Sets.newHashSet(baseOlapTable);
+ }
+ };
+
+ Set<TableName> excludedTriggerTables = ImmutableSet.of();
+ boolean isMTMVPartitionSync =
MTMVPartitionUtil.isMTMVPartitionSync(context, "name1", baseTables,
+ excludedTriggerTables);
+
+ Assert.assertTrue(isMTMVPartitionSync);
+ Assert.assertTrue(excludedTriggerTables.isEmpty());
+ }
+
@Test
public void testGeneratePartitionName() {
List<List<PartitionValue>> inValues = Lists.newArrayList();
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]