diff --git a/fe/fe-core/src/main/java/org/apache/doris/catalog/TableProperty.java b/fe/fe-core/src/main/java/org/apache/doris/catalog/TableProperty.java index 7d1c4cab36..427b09af0a 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/catalog/TableProperty.java +++ b/fe/fe-core/src/main/java/org/apache/doris/catalog/TableProperty.java @@ -149,6 +149,7 @@ public class TableProperty implements Writable { public void modifyTableProperties(Map modifyProperties) { properties.putAll(modifyProperties); + removeDuplicateReplicaNumProperty(); } public void modifyDataSortInfoProperties(DataSortInfo dataSortInfo) { @@ -237,7 +238,18 @@ public class TableProperty implements Writable { ReplicaAllocation.DEFAULT_ALLOCATION.toCreateStmt()); } } + tableProperty.removeDuplicateReplicaNumProperty(); tableProperty.buildReplicaAllocation(); return tableProperty; } + + // For some historical reason, both "dynamic_partition.replication_num" and "dynamic_partition.replication_allocation" + // may be exist in "properties". we need remove the "dynamic_partition.replication_num", or it will always replace + // the "dynamic_partition.replication_allocation", result in unable to set "dynamic_partition.replication_allocation". + private void removeDuplicateReplicaNumProperty() { + if (properties.containsKey(DynamicPartitionProperty.REPLICATION_NUM) + && properties.containsKey(DynamicPartitionProperty.REPLICATION_ALLOCATION)) { + properties.remove(DynamicPartitionProperty.REPLICATION_NUM); + } + } }