From 5e921896eedf87b0fb06bc8a1fd0991b9ac64131 Mon Sep 17 00:00:00 2001 From: neal-zhu <13126959424@163.com> Date: Wed, 28 Aug 2019 23:43:34 +0800 Subject: [PATCH] drop fileds in State that are duplicates of fileds in Saver and fix typo --- db/version_set.cc | 19 +++++++------------ 1 file 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()); }