This is an automated email from the ASF dual-hosted git repository.
morrysnow pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push:
new 84d9ab00f03 [fix](meta) replace partition should not get table version
in cloud mode (#50888)
84d9ab00f03 is described below
commit 84d9ab00f03713ea731daeccafe6b92da9cf8b06
Author: zhangdong <[email protected]>
AuthorDate: Mon May 19 16:32:14 2025 +0800
[fix](meta) replace partition should not get table version in cloud mode
(#50888)
### What problem does this PR solve?
In cloud mode, the internal partition deletion logic will update the
table version, so should not get version when replace
---
.../src/main/java/org/apache/doris/catalog/Env.java | 14 +++++++++-----
regression-test/data/mtmv_p0/test_modify_data_mtmv.out | Bin 0 -> 136 bytes
.../suites/mtmv_p0/test_modify_data_mtmv.groovy | 14 +++++++++++++-
3 files changed, 22 insertions(+), 6 deletions(-)
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 da07550bda7..09ae8b4209e 100644
--- 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
@@ -6385,13 +6385,13 @@ public class Env {
List<Long> replacedPartitionIds =
olapTable.replaceTempPartitions(db.getId(), partitionNames,
tempPartitionNames, isStrictRange,
useTempPartitionName, isForceDropOld);
- long version;
+ long version = 0L;
long versionTime = System.currentTimeMillis();
+ // In cloud mode, the internal partition deletion logic will update
the table version,
+ // so here we only need to handle non-cloud mode.
if (Config.isNotCloudMode()) {
version = olapTable.getNextVersion();
olapTable.updateVisibleVersionAndTime(version, versionTime);
- } else {
- version = olapTable.getVisibleVersion();
}
// Here, we only wait for the EventProcessor to finish processing the
event,
// but regardless of the success or failure of the result,
@@ -6428,8 +6428,12 @@ public class Env {
olapTable.replaceTempPartitions(dbId,
replaceTempPartitionLog.getPartitions(),
replaceTempPartitionLog.getTempPartitions(),
replaceTempPartitionLog.isStrictRange(),
replaceTempPartitionLog.useTempPartitionName(),
replaceTempPartitionLog.isForce());
-
olapTable.updateVisibleVersionAndTime(replaceTempPartitionLog.getVersion(),
- replaceTempPartitionLog.getVersionTime());
+ // In cloud mode, the internal partition deletion logic will
update the table version,
+ // so here we only need to handle non-cloud mode.
+ if (Config.isNotCloudMode()) {
+
olapTable.updateVisibleVersionAndTime(replaceTempPartitionLog.getVersion(),
+ replaceTempPartitionLog.getVersionTime());
+ }
} catch (DdlException e) {
throw new MetaNotFoundException(e);
} finally {
diff --git a/regression-test/data/mtmv_p0/test_modify_data_mtmv.out
b/regression-test/data/mtmv_p0/test_modify_data_mtmv.out
new file mode 100644
index 00000000000..020f125165c
Binary files /dev/null and
b/regression-test/data/mtmv_p0/test_modify_data_mtmv.out differ
diff --git a/regression-test/suites/mtmv_p0/test_modify_data_mtmv.groovy
b/regression-test/suites/mtmv_p0/test_modify_data_mtmv.groovy
index 421cca44f6c..6f1cc39d41c 100644
--- a/regression-test/suites/mtmv_p0/test_modify_data_mtmv.groovy
+++ b/regression-test/suites/mtmv_p0/test_modify_data_mtmv.groovy
@@ -47,13 +47,25 @@ suite("test_modify_data_mtmv","mtmv") {
"""
sql """
- insert into ${tableName} values(1,1),(2,2),(3,3);
+ insert into ${tableName} values(1,1);
"""
sql """
REFRESH MATERIALIZED VIEW ${mvName} AUTO
"""
waitingMTMVTaskFinishedByMvName(mvName)
+ order_qt_insert """select * from ${mvName};"""
+
+ sql """
+ insert overwrite table ${tableName} values(2,2);
+ """
+ sql """
+ REFRESH MATERIALIZED VIEW ${mvName} AUTO
+ """
+ waitingMTMVTaskFinishedByMvName(mvName)
+
+ order_qt_overwrite """select * from ${mvName};"""
+
// insert into mtmv
test {
sql """insert into ${mvName} values(1,1)"""
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]