Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions fe/fe-core/src/main/java/org/apache/doris/catalog/Env.java
Original file line number Diff line number Diff line change
Expand Up @@ -6373,13 +6373,13 @@ public void replaceTempPartition(Database db, OlapTable olapTable, ReplacePartit
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,
Expand Down Expand Up @@ -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 {
Expand Down
7 changes: 7 additions & 0 deletions regression-test/data/mtmv_p0/test_modify_data_mtmv.out
Original file line number Diff line number Diff line change
@@ -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

14 changes: 13 additions & 1 deletion regression-test/suites/mtmv_p0/test_modify_data_mtmv.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -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)"""
Expand Down