This is an automated email from the ASF dual-hosted git repository.

dataroaring pushed a commit to branch branch-2.0
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/branch-2.0 by this push:
     new 09344f69be9 [fix](merge-on-write) migration may cause duplicate keys 
for mow table (#28923) (#28941)
09344f69be9 is described below

commit 09344f69be9efcade9b6c837f39e7d798f1ed3aa
Author: Xin Liao <liaoxin...@126.com>
AuthorDate: Mon Dec 25 13:48:35 2023 +0800

    [fix](merge-on-write) migration may cause duplicate keys for mow table 
(#28923) (#28941)
---
 be/src/olap/task/engine_storage_migration_task.cpp | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/be/src/olap/task/engine_storage_migration_task.cpp 
b/be/src/olap/task/engine_storage_migration_task.cpp
index fe18ef65719..e14be62fe88 100644
--- a/be/src/olap/task/engine_storage_migration_task.cpp
+++ b/be/src/olap/task/engine_storage_migration_task.cpp
@@ -24,6 +24,7 @@
 #include <algorithm>
 #include <ctime>
 #include <memory>
+#include <mutex>
 #include <new>
 #include <ostream>
 #include <set>
@@ -195,6 +196,21 @@ Status EngineStorageMigrationTask::_migrate() {
     int32_t end_version = 0;
     std::vector<RowsetSharedPtr> consistent_rowsets;
 
+    // During migration, if the rowsets being migrated undergoes a compaction 
operation,
+    // that will result in incorrect delete bitmaps after migration for mow 
table. Therefore,
+    // compaction will be prohibited for the mow table when migration. 
Moreover, it is useless
+    // to perform a compaction operation on the migration data, as the 
migration still migrates
+    // the data of rowsets before the compaction operation.
+    std::unique_lock full_compaction_lock(_tablet->get_full_compaction_lock(), 
std::defer_lock);
+    std::unique_lock base_compaction_lock(_tablet->get_base_compaction_lock(), 
std::defer_lock);
+    std::unique_lock 
cumu_compaction_lock(_tablet->get_cumulative_compaction_lock(),
+                                          std::defer_lock);
+    if (_tablet->enable_unique_key_merge_on_write()) {
+        full_compaction_lock.lock();
+        base_compaction_lock.lock();
+        cumu_compaction_lock.lock();
+    }
+
     // try hold migration lock first
     Status res;
     uint64_t shard = 0;


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to