From 10cebec79efa43a6f3e02183049ee091ae335cd1 Mon Sep 17 00:00:00 2001 From: Yueh-Hsuan Chiang Date: Thu, 27 Mar 2014 16:15:25 -0700 Subject: [PATCH] Fix the bug in MergeUtil which causes mixing values of different keys. Summary: Fix the bug in MergeUtil which causes mixing values of different keys. Test Plan: stringappend_test make all check Reviewers: haobo, igor Reviewed By: igor CC: leveldb Differential Revision: https://reviews.facebook.net/D17235 --- db/merge_helper.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/db/merge_helper.cc b/db/merge_helper.cc index f5244498d4..0e36f6ae07 100644 --- a/db/merge_helper.cc +++ b/db/merge_helper.cc @@ -40,12 +40,12 @@ void MergeHelper::MergeUntil(Iterator* iter, SequenceNumber stop_before, ParseInternalKey(keys_.back(), &orig_ikey); bool hit_the_next_user_key = false; - ParsedInternalKey ikey; std::string merge_result; // Temporary value for merge results if (steps) { ++(*steps); } for (iter->Next(); iter->Valid(); iter->Next()) { + ParsedInternalKey ikey; assert(operands_.size() >= 1); // Should be invariants! assert(keys_.size() == operands_.size()); @@ -194,7 +194,7 @@ void MergeHelper::MergeUntil(Iterator* iter, SequenceNumber stop_before, if (operands_.size() >= 2 && operands_.size() >= min_partial_merge_operands_ && user_merge_operator_->PartialMergeMulti( - ikey.user_key, + orig_ikey.user_key, std::deque(operands_.begin(), operands_.end()), &merge_result, logger_)) { // Merging of operands (associative merge) was successful.