@ -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);
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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,
|
||||
|
||||
Reference in New Issue
Block a user