[fix](dynamic-partition) fix bug that can not set dynamic_partition.replication_allocation property (#8471)

This commit is contained in:
Mingyu Chen
2022-03-15 11:45:18 +08:00
committed by GitHub
parent c666eaadfd
commit 2252ff81d7

View File

@ -149,6 +149,7 @@ public class TableProperty implements Writable {
public void modifyTableProperties(Map<String, String> 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);
}
}
}