Fix the failure of stringappend_test caused by PartialMergeMulti.

Summary:
Fix a bug that PartialMergeMulti will try to merge the first operand
with an empty slice.

Test Plan: run stringappend_test and merge_test.

Reviewers: haobo, igor

Reviewed By: haobo

CC: leveldb

Differential Revision: https://reviews.facebook.net/D17157
This commit is contained in:
Yueh-Hsuan Chiang 2014-03-25 11:50:09 -07:00
parent ebaff6f9e2
commit 34f9da1cef

View File

@ -20,8 +20,10 @@ bool MergeOperator::PartialMergeMulti(const Slice& key,
Logger* logger) const {
// Simply loop through the operands
std::string temp_value;
Slice temp_slice;
for (const auto& operand : operand_list) {
Slice temp_slice(operand_list[0]);
for (int i = 1; i < operand_list.size(); ++i) {
auto& operand = operand_list[i];
if (!PartialMerge(key, temp_slice, operand, &temp_value, logger)) {
return false;
}