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

morningman pushed a commit to branch branch-1.2-lts
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/branch-1.2-lts by this push:
     new 2191fdcf84 [fix](merge-on-write) fix that the query result has 
duplicate keys when load with sequence column (#16587)
2191fdcf84 is described below

commit 2191fdcf842836483c5b7843222bb3f3ff1057f1
Author: Xin Liao <[email protected]>
AuthorDate: Fri Feb 10 22:31:05 2023 +0800

    [fix](merge-on-write) fix that the query result has duplicate keys when 
load with sequence column (#16587)
---
 be/src/olap/tablet.cpp | 21 +++++++++++++++++++--
 1 file changed, 19 insertions(+), 2 deletions(-)

diff --git a/be/src/olap/tablet.cpp b/be/src/olap/tablet.cpp
index d1b3eca443..0834ce87d6 100644
--- a/be/src/olap/tablet.cpp
+++ b/be/src/olap/tablet.cpp
@@ -2077,8 +2077,15 @@ Status Tablet::calc_delete_bitmap(RowsetId rowset_id,
                         loc.row_id = row_id;
                     }
 
-                    delete_bitmap->add({loc.rowset_id, loc.segment_id, 
dummy_version.first},
-                                       loc.row_id);
+                    // delete bitmap will be calculate when memtable flush and
+                    // publish. The two stages may see different versions.
+                    // When there is sequence column, the currently imported 
data
+                    // of rowset may be marked for deletion at memtablet flush 
or
+                    // publish because the seq column is smaller than the 
previous
+                    // rowset.
+                    // just set 0 as a unified temporary version number, and 
update to
+                    // the real version number later.
+                    delete_bitmap->add({loc.rowset_id, loc.segment_id, 0}, 
loc.row_id);
                 }
                 ++row_id;
             }
@@ -2145,6 +2152,11 @@ Status Tablet::update_delete_bitmap_without_lock(const 
RowsetSharedPtr& rowset)
         int ret = _tablet_meta->delete_bitmap().set(
                 {std::get<0>(iter->first), std::get<1>(iter->first), 
cur_version}, iter->second);
         DCHECK(ret == 1);
+        if (ret != 1) {
+            LOG(WARNING) << "failed to set delete bimap, key is: |" << 
std::get<0>(iter->first)
+                         << "|" << std::get<1>(iter->first) << "|" << 
cur_version;
+            return Status::InternalError("failed to set delete bimap");
+        }
     }
 
     return Status::OK();
@@ -2190,6 +2202,11 @@ Status Tablet::update_delete_bitmap(const 
RowsetSharedPtr& rowset, DeleteBitmapP
         int ret = _tablet_meta->delete_bitmap().set(
                 {std::get<0>(iter->first), std::get<1>(iter->first), 
cur_version}, iter->second);
         DCHECK(ret == 1);
+        if (ret != 1) {
+            LOG(WARNING) << "failed to set delete bimap, key is: |" << 
std::get<0>(iter->first)
+                         << "|" << std::get<1>(iter->first) << "|" << 
cur_version;
+            return Status::InternalError("failed to set delete bimap");
+        }
     }
 
     return Status::OK();


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to