diff --git a/mutation_partition.cc b/mutation_partition.cc index b03950bff0..f73fa477f1 100644 --- a/mutation_partition.cc +++ b/mutation_partition.cc @@ -917,7 +917,8 @@ position_in_partition_view rows_entry::position() const { bool rows_entry::equal(const schema& s, const rows_entry& other, const schema& other_schema) const { - return key().equal(s, other.key()) // Only representation-compatible changes are allowed + position_in_partition::equal_compare eq(s); + return eq(position(), other.position()) && row().equal(column_kind::regular_column, s, other.row(), other_schema); } diff --git a/mutation_partition.hh b/mutation_partition.hh index 6175e03e11..d1434a5783 100644 --- a/mutation_partition.hh +++ b/mutation_partition.hh @@ -689,23 +689,36 @@ public: bool empty() const { return _row.empty(); } + struct tri_compare { + position_in_partition::tri_compare _c; + explicit tri_compare(const schema& s) : _c(s) {} + int operator()(const rows_entry& e1, const rows_entry& e2) const { + return _c(e1.position(), e2.position()); + } + int operator()(const clustering_key& key, const rows_entry& e) const { + return _c(position_in_partition_view::for_key(key), e.position()); + } + int operator()(const rows_entry& e, const clustering_key& key) const { + return _c(e.position(), position_in_partition_view::for_key(key)); + } + }; struct compare { - clustering_key::less_compare _c; - compare(const schema& s) : _c(s) {} + tri_compare _c; + explicit compare(const schema& s) : _c(s) {} bool operator()(const rows_entry& e1, const rows_entry& e2) const { - return _c(e1._key, e2._key); + return _c(e1, e2) < 0; } bool operator()(const clustering_key& key, const rows_entry& e) const { - return _c(key, e._key); + return _c(key, e) < 0; } bool operator()(const rows_entry& e, const clustering_key& key) const { - return _c(e._key, key); + return _c(e, key) < 0; } bool operator()(const clustering_key_view& key, const rows_entry& e) const { - return _c(key, e._key); + return _c(key, e) < 0; } bool operator()(const rows_entry& e, const clustering_key_view& key) const { - return _c(e._key, key); + return _c(e, key) < 0; } }; template diff --git a/streamed_mutation.cc b/streamed_mutation.cc index 5a1bf99d41..97da4b7ffe 100644 --- a/streamed_mutation.cc +++ b/streamed_mutation.cc @@ -472,8 +472,7 @@ mutation_fragment_opt range_tombstone_stream::do_get_next() mutation_fragment_opt range_tombstone_stream::get_next(const rows_entry& re) { if (!_list.empty()) { - position_in_partition_view view(position_in_partition_view::clustering_row_tag_t(), re.key()); - return !_cmp(view, _list.begin()->position()) ? do_get_next() : mutation_fragment_opt(); + return !_cmp(re.position(), _list.begin()->position()) ? do_get_next() : mutation_fragment_opt(); } return { }; }