diff options
author | neal-zhu <13126959424@163.com> | 2019-08-28 23:43:34 +0800 |
---|---|---|
committer | neal-zhu <13126959424@163.com> | 2019-08-28 23:43:34 +0800 |
commit | 5e921896eedf87b0fb06bc8a1fd0991b9ac64131 (patch) | |
tree | 9c9ccdf4d261a755391b71ec0969d957b69d5913 | |
parent | 107a75b62c19cce901ce10619b63c4b7acc9a0be (diff) | |
download | leveldb-5e921896eedf87b0fb06bc8a1fd0991b9ac64131.tar.gz |
drop fileds in State that are duplicates of fileds in Saver and fix typo
-rw-r--r-- | db/version_set.cc | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/db/version_set.cc b/db/version_set.cc index 3ddddf3..fd5e3ab 100644 --- a/db/version_set.cc +++ b/db/version_set.cc @@ -332,9 +332,6 @@ Status Version::Get(const ReadOptions& options, const LookupKey& k, GetStats* stats; const ReadOptions* options; Slice ikey; - Slice user_key; - const Comparator* ucmp; - std::string* value; FileMetaData* last_file_read; int last_file_read_level; @@ -364,14 +361,15 @@ Status Version::Get(const ReadOptions& options, const LookupKey& k, } switch (state->saver.state) { case kNotFound: - return true; // Keep saerching in other files + return true; // Keep searching in other files case kFound: state->found = true; return false; case kDeleted: return false; case kCorrupt: - state->s = Status::Corruption("corrupted key for ", state->user_key); + state->s = + Status::Corruption("corrupted key for ", state->saver.user_key); state->found = true; return false; } @@ -386,17 +384,14 @@ Status Version::Get(const ReadOptions& options, const LookupKey& k, state.options = &options; state.ikey = k.internal_key(); - state.user_key = k.user_key(); - state.ucmp = vset_->icmp_.user_comparator(); - state.value = value; state.vset = vset_; state.saver.state = kNotFound; - state.saver.ucmp = state.ucmp; - state.saver.user_key = state.user_key; - state.saver.value = state.value; + state.saver.ucmp = vset_->icmp_.user_comparator(); + state.saver.user_key = k.user_key(); + state.saver.value = value; - ForEachOverlapping(state.user_key, state.ikey, &state, &State::Match); + ForEachOverlapping(state.saver.user_key, state.ikey, &state, &State::Match); return state.found ? state.s : Status::NotFound(Slice()); } |