You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by mo...@apache.org on 2022/07/08 13:39:19 UTC

[doris] branch master updated: [feature-wip](unique-key-merge-on-write) add interface for segment key bounds, DSIP-018[3/2] (#10655)

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

morningman 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 feeef7e4da [feature-wip](unique-key-merge-on-write) add interface for segment key bounds, DSIP-018[3/2] (#10655)
feeef7e4da is described below

commit feeef7e4dab86c87a15ba724964627a9768ca682
Author: zhannngchen <48...@users.noreply.github.com>
AuthorDate: Fri Jul 8 21:39:13 2022 +0800

    [feature-wip](unique-key-merge-on-write) add interface for segment key bounds, DSIP-018[3/2] (#10655)
    
    Add interfaces for segment key bounds, key bounds will be used to speed up point lookup
    on the primary key index of each segment.
    For the detail, see DSIP-018:https://cwiki.apache.org/confluence/display/DORIS/DSIP-018%3A+Support+Merge-On-Write+implementation+for+UNIQUE+KEY+data+model
    
    KeyBounds will be updated by BetaRowsetWriter, will be used to construct a RowsetTree(based on IntervalTree,
    will be added through next patch)
---
 be/src/olap/rowset/rowset.h      |  5 +++++
 be/src/olap/rowset/rowset_meta.h | 13 +++++++++++++
 gensrc/proto/olap_file.proto     |  8 ++++++++
 3 files changed, 26 insertions(+)

diff --git a/be/src/olap/rowset/rowset.h b/be/src/olap/rowset/rowset.h
index 158848be89..ec2a39652b 100644
--- a/be/src/olap/rowset/rowset.h
+++ b/be/src/olap/rowset/rowset.h
@@ -258,6 +258,11 @@ public:
         }
     }
 
+    virtual Status get_segments_key_bounds(std::vector<KeyBoundsPB>* segments_key_bounds) {
+        _rowset_meta->get_segments_key_bounds(segments_key_bounds);
+        return Status::OK();
+    }
+
 protected:
     friend class RowsetFactory;
 
diff --git a/be/src/olap/rowset/rowset_meta.h b/be/src/olap/rowset/rowset_meta.h
index e4153e2345..c91fe0469d 100644
--- a/be/src/olap/rowset/rowset_meta.h
+++ b/be/src/olap/rowset/rowset_meta.h
@@ -298,6 +298,19 @@ public:
         return score;
     }
 
+    void get_segments_key_bounds(std::vector<KeyBoundsPB>* segments_key_bounds) const {
+        for (const KeyBoundsPB& key_range : _rowset_meta_pb.segments_key_bounds()) {
+            segments_key_bounds->push_back(key_range);
+        }
+    }
+
+    void set_segments_key_bounds(const std::vector<KeyBoundsPB>& segments_key_bounds) {
+        for (const KeyBoundsPB& key_bounds : segments_key_bounds) {
+            KeyBoundsPB* new_key_bounds = _rowset_meta_pb.add_segments_key_bounds();
+            *new_key_bounds = key_bounds;
+        }
+    }
+
     const AlphaRowsetExtraMetaPB& alpha_rowset_extra_meta_pb() const {
         return _rowset_meta_pb.alpha_rowset_extra_meta_pb();
     }
diff --git a/gensrc/proto/olap_file.proto b/gensrc/proto/olap_file.proto
index 0d484a292d..4385d5803d 100644
--- a/gensrc/proto/olap_file.proto
+++ b/gensrc/proto/olap_file.proto
@@ -53,6 +53,11 @@ enum SegmentsOverlapPB {
     NONOVERLAPPING = 2;
 }
 
+message KeyBoundsPB {
+    required bytes min_key = 1;
+    required bytes max_key = 2;
+}
+
 message RowsetMetaPB {
     required int64 rowset_id = 1;
     optional int64 partition_id = 2;
@@ -99,6 +104,9 @@ message RowsetMetaPB {
     optional int64 oldest_write_timestamp = 25 [default = -1];
     // latest write time
     optional int64 newest_write_timestamp = 26 [default = -1];
+    // the encoded segment min/max key of segments in this rowset,
+    // only used in unique key data model with primary_key_index support.
+    repeated KeyBoundsPB segments_key_bounds = 27;
     // spare field id for future use
     optional AlphaRowsetExtraMetaPB alpha_rowset_extra_meta_pb = 50;
     // to indicate whether the data between the segments overlap


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