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 b1711e94b7 (unique-key-merge-on-write) Add tablet lookup interface,
DSIP-18[3/4] (#10820)
b1711e94b7 is described below
commit b1711e94b79a1e4dab30f3d9a69e4460b76b16b7
Author: zhannngchen <[email protected]>
AuthorDate: Fri Jul 15 20:49:28 2022 +0800
(unique-key-merge-on-write) Add tablet lookup interface, DSIP-18[3/4]
(#10820)
Add lookup_row_key interface for tablet and segment.
---
be/src/olap/rowset/segment_v2/segment.cpp | 5 +++++
be/src/olap/rowset/segment_v2/segment.h | 2 ++
be/src/olap/tablet.cpp | 6 ++++++
be/src/olap/tablet.h | 5 +++++
be/src/olap/utils.h | 10 ++++++++++
5 files changed, 28 insertions(+)
diff --git a/be/src/olap/rowset/segment_v2/segment.cpp
b/be/src/olap/rowset/segment_v2/segment.cpp
index bc4a750788..c95c28e41d 100644
--- a/be/src/olap/rowset/segment_v2/segment.cpp
+++ b/be/src/olap/rowset/segment_v2/segment.cpp
@@ -223,5 +223,10 @@ Status Segment::new_bitmap_index_iterator(uint32_t cid,
BitmapIndexIterator** it
return Status::OK();
}
+Status Segment::lookup_row_key(const Slice& key, RowLocation* row_location) {
+ //TODO(liaoxin01): implement it after index related code merged.
+ return Status::OK();
+}
+
} // namespace segment_v2
} // namespace doris
diff --git a/be/src/olap/rowset/segment_v2/segment.h
b/be/src/olap/rowset/segment_v2/segment.h
index 2c9cb83df1..64f8582936 100644
--- a/be/src/olap/rowset/segment_v2/segment.h
+++ b/be/src/olap/rowset/segment_v2/segment.h
@@ -100,6 +100,8 @@ public:
return _sk_index_decoder->num_items() - 1;
}
+ Status lookup_row_key(const Slice& key, RowLocation* row_location);
+
// only used by UT
const SegmentFooterPB& footer() const { return _footer; }
diff --git a/be/src/olap/tablet.cpp b/be/src/olap/tablet.cpp
index 366755770e..ef04985989 100644
--- a/be/src/olap/tablet.cpp
+++ b/be/src/olap/tablet.cpp
@@ -1818,4 +1818,10 @@ const TabletSchema& Tablet::tablet_schema() const {
return *rowset_meta->tablet_schema();
}
+Status Tablet::lookup_row_key(const Slice& encoded_key, RowLocation*
row_location) {
+ // TODO(zhannngchen): to be implemented in next patch, align with
rowset-tree usage and
+ // update.
+ return Status::NotFound("can't find key in all rowsets");
+}
+
} // namespace doris
diff --git a/be/src/olap/tablet.h b/be/src/olap/tablet.h
index 3e20c3f230..c6ae64fab6 100644
--- a/be/src/olap/tablet.h
+++ b/be/src/olap/tablet.h
@@ -305,6 +305,11 @@ public:
// Physically remove remote rowsets.
void remove_all_remote_rowsets();
+ // Lookup the row location of `encoded_key`, the function sets
`row_location` on success.
+ // NOTE: the method only works in unique key model with primary key index,
you will got a
+ // not supported error in other data model.
+ Status lookup_row_key(const Slice& encoded_key, RowLocation* row_location);
+
private:
Status _init_once_action();
void _print_missed_versions(const std::vector<Version>& missed_versions)
const;
diff --git a/be/src/olap/utils.h b/be/src/olap/utils.h
index 8cd6f2b2c4..c7b8b1a11d 100644
--- a/be/src/olap/utils.h
+++ b/be/src/olap/utils.h
@@ -284,4 +284,14 @@ bool valid_bool(const std::string& value_str);
} \
} while (0)
+struct RowLocation {
+ RowLocation() : segment_id(0), row_id(0) {}
+ RowLocation(uint32_t sid, uint32_t rid) : segment_id(sid), row_id(rid) {}
+ RowLocation(RowsetId rsid, uint32_t sid, uint32_t rid)
+ : rowset_id(rsid), segment_id(sid), row_id(rid) {}
+ RowsetId rowset_id;
+ uint32_t segment_id;
+ uint32_t row_id;
+};
+
} // namespace doris
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]