Replace exception by setting valid_ = false in DBIter::MergeValuesNewToOld()

Summary: Replace exception by setting valid_ = false in DBIter::MergeValuesNewToOld().

Test Plan:
Not sure if I am right at this, but it seems we currently don't have a good
way to test that code path as it requires dynamically set merge_operator = nullptr
at the time while Merge() is calling.

Reviewers: igor, sdong

Reviewed By: sdong

Subscribers: dhruba, leveldb

Differential Revision: https://reviews.facebook.net/D29811
main
Yueh-Hsuan Chiang 10 years ago
parent c0dee851c3
commit 5f719d7202
  1. 5
      db/db_iter.cc

@ -281,8 +281,9 @@ void DBIter::MergeValuesNewToOld() {
if (!user_merge_operator_) { if (!user_merge_operator_) {
Log(InfoLogLevel::ERROR_LEVEL, Log(InfoLogLevel::ERROR_LEVEL,
logger_, "Options::merge_operator is null."); logger_, "Options::merge_operator is null.");
throw std::logic_error("DBIter::MergeValuesNewToOld() with" status_ = Status::InvalidArgument("user_merge_operator_ must be set.");
" Options::merge_operator null"); valid_ = false;
return;
} }
// Start the merge process by pushing the first operand // Start the merge process by pushing the first operand

Loading…
Cancel
Save