Always pass MergeContext as pointer, not reference
Summary: To follow the coding convention and make sure when passing reference as a parameter it is also const, pass MergeContext as a pointer to mem tables. Test Plan: make all check Reviewers: ljin, igor Reviewed By: igor Subscribers: leveldb, dhruba, yhchiang Differential Revision: https://reviews.facebook.net/D23085
This commit is contained in:
parent
d343c3fe46
commit
06d986252a
@ -3449,10 +3449,10 @@ Status DBImpl::GetImpl(const ReadOptions& options,
|
|||||||
LookupKey lkey(key, snapshot);
|
LookupKey lkey(key, snapshot);
|
||||||
PERF_TIMER_STOP(get_snapshot_time);
|
PERF_TIMER_STOP(get_snapshot_time);
|
||||||
|
|
||||||
if (sv->mem->Get(lkey, value, &s, merge_context)) {
|
if (sv->mem->Get(lkey, value, &s, &merge_context)) {
|
||||||
// Done
|
// Done
|
||||||
RecordTick(stats_, MEMTABLE_HIT);
|
RecordTick(stats_, MEMTABLE_HIT);
|
||||||
} else if (sv->imm->Get(lkey, value, &s, merge_context)) {
|
} else if (sv->imm->Get(lkey, value, &s, &merge_context)) {
|
||||||
// Done
|
// Done
|
||||||
RecordTick(stats_, MEMTABLE_HIT);
|
RecordTick(stats_, MEMTABLE_HIT);
|
||||||
} else {
|
} else {
|
||||||
@ -3537,9 +3537,9 @@ std::vector<Status> DBImpl::MultiGet(
|
|||||||
assert(mgd_iter != multiget_cf_data.end());
|
assert(mgd_iter != multiget_cf_data.end());
|
||||||
auto mgd = mgd_iter->second;
|
auto mgd = mgd_iter->second;
|
||||||
auto super_version = mgd->super_version;
|
auto super_version = mgd->super_version;
|
||||||
if (super_version->mem->Get(lkey, value, &s, merge_context)) {
|
if (super_version->mem->Get(lkey, value, &s, &merge_context)) {
|
||||||
// Done
|
// Done
|
||||||
} else if (super_version->imm->Get(lkey, value, &s, merge_context)) {
|
} else if (super_version->imm->Get(lkey, value, &s, &merge_context)) {
|
||||||
// Done
|
// Done
|
||||||
} else {
|
} else {
|
||||||
super_version->current->Get(options, lkey, value, &s, &merge_context);
|
super_version->current->Get(options, lkey, value, &s, &merge_context);
|
||||||
|
@ -61,7 +61,7 @@ Status DBImplReadOnly::Get(const ReadOptions& read_options,
|
|||||||
SuperVersion* super_version = cfd->GetSuperVersion();
|
SuperVersion* super_version = cfd->GetSuperVersion();
|
||||||
MergeContext merge_context;
|
MergeContext merge_context;
|
||||||
LookupKey lkey(key, snapshot);
|
LookupKey lkey(key, snapshot);
|
||||||
if (super_version->mem->Get(lkey, value, &s, merge_context)) {
|
if (super_version->mem->Get(lkey, value, &s, &merge_context)) {
|
||||||
} else {
|
} else {
|
||||||
super_version->current->Get(read_options, lkey, value, &s, &merge_context);
|
super_version->current->Get(read_options, lkey, value, &s, &merge_context);
|
||||||
}
|
}
|
||||||
|
@ -430,7 +430,7 @@ static bool SaveValue(void* arg, const char* entry) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool MemTable::Get(const LookupKey& key, std::string* value, Status* s,
|
bool MemTable::Get(const LookupKey& key, std::string* value, Status* s,
|
||||||
MergeContext& merge_context) {
|
MergeContext* merge_context) {
|
||||||
// The sequence number is updated synchronously in version_set.h
|
// The sequence number is updated synchronously in version_set.h
|
||||||
if (IsEmpty()) {
|
if (IsEmpty()) {
|
||||||
// Avoiding recording stats for speed.
|
// Avoiding recording stats for speed.
|
||||||
@ -454,7 +454,7 @@ bool MemTable::Get(const LookupKey& key, std::string* value, Status* s,
|
|||||||
saver.value = value;
|
saver.value = value;
|
||||||
saver.status = s;
|
saver.status = s;
|
||||||
saver.mem = this;
|
saver.mem = this;
|
||||||
saver.merge_context = &merge_context;
|
saver.merge_context = merge_context;
|
||||||
saver.merge_operator = ioptions_.merge_operator;
|
saver.merge_operator = ioptions_.merge_operator;
|
||||||
saver.logger = ioptions_.info_log;
|
saver.logger = ioptions_.info_log;
|
||||||
saver.inplace_update_support = moptions_.inplace_update_support;
|
saver.inplace_update_support = moptions_.inplace_update_support;
|
||||||
|
@ -118,7 +118,7 @@ class MemTable {
|
|||||||
// store MergeInProgress in s, and return false.
|
// store MergeInProgress in s, and return false.
|
||||||
// Else, return false.
|
// Else, return false.
|
||||||
bool Get(const LookupKey& key, std::string* value, Status* s,
|
bool Get(const LookupKey& key, std::string* value, Status* s,
|
||||||
MergeContext& merge_context);
|
MergeContext* merge_context);
|
||||||
|
|
||||||
// Attempts to update the new_value inplace, else does normal Add
|
// Attempts to update the new_value inplace, else does normal Add
|
||||||
// Pseudocode
|
// Pseudocode
|
||||||
|
@ -62,7 +62,7 @@ int MemTableList::size() const {
|
|||||||
// Return the most recent value found, if any.
|
// Return the most recent value found, if any.
|
||||||
// Operands stores the list of merge operations to apply, so far.
|
// Operands stores the list of merge operations to apply, so far.
|
||||||
bool MemTableListVersion::Get(const LookupKey& key, std::string* value,
|
bool MemTableListVersion::Get(const LookupKey& key, std::string* value,
|
||||||
Status* s, MergeContext& merge_context) {
|
Status* s, MergeContext* merge_context) {
|
||||||
for (auto& memtable : memlist_) {
|
for (auto& memtable : memlist_) {
|
||||||
if (memtable->Get(key, value, s, merge_context)) {
|
if (memtable->Get(key, value, s, merge_context)) {
|
||||||
return true;
|
return true;
|
||||||
|
@ -46,7 +46,7 @@ class MemTableListVersion {
|
|||||||
// Search all the memtables starting from the most recent one.
|
// Search all the memtables starting from the most recent one.
|
||||||
// Return the most recent value found, if any.
|
// Return the most recent value found, if any.
|
||||||
bool Get(const LookupKey& key, std::string* value, Status* s,
|
bool Get(const LookupKey& key, std::string* value, Status* s,
|
||||||
MergeContext& merge_context);
|
MergeContext* merge_context);
|
||||||
|
|
||||||
void AddIterators(const ReadOptions& options,
|
void AddIterators(const ReadOptions& options,
|
||||||
std::vector<Iterator*>* iterator_list, Arena* arena);
|
std::vector<Iterator*>* iterator_list, Arena* arena);
|
||||||
|
Loading…
Reference in New Issue
Block a user