mutation/collection_mutation: collection_mutation(): remove unused abstract_type param

This commit is contained in:
Botond Dénes
2026-03-17 15:29:59 +02:00
parent 6926375c4d
commit 24fdfa34dd
27 changed files with 98 additions and 100 deletions

View File

@@ -2657,7 +2657,7 @@ mutation put_or_delete_item::build(schema_ptr schema, api::timestamp_type ts) co
}
auto attrs = attrs_column(*schema);
if (!attrs_collector.empty()) {
auto serialized_map = attrs_collector.to_mut().serialize(*attrs_type());
auto serialized_map = attrs_collector.to_mut().serialize();
row.cells().apply(attrs, std::move(serialized_map));
}
// To allow creation of an item with no attributes, we need a row marker.
@@ -2680,7 +2680,7 @@ mutation put_or_delete_item::build(schema_ptr schema, api::timestamp_type ts) co
// Scylla to handle collection replacements in CQL (see #6084, PR #6491,
// e.g. cql3::maps::setter::execute()) and we utilize it to avoid
// emitting the REMOVE event (resolving #6930).
row.cells().apply(attrs, collection_mutation_description{tombstone{ts - 1, gc_clock::now()}}.serialize(*attrs.type));
row.cells().apply(attrs, collection_mutation_description{tombstone{ts - 1, gc_clock::now()}}.serialize());
// Note that for old tables created with regular LSI and GSI key columns,
// we must also delete the regular columns that are not part of the new
// schema consisting of pk, ck, and :attrs.
@@ -4312,7 +4312,7 @@ std::optional<mutation> update_item_operation::apply(std::unique_ptr<rjson::valu
apply_attribute_updates(previous_item, ts, row, modified_attrs, any_updates, any_deletes);
}
if (!modified_attrs.empty()) {
auto serialized_map = modified_attrs.to_mut().serialize(*attrs_type());
auto serialized_map = modified_attrs.to_mut().serialize();
row.cells().apply(attrs_column(*_schema), std::move(serialized_map));
}
// To allow creation of an item with no attributes, we need a row marker.

View File

@@ -639,7 +639,7 @@ void process_changes_with_splitting(const mutation& base_mutation, change_proces
}
for (auto& nonatomic_update : sr_update.nonatomic_entries) {
auto& cdef = base_schema->column_at(column_kind::static_column, nonatomic_update.id);
m.set_static_cell(cdef, collection_mutation_description{nonatomic_update.t, std::move(nonatomic_update.cells)}.serialize(*cdef.type));
m.set_static_cell(cdef, collection_mutation_description{nonatomic_update.t, std::move(nonatomic_update.cells)}.serialize());
}
processor.process_change(m);
}
@@ -654,7 +654,7 @@ void process_changes_with_splitting(const mutation& base_mutation, change_proces
}
for (auto& nonatomic_update : cr_insert.nonatomic_entries) {
auto& cdef = base_schema->column_at(column_kind::regular_column, nonatomic_update.id);
row.cells().apply(cdef, collection_mutation_description{nonatomic_update.t, std::move(nonatomic_update.cells)}.serialize(*cdef.type));
row.cells().apply(cdef, collection_mutation_description{nonatomic_update.t, std::move(nonatomic_update.cells)}.serialize());
}
row.apply(cr_insert.marker);
@@ -671,7 +671,7 @@ void process_changes_with_splitting(const mutation& base_mutation, change_proces
}
for (auto& nonatomic_update : cr_update.nonatomic_entries) {
auto& cdef = base_schema->column_at(column_kind::regular_column, nonatomic_update.id);
row.apply(cdef, collection_mutation_description{nonatomic_update.t, std::move(nonatomic_update.cells)}.serialize(*cdef.type));
row.apply(cdef, collection_mutation_description{nonatomic_update.t, std::move(nonatomic_update.cells)}.serialize());
}
processor.process_change(m);

View File

@@ -56,7 +56,7 @@ void constants::deleter::execute(mutation& m, const clustering_key_prefix& prefi
collection_mutation_description coll_m;
coll_m.tomb = params.make_tombstone();
m.set_cell(prefix, column, coll_m.serialize(*column.type));
m.set_cell(prefix, column, coll_m.serialize());
} else {
m.set_cell(prefix, column, params.make_dead_cell());
}

View File

