Add assert to MergeOperator::PartialMergeMulti to check # of operands.

Summary:
Add assert(operands_list.size() >= 2) in MergeOperator::PartialMergeMulti
to ensure it's only be called when we have at least two merge operands.

Test Plan: run merge_test and stringappend_test.

Reviewers: haobo, igor

Reviewed By: igor

CC: leveldb

Differential Revision: https://reviews.facebook.net/D17169
main
Yueh-Hsuan Chiang 11 years ago
parent 5c44a8db61
commit b9ce156e38
  1. 1
      db/merge_operator.cc

@ -18,6 +18,7 @@ bool MergeOperator::PartialMergeMulti(const Slice& key,
const std::deque<Slice>& operand_list, const std::deque<Slice>& operand_list,
std::string* new_value, std::string* new_value,
Logger* logger) const { Logger* logger) const {
assert(operand_list.size() >= 2);
// Simply loop through the operands // Simply loop through the operands
std::string temp_value; std::string temp_value;
Slice temp_slice(operand_list[0]); Slice temp_slice(operand_list[0]);

Loading…
Cancel
Save