[fix](replication_allocation) fix two problems for force_olap_table_replication_allocation #34554

This commit is contained in:
camby
2024-05-10 13:46:48 +08:00
committed by yiguolei
parent 9915862bf7
commit e417a5cc36
2 changed files with 5 additions and 3 deletions

View File

@ -636,7 +636,8 @@ public class DynamicPartitionUtil {
// check replication_allocation first, then replciation_num
ReplicaAllocation replicaAlloc = null;
if (properties.containsKey(DynamicPartitionProperty.REPLICATION_ALLOCATION)) {
if (!Config.force_olap_table_replication_allocation.isEmpty()
|| properties.containsKey(DynamicPartitionProperty.REPLICATION_ALLOCATION)) {
replicaAlloc = PropertyAnalyzer.analyzeReplicaAllocation(properties, "dynamic_partition");
properties.remove(DynamicPartitionProperty.REPLICATION_ALLOCATION);
analyzedProperties.put(DynamicPartitionProperty.REPLICATION_ALLOCATION, replicaAlloc.toCreateStmt());

View File

@ -137,9 +137,10 @@ public class UserPropertyMgr implements Writable {
Set<Tag> tags = existProperty.getCopiedResourceTags();
// only root and admin can return empty tag.
// empty tag means user can access all backends.
// for normal user, if tag is empty, use default tag.
// for normal user, if tag is empty and not set force_olap_table_replication_allocation, use default tag.
if (tags.isEmpty() && !(qualifiedUser.equalsIgnoreCase(Auth.ROOT_USER)
|| qualifiedUser.equalsIgnoreCase(Auth.ADMIN_USER))) {
|| qualifiedUser.equalsIgnoreCase(Auth.ADMIN_USER))
&& Config.force_olap_table_replication_allocation.isEmpty()) {
tags = Sets.newHashSet(Tag.DEFAULT_BACKEND_TAG);
}
return tags;