mirror of
https://github.com/facebook/rocksdb.git
synced 2024-12-01 16:15:59 +00:00
cda4006e87
Summary: * PartialMerge api now takes a list of operands instead of two operands. * Add min_pertial_merge_operands to Options, indicating the minimum number of operands to trigger partial merge. * This diff is based on Schalk's previous diff (D14601), but it also includes necessary changes such as updating the pure C api for partial merge. Test Plan: * make check all * develop tests for cases where partial merge takes more than two operands. TODOs (from Schalk): * Add test with min_partial_merge_operands > 2. * Perform benchmarks to measure the performance improvements (can probably use results of task #2837810.) * Add description of problem to doc/index.html. * Change wiki pages to reflect the interface changes. Reviewers: haobo, igor, vamsi Reviewed By: haobo CC: leveldb, dhruba Differential Revision: https://reviews.facebook.net/D16815
52 lines
1.8 KiB
C++
52 lines
1.8 KiB
C++
/**
|
|
* A TEST MergeOperator for rocksdb that implements string append.
|
|
* It is built using the MergeOperator interface rather than the simpler
|
|
* AssociativeMergeOperator interface. This is useful for testing/benchmarking.
|
|
* While the two operators are semantically the same, all production code
|
|
* should use the StringAppendOperator defined in stringappend.{h,cc}. The
|
|
* operator defined in the present file is primarily for testing.
|
|
*
|
|
* @author Deon Nicholas (dnicholas@fb.com)
|
|
* Copyright 2013 Facebook
|
|
*/
|
|
|
|
#pragma once
|
|
#include <deque>
|
|
#include <string>
|
|
|
|
#include "rocksdb/merge_operator.h"
|
|
#include "rocksdb/slice.h"
|
|
|
|
namespace rocksdb {
|
|
|
|
class StringAppendTESTOperator : public MergeOperator {
|
|
public:
|
|
// Constructor with delimiter
|
|
explicit StringAppendTESTOperator(char delim_char);
|
|
|
|
virtual bool FullMerge(const Slice& key,
|
|
const Slice* existing_value,
|
|
const std::deque<std::string>& operand_sequence,
|
|
std::string* new_value,
|
|
Logger* logger) const override;
|
|
|
|
virtual bool PartialMergeMulti(const Slice& key,
|
|
const std::deque<Slice>& operand_list,
|
|
std::string* new_value, Logger* logger) const
|
|
override;
|
|
|
|
virtual const char* Name() const override;
|
|
|
|
private:
|
|
// A version of PartialMerge that actually performs "partial merging".
|
|
// Use this to simulate the exact behaviour of the StringAppendOperator.
|
|
bool _AssocPartialMergeMulti(const Slice& key,
|
|
const std::deque<Slice>& operand_list,
|
|
std::string* new_value, Logger* logger) const;
|
|
|
|
char delim_; // The delimiter is inserted between elements
|
|
|
|
};
|
|
|
|
} // namespace rocksdb
|