You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by yi...@apache.org on 2025/04/03 01:50:31 UTC
(doris) branch branch-2.1 updated: branch-2.1: [fix](meta) do not check replica allocation when replay #49569 (#49604)
This is an automated email from the ASF dual-hosted git repository.
yiguolei pushed a commit to branch branch-2.1
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-2.1 by this push:
new 2b084295777 branch-2.1: [fix](meta) do not check replica allocation when replay #49569 (#49604)
2b084295777 is described below
commit 2b0842957770e5616f8f4008e8fe6c04d580d2f0
Author: github-actions[bot] <41...@users.noreply.github.com>
AuthorDate: Thu Apr 3 09:50:24 2025 +0800
branch-2.1: [fix](meta) do not check replica allocation when replay #49569 (#49604)
Cherry-picked from #49569
Co-authored-by: Mingyu Chen (Rayner) <mo...@163.com>
---
.../org/apache/doris/catalog/ColocateTableIndex.java | 8 ++++----
.../src/main/java/org/apache/doris/catalog/Env.java | 2 +-
.../doris/common/util/DynamicPartitionUtil.java | 19 +++++++++++--------
3 files changed, 16 insertions(+), 13 deletions(-)
diff --git a/fe/fe-core/src/main/java/org/apache/doris/catalog/ColocateTableIndex.java b/fe/fe-core/src/main/java/org/apache/doris/catalog/ColocateTableIndex.java
index 46a96bd39ea..ba7755365b2 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/catalog/ColocateTableIndex.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/catalog/ColocateTableIndex.java
@@ -878,7 +878,7 @@ public class ColocateTableIndex implements Writable {
}
private void modifyColocateGroupReplicaAllocation(GroupId groupId, ReplicaAllocation replicaAlloc,
- Map<Tag, List<List<Long>>> backendsPerBucketSeq, boolean needEditLog) throws UserException {
+ Map<Tag, List<List<Long>>> backendsPerBucketSeq, boolean isReplay) throws UserException {
ColocateGroupSchema groupSchema = getGroupSchema(groupId);
if (groupSchema == null) {
LOG.warn("not found group {}", groupId);
@@ -912,7 +912,7 @@ public class ColocateTableIndex implements Writable {
origDynamicProperties.put(DynamicPartitionProperty.REPLICATION_ALLOCATION,
replicaAlloc.toCreateStmt());
Map<String, String> analyzedDynamicPartition = DynamicPartitionUtil.analyzeDynamicPartition(
- origDynamicProperties, table, db);
+ origDynamicProperties, table, db, isReplay);
tableProperty.modifyTableProperties(analyzedDynamicPartition);
tableProperty.buildDynamicProperty();
}
@@ -932,11 +932,11 @@ public class ColocateTableIndex implements Writable {
groupSchema.setReplicaAlloc(replicaAlloc);
setBackendsPerBucketSeq(groupId, backendsPerBucketSeq);
- if (needEditLog) {
+ if (!isReplay) {
ColocatePersistInfo info = ColocatePersistInfo.createForModifyReplicaAlloc(groupId,
replicaAlloc, backendsPerBucketSeq);
Env.getCurrentEnv().getEditLog().logColocateModifyRepliaAlloc(info);
}
- LOG.info("modify group {} replication allocation to {}, is replay {}", groupId, replicaAlloc, !needEditLog);
+ LOG.info("modify group {} replication allocation to {}, is replay {}", groupId, replicaAlloc, isReplay);
}
}
diff --git a/fe/fe-core/src/main/java/org/apache/doris/catalog/Env.java b/fe/fe-core/src/main/java/org/apache/doris/catalog/Env.java
index 2e595406867..80a6d942bd9 100755
--- a/fe/fe-core/src/main/java/org/apache/doris/catalog/Env.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/catalog/Env.java
@@ -5064,7 +5064,7 @@ public class Env {
Map<String, String> origDynamicProperties = tableProperty.getOriginDynamicPartitionProperty();
origDynamicProperties.putAll(properties);
Map<String, String> analyzedDynamicPartition = DynamicPartitionUtil.analyzeDynamicPartition(
- origDynamicProperties, table, db);
+ origDynamicProperties, table, db, false);
tableProperty.modifyTableProperties(analyzedDynamicPartition);
tableProperty.buildDynamicProperty();
}
diff --git a/fe/fe-core/src/main/java/org/apache/doris/common/util/DynamicPartitionUtil.java b/fe/fe-core/src/main/java/org/apache/doris/common/util/DynamicPartitionUtil.java
index 59a38348f8d..278109f104d 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/common/util/DynamicPartitionUtil.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/common/util/DynamicPartitionUtil.java
@@ -238,8 +238,8 @@ public class DynamicPartitionUtil {
null, false, true);
}
- private static void checkReplicaAllocation(ReplicaAllocation replicaAlloc, int hotPartitionNum,
- Database db) throws DdlException {
+ private static void checkReplicaAllocation(ReplicaAllocation replicaAlloc, int hotPartitionNum)
+ throws DdlException {
if (replicaAlloc.getTotalReplicaNum() <= 0) {
ErrorReport.reportDdlException(ErrorCode.ERROR_DYNAMIC_PARTITION_REPLICATION_NUM_ZERO);
}
@@ -528,8 +528,9 @@ public class DynamicPartitionUtil {
}
// Analyze all properties to check their validation
+ // ATTN, should not throw any exception when isReplay is true.
public static Map<String, String> analyzeDynamicPartition(Map<String, String> properties,
- OlapTable olapTable, Database db) throws UserException {
+ OlapTable olapTable, Database db, boolean isReplay) throws UserException {
// properties should not be empty, check properties before call this function
Map<String, String> analyzedProperties = new HashMap<>();
if (properties.containsKey(DynamicPartitionProperty.TIME_UNIT)) {
@@ -605,7 +606,6 @@ public class DynamicPartitionUtil {
// If create_history_partition is false, history partition is not considered.
// If create_history_partition is true, will pre-create history partition according the valid value from
// start and history_partition_num.
- //
long expectCreatePartitionNum = 0;
if (!createHistoryPartition) {
start = 0;
@@ -621,7 +621,7 @@ public class DynamicPartitionUtil {
}
expectCreatePartitionNum = (long) end - start;
- if (hasEnd && (expectCreatePartitionNum > Config.max_dynamic_partition_num)
+ if (!isReplay && hasEnd && (expectCreatePartitionNum > Config.max_dynamic_partition_num)
&& Boolean.parseBoolean(analyzedProperties.getOrDefault(DynamicPartitionProperty.ENABLE, "true"))) {
throw new DdlException("Too many dynamic partitions: "
+ expectCreatePartitionNum + ". Limit: " + Config.max_dynamic_partition_num);
@@ -674,11 +674,14 @@ public class DynamicPartitionUtil {
} else {
replicaAlloc = olapTable.getDefaultReplicaAllocation();
}
- if (olapTable.getMinLoadReplicaNum() > replicaAlloc.getTotalReplicaNum()) {
+ if (!isReplay && olapTable.getMinLoadReplicaNum() > replicaAlloc.getTotalReplicaNum()) {
throw new DdlException("Failed to check min load replica num [" + olapTable.getMinLoadReplicaNum()
+ "] <= dynamic partition replica num [" + replicaAlloc.getTotalReplicaNum() + "]");
}
- checkReplicaAllocation(replicaAlloc, hotPartitionNum, db);
+
+ if (!isReplay) {
+ checkReplicaAllocation(replicaAlloc, hotPartitionNum);
+ }
if (properties.containsKey(DynamicPartitionProperty.RESERVED_HISTORY_PERIODS)) {
String reservedHistoryPeriods = properties.get(DynamicPartitionProperty.RESERVED_HISTORY_PERIODS);
@@ -748,7 +751,7 @@ public class DynamicPartitionUtil {
Database db) throws UserException {
if (DynamicPartitionUtil.checkInputDynamicPartitionProperties(properties, olapTable)) {
Map<String, String> dynamicPartitionProperties =
- DynamicPartitionUtil.analyzeDynamicPartition(properties, olapTable, db);
+ DynamicPartitionUtil.analyzeDynamicPartition(properties, olapTable, db, false);
TableProperty tableProperty = olapTable.getTableProperty();
if (tableProperty != null) {
tableProperty.modifyTableProperties(dynamicPartitionProperties);
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org