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 ad35b25572c6c7..dd7e284533375f 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 @@ -6373,13 +6373,13 @@ public void replaceTempPartition(Database db, OlapTable olapTable, ReplacePartit List 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, @@ -6416,8 +6416,12 @@ public void replayReplaceTempPartition(ReplacePartitionOperationLog replaceTempP 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 00000000000000..020f125165ce48 --- /dev/null +++ b/regression-test/data/mtmv_p0/test_modify_data_mtmv.out @@ -0,0 +1,7 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !insert -- +1 1 + +-- !overwrite -- +2 2 + 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 421cca44f6cb57..6f1cc39d41cab8 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)"""