You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by ya...@apache.org on 2021/04/19 01:26:19 UTC
[incubator-doris] branch master updated: (#5621) using KeyMayExist
instead of Get when visit rocksdb (#5622)
This is an automated email from the ASF dual-hosted git repository.
yangzhg pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-doris.git
The following commit(s) were added to refs/heads/master by this push:
new 6f000c2 (#5621) using KeyMayExist instead of Get when visit rocksdb (#5622)
6f000c2 is described below
commit 6f000c2ea41cdbe8f799fbb2013724630ed29566
Author: wangbo <50...@qq.com>
AuthorDate: Mon Apr 19 09:25:59 2021 +0800
(#5621) using KeyMayExist instead of Get when visit rocksdb (#5622)
---
be/src/olap/olap_meta.cpp | 15 +++++++++++++++
be/src/olap/olap_meta.h | 2 ++
be/src/olap/rowset/rowset_meta_manager.cpp | 6 +-----
3 files changed, 18 insertions(+), 5 deletions(-)
diff --git a/be/src/olap/olap_meta.cpp b/be/src/olap/olap_meta.cpp
index 73237e2..844f229 100644
--- a/be/src/olap/olap_meta.cpp
+++ b/be/src/olap/olap_meta.cpp
@@ -102,6 +102,21 @@ OLAPStatus OlapMeta::get(const int column_family_index, const std::string& key,
return OLAP_SUCCESS;
}
+bool OlapMeta::key_may_exist(const int column_family_index, const std::string& key,
+ std::string* value) {
+ DorisMetrics::instance()->meta_read_request_total->increment(1);
+ rocksdb::ColumnFamilyHandle* handle = _handles[column_family_index];
+ int64_t duration_ns = 0;
+ bool is_exist = false;
+ {
+ SCOPED_RAW_TIMER(&duration_ns);
+ is_exist = _db->KeyMayExist(ReadOptions(), handle, Slice(key), value);
+ }
+ DorisMetrics::instance()->meta_read_request_duration_us->increment(duration_ns / 1000);
+
+ return is_exist;
+}
+
OLAPStatus OlapMeta::put(const int column_family_index, const std::string& key,
const std::string& value) {
DorisMetrics::instance()->meta_write_request_total->increment(1);
diff --git a/be/src/olap/olap_meta.h b/be/src/olap/olap_meta.h
index c75b170..8e5577c 100644
--- a/be/src/olap/olap_meta.h
+++ b/be/src/olap/olap_meta.h
@@ -37,6 +37,8 @@ public:
OLAPStatus get(const int column_family_index, const std::string& key, std::string* value);
+ bool key_may_exist(const int column_family_index, const std::string& key, std::string* value);
+
OLAPStatus put(const int column_family_index, const std::string& key, const std::string& value);
OLAPStatus remove(const int column_family_index, const std::string& key);
diff --git a/be/src/olap/rowset/rowset_meta_manager.cpp b/be/src/olap/rowset/rowset_meta_manager.cpp
index 85a226f..4ed988d 100644
--- a/be/src/olap/rowset/rowset_meta_manager.cpp
+++ b/be/src/olap/rowset/rowset_meta_manager.cpp
@@ -38,11 +38,7 @@ bool RowsetMetaManager::check_rowset_meta(OlapMeta* meta, TabletUid tablet_uid,
const RowsetId& rowset_id) {
std::string key = ROWSET_PREFIX + tablet_uid.to_string() + "_" + rowset_id.to_string();
std::string value;
- OLAPStatus s = meta->get(META_COLUMN_FAMILY_INDEX, key, &value);
- if (s != OLAP_SUCCESS) {
- return false;
- }
- return true;
+ return meta->key_may_exist(META_COLUMN_FAMILY_INDEX, key, &value);;
}
OLAPStatus RowsetMetaManager::get_rowset_meta(OlapMeta* meta, TabletUid tablet_uid,
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org