@@ -43,7 +43,7 @@ lists::setter::execute(mutation& m, const clustering_key_prefix& prefix, const u
collection_mutation_view_description mut;
mut.tomb = params.make_tombstone_just_before();
m.set_cell(prefix, column, mut.serialize(*column.type));
m.set_cell(prefix, column, mut.serialize());
}
do_append(value, m, prefix, column, params);
}
@@ -94,7 +94,7 @@ lists::setter_by_index::execute(mutation& m, const clustering_key_prefix& prefix
params.make_cell(*ltype->value_comparator(), value.view(), atomic_cell::collection_member::yes));
}
m.set_cell(prefix, column, mut.serialize(*ltype));
m.set_cell(prefix, column, mut.serialize());
}
bool
@@ -127,7 +127,7 @@ lists::setter_by_uuid::execute(mutation& m, const clustering_key_prefix& prefix,
params.make_cell(*ltype->value_comparator(), value.view(), atomic_cell::collection_member::yes));
}
m.set_cell(prefix, column, mut.serialize(*ltype));
m.set_cell(prefix, column, mut.serialize());
}
void
@@ -172,7 +172,7 @@ lists::do_append(const cql3::raw_value& list_value,
throw exceptions::invalid_request_exception("Too many list values per single CQL statement or batch");
}
}
m.set_cell(prefix, column, appended.serialize(*ltype));
m.set_cell(prefix, column, appended.serialize());
} else {
auto ltype = static_cast<const list_type_impl*>(column.type.get());
// for frozen lists, we're overwriting the whole cell value
@@ -234,7 +234,7 @@ lists::prepender::execute(mutation& m, const clustering_key_prefix& prefix, cons
throw exceptions::invalid_request_exception("Too many list values per single CQL statement or batch");
}
}
m.set_cell(prefix, column, mut.serialize(*ltype));
m.set_cell(prefix, column, mut.serialize());
}
bool
@@ -290,7 +290,7 @@ lists::discarder::execute(mutation& m, const clustering_key_prefix& prefix, cons
mnew.cells.emplace_back(std::move(eidx), params.make_dead_cell());
}
}
m.set_cell(prefix, column, mnew.serialize(*ltype));
m.set_cell(prefix, column, mnew.serialize());
}
bool
@@ -320,7 +320,7 @@ lists::discarder_by_index::execute(mutation& m, const clustering_key_prefix& pre
const data_value& eidx_dv = existing_list[idx].first;
bytes eidx = eidx_dv.type()->decompose(eidx_dv);
mut.cells.emplace_back(std::move(eidx), params.make_dead_cell());
m.set_cell(prefix, column, mut.serialize(*column.type));
m.set_cell(prefix, column, mut.serialize());
}
}

View File

@@ -31,7 +31,7 @@ maps::setter::execute(mutation& m, const clustering_key_prefix& row_key, const u
// Delete all cells first, then put new ones
collection_mutation_description mut;
mut.tomb = params.make_tombstone_just_before();
m.set_cell(row_key, column, mut.serialize(*column.type));
m.set_cell(row_key, column, mut.serialize());
}
do_put(m, row_key, params, value, column);
}
@@ -58,7 +58,7 @@ maps::setter_by_key::execute(mutation& m, const clustering_key_prefix& prefix, c
collection_mutation_description update;
update.cells.emplace_back(std::move(key).to_bytes(), std::move(avalue));
m.set_cell(prefix, column, update.serialize(*ctype));
m.set_cell(prefix, column, update.serialize());
}
void
@@ -83,7 +83,7 @@ maps::do_put(mutation& m, const clustering_key_prefix& prefix, const update_para
mut.cells.emplace_back(to_bytes(e.first), params.make_cell(*ctype->get_values_type(), raw_value_view::make_value(e.second), atomic_cell::collection_member::yes));
}
m.set_cell(prefix, column, mut.serialize(*ctype));
m.set_cell(prefix, column, mut.serialize());
} else {
// for frozen maps, we're overwriting the whole cell
if (map_value.is_null()) {
@@ -104,7 +104,7 @@ maps::discarder_by_key::execute(mutation& m, const clustering_key_prefix& prefix
collection_mutation_description mut;
mut.cells.emplace_back(std::move(key).to_bytes(), params.make_dead_cell());
m.set_cell(prefix, column, mut.serialize(*column.type));
m.set_cell(prefix, column, mut.serialize());
}
}

View File

@@ -26,7 +26,7 @@ sets::setter::execute(mutation& m, const clustering_key_prefix& row_key, const u
// Delete all cells first, then add new ones
collection_mutation_description mut;
mut.tomb = params.make_tombstone_just_before();
m.set_cell(row_key, column, mut.serialize(*column.type));
m.set_cell(row_key, column, mut.serialize());
}
adder::do_add(m, row_key, params, value, column);
}
@@ -63,7 +63,7 @@ sets::adder::do_add(mutation& m, const clustering_key_prefix& row_key, const upd
mut.cells.emplace_back(to_bytes(*e), params.make_cell(*set_type.value_comparator(), bytes_view(), atomic_cell::collection_member::yes));
}
m.set_cell(row_key, column, mut.serialize(set_type));
m.set_cell(row_key, column, mut.serialize());
} else if (!value.is_null()) {
// for frozen sets, we're overwriting the whole cell
value.view().with_value([&] (const FragmentedView auto& v) {
@@ -93,7 +93,7 @@ sets::discarder::execute(mutation& m, const clustering_key_prefix& row_key, cons
}
mut.cells.push_back({to_bytes(*e), params.make_dead_cell()});
}
m.set_cell(row_key, column, mut.serialize(*column.type));
m.set_cell(row_key, column, mut.serialize());
}
void sets::element_discarder::execute(mutation& m, const clustering_key_prefix& row_key, const update_parameters& params)
@@ -105,7 +105,7 @@ void sets::element_discarder::execute(mutation& m, const clustering_key_prefix&
}
collection_mutation_description mut;
mut.cells.emplace_back(std::move(elt).to_bytes(), params.make_dead_cell());
m.set_cell(row_key, column, mut.serialize(*column.type));
m.set_cell(row_key, column, mut.serialize());
}
}

View File

