db/merge_helper.cc
// TODO(agiardullo): Clean up merge callsites to use this func
Clean up merge callsites to use this func
Clean up merge callsites to use this func
Status MergeHelper::TimedFullMerge(const Slice& key, const Slice* value,
                                   const std::deque<std::string>& operands,
                                   const MergeOperator* merge_operator,
                                   Statistics* statistics, Env* env,
                                   Logger* logger, std::string* result) {
  if (operands.size() == 0) {
    result->assign(value->data(), value->size());
    return Status::OK();
  }
  if (merge_operator == nullptr) {
    return Status::NotSupported("Provide a merge_operator when opening DB");
  }
  StopWatchNano timer(env, statistics != nullptr);
  PERF_TIMER_GUARD(merge_operator_time_nanos);
  bool success =
      merge_operator->FullMerge(key, value, operands, result, logger);
  RecordTick(statistics, MERGE_OPERATION_TOTAL_TIME,
             env != nullptr ? timer.ElapsedNanos() : 0);
  if (!success) {
    RecordTick(statistics, NUMBER_MERGE_FAILURES);
    return Status::Corruption("Error: Could not perform merge.");
  }
  return Status::OK();
}
Status MergeHelper :: TimedFullMerge ( const Slice & key , const Slice * value , const std :: deque < std :: string > & operands , const MergeOperator * merge_operator , Statistics * statistics , Env * env , Logger * logger , std :: string * result ) { if ( operands . size ( ) == 0 ) { result -> assign ( value -> data ( ) , value -> size ( ) ) ; return Status :: OK ( ) ; } if ( merge_operator == nullptr ) { return Status :: NotSupported ( " " ) ; } StopWatchNano timer ( env , statistics != nullptr ) ; PERF_TIMER_GUARD ( merge_operator_time_nanos ) ; bool success = merge_operator -> FullMerge ( key , value , operands , result , logger ) ; RecordTick ( statistics , MERGE_OPERATION_TOTAL_TIME , env != nullptr ? timer . ElapsedNanos ( ) : 0 ) ; if ( ! success ) { RecordTick ( statistics , NUMBER_MERGE_FAILURES ) ; return Status :: Corruption ( " " ) ; } return Status :: OK ( ) ; }
TODO(agiardullo): Clean up merge callsites to use this func
TODO ( agiardullo ) : Clean up merge callsites to use this func
// Setup to time the merge // Do the merge