Skip to content

Commit 34f9da1

Browse files
committed
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
1 parent ebaff6f commit 34f9da1

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

db/merge_operator.cc

+4-2
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,10 @@ bool MergeOperator::PartialMergeMulti(const Slice& key,
2020
Logger* logger) const {
2121
// Simply loop through the operands
2222
std::string temp_value;
23-
Slice temp_slice;
24-
for (const auto& operand : operand_list) {
23+
Slice temp_slice(operand_list[0]);
24+
25+
for (int i = 1; i < operand_list.size(); ++i) {
26+
auto& operand = operand_list[i];
2527
if (!PartialMerge(key, temp_slice, operand, &temp_value, logger)) {
2628
return false;
2729
}

0 commit comments

Comments
 (0)