From 132306fbf00b67a6a776dc4b4ebb8198c5a4f490 Mon Sep 17 00:00:00 2001 From: Sagar Vemuri Date: Tue, 15 Aug 2017 14:54:41 -0700 Subject: [PATCH] Remove PartialMerge implementation from Cassandra merge operator Summary: `PartialMergeMulti` implementation is enough for Cassandra, and `PartialMerge` is not required. Implementing both will just duplicate the code. As per https://github.com/facebook/rocksdb/blob/master/include/rocksdb/merge_operator.h#L130-L135 : ``` // The default implementation of PartialMergeMulti will use this function // as a helper, for backward compatibility. Any successor class of // MergeOperator should either implement PartialMerge or PartialMergeMulti, // although implementing PartialMergeMulti is suggested as it is in general // more effective to merge multiple operands at a time instead of two // operands at a time. ``` Closes https://github.com/facebook/rocksdb/pull/2737 Reviewed By: scv119 Differential Revision: D5633073 Pulled By: sagar0 fbshipit-source-id: ef4fa102c22fec6a0175ed12f5c44c15afe3c8ca --- utilities/cassandra/merge_operator.cc | 21 --------------------- utilities/cassandra/merge_operator.h | 6 ------ 2 files changed, 27 deletions(-) diff --git a/utilities/cassandra/merge_operator.cc b/utilities/cassandra/merge_operator.cc index 3c9cb7f74..715ef8586 100644 --- a/utilities/cassandra/merge_operator.cc +++ b/utilities/cassandra/merge_operator.cc @@ -47,27 +47,6 @@ bool CassandraValueMergeOperator::FullMergeV2( return true; } -// Implementation for the merge operation (merges two Cassandra values) -bool CassandraValueMergeOperator::PartialMerge(const Slice& key, - const Slice& left_operand, - const Slice& right_operand, - std::string* new_value, - Logger* logger) const { - // Clear the *new_value for writing. - assert(new_value); - new_value->clear(); - - std::vector row_values; - row_values.push_back(RowValue::Deserialize(left_operand.data(), - left_operand.size())); - row_values.push_back(RowValue::Deserialize(right_operand.data(), - right_operand.size())); - RowValue merged = RowValue::Merge(std::move(row_values)); - new_value->reserve(merged.Size()); - merged.Serialize(new_value); - return true; -} - bool CassandraValueMergeOperator::PartialMergeMulti( const Slice& key, const std::deque& operand_list, diff --git a/utilities/cassandra/merge_operator.h b/utilities/cassandra/merge_operator.h index edbf12001..679474075 100644 --- a/utilities/cassandra/merge_operator.h +++ b/utilities/cassandra/merge_operator.h @@ -20,12 +20,6 @@ public: virtual bool FullMergeV2(const MergeOperationInput& merge_in, MergeOperationOutput* merge_out) const override; - virtual bool PartialMerge(const Slice& key, - const Slice& left_operand, - const Slice& right_operand, - std::string* new_value, - Logger* logger) const override; - virtual bool PartialMergeMulti(const Slice& key, const std::deque& operand_list, std::string* new_value,