@@ -60,7 +60,7 @@ void user_types::setter::execute(mutation& m, const clustering_key_prefix& row_k
}
}
m.set_cell(row_key, column, mut.serialize(type));
m.set_cell(row_key, column, mut.serialize());
} else {
if (!ut_value.is_null()) {
m.set_cell(row_key, column, params.make_cell(type, ut_value.view()));
@@ -82,7 +82,7 @@ void user_types::setter_by_field::execute(mutation& m, const clustering_key_pref
? params.make_cell(*type.type(_field_idx), value.view(), atomic_cell::collection_member::yes)
: params.make_dead_cell());
m.set_cell(row_key, column, mut.serialize(type));
m.set_cell(row_key, column, mut.serialize());
}
void user_types::deleter_by_field::execute(mutation& m, const clustering_key_prefix& row_key, const update_parameters& params) {
@@ -91,7 +91,7 @@ void user_types::deleter_by_field::execute(mutation& m, const clustering_key_pre
collection_mutation_description mut;
mut.cells.emplace_back(serialize_field_index(_field_idx), params.make_dead_cell());
m.set_cell(row_key, column, mut.serialize(*column.type));
m.set_cell(row_key, column, mut.serialize());
}
}

View File

@@ -1127,7 +1127,7 @@ make_map_mutation(const Map& map,
mut.cells.emplace_back(ktyp->decompose(data_value(te.first)), atomic_cell::make_live(*vtyp, timestamp, vtyp->decompose(data_value(te.second)), atomic_cell::collection_member::yes));
}
return mut.serialize(*column_type);
return mut.serialize();
} else {
map_type_impl::native_type tmp;
tmp.reserve(map.size());
@@ -1390,7 +1390,7 @@ make_list_mutation(const std::vector<T, Args...>& values,
atomic_cell::make_live(*vtyp, timestamp, vtyp->decompose(std::move(dv)), atomic_cell::collection_member::yes));
}
return m.serialize(*column_type);
return m.serialize();
} else {
list_type_impl::native_type tmp;
tmp.reserve(values.size());

View File

@@ -732,7 +732,7 @@ static collection_mutation make_empty(
n.cells.emplace_back(c.first, make_empty(c.second));
}
});
return n.serialize(type);
return n.serialize();
}
// In some cases, we need to copy to a view table even columns which have not

View File

@@ -33,10 +33,10 @@ bool collection_mutation_input_stream::empty() const {
return _src.empty();
}
collection_mutation::collection_mutation(const abstract_type& type, collection_mutation_view v)
collection_mutation::collection_mutation(collection_mutation_view v)
: _data(v.data) {}
collection_mutation::collection_mutation(const abstract_type& type, managed_bytes data)
collection_mutation::collection_mutation(managed_bytes data)
: _data(std::move(data)) {}
collection_mutation::operator collection_mutation_view() const
@@ -241,7 +241,6 @@ concept CollectionMutationAdaptor = requires(const Element& e, managed_bytes_mut
template <typename Adaptor, typename Iterator>
requires CollectionMutationAdaptor<Adaptor, std::iter_value_t<Iterator>>
static collection_mutation serialize_collection_mutation(
const abstract_type& type,
const tombstone& tomb,
std::ranges::subrange<Iterator> cells) {
auto element_size = [] (size_t c, auto&& e) -> size_t {
@@ -273,7 +272,7 @@ static collection_mutation serialize_collection_mutation(
writek(kv);
writev(kv);
}
return collection_mutation(type, std::move(ret));
return collection_mutation(std::move(ret));
}
namespace {
@@ -300,12 +299,12 @@ struct atomic_cell_adaptor {
}
collection_mutation collection_mutation_description::serialize(const abstract_type& type) const {
return serialize_collection_mutation<atomic_cell_adaptor>(type, tomb, std::ranges::subrange(cells.begin(), cells.end()));
collection_mutation collection_mutation_description::serialize() const {
return serialize_collection_mutation<atomic_cell_adaptor>(tomb, std::ranges::subrange(cells.begin(), cells.end()));
}
collection_mutation collection_mutation_view_description::serialize(const abstract_type& type) const {
return serialize_collection_mutation<atomic_cell_adaptor>(type, tomb, std::ranges::subrange(cells.begin(), cells.end()));
collection_mutation collection_mutation_view_description::serialize() const {
return serialize_collection_mutation<atomic_cell_adaptor>(tomb, std::ranges::subrange(cells.begin(), cells.end()));
}
namespace {
@@ -364,7 +363,7 @@ struct serialized_cell_adaptor {
collection_mutation read_from_collection_cell_view(const abstract_type& type, const ser::collection_cell_view& collection) {
auto tomb = collection.tomb();
auto cells = collection.elements();
return serialize_collection_mutation<serialized_cell_adaptor>(type, tomb, std::ranges::subrange(cells.begin(), cells.end()));
return serialize_collection_mutation<serialized_cell_adaptor>(tomb, std::ranges::subrange(cells.begin(), cells.end()));
}
template <typename C>
@@ -424,7 +423,7 @@ collection_mutation merge(const abstract_type& type, collection_mutation_view a,
[] (const abstract_type& o) -> collection_mutation_view_description {
throw std::runtime_error(format("collection_mutation merge: unknown type: {}", o.name()));
}
)).serialize(type);
)).serialize();
});
});
}
@@ -470,7 +469,7 @@ collection_mutation difference(const abstract_type& type, collection_mutation_vi
[] (const abstract_type& o) -> collection_mutation_view_description {
throw std::runtime_error(format("collection_mutation difference: unknown type: {}", o.name()));
}
)).serialize(type);
)).serialize();
});
});
}

View File

@@ -44,7 +44,7 @@ struct collection_mutation_description {
can_gc_fn&, gc_clock::time_point gc_before, compaction_garbage_collector* collector = nullptr);
// Packs the data to a serialized blob.
collection_mutation serialize(const abstract_type&) const;
collection_mutation serialize() const;
};
// Similar to collection_mutation_description, except that it doesn't store the cells' data, only observes it.
@@ -57,7 +57,7 @@ struct collection_mutation_view_description {
collection_mutation_description materialize(const abstract_type&) const;
// Packs the data to a serialized blob.
collection_mutation serialize(const abstract_type&) const;
collection_mutation serialize() const;
};
class collection_mutation_input_stream {
@@ -125,8 +125,8 @@ public:
managed_bytes _data;
collection_mutation() {}
collection_mutation(const abstract_type&, collection_mutation_view);
collection_mutation(const abstract_type&, managed_bytes);
collection_mutation(collection_mutation_view);
collection_mutation(managed_bytes);
operator collection_mutation_view() const;
};

View File

@@ -87,7 +87,7 @@ converting_mutation_partition_applier::accept_cell(row& dst, column_kind kind, c
));
if (new_view.tomb || !new_view.cells.empty()) {
dst.apply(new_def, new_view.serialize(*new_def.type));
dst.apply(new_def, new_view.serialize());
}
});
}

View File

@@ -88,7 +88,7 @@ public:
virtual void collect(column_id id, collection_mutation_description mut) override {
if (mut.tomb || !mut.cells.empty()) {
const auto& cdef = _schema.column_at(_kind, id);
_row.apply(cdef, mut.serialize(*cdef.type));
_row.apply(cdef, mut.serialize());
}
}
virtual void collect(row_marker marker) override {

View File

@@ -1664,7 +1664,7 @@ compact_and_expire_result row::compact_and_expire(
if (m.cells.empty() && m.tomb <= tomb.tomb()) {
erase = true;
} else {
c = m.serialize(*def.type);
c = m.serialize();
}
});
}

View File

@@ -290,7 +290,7 @@ timestamp_based_splitting_mutation_writer::split_collection(atomic_cell_or_colle
}
for (auto&& [bucket, bucket_mv] : mutations_by_bucket) {
pieces_by_bucket.emplace(bucket, bucket_mv.serialize(*cdef.type));
pieces_by_bucket.emplace(bucket, bucket_mv.serialize());
}
});

View File

@@ -46,7 +46,7 @@ public:
}
virtual void accept_static_cell(column_id id, collection_mutation_view collection) override {
accept_static_cell(id, collection_mutation(*_schema.static_column_at(id).type, std::move(collection)));
accept_static_cell(id, collection_mutation(std::move(collection)));
}
void accept_static_cell(column_id id, collection_mutation&& collection) {
@@ -76,7 +76,7 @@ public:
}
virtual void accept_row_cell(column_id id, collection_mutation_view collection) override {
accept_row_cell(id, collection_mutation(*_schema.regular_column_at(id).type, std::move(collection)));
accept_row_cell(id, collection_mutation(std::move(collection)));
}
void accept_row_cell(column_id id, collection_mutation collection) {
@@ -136,7 +136,7 @@ public:
virtual void accept_static_cell(column_id id, collection_mutation_view collection) override {
row& r = _partition->static_row().maybe_create();
r.append_cell(id, collection_mutation(*_schema->static_column_at(id).type, std::move(collection)));
r.append_cell(id, collection_mutation(std::move(collection)));
}
virtual future<> accept_row_tombstone(const range_tombstone& rt) override {
@@ -166,7 +166,7 @@ public:
virtual void accept_row_cell(column_id id, collection_mutation_view collection) override {
row& r = _current_row->cells();
r.append_cell(id, collection_mutation(*_schema->regular_column_at(id).type, std::move(collection)));
r.append_cell(id, collection_mutation(std::move(collection)));
}
virtual future<> accept_end_of_partition() override {

View File

@@ -69,7 +69,7 @@ Builder& topology_mutation_builder_base<Builder>::apply_set(const char* cell, co
cm.tomb = tombstone(self().timestamp() - 1, gc_clock::now());
}
self().row().apply(*cdef, cm.serialize(*cdef->type));
self().row().apply(*cdef, cm.serialize());
return self();
}
@@ -84,7 +84,7 @@ Builder& topology_mutation_builder_base<Builder>::del(const char* cell) {
} else {
collection_mutation_description cm;
cm.tomb = tombstone{self().timestamp(), gc_clock::now()};
self().row().apply(*cdef, cm.serialize(*cdef->type));
self().row().apply(*cdef, cm.serialize());
}
return self();
}

View File

@@ -252,7 +252,7 @@ private:
if (!_cdef) {
return;
}
auto ac = atomic_cell_or_collection::from_collection_mutation(cm.serialize(*_cdef->type));
auto ac = atomic_cell_or_collection::from_collection_mutation(cm.serialize());
if (_cdef->is_static()) {
mf.mutate_as_static_row(s, [&] (static_row& sr) mutable {
sr.set_cell(*_cdef, std::move(ac));

View File

@@ -450,7 +450,7 @@ public:
const column_definition& column_def = get_column_definition(column_id);
if (!_cm.cells.empty() || (_cm.tomb && _cm.tomb.timestamp > column_def.dropped_at())) {
check_schema_mismatch(column_info, column_def);
_cells.push_back({column_def.id, _cm.serialize(*column_def.type)});
_cells.push_back({column_def.id, _cm.serialize()});
}
}
_cm.tomb = {};

View File

@@ -245,7 +245,7 @@ SEASTAR_THREAD_TEST_CASE(test_freeze_unfreeze_with_large_collection_cells) {
for (size_t i = 0; i < num_entries; ++i) {
cmd.cells.emplace_back(int32_type->decompose(int32_t(i)), make_atomic_cell(atomic_cell::collection_member::yes));
}
m.set_clustered_cell(ck, cdef_collection, atomic_cell_or_collection(cmd.serialize(*collection_type)));
m.set_clustered_cell(ck, cdef_collection, atomic_cell_or_collection(cmd.serialize()));
}
for (auto do_freeze_gently : {false, true}) {

View File

@@ -242,19 +242,19 @@ SEASTAR_TEST_CASE(test_map_mutations) {
auto& column = *s->get_column_definition("s1");
auto mmut1 = make_collection_mutation({}, int32_type->decompose(101), make_collection_member(utf8_type, sstring("101")));
mutation m1(s, key);
m1.set_static_cell(column, mmut1.serialize(*my_map_type));
m1.set_static_cell(column, mmut1.serialize());
mt->apply(m1);
auto mmut2 = make_collection_mutation({}, int32_type->decompose(102), make_collection_member(utf8_type, sstring("102")));
mutation m2(s, key);
m2.set_static_cell(column, mmut2.serialize(*my_map_type));
m2.set_static_cell(column, mmut2.serialize());
mt->apply(m2);
auto mmut3 = make_collection_mutation({}, int32_type->decompose(103), make_collection_member(utf8_type, sstring("103")));
mutation m3(s, key);
m3.set_static_cell(column, mmut3.serialize(*my_map_type));
m3.set_static_cell(column, mmut3.serialize());
mt->apply(m3);
auto mmut2o = make_collection_mutation({}, int32_type->decompose(102), make_collection_member(utf8_type, sstring("102 override")));
mutation m2o(s, key);
m2o.set_static_cell(column, mmut2o.serialize(*my_map_type));
m2o.set_static_cell(column, mmut2o.serialize());
mt->apply(m2o);
auto p = get_partition(semaphore.make_permit(), *mt, key);
@@ -283,19 +283,19 @@ SEASTAR_TEST_CASE(test_set_mutations) {
auto& column = *s->get_column_definition("s1");
auto mmut1 = make_collection_mutation({}, int32_type->decompose(101), make_atomic_cell());
mutation m1(s, key);
m1.set_static_cell(column, mmut1.serialize(*my_set_type));
m1.set_static_cell(column, mmut1.serialize());
mt->apply(m1);
auto mmut2 = make_collection_mutation({}, int32_type->decompose(102), make_atomic_cell());
mutation m2(s, key);
m2.set_static_cell(column, mmut2.serialize(*my_set_type));
m2.set_static_cell(column, mmut2.serialize());
mt->apply(m2);
auto mmut3 = make_collection_mutation({}, int32_type->decompose(103), make_atomic_cell());
mutation m3(s, key);
m3.set_static_cell(column, mmut3.serialize(*my_set_type));
m3.set_static_cell(column, mmut3.serialize());
mt->apply(m3);
auto mmut2o = make_collection_mutation({}, int32_type->decompose(102), make_atomic_cell());
mutation m2o(s, key);
m2o.set_static_cell(column, mmut2o.serialize(*my_set_type));
m2o.set_static_cell(column, mmut2o.serialize());
mt->apply(m2o);
auto p = get_partition(semaphore.make_permit(), *mt, key);
@@ -325,19 +325,19 @@ SEASTAR_TEST_CASE(test_list_mutations) {
auto make_key = [] { return timeuuid_type->decompose(utils::UUID_gen::get_time_UUID()); };
auto mmut1 = make_collection_mutation({}, make_key(), make_collection_member(int32_type, 101));
mutation m1(s, key);
m1.set_static_cell(column, mmut1.serialize(*my_list_type));
m1.set_static_cell(column, mmut1.serialize());
mt->apply(m1);
auto mmut2 = make_collection_mutation({}, make_key(), make_collection_member(int32_type, 102));
mutation m2(s, key);
m2.set_static_cell(column, mmut2.serialize(*my_list_type));
m2.set_static_cell(column, mmut2.serialize());
mt->apply(m2);
auto mmut3 = make_collection_mutation({}, make_key(), make_collection_member(int32_type, 103));
mutation m3(s, key);
m3.set_static_cell(column, mmut3.serialize(*my_list_type));
m3.set_static_cell(column, mmut3.serialize());
mt->apply(m3);
auto mmut2o = make_collection_mutation({}, make_key(), make_collection_member(int32_type, 102));
mutation m2o(s, key);
m2o.set_static_cell(column, mmut2o.serialize(*my_list_type));
m2o.set_static_cell(column, mmut2o.serialize());
mt->apply(m2o);
auto p = get_partition(semaphore.make_permit(), *mt, key);
@@ -373,19 +373,19 @@ SEASTAR_THREAD_TEST_CASE(test_udt_mutations) {
auto mut1 = make_collection_mutation({}, serialize_field_index(0), make_collection_member(int32_type, 0),
serialize_field_index(2), make_collection_member(long_type, int64_t(2)));
mutation m1(s, key);
m1.set_static_cell(column, mut1.serialize(*ut));
m1.set_static_cell(column, mut1.serialize());
mt->apply(m1);
// {d: "text"}
auto mut2 = make_collection_mutation({}, serialize_field_index(3), make_collection_member(utf8_type, "text"));
mutation m2(s, key);
m2.set_static_cell(column, mut2.serialize(*ut));
m2.set_static_cell(column, mut2.serialize());
mt->apply(m2);
// {c: 3}
auto mut3 = make_collection_mutation({}, serialize_field_index(2), make_collection_member(long_type, int64_t(3)));
mutation m3(s, key);
m3.set_static_cell(column, mut3.serialize(*ut));
m3.set_static_cell(column, mut3.serialize());
mt->apply(m3);
auto p = get_partition(semaphore.make_permit(), *mt, key);
@@ -446,7 +446,7 @@ SEASTAR_THREAD_TEST_CASE(test_large_collection_allocation) {
mutation mut(schema, pk);
row r;
r.apply(cdef, atomic_cell_or_collection(cmd.serialize(*collection_type)));
r.apply(cdef, atomic_cell_or_collection(cmd.serialize()));
mut.apply(mutation_fragment(*schema, semaphore.make_permit(), clustering_row(clustering_key_prefix::make_empty(), {}, {}, std::move(r))));
return mut;
@@ -507,10 +507,10 @@ SEASTAR_THREAD_TEST_CASE(test_large_collection_serialization_exception_safety) {
}
// We need an undisturbed run first to create all thread_local variables.
cmd.serialize(*collection_type);
cmd.serialize();
memory::with_allocation_failures([&] {
cmd.serialize(*collection_type);
cmd.serialize();
});
}
@@ -1277,7 +1277,7 @@ SEASTAR_TEST_CASE(test_mutation_diff) {
m1.set_clustered_cell(ckey2, *s->get_column_definition("v2"),
atomic_cell::make_live(*bytes_type, 2, bytes_type->decompose(data_value(bytes("v2:value4")))));
auto mset1 = make_collection_mutation({}, int32_type->decompose(1), make_atomic_cell(), int32_type->decompose(2), make_atomic_cell());
m1.set_clustered_cell(ckey2, *s->get_column_definition("v3"), mset1.serialize(*my_set_type));
m1.set_clustered_cell(ckey2, *s->get_column_definition("v3"), mset1.serialize());
mutation m2(s, partition_key::from_single_value(*s, "key1"));
m2.set_clustered_cell(ckey1, *s->get_column_definition("v1"),
@@ -1290,7 +1290,7 @@ SEASTAR_TEST_CASE(test_mutation_diff) {
m2.set_clustered_cell(ckey2, *s->get_column_definition("v2"),
atomic_cell::make_live(*bytes_type, 3, bytes_type->decompose(data_value(bytes("v2:value4a")))));
auto mset2 = make_collection_mutation({}, int32_type->decompose(1), make_atomic_cell(), int32_type->decompose(3), make_atomic_cell());
m2.set_clustered_cell(ckey2, *s->get_column_definition("v3"), mset2.serialize(*my_set_type));
m2.set_clustered_cell(ckey2, *s->get_column_definition("v3"), mset2.serialize());
mutation m3(s, partition_key::from_single_value(*s, "key1"));
m3.set_clustered_cell(ckey1, *s->get_column_definition("v1"),
@@ -1301,7 +1301,7 @@ SEASTAR_TEST_CASE(test_mutation_diff) {
m3.set_clustered_cell(ckey2, *s->get_column_definition("v2"),
atomic_cell::make_live(*bytes_type, 3, bytes_type->decompose(data_value(bytes("v2:value4a")))));
auto mset3 = make_collection_mutation({}, int32_type->decompose(1), make_atomic_cell());
m3.set_clustered_cell(ckey2, *s->get_column_definition("v3"), mset3.serialize(*my_set_type));
m3.set_clustered_cell(ckey2, *s->get_column_definition("v3"), mset3.serialize());
mutation m12(s, partition_key::from_single_value(*s, "key1"));
m12.apply(m1);
@@ -1992,12 +1992,12 @@ SEASTAR_TEST_CASE(test_collection_cell_diff) {
mcol1.cells.emplace_back(
bytes(reinterpret_cast<const int8_t*>(uuid.data()), uuid.size()),
atomic_cell::make_live(*bytes_type, api::timestamp_type(1), to_bytes("element")));
m1.set_clustered_cell(clustering_key::make_empty(), col, mcol1.serialize(*col.type));
m1.set_clustered_cell(clustering_key::make_empty(), col, mcol1.serialize());
mutation m2(s, k);
collection_mutation_description mcol2;
mcol2.tomb = tombstone(api::timestamp_type(2), gc_clock::now());
m2.set_clustered_cell(clustering_key::make_empty(), col, mcol2.serialize(*col.type));
m2.set_clustered_cell(clustering_key::make_empty(), col, mcol2.serialize());
mutation m12 = m1;
m12.apply(m2);
@@ -2621,7 +2621,7 @@ SEASTAR_THREAD_TEST_CASE(test_cell_external_memory_usage) {
auto collection_type = map_type_impl::get_instance(int32_type, bytes_type, true);
auto m = make_collection_mutation({ }, int32_type->decompose(0), make_collection_member(bytes_type, data_value(bytes(bv))));
auto cell = atomic_cell_or_collection(m.serialize(*collection_type));
auto cell = atomic_cell_or_collection(m.serialize());
with_allocator(alloc, [&] {
auto before = alloc.allocated_bytes();
@@ -3881,7 +3881,7 @@ SEASTAR_TEST_CASE(test_compact_and_expire_cell_stats) {
collection_mutation_description desc;
desc.tomb = tomb;
do_make_collection(desc, std::forward<decltype(cells)>(cells)...);
return desc.serialize(*collection_type);
return desc.serialize();
};
const auto check = [&] (row_content rc, row_tombstone rt, compact_and_expire_result expected_res, std::source_location sl = std::source_location::current()) {
@@ -3898,7 +3898,7 @@ SEASTAR_TEST_CASE(test_compact_and_expire_cell_stats) {
}
if (rc.collection_column) {
const auto cdef = *s.get_column_definition(column_names.at(col_kind)[1]);
r.apply(cdef, atomic_cell_or_collection(collection_mutation(*collection_type, *rc.collection_column)));
r.apply(cdef, atomic_cell_or_collection(collection_mutation(*rc.collection_column)));
}
auto res = r.compact_and_expire(s, col_kind, rt, now, always_gc, now);
BOOST_REQUIRE_EQUAL(res, expected_res);

View File

@@ -3620,7 +3620,7 @@ SEASTAR_TEST_CASE(test_write_collection_wide_update) {
set_values.cells.emplace_back(int32_type->decompose(2), atomic_cell::make_live(*bytes_type, write_timestamp, bytes_view{}));
set_values.cells.emplace_back(int32_type->decompose(3), atomic_cell::make_live(*bytes_type, write_timestamp, bytes_view{}));
mut.set_clustered_cell(clustering_key::make_empty(), *s->get_column_definition("col"), set_values.serialize(*set_of_ints_type));
mut.set_clustered_cell(clustering_key::make_empty(), *s->get_column_definition("col"), set_values.serialize());
write_mut_and_validate(env, s, table_name, mut);
});
@@ -3644,7 +3644,7 @@ SEASTAR_TEST_CASE(test_write_collection_incremental_update) {
collection_mutation_description set_values;
set_values.cells.emplace_back(int32_type->decompose(2), atomic_cell::make_live(*bytes_type, write_timestamp, bytes_view{}));
mut.set_clustered_cell(clustering_key::make_empty(), *s->get_column_definition("col"), set_values.serialize(*set_of_ints_type));
mut.set_clustered_cell(clustering_key::make_empty(), *s->get_column_definition("col"), set_values.serialize());
write_mut_and_validate(env, s, table_name, mut);
});
@@ -4937,7 +4937,7 @@ SEASTAR_TEST_CASE(test_write_interleaved_atomic_and_collection_columns) {
set_values.tomb = tombstone {write_timestamp - 1, write_time_point};
set_values.cells.emplace_back(int32_type->decompose(3), atomic_cell::make_live(*bytes_type, write_timestamp, bytes_view{}));
set_values.cells.emplace_back(int32_type->decompose(4), atomic_cell::make_live(*bytes_type, write_timestamp, bytes_view{}));
mut.set_clustered_cell(ckey, *s->get_column_definition("rc4"), set_values.serialize(*set_of_ints_type));
mut.set_clustered_cell(ckey, *s->get_column_definition("rc4"), set_values.serialize());
mut.set_cell(ckey, "rc5", data_value{5}, write_timestamp);
@@ -4976,7 +4976,7 @@ SEASTAR_TEST_CASE(test_write_static_interleaved_atomic_and_collection_columns) {
set_values.tomb = tombstone {write_timestamp - 1, write_time_point};
set_values.cells.emplace_back(int32_type->decompose(3), atomic_cell::make_live(*bytes_type, write_timestamp, bytes_view{}));
set_values.cells.emplace_back(int32_type->decompose(4), atomic_cell::make_live(*bytes_type, write_timestamp, bytes_view{}));
mut.set_static_cell(*s->get_column_definition("st4"), set_values.serialize(*set_of_ints_type));
mut.set_static_cell(*s->get_column_definition("st4"), set_values.serialize());
mut.set_static_cell("st5", data_value{5}, write_timestamp);
@@ -5794,7 +5794,7 @@ SEASTAR_TEST_CASE(test_legacy_udt_in_collection_table) {
collection_mutation_description desc;
desc.cells.emplace_back(int32_type->decompose(0),
atomic_cell::make_live(*ut, write_timestamp, ut->decompose(ut_val), atomic_cell::collection_member::yes));
mut.set_clustered_cell(ckey, *m_cdef, desc.serialize(*m_type));
mut.set_clustered_cell(ckey, *m_cdef, desc.serialize());
}
// fm = {0: {a: 0, b: 0}}
@@ -5805,7 +5805,7 @@ SEASTAR_TEST_CASE(test_legacy_udt_in_collection_table) {
collection_mutation_description desc;
desc.cells.emplace_back(int32_type->decompose(0),
atomic_cell::make_live(*fm_type, write_timestamp, fm_type->decompose(fm_val), atomic_cell::collection_member::yes));
mut.set_clustered_cell(ckey, *mm_cdef, desc.serialize(*mm_type));
mut.set_clustered_cell(ckey, *mm_cdef, desc.serialize());
}
// fmm = {0: {0: {a: 0, b: 0}}},
@@ -5816,7 +5816,7 @@ SEASTAR_TEST_CASE(test_legacy_udt_in_collection_table) {
collection_mutation_description desc;
desc.cells.emplace_back(ut->decompose(ut_val),
atomic_cell::make_live(*bytes_type, write_timestamp, bytes{}, atomic_cell::collection_member::yes));
mut.set_clustered_cell(ckey, *s_cdef, desc.serialize(*s_type));
mut.set_clustered_cell(ckey, *s_cdef, desc.serialize());
}
// fs = {{a: 0, b: 0}},
@@ -5827,7 +5827,7 @@ SEASTAR_TEST_CASE(test_legacy_udt_in_collection_table) {
collection_mutation_description desc;
desc.cells.emplace_back(timeuuid_type->decompose(utils::UUID("7fb27e80-7b12-11ea-9fad-f4d108a9e4a3")),
atomic_cell::make_live(*ut, write_timestamp, ut->decompose(ut_val), atomic_cell::collection_member::yes));
mut.set_clustered_cell(ckey, *l_cdef, desc.serialize(*l_type));
mut.set_clustered_cell(ckey, *l_cdef, desc.serialize());
}
// fl = [{a: 0, b: 0}]

View File

@@ -141,16 +141,16 @@ SEASTAR_TEST_CASE(datafile_generation_11) {
set_mut.cells.emplace_back(to_bytes("2"), make_atomic_cell(bytes_type, {}));
set_mut.cells.emplace_back(to_bytes("3"), make_atomic_cell(bytes_type, {}));
m.set_clustered_cell(c_key, set_col, set_mut.serialize(*set_col.type));
m.set_clustered_cell(c_key, set_col, set_mut.serialize());
m.set_static_cell(static_set_col, set_mut.serialize(*static_set_col.type));
m.set_static_cell(static_set_col, set_mut.serialize());
auto key2 = partition_key::from_exploded(*s, {to_bytes("key2")});
mutation m2(s, key2);
collection_mutation_description set_mut_single;
set_mut_single.cells.emplace_back(to_bytes("4"), make_atomic_cell(bytes_type, {}));
m2.set_clustered_cell(c_key, set_col, set_mut_single.serialize(*set_col.type));
m2.set_clustered_cell(c_key, set_col, set_mut_single.serialize());
auto mt = make_memtable(s, {std::move(m), std::move(m2)}).get();

View File

@@ -135,7 +135,7 @@ mutation mutation_description::build(schema_ptr s) const {
atomic_cell::collection_member::yes));
}
}
m.set_static_cell(*cdef, mut.serialize(*cdef->type));
m.set_static_cell(*cdef, mut.serialize());
}
), value_or_collection);
}
@@ -186,7 +186,7 @@ mutation mutation_description::build(schema_ptr s) const {
}
}
m.set_clustered_cell(ck, *cdef, mut.serialize(*cdef->type));
m.set_clustered_cell(ck, *cdef, mut.serialize());
}
), value_or_collection);
}

View File

@@ -2290,7 +2290,7 @@ public:
std::sort(m.cells.begin(), m.cells.end(), [] (auto&& c1, auto&& c2) {
return timeuuid_type->as_less_comparator()(c1.first, c2.first);
});
return m.serialize(*ctype);
return m.serialize();
};
auto get_dead_cell = [&] () -> atomic_cell_or_collection{
if (col.is_atomic() || col.is_counter()) {
@@ -2298,7 +2298,7 @@ public:
}
collection_mutation_description m;
m.tomb = tombstone(gen_timestamp(timestamp_level::collection_tombstone), new_expiry());
return m.serialize(*col.type);
return m.serialize();
};
// FIXME: generate expiring cells

View File

@@ -154,8 +154,7 @@ public:
cmd.cells.emplace_back(k, atomic_cell::make_live(*bytes_type, t, v, atomic_cell::collection_member::yes));
}
const auto map_type = get_collection_type();
auto serialized_map = cmd.serialize(*map_type);
auto serialized_map = cmd.serialize();
const column_definition& c1_def = *_s->get_column_definition(to_bytes("c1"));
m.set_clustered_cell(ck, c1_def, atomic_cell_or_collection(std::move(serialized_map)));
return t;

View File

@@ -742,7 +742,7 @@ struct collection_with_type {
collection_mutation data;
data_type type;
collection_with_type(collection_mutation_view data_view, data_type type) : data(*type, data_view), type(std::move(type)) { }
collection_with_type(collection_mutation_view data_view, data_type type) : data(data_view), type(std::move(type)) { }
};
int collection_index_l(lua_State* l) {