This is an automated email from the ASF dual-hosted git repository.
yiguolei 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 0334cde2b1 [fix](merge-on-write) when if publish and be down, need
recalc delete bitmap for MoW (#17617)
0334cde2b1 is described below
commit 0334cde2b1cc252df9ac270b3c21c9682af4083f
Author: xueweizhang <[email protected]>
AuthorDate: Fri Mar 10 07:55:00 2023 +0800
[fix](merge-on-write) when if publish and be down, need recalc delete
bitmap for MoW (#17617)
* (merge-on-write) when if publish and be down, need recalc delete bitmap
for MoW
Signed-off-by: nextdreamblue <[email protected]>
* fix code
Signed-off-by: nextdreamblue <[email protected]>
---------
Signed-off-by: nextdreamblue <[email protected]>
---
be/src/olap/tablet.cpp | 27 +++++++++++++++------------
be/src/olap/txn_manager.cpp | 9 +++++++++
2 files changed, 24 insertions(+), 12 deletions(-)
diff --git a/be/src/olap/tablet.cpp b/be/src/olap/tablet.cpp
index 2c8449ee91..f32e0b077b 100644
--- a/be/src/olap/tablet.cpp
+++ b/be/src/olap/tablet.cpp
@@ -2624,18 +2624,21 @@ Status Tablet::update_delete_bitmap(const
RowsetSharedPtr& rowset, const TabletT
delete_bitmap, cur_version - 1, true));
// Check the delete_bitmap correctness.
- DeleteBitmap rs_bm(tablet_id());
- delete_bitmap->subset({rowset->rowset_id(), 0, 0}, {rowset->rowset_id(),
UINT32_MAX, INT64_MAX},
- &rs_bm);
- auto num_rows = rowset->num_rows();
- auto bitmap_cardinality = rs_bm.cardinality();
- std::string err_msg = fmt::format(
- "The delete bitmap of unique key table may not correct, expect num
unique keys: {}, "
- "now the num_rows: {}, delete bitmap cardinality: {}, num
sgements: {}",
- load_info->num_keys, num_rows, bitmap_cardinality,
rowset->num_segments());
- DCHECK_EQ(load_info->num_keys, num_rows - bitmap_cardinality) << err_msg;
- if (load_info->num_keys != num_rows - bitmap_cardinality) {
- return Status::InternalError(err_msg);
+ if (load_info->num_keys != 0) {
+ DeleteBitmap rs_bm(tablet_id());
+ delete_bitmap->subset({rowset->rowset_id(), 0, 0},
+ {rowset->rowset_id(), UINT32_MAX, INT64_MAX},
&rs_bm);
+ auto num_rows = rowset->num_rows();
+ auto bitmap_cardinality = rs_bm.cardinality();
+ std::string err_msg = fmt::format(
+ "The delete bitmap of unique key table may not correct, expect
num unique keys:"
+ "{}, "
+ "now the num_rows: {}, delete bitmap cardinality: {}, num
sgements: {}",
+ load_info->num_keys, num_rows, bitmap_cardinality,
rowset->num_segments());
+ DCHECK_EQ(load_info->num_keys, num_rows - bitmap_cardinality) <<
err_msg;
+ if (load_info->num_keys != num_rows - bitmap_cardinality) {
+ return Status::InternalError(err_msg);
+ }
}
// update version without write lock, compaction and publish_txn
diff --git a/be/src/olap/txn_manager.cpp b/be/src/olap/txn_manager.cpp
index 5d3daef7d5..e953ed87e2 100644
--- a/be/src/olap/txn_manager.cpp
+++ b/be/src/olap/txn_manager.cpp
@@ -269,6 +269,15 @@ Status TxnManager::commit_txn(OlapMeta* meta, TPartitionId
partition_id,
{
std::lock_guard<std::shared_mutex>
wrlock(_get_txn_map_lock(transaction_id));
TabletTxnInfo load_info(load_id, rowset_ptr);
+ if (is_recovery) {
+ TabletSharedPtr tablet =
StorageEngine::instance()->tablet_manager()->get_tablet(
+ tablet_info.tablet_id, tablet_info.tablet_uid);
+ if (tablet != nullptr &&
tablet->enable_unique_key_merge_on_write()) {
+ load_info.unique_key_merge_on_write = true;
+ load_info.delete_bitmap.reset(new
DeleteBitmap(tablet->tablet_id()));
+ load_info.num_keys = 0;
+ }
+ }
txn_tablet_map_t& txn_tablet_map = _get_txn_tablet_map(transaction_id);
txn_tablet_map[key][tablet_info] = load_info;
_insert_txn_partition_map_unlocked(transaction_id, partition_id);
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]