You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by da...@apache.org on 2023/06/14 08:25:19 UTC
[doris] branch master updated: [Enhancement](merge-on-write) optimize contains_agg when calculate delete bitmap (#20762)
This is an automated email from the ASF dual-hosted git repository.
dataroaring 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 dd5b82fe00 [Enhancement](merge-on-write) optimize contains_agg when calculate delete bitmap (#20762)
dd5b82fe00 is described below
commit dd5b82fe007e7654c93c2eac30fc98ac1c216be3
Author: Xin Liao <li...@126.com>
AuthorDate: Wed Jun 14 16:25:11 2023 +0800
[Enhancement](merge-on-write) optimize contains_agg when calculate delete bitmap (#20762)
---
be/src/olap/tablet.cpp | 4 ++--
be/src/olap/tablet_meta.cpp | 15 +++++++++++++++
be/src/olap/tablet_meta.h | 1 +
3 files changed, 18 insertions(+), 2 deletions(-)
diff --git a/be/src/olap/tablet.cpp b/be/src/olap/tablet.cpp
index f2e2424864..011ea8e9b6 100644
--- a/be/src/olap/tablet.cpp
+++ b/be/src/olap/tablet.cpp
@@ -2749,8 +2749,8 @@ Status Tablet::lookup_row_key(const Slice& encoded_key, bool with_seq_col,
return s;
}
loc.rowset_id = rs.first->rowset_id();
- if (_tablet_meta->delete_bitmap().contains_agg({loc.rowset_id, loc.segment_id, version},
- loc.row_id)) {
+ if (_tablet_meta->delete_bitmap().contains_agg_without_cache(
+ {loc.rowset_id, loc.segment_id, version}, loc.row_id)) {
// if has sequence col, we continue to compare the sequence_id of
// all rowsets, util we find an existing key.
if (_schema->has_sequence_col()) {
diff --git a/be/src/olap/tablet_meta.cpp b/be/src/olap/tablet_meta.cpp
index 3ee508afb9..4f08e50a79 100644
--- a/be/src/olap/tablet_meta.cpp
+++ b/be/src/olap/tablet_meta.cpp
@@ -941,6 +941,21 @@ bool DeleteBitmap::contains_agg(const BitmapKey& bmk, uint32_t row_id) const {
return get_agg(bmk)->contains(row_id);
}
+bool DeleteBitmap::contains_agg_without_cache(const BitmapKey& bmk, uint32_t row_id) const {
+ DeleteBitmap::BitmapKey start {std::get<0>(bmk), std::get<1>(bmk), 0};
+ for (auto it = delete_bitmap.lower_bound(start); it != delete_bitmap.end(); ++it) {
+ auto& [k, bm] = *it;
+ if (std::get<0>(k) != std::get<0>(bmk) || std::get<1>(k) != std::get<1>(bmk) ||
+ std::get<2>(k) > std::get<2>(bmk)) {
+ break;
+ }
+ if (bm.contains(row_id)) {
+ return true;
+ }
+ }
+ return false;
+}
+
int DeleteBitmap::set(const BitmapKey& bmk, const roaring::Roaring& segment_delete_bitmap) {
std::lock_guard l(lock);
auto [_, inserted] = delete_bitmap.insert_or_assign(bmk, segment_delete_bitmap);
diff --git a/be/src/olap/tablet_meta.h b/be/src/olap/tablet_meta.h
index 2b4d83dce8..2c6a98b111 100644
--- a/be/src/olap/tablet_meta.h
+++ b/be/src/olap/tablet_meta.h
@@ -415,6 +415,7 @@ public:
*/
bool contains_agg(const BitmapKey& bitmap, uint32_t row_id) const;
+ bool contains_agg_without_cache(const BitmapKey& bmk, uint32_t row_id) const;
/**
* Gets aggregated delete_bitmap on rowset_id and version, the same effect:
* `select sum(roaring::Roaring) where RowsetId=rowset_id and SegmentId=seg_id and Version <= version`
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org