From 6926375c4d5caa79f1489c200af56dbe18bfbf06 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Botond=20D=C3=A9nes?= Date: Tue, 17 Mar 2026 16:09:19 +0200 Subject: [PATCH] mutation/atomic_cell: drop unused type param from from_bytes() The abstract_type parameter was needed by the old IMR-based atomic-cell serialization format. When we reverted to the simpler managed_bytes representation, the parameter became a no-op but was never removed. Drop it from all overloads of atomic_cell_view::from_bytes() and atomic_cell_mutable_view::from_bytes() and update all call sites. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- mutation/atomic_cell.cc | 4 ++-- mutation/atomic_cell.hh | 6 +++--- mutation/atomic_cell_or_collection.hh | 4 ++-- mutation/collection_mutation.cc | 12 ++++++------ tools/lua_sstable_consumer.cc | 4 ++-- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/mutation/atomic_cell.cc b/mutation/atomic_cell.cc index 6d559d8134..81a2c3d56b 100644 --- a/mutation/atomic_cell.cc +++ b/mutation/atomic_cell.cc @@ -140,8 +140,8 @@ bool atomic_cell_or_collection::equals(const abstract_type& type, const atomic_c } if (type.is_atomic()) { - auto a = atomic_cell_view::from_bytes(type, _data); - auto b = atomic_cell_view::from_bytes(type, other._data); + auto a = atomic_cell_view::from_bytes(_data); + auto b = atomic_cell_view::from_bytes(other._data); if (a.timestamp() != b.timestamp()) { return false; } diff --git a/mutation/atomic_cell.hh b/mutation/atomic_cell.hh index 14ff9cdeec..8efcef6c9f 100644 --- a/mutation/atomic_cell.hh +++ b/mutation/atomic_cell.hh @@ -297,10 +297,10 @@ class atomic_cell_view final : public basic_atomic_cell_view { : basic_atomic_cell_view(view) {} friend class atomic_cell; public: - static atomic_cell_view from_bytes(const abstract_type& t, managed_bytes_view v) { + static atomic_cell_view from_bytes(managed_bytes_view v) { return atomic_cell_view(v); } - static atomic_cell_view from_bytes(const abstract_type& t, bytes_view v) { + static atomic_cell_view from_bytes(bytes_view v) { return atomic_cell_view(managed_bytes_view(v)); } @@ -325,7 +325,7 @@ class atomic_cell_mutable_view final : public basic_atomic_cell_view(); in.read_fragmented(key_size); // Skip auto vsize = in.read_trivial(); - auto value = atomic_cell_view::from_bytes(type, in.read_fragmented(vsize)); + auto value = atomic_cell_view::from_bytes(in.read_fragmented(vsize)); if (value.is_live(tomb, now, false)) { return true; } @@ -91,7 +91,7 @@ api::timestamp_type collection_mutation_view::last_update(const abstract_type& t const auto key_size = in.read_trivial(); in.read_fragmented(key_size); // Skip auto vsize = in.read_trivial(); - auto value = atomic_cell_view::from_bytes(type, in.read_fragmented(vsize)); + auto value = atomic_cell_view::from_bytes(in.read_fragmented(vsize)); max = std::max(value.timestamp(), max); } @@ -503,22 +503,22 @@ deserialize_collection_mutation(const abstract_type& type, collection_mutation_i return visit(type, make_visitor( [&] (const collection_type_impl& ctype) { // value_comparator(), ugh - return deserialize_collection_mutation(in, [&ctype] (collection_mutation_input_stream& in) { + return deserialize_collection_mutation(in, [] (collection_mutation_input_stream& in) { // FIXME: we could probably avoid the need for size auto ksize = in.read_trivial(); auto key = in.read_linearized(ksize); auto vsize = in.read_trivial(); - auto value = atomic_cell_view::from_bytes(*ctype.value_comparator(), in.read_fragmented(vsize)); + auto value = atomic_cell_view::from_bytes(in.read_fragmented(vsize)); return std::make_pair(key, value); }); }, [&] (const user_type_impl& utype) { - return deserialize_collection_mutation(in, [&utype] (collection_mutation_input_stream& in) { + return deserialize_collection_mutation(in, [] (collection_mutation_input_stream& in) { // FIXME: we could probably avoid the need for size auto ksize = in.read_trivial(); auto key = in.read_linearized(ksize); auto vsize = in.read_trivial(); - auto value = atomic_cell_view::from_bytes(*utype.type(deserialize_field_index(key)), in.read_fragmented(vsize)); + auto value = atomic_cell_view::from_bytes(in.read_fragmented(vsize)); return std::make_pair(key, value); }); }, diff --git a/tools/lua_sstable_consumer.cc b/tools/lua_sstable_consumer.cc index 791635b1ec..168d6f2816 100644 --- a/tools/lua_sstable_consumer.cc +++ b/tools/lua_sstable_consumer.cc @@ -629,7 +629,7 @@ struct counter_shards_value { int counter_shards_value_tostring_l(lua_State* l) { auto& csv = pop_userdata_as_ref(l, 1); lua_pop(l, 1); - auto cv = counter_cell_view(atomic_cell_view::from_bytes(*csv.type, csv.data)); + auto cv = counter_cell_view(atomic_cell_view::from_bytes(csv.data)); lua::push_sstring(l, format("{}", cv.total_value())); return 1; } @@ -638,7 +638,7 @@ int counter_shards_value_index_l(lua_State* l) { auto field = lua_tostring(l, 2); auto& csv = pop_userdata_as_ref(l, 1); lua_pop(l, 2); - auto cv = counter_cell_view(atomic_cell_view::from_bytes(*csv.type, csv.data)); + auto cv = counter_cell_view(atomic_cell_view::from_bytes(csv.data)); if (strcmp(field, "value") == 0) { lua::push_data_value(l, data_value(cv.total_value())); } else if (strcmp(field, "shards") == 0) {