From 2252ff81d7f5b17069446c33fc1eafaac872bb4f Mon Sep 17 00:00:00 2001 From: Mingyu Chen Date: Tue, 15 Mar 2022 11:45:18 +0800 Subject: [PATCH] [fix](dynamic-partition) fix bug that can not set dynamic_partition.replication_allocation property (#8471) --- .../java/org/apache/doris/catalog/TableProperty.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) 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); + } + } }