git-hulk commented on code in PR #2174:
URL: https://github.com/apache/kvrocks/pull/2174#discussion_r1527684752
##########
src/storage/redis_db.cc:
##########
@@ -84,25 +84,25 @@ rocksdb::Status Database::ParseMetadata(RedisTypes types,
Slice *bytes, Metadata
return s;
}
-rocksdb::Status Database::GetMetadata(RedisTypes types, const Slice &ns_key,
Metadata *metadata) {
+rocksdb::Status Database::GetMetadata(GetOptions options, RedisTypes types,
const Slice &ns_key, Metadata *metadata) {
std::string raw_value;
Slice rest;
- return GetMetadata(types, ns_key, &raw_value, metadata, &rest);
+ return GetMetadata(options, types, ns_key, &raw_value, metadata, &rest);
}
-rocksdb::Status Database::GetMetadata(RedisTypes types, const Slice &ns_key,
std::string *raw_value, Metadata *metadata,
+rocksdb::Status Database::GetMetadata(GetOptions options, RedisTypes types,
const Slice &ns_key, std::string *raw_value, Metadata *metadata,
Slice *rest) {
- auto s = GetRawMetadata(ns_key, raw_value);
+ auto s = GetRawMetadata(options, ns_key, raw_value);
*rest = *raw_value;
if (!s.ok()) return s;
return ParseMetadata(types, rest, metadata);
}
-rocksdb::Status Database::GetRawMetadata(const Slice &ns_key, std::string
*bytes) {
- LatestSnapShot ss(storage_);
- rocksdb::ReadOptions read_options;
- read_options.snapshot = ss.GetSnapShot();
- return storage_->Get(read_options, metadata_cf_handle_, ns_key, bytes);
+rocksdb::Status Database::GetRawMetadata(GetOptions options, const Slice
&ns_key, std::string *bytes) {
+ rocksdb::ReadOptions opts;
Review Comment:
I cannot quite remember the detail, and we discussed using the same snapshot
in the same command(transaction). But it failed since many places need to be
modified, I guess that's why some places are explicitly using the snapshot but
some of them NOT.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]