[fix](mtmv)fix when related table drop partition,mv partition is sync… (#36602)
pick: https://github.com/apache/doris/pull/36547
This commit is contained in:
@ -325,6 +325,11 @@ public class MTMVPartitionUtil {
|
||||
if (!relatedTable.needAutoRefresh()) {
|
||||
return true;
|
||||
}
|
||||
// check if partitions of related table if changed
|
||||
Set<String> snapshotPartitions = mtmv.getRefreshSnapshot().getSnapshotPartitions(mtmvPartitionName);
|
||||
if (!Objects.equals(relatedPartitionNames, snapshotPartitions)) {
|
||||
return false;
|
||||
}
|
||||
for (String relatedPartitionName : relatedPartitionNames) {
|
||||
MTMVSnapshotIf relatedPartitionCurrentSnapshot = relatedTable
|
||||
.getPartitionSnapshot(relatedPartitionName);
|
||||
|
||||
@ -18,6 +18,7 @@
|
||||
package org.apache.doris.mtmv;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
import com.google.common.collect.Sets;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import org.apache.commons.collections.MapUtils;
|
||||
|
||||
@ -46,6 +47,14 @@ public class MTMVRefreshSnapshot {
|
||||
return relatedPartitionSnapshot.equals(relatedPartitionCurrentSnapshot);
|
||||
}
|
||||
|
||||
public Set<String> getSnapshotPartitions(String mtmvPartitionName) {
|
||||
MTMVRefreshPartitionSnapshot partitionSnapshot = partitionSnapshots.get(mtmvPartitionName);
|
||||
if (partitionSnapshot == null) {
|
||||
return Sets.newHashSet();
|
||||
}
|
||||
return partitionSnapshot.getPartitions().keySet();
|
||||
}
|
||||
|
||||
public boolean equalsWithBaseTable(String mtmvPartitionName, long baseTableId,
|
||||
MTMVSnapshotIf baseTableCurrentSnapshot) {
|
||||
MTMVRefreshPartitionSnapshot partitionSnapshot = partitionSnapshots.get(mtmvPartitionName);
|
||||
|
||||
Reference in New Issue
Block a user