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
This commit is contained in:
Yueh-Hsuan Chiang 2014-03-25 13:38:28 -07:00
parent 5c44a8db61
commit b9ce156e38

View File

@ -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]);