From 380bc0aa0d8ae5eaff3d2db77021dd8037868ffb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Guilherme=20Vanz?= Date: Fri, 19 Jan 2018 22:01:54 -0200 Subject: [PATCH] Swap arguments order of mutation constructor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Swap arguments in the mutation constructor keeping the same standard from the constructor variants. Refs #3084 Signed-off-by: José Guilherme Vanz Message-Id: <20180120000154.3823-1-guilherme.sft@gmail.com> --- canonical_mutation.cc | 2 +- cql3/statements/modification_statement.cc | 2 +- db/batchlog_manager.cc | 4 +- db/commitlog/commitlog_replayer.cc | 2 +- db/hints/manager.cc | 2 +- db/schema_tables.cc | 44 ++++----- db/system_keyspace.cc | 2 +- frozen_mutation.cc | 2 +- mutation.hh | 4 +- mutation_partition.cc | 2 +- mutation_rebuilder.hh | 4 +- service/storage_proxy.cc | 4 +- streamed_mutation.cc | 2 +- tests/batchlog_manager_test.cc | 2 +- tests/cache_flat_mutation_reader_test.cc | 14 +-- tests/cell_locker_test.cc | 4 +- tests/counter_test.cc | 22 ++--- tests/database_test.cc | 4 +- tests/flat_mutation_reader_test.cc | 6 +- tests/frozen_mutation_test.cc | 10 +- tests/memory_footprint.cc | 4 +- tests/memtable_test.cc | 2 +- tests/mutation_query_test.cc | 20 ++-- tests/mutation_reader_test.cc | 42 ++++----- tests/mutation_source_test.cc | 34 +++---- tests/mutation_test.cc | 106 ++++++++++----------- tests/mvcc_test.cc | 4 +- tests/perf/perf_cache_eviction.cc | 2 +- tests/perf/perf_mutation.cc | 2 +- tests/perf/perf_mutation_readers.cc | 8 +- tests/perf/perf_sstable.hh | 2 +- tests/perf_row_cache_update.cc | 2 +- tests/row_cache_alloc_stress.cc | 8 +- tests/row_cache_stress_test.cc | 2 +- tests/row_cache_test.cc | 72 +++++++-------- tests/schema_change_test.cc | 2 +- tests/simple_schema.hh | 2 +- tests/sstable_datafile_test.cc | 108 +++++++++++----------- tests/sstable_mutation_test.cc | 18 ++-- tests/sstable_resharding_test.cc | 2 +- tests/sstable_test.cc | 2 +- tests/streamed_mutation_test.cc | 2 +- thrift/handler.cc | 10 +- 43 files changed, 297 insertions(+), 297 deletions(-) diff --git a/canonical_mutation.cc b/canonical_mutation.cc index f4de2fc2a6..fa60dcc042 100644 --- a/canonical_mutation.cc +++ b/canonical_mutation.cc @@ -75,7 +75,7 @@ mutation canonical_mutation::to_mutation(schema_ptr s) const { auto version = mv.schema_version(); auto pk = mv.key(); - mutation m(std::move(pk), std::move(s)); + mutation m(std::move(s), std::move(pk)); if (version == m.schema()->version()) { auto partition_view = mutation_partition_view::from_view(mv.partition()); diff --git a/cql3/statements/modification_statement.cc b/cql3/statements/modification_statement.cc index 2bb1ee631e..cbd9626a3c 100644 --- a/cql3/statements/modification_statement.cc +++ b/cql3/statements/modification_statement.cc @@ -159,7 +159,7 @@ modification_statement::get_mutations(distributed& proxy mutations.reserve(keys->size()); for (auto key : *keys) { // We know key.start() must be defined since we only allow EQ relations on the partition key. - mutations.emplace_back(std::move(*key.start()->value().key()), s); + mutations.emplace_back(s, std::move(*key.start()->value().key())); auto& m = mutations.back(); for (auto&& r : *ranges) { this->add_update_for_key(m, r, *params_ptr); diff --git a/db/batchlog_manager.cc b/db/batchlog_manager.cc index 80ea304c39..f642953a8a 100644 --- a/db/batchlog_manager.cc +++ b/db/batchlog_manager.cc @@ -162,7 +162,7 @@ mutation db::batchlog_manager::get_batch_log_mutation_for(const std::vector db::batchlog_manager::replay_all_failed_batches() { // delete batch auto schema = _qp.db().local().find_schema(system_keyspace::NAME, system_keyspace::BATCHLOG); auto key = partition_key::from_singular(*schema, id); - mutation m(key, schema); + mutation m(schema, key); auto now = service::client_state(service::client_state::internal_tag()).get_timestamp(); m.partition().apply_delete(*schema, clustering_key_prefix::make_empty(), tombstone(now, gc_clock::now())); return _qp.proxy().local().mutate_locally(m); diff --git a/db/commitlog/commitlog_replayer.cc b/db/commitlog/commitlog_replayer.cc index a054a6ea99..574ce76fcb 100644 --- a/db/commitlog/commitlog_replayer.cc +++ b/db/commitlog/commitlog_replayer.cc @@ -295,7 +295,7 @@ future<> db::commitlog_replayer::impl::process(stats* s, temporary_buffer cm_it = local_cm.emplace(fm.schema_version(), src_cm).first; } const column_mapping& cm = cm_it->second; - mutation m(fm.decorated_key(*cf.schema()), cf.schema()); + mutation m(cf.schema(), fm.decorated_key(*cf.schema())); converting_mutation_partition_applier v(cm, *cf.schema(), m.partition()); fm.partition().accept(cm, v); cf.apply(std::move(m)); diff --git a/db/hints/manager.cc b/db/hints/manager.cc index e089359e68..9ecb687e15 100644 --- a/db/hints/manager.cc +++ b/db/hints/manager.cc @@ -371,7 +371,7 @@ mutation manager::end_point_hints_manager::sender::get_mutation(lw_shared_ptrversion() != fm.schema_version()) { - mutation m(fm.decorated_key(*cf.schema()), cf.schema()); + mutation m(cf.schema(), fm.decorated_key(*cf.schema())); converting_mutation_partition_applier v(cm, *cf.schema(), m.partition()); fm.partition().accept(cm, v); diff --git a/db/schema_tables.cc b/db/schema_tables.cc index 2718452f0b..3aa42cbb9f 100644 --- a/db/schema_tables.cc +++ b/db/schema_tables.cc @@ -616,7 +616,7 @@ future query_partition_mutation(service::storage_proxy& proxy, .then([dk = std::move(dk), s](foreign_ptr> res, cache_temperature hit_rate) { auto&& partitions = res->partitions(); if (partitions.size() == 0) { - return mutation(std::move(dk), s); + return mutation(s, std::move(dk)); } else if (partitions.size() == 1) { return partitions[0].mut().unfreeze(s); } else { @@ -1233,7 +1233,7 @@ std::vector make_create_keyspace_mutations(lw_shared_ptr mutations; schema_ptr s = keyspaces(); auto pkey = partition_key::from_singular(*s, keyspace->name()); - mutation m(pkey, s); + mutation m(s, pkey); auto ckey = clustering_key_prefix::make_empty(); m.set_cell(ckey, "durable_writes", keyspace->durable_writes(), timestamp); @@ -1261,13 +1261,13 @@ std::vector make_drop_keyspace_mutations(lw_shared_ptr mutations; for (auto&& schema_table : all_tables()) { auto pkey = partition_key::from_exploded(*schema_table, {utf8_type->decompose(keyspace->name())}); - mutation m{pkey, schema_table}; + mutation m{schema_table, pkey}; m.partition().apply(tombstone{timestamp, gc_clock::now()}); mutations.emplace_back(std::move(m)); } auto&& schema = db::system_keyspace::built_indexes(); auto pkey = partition_key::from_exploded(*schema, {utf8_type->decompose(keyspace->name())}); - mutation m{pkey, schema}; + mutation m{schema, pkey}; m.partition().apply(tombstone{timestamp, gc_clock::now()}); mutations.emplace_back(std::move(m)); return mutations; @@ -1379,7 +1379,7 @@ void add_type_to_schema_mutation(user_type type, api::timestamp_type timestamp, schema_ptr s = types(); auto pkey = partition_key::from_singular(*s, type->_keyspace); auto ckey = clustering_key::from_singular(*s, type->get_name_as_string()); - mutation m{pkey, s}; + mutation m{s, pkey}; auto field_names_column = s->get_column_definition("field_names"); auto field_names = make_list_mutation(type->field_names(), *field_names_column, timestamp, [](auto&& name) { @@ -1411,7 +1411,7 @@ future> make_drop_type_mutations(lw_shared_ptr_keyspace); auto ckey = clustering_key::from_singular(*s, type->get_name_as_string()); - mutation m{pkey, s}; + mutation m{s, pkey}; m.partition().apply_delete(*s, ckey, tombstone(timestamp, gc_clock::now())); mutations.emplace_back(std::move(m)); @@ -1527,7 +1527,7 @@ mutation make_scylla_tables_mutation(schema_ptr table, api::timestamp_type times schema_ptr s = tables(); auto pkey = partition_key::from_singular(*s, table->ks_name()); auto ckey = clustering_key::from_singular(*s, table->cf_name()); - mutation m(pkey, scylla_tables()); + mutation m(scylla_tables(), pkey); m.set_clustered_cell(ckey, "version", utils::UUID(table->version()), timestamp); return m; } @@ -1541,7 +1541,7 @@ static schema_mutations make_table_mutations(schema_ptr table, api::timestamp_ty // we don't keep a property the user has removed schema_ptr s = tables(); auto pkey = partition_key::from_singular(*s, table->ks_name()); - mutation m{pkey, s}; + mutation m{s, pkey}; auto ckey = clustering_key::from_singular(*s, table->cf_name()); m.set_clustered_cell(ckey, "id", table->id(), timestamp); @@ -1567,9 +1567,9 @@ static schema_mutations make_table_mutations(schema_ptr table, api::timestamp_ty add_table_params_to_mutations(m, ckey, table, timestamp); - mutation columns_mutation(pkey, columns()); - mutation dropped_columns_mutation(pkey, dropped_columns()); - mutation indices_mutation(pkey, indexes()); + mutation columns_mutation(columns(), pkey); + mutation dropped_columns_mutation(dropped_columns(), pkey); + mutation indices_mutation(indexes(), pkey); if (with_columns_and_triggers) { for (auto&& column : table->v3().all_columns()) { @@ -1603,7 +1603,7 @@ static void make_update_indices_mutations( api::timestamp_type timestamp, std::vector& mutations) { - mutation indices_mutation(partition_key::from_singular(*indexes(), old_table->ks_name()), indexes()); + mutation indices_mutation(indexes(), partition_key::from_singular(*indexes(), old_table->ks_name())); auto diff = difference(old_table->all_indices(), new_table->all_indices()); @@ -1633,7 +1633,7 @@ static void add_drop_column_to_mutations(schema_ptr table, const sstring& name, schema_ptr s = dropped_columns(); auto pkey = partition_key::from_singular(*s, table->ks_name()); auto ckey = clustering_key::from_exploded(*s, {utf8_type->decompose(table->cf_name()), utf8_type->decompose(name)}); - mutation m(pkey, s); + mutation m(s, pkey); add_dropped_column_to_schema_mutation(table, name, dc, timestamp, m); mutations.emplace_back(std::move(m)); } @@ -1643,7 +1643,7 @@ static void make_update_columns_mutations(schema_ptr old_table, api::timestamp_type timestamp, bool from_thrift, std::vector& mutations) { - mutation columns_mutation(partition_key::from_singular(*columns(), old_table->ks_name()), columns()); + mutation columns_mutation(columns(), partition_key::from_singular(*columns(), old_table->ks_name())); auto diff = difference(old_table->v3().columns_by_name(), new_table->v3().columns_by_name()); @@ -1710,7 +1710,7 @@ static void make_drop_table_or_view_mutations(schema_ptr schema_table, api::timestamp_type timestamp, std::vector& mutations) { auto pkey = partition_key::from_singular(*schema_table, table_or_view->ks_name()); - mutation m{pkey, schema_table}; + mutation m{schema_table, pkey}; auto ckey = clustering_key::from_singular(*schema_table, table_or_view->cf_name()); m.partition().apply_delete(*schema_table, ckey, tombstone(timestamp, gc_clock::now())); mutations.emplace_back(m); @@ -1721,7 +1721,7 @@ static void make_drop_table_or_view_mutations(schema_ptr schema_table, drop_column_from_schema_mutation(dropped_columns(), table_or_view, column, timestamp, mutations); } { - mutation m{pkey, scylla_tables()}; + mutation m{scylla_tables(), pkey}; m.partition().apply_delete(*scylla_tables(), ckey, tombstone(timestamp, gc_clock::now())); mutations.emplace_back(m); } @@ -2086,7 +2086,7 @@ static void drop_index_from_schema_mutation(schema_ptr table, const index_metada schema_ptr s = indexes(); auto pkey = partition_key::from_singular(*s, table->ks_name()); auto ckey = clustering_key::from_exploded(*s, {utf8_type->decompose(table->cf_name()), utf8_type->decompose(index.name())}); - mutation m{pkey, s}; + mutation m{s, pkey}; m.partition().apply_delete(*s, ckey, tombstone(timestamp, gc_clock::now())); mutations.push_back(std::move(m)); } @@ -2102,7 +2102,7 @@ static void drop_column_from_schema_mutation( auto ckey = clustering_key::from_exploded(*schema_table, {utf8_type->decompose(table->cf_name()), utf8_type->decompose(column_name)}); - mutation m{pkey, schema_table}; + mutation m{schema_table, pkey}; m.partition().apply_delete(*schema_table, ckey, tombstone(timestamp, gc_clock::now())); mutations.emplace_back(m); } @@ -2230,7 +2230,7 @@ static schema_mutations make_view_mutations(view_ptr view, api::timestamp_type t // we don't keep a property the user has removed schema_ptr s = views(); auto pkey = partition_key::from_singular(*s, view->ks_name()); - mutation m{pkey, s}; + mutation m{s, pkey}; auto ckey = clustering_key::from_singular(*s, view->cf_name()); m.set_clustered_cell(ckey, "base_table_id", view->view_info()->base_id(), timestamp); @@ -2243,9 +2243,9 @@ static schema_mutations make_view_mutations(view_ptr view, api::timestamp_type t add_table_params_to_mutations(m, ckey, view, timestamp); - mutation columns_mutation(pkey, columns()); - mutation dropped_columns_mutation(pkey, dropped_columns()); - mutation indices_mutation(pkey, indexes()); + mutation columns_mutation(columns(), pkey); + mutation dropped_columns_mutation(dropped_columns(), pkey); + mutation indices_mutation(indexes(), pkey); if (with_columns) { for (auto&& column : view->v3().all_columns()) { diff --git a/db/system_keyspace.cc b/db/system_keyspace.cc index 84aaae4a83..6b82413fe7 100644 --- a/db/system_keyspace.cc +++ b/db/system_keyspace.cc @@ -1769,7 +1769,7 @@ future increment_and_get_generation() { mutation make_size_estimates_mutation(const sstring& ks, std::vector estimates) { auto&& schema = db::system_keyspace::size_estimates(); auto timestamp = api::new_timestamp(); - mutation m_to_apply{partition_key::from_single_value(*schema, utf8_type->decompose(ks)), schema}; + mutation m_to_apply{schema, partition_key::from_single_value(*schema, utf8_type->decompose(ks))}; for (auto&& e : estimates) { auto ck = clustering_key_prefix(std::vector{ diff --git a/frozen_mutation.cc b/frozen_mutation.cc index 5e1e6d92de..d97507ec05 100644 --- a/frozen_mutation.cc +++ b/frozen_mutation.cc @@ -107,7 +107,7 @@ frozen_mutation::frozen_mutation(const mutation& m) mutation frozen_mutation::unfreeze(schema_ptr schema) const { - mutation m(key(*schema), schema); + mutation m(schema, key(*schema)); partition_builder b(*schema, m.partition()); partition().accept(*schema, b); return m; diff --git a/mutation.hh b/mutation.hh index b94ab6b87d..56c2d22421 100644 --- a/mutation.hh +++ b/mutation.hh @@ -50,10 +50,10 @@ private: explicit operator bool() const { return bool(_ptr); } friend class optimized_optional; public: - mutation(dht::decorated_key key, schema_ptr schema) + mutation(schema_ptr schema, dht::decorated_key key) : _ptr(std::make_unique(std::move(key), std::move(schema))) { } - mutation(partition_key key_, schema_ptr schema) + mutation(schema_ptr schema, partition_key key_) : _ptr(std::make_unique(std::move(key_), std::move(schema))) { } mutation(schema_ptr schema, dht::decorated_key key, const mutation_partition& mp) diff --git a/mutation_partition.cc b/mutation_partition.cc index b3de85e958..49581d2f60 100644 --- a/mutation_partition.cc +++ b/mutation_partition.cc @@ -1969,7 +1969,7 @@ class counter_write_query_result_builder { public: counter_write_query_result_builder(const schema& s) : _schema(s) { } void consume_new_partition(const dht::decorated_key& dk) { - _mutation = mutation(dk, _schema.shared_from_this()); + _mutation = mutation(_schema.shared_from_this(), dk); } void consume(tombstone) { } stop_iteration consume(static_row&& sr, tombstone, bool) { diff --git a/mutation_rebuilder.hh b/mutation_rebuilder.hh index e364744731..6e48a1c295 100644 --- a/mutation_rebuilder.hh +++ b/mutation_rebuilder.hh @@ -29,7 +29,7 @@ class mutation_rebuilder { public: mutation_rebuilder(dht::decorated_key dk, schema_ptr s) - : _m(std::move(dk), std::move(s)), _remaining_limit(0) { + : _m(std::move(s), std::move(dk)), _remaining_limit(0) { } stop_iteration consume(tombstone t) { @@ -58,4 +58,4 @@ public: mutation_opt consume_end_of_stream() { return mutation_opt(std::move(_m)); } -}; \ No newline at end of file +}; diff --git a/service/storage_proxy.cc b/service/storage_proxy.cc index ee72bf898d..ab9bc5dce4 100644 --- a/service/storage_proxy.cc +++ b/service/storage_proxy.cc @@ -1491,7 +1491,7 @@ storage_proxy::mutate_atomically(std::vector mutations, db::consistenc auto schema = _p._db.local().find_schema(db::system_keyspace::NAME, db::system_keyspace::BATCHLOG); auto key = partition_key::from_exploded(*schema, {uuid_type->decompose(_batch_uuid)}); auto now = service::client_state(service::client_state::internal_tag()).get_timestamp(); - mutation m(key, schema); + mutation m(schema, key); m.partition().apply_delete(*schema, clustering_key_prefix::make_empty(), tombstone(now, gc_clock::now())); tracing::trace(_trace_state, "Sending a batchlog remove mutation"); @@ -2369,7 +2369,7 @@ public: auto it = boost::range::find_if(v, [] (auto&& ver) { return bool(ver.par); }); - auto m = boost::accumulate(v, mutation(it->par->mut().key(*schema), schema), [this, schema] (mutation& m, const version& ver) { + auto m = boost::accumulate(v, mutation(schema, it->par->mut().key(*schema)), [this, schema] (mutation& m, const version& ver) { if (ver.par) { m.partition().apply(*schema, ver.par->mut().partition(), *schema); } diff --git a/streamed_mutation.cc b/streamed_mutation.cc index d1c355bfdc..b25958dfe8 100644 --- a/streamed_mutation.cc +++ b/streamed_mutation.cc @@ -218,7 +218,7 @@ std::ostream& operator<<(std::ostream& os, const mutation_fragment& mf) { } streamed_mutation make_empty_streamed_mutation(schema_ptr s, dht::decorated_key key, streamed_mutation::forwarding fwd) { - return streamed_mutation_from_mutation(mutation(std::move(key), std::move(s)), fwd); + return streamed_mutation_from_mutation(mutation(std::move(s), std::move(key)), fwd); } streamed_mutation streamed_mutation_from_mutation(mutation m, streamed_mutation::forwarding fwd) diff --git a/tests/batchlog_manager_test.cc b/tests/batchlog_manager_test.cc index 5d279f41d5..3b133c8a26 100644 --- a/tests/batchlog_manager_test.cc +++ b/tests/batchlog_manager_test.cc @@ -56,7 +56,7 @@ SEASTAR_TEST_CASE(test_execute_batch) { auto key = partition_key::from_exploded(*s, {to_bytes("key1")}); auto c_key = clustering_key::from_exploded(*s, {int32_type->decompose(1)}); - mutation m(key, s); + mutation m(s, key); m.set_clustered_cell(c_key, r1_col, make_atomic_cell(int32_type->decompose(100))); using namespace std::chrono_literals; diff --git a/tests/cache_flat_mutation_reader_test.cc b/tests/cache_flat_mutation_reader_test.cc index 5a63a15e46..6187132ff4 100644 --- a/tests/cache_flat_mutation_reader_test.cc +++ b/tests/cache_flat_mutation_reader_test.cc @@ -249,7 +249,7 @@ void test_single_row(int ck, std::deque expected_cache_rows) { const int value = 12; - mutation underlying(PK, SCHEMA); + mutation underlying(SCHEMA, PK); add_row(underlying, ck, value); auto m = make_incomplete_mutation(); @@ -560,7 +560,7 @@ void test_two_rows(int ck1, const int value1 = 12; const int value2 = 34; - mutation underlying(PK, SCHEMA); + mutation underlying(SCHEMA, PK); add_row(underlying, ck1, value1); add_row(underlying, ck2, value2); @@ -1140,7 +1140,7 @@ void test_three_rows(int ck1, const int value2 = 34; const int value3 = 56; - mutation underlying(PK, SCHEMA); + mutation underlying(SCHEMA, PK); add_row(underlying, ck1, value1); add_row(underlying, ck2, value2); add_row(underlying, ck3, value3); @@ -1283,7 +1283,7 @@ SEASTAR_TEST_CASE(test_single_row_and_tombstone_not_cached_single_row_range1) { const int value1 = 12; range_tombstone rt(make_ck(0), bound_kind::incl_start, make_ck(2), bound_kind::incl_end, new_tombstone()); - mutation underlying(PK, SCHEMA); + mutation underlying(SCHEMA, PK); add_row(underlying, ck1, value1); add_tombstone(underlying, rt); @@ -1306,7 +1306,7 @@ SEASTAR_TEST_CASE(test_single_row_and_tombstone_not_cached_single_row_range2) { const int value1 = 12; range_tombstone rt(make_ck(0), bound_kind::incl_start, make_ck(2), bound_kind::incl_end, new_tombstone()); - mutation underlying(PK, SCHEMA); + mutation underlying(SCHEMA, PK); add_row(underlying, ck1, value1); add_tombstone(underlying, rt); @@ -1329,7 +1329,7 @@ SEASTAR_TEST_CASE(test_single_row_and_tombstone_not_cached_single_row_range3) { const int value1 = 12; range_tombstone rt(make_ck(0), bound_kind::incl_start, make_ck(2), bound_kind::incl_end, new_tombstone()); - mutation underlying(PK, SCHEMA); + mutation underlying(SCHEMA, PK); add_row(underlying, ck1, value1); add_tombstone(underlying, rt); @@ -1354,7 +1354,7 @@ SEASTAR_TEST_CASE(test_single_row_and_tombstone_not_cached_single_row_range4) { const int value1 = 12; range_tombstone rt(make_ck(0), bound_kind::incl_start, make_ck(2), bound_kind::incl_end, new_tombstone()); - mutation underlying(PK, SCHEMA); + mutation underlying(SCHEMA, PK); add_row(underlying, ck1, value1); add_tombstone(underlying, rt); diff --git a/tests/cell_locker_test.cc b/tests/cell_locker_test.cc index c52d77d61d..631f8b7ae7 100644 --- a/tests/cell_locker_test.cc +++ b/tests/cell_locker_test.cc @@ -82,7 +82,7 @@ static auto make_row(const sstring& key, std::initializer_list cells) { static mutation make_mutation(schema_ptr s, const sstring& pk, std::initializer_list static_cells, std::initializer_list>> clustering_cells) { - auto m = mutation(partition_key::from_single_value(*s, to_bytes(pk)), s); + auto m = mutation(s, partition_key::from_single_value(*s, to_bytes(pk))); for (auto&& c : static_cells) { m.set_static_cell(to_bytes(c), empty_value, api::new_timestamp()); } @@ -132,7 +132,7 @@ SEASTAR_TEST_CASE(test_disjoint_mutations) { make_row("one", { "r3" }), }); - auto m3 = mutation(partition_key::from_single_value(*s, to_bytes("1")), s); + auto m3 = mutation(s, partition_key::from_single_value(*s, to_bytes("1"))); m3.partition() = m1.partition(); auto l1 = cl.lock_cells(m1.decorated_key(), partition_cells_range(m1.partition()), no_timeout).get0(); diff --git a/tests/counter_test.cc b/tests/counter_test.cc index a774f8aedc..afd06eee1a 100644 --- a/tests/counter_test.cc +++ b/tests/counter_test.cc @@ -203,7 +203,7 @@ SEASTAR_TEST_CASE(test_counter_mutations) { auto& col = *s->get_column_definition(utf8_type->decompose(sstring("c1"))); auto& scol = *s->get_column_definition(utf8_type->decompose(sstring("s1"))); - mutation m1(pk, s); + mutation m1(s, pk); counter_cell_builder b1; b1.add_shard(counter_shard(id[0], 1, 1)); b1.add_shard(counter_shard(id[1], 2, 1)); @@ -216,7 +216,7 @@ SEASTAR_TEST_CASE(test_counter_mutations) { b1s.add_shard(counter_shard(id[3], 6, 2)); m1.set_static_cell(scol, b1s.build(api::new_timestamp())); - mutation m2(pk, s); + mutation m2(s, pk); counter_cell_builder b2; b2.add_shard(counter_shard(id[0], 1, 1)); b2.add_shard(counter_shard(id[2], -5, 4)); @@ -229,11 +229,11 @@ SEASTAR_TEST_CASE(test_counter_mutations) { b2s.add_shard(counter_shard(id[3], 9, 1)); m2.set_static_cell(scol, b2s.build(api::new_timestamp())); - mutation m3(pk, s); + mutation m3(s, pk); m3.set_clustered_cell(ck, col, atomic_cell::make_dead(1, gc_clock::now())); m3.set_static_cell(scol, atomic_cell::make_dead(1, gc_clock::now())); - mutation m4(pk, s); + mutation m4(s, pk); m4.partition().apply(tombstone(0, gc_clock::now())); // Apply @@ -352,18 +352,18 @@ SEASTAR_TEST_CASE(test_counter_update_mutations) { auto c1 = atomic_cell::make_live_counter_update(api::new_timestamp(), 5); auto s1 = atomic_cell::make_live_counter_update(api::new_timestamp(), 4); - mutation m1(pk, s); + mutation m1(s, pk); m1.set_clustered_cell(ck, col, c1); m1.set_static_cell(scol, s1); auto c2 = atomic_cell::make_live_counter_update(api::new_timestamp(), 9); auto s2 = atomic_cell::make_live_counter_update(api::new_timestamp(), 8); - mutation m2(pk, s); + mutation m2(s, pk); m2.set_clustered_cell(ck, col, c2); m2.set_static_cell(scol, s2); auto c3 = atomic_cell::make_dead(api::new_timestamp() / 2, gc_clock::now()); - mutation m3(pk, s); + mutation m3(s, pk); m3.set_clustered_cell(ck, col, c3); m3.set_static_cell(scol, c3); @@ -402,25 +402,25 @@ SEASTAR_TEST_CASE(test_transfer_updates_to_shards) { auto c1 = atomic_cell::make_live_counter_update(api::new_timestamp(), 5); auto s1 = atomic_cell::make_live_counter_update(api::new_timestamp(), 4); - mutation m1(pk, s); + mutation m1(s, pk); m1.set_clustered_cell(ck, col, c1); m1.set_static_cell(scol, s1); auto c2 = atomic_cell::make_live_counter_update(api::new_timestamp(), 9); auto s2 = atomic_cell::make_live_counter_update(api::new_timestamp(), 8); - mutation m2(pk, s); + mutation m2(s, pk); m2.set_clustered_cell(ck, col, c2); m2.set_static_cell(scol, s2); auto c3 = atomic_cell::make_dead(api::new_timestamp() / 2, gc_clock::now()); - mutation m3(pk, s); + mutation m3(s, pk); m3.set_clustered_cell(ck, col, c3); m3.set_static_cell(scol, c3); auto m0 = m1; transform_counter_updates_to_shards(m0, nullptr, 0); - auto empty = mutation(pk, s); + auto empty = mutation(s, pk); auto m = m1; transform_counter_updates_to_shards(m, &empty, 0); BOOST_REQUIRE_EQUAL(m, m0); diff --git a/tests/database_test.cc b/tests/database_test.cc index d1c0086267..45c3a91f8e 100644 --- a/tests/database_test.cc +++ b/tests/database_test.cc @@ -39,13 +39,13 @@ SEASTAR_TEST_CASE(test_querying_with_limits) { dht::partition_range_vector pranges; for (uint32_t i = 1; i <= 3; ++i) { auto pkey = partition_key::from_single_value(*s, to_bytes(sprint("key%d", i))); - mutation m(pkey, s); + mutation m(s, pkey); m.partition().apply(tombstone(api::timestamp_type(1), gc_clock::now())); db.apply(s, freeze(m)).get(); } for (uint32_t i = 3; i <= 8; ++i) { auto pkey = partition_key::from_single_value(*s, to_bytes(sprint("key%d", i))); - mutation m(pkey, s); + mutation m(s, pkey); m.set_clustered_cell(clustering_key_prefix::make_empty(), "v", data_value(bytes("v1")), 1); db.apply(s, freeze(m)).get(); pranges.emplace_back(dht::partition_range::make_singular(dht::global_partitioner().decorate_key(*s, std::move(pkey)))); diff --git a/tests/flat_mutation_reader_test.cc b/tests/flat_mutation_reader_test.cc index 440ddf86dc..d6d71b3261 100644 --- a/tests/flat_mutation_reader_test.cc +++ b/tests/flat_mutation_reader_test.cc @@ -453,7 +453,7 @@ SEASTAR_TEST_CASE(test_multi_range_reader) { })); auto ms = boost::copy_range>(keys | boost::adaptors::transformed([&] (auto& key) { - auto m = mutation(key, s.schema()); + auto m = mutation(s.schema(), key); for (auto& mf : crs) { m.apply(mf); } @@ -537,7 +537,7 @@ public: void consume_new_partition(dht::decorated_key dk) { BOOST_REQUIRE(!_inside_partition); BOOST_REQUIRE(!_previous_position); - _mutations.emplace_back(dk, _schema); + _mutations.emplace_back(_schema, dk); _inside_partition = true; } void consume(tombstone pt) { @@ -669,7 +669,7 @@ SEASTAR_TEST_CASE(test_make_forwardable) { })); auto ms = boost::copy_range < std::vector < mutation >> (keys | boost::adaptors::transformed([&](auto &key) { - auto m = mutation(key, s.schema()); + auto m = mutation(s.schema(), key); for (auto &mf : crs) { m.apply(mf); } diff --git a/tests/frozen_mutation_test.cc b/tests/frozen_mutation_test.cc index f8a89786ef..daf4e9654d 100644 --- a/tests/frozen_mutation_test.cc +++ b/tests/frozen_mutation_test.cc @@ -69,27 +69,27 @@ SEASTAR_TEST_CASE(test_application_of_partition_view_has_the_same_effect_as_appl partition_key key = partition_key::from_single_value(*s, bytes("key")); clustering_key ck = clustering_key::from_deeply_exploded(*s, {data_value(bytes("ck"))}); - mutation m1(key, s); + mutation m1(s, key); m1.partition().apply(new_tombstone()); m1.set_clustered_cell(ck, "reg_1", data_value(bytes("val1")), new_timestamp()); m1.set_clustered_cell(ck, "reg_2", data_value(bytes("val2")), new_timestamp()); m1.partition().apply_insert(*s, ck, new_timestamp()); m1.set_static_cell("static_1", data_value(bytes("val3")), new_timestamp()); - mutation m2(key, s); + mutation m2(s, key); m2.set_clustered_cell(ck, "reg_1", data_value(bytes("val4")), new_timestamp()); m2.partition().apply_insert(*s, ck, new_timestamp()); m2.set_static_cell("static_1", data_value(bytes("val5")), new_timestamp()); - mutation m_frozen(key, s); + mutation m_frozen(s, key); m_frozen.partition().apply(*s, freeze(m1).partition(), *s); m_frozen.partition().apply(*s, freeze(m2).partition(), *s); - mutation m_unfrozen(key, s); + mutation m_unfrozen(s, key); m_unfrozen.partition().apply(*s, m1.partition(), *s); m_unfrozen.partition().apply(*s, m2.partition(), *s); - mutation m_refrozen(key, s); + mutation m_refrozen(s, key); m_refrozen.partition().apply(*s, freeze(m1).unfreeze(s).partition(), *s); m_refrozen.partition().apply(*s, freeze(m2).unfreeze(s).partition(), *s); diff --git a/tests/memory_footprint.cc b/tests/memory_footprint.cc index 4f8756ba66..273b19b63e 100644 --- a/tests/memory_footprint.cc +++ b/tests/memory_footprint.cc @@ -99,7 +99,7 @@ static schema_ptr cassandra_stress_schema() { [[gnu::unused]] static mutation make_cs_mutation() { auto s = cassandra_stress_schema(); - mutation m(partition_key::from_single_value(*s, bytes_type->from_string("4b343050393536353531")), s); + mutation m(s, partition_key::from_single_value(*s, bytes_type->from_string("4b343050393536353531"))); for (auto&& col : s->regular_columns()) { m.set_clustered_cell(clustering_key::make_empty(), col, atomic_cell::make_live(1, bytes_type->from_string("8f75da6b3dcec90c8a404fb9a5f6b0621e62d39c69ba5758e5f41b78311fbb26cc7a"))); @@ -144,7 +144,7 @@ static mutation make_mutation(mutation_settings settings) { auto s = builder.build(); - mutation m(partition_key::from_single_value(*s, bytes_type->decompose(data_value(random_bytes(settings.partition_key_size)))), s); + mutation m(s, partition_key::from_single_value(*s, bytes_type->decompose(data_value(random_bytes(settings.partition_key_size))))); for (size_t i = 0; i < settings.row_count; ++i) { auto ck = clustering_key::from_single_value(*s, bytes_type->decompose(data_value(random_bytes(settings.clustering_key_size)))); diff --git a/tests/memtable_test.cc b/tests/memtable_test.cc index fb4fb931e3..3a9a8b0b26 100644 --- a/tests/memtable_test.cc +++ b/tests/memtable_test.cc @@ -52,7 +52,7 @@ static void set_column(mutation& m, const sstring& column_name) { static mutation make_unique_mutation(schema_ptr s) { - return mutation(partition_key::from_single_value(*s, make_unique_bytes()), s); + return mutation(s, partition_key::from_single_value(*s, make_unique_bytes())); } // Returns a vector of empty mutations in ring order diff --git a/tests/mutation_query_test.cc b/tests/mutation_query_test.cc index e5782202ce..b74fbd3e7b 100644 --- a/tests/mutation_query_test.cc +++ b/tests/mutation_query_test.cc @@ -84,7 +84,7 @@ SEASTAR_TEST_CASE(test_reading_from_single_partition) { auto s = make_schema(); auto now = gc_clock::now(); - mutation m1(partition_key::from_single_value(*s, "key1"), s); + mutation m1(s, partition_key::from_single_value(*s, "key1")); m1.set_clustered_cell(clustering_key::from_single_value(*s, bytes("A")), "v1", data_value(bytes("A:v")), 1); m1.set_clustered_cell(clustering_key::from_single_value(*s, bytes("B")), "v1", data_value(bytes("B:v")), 1); m1.set_clustered_cell(clustering_key::from_single_value(*s, bytes("C")), "v1", data_value(bytes("C:v")), 1); @@ -137,7 +137,7 @@ SEASTAR_TEST_CASE(test_cells_are_expired_according_to_query_timestamp) { auto s = make_schema(); auto now = gc_clock::now(); - mutation m1(partition_key::from_single_value(*s, "key1"), s); + mutation m1(s, partition_key::from_single_value(*s, "key1")); m1.set_clustered_cell(clustering_key::from_single_value(*s, bytes("A")), *s->get_column_definition("v1"), @@ -185,7 +185,7 @@ SEASTAR_TEST_CASE(test_reverse_ordering_is_respected) { auto s = make_schema(); auto now = gc_clock::now(); - mutation m1(partition_key::from_single_value(*s, "key1"), s); + mutation m1(s, partition_key::from_single_value(*s, "key1")); m1.set_clustered_cell(clustering_key::from_single_value(*s, bytes("A")), "v1", data_value(bytes("A_v1")), 1); m1.set_clustered_cell(clustering_key::from_single_value(*s, bytes("B")), "v1", data_value(bytes("B_v1")), 1); @@ -381,7 +381,7 @@ SEASTAR_TEST_CASE(test_query_when_partition_tombstone_covers_live_cells) { auto s = make_schema(); auto now = gc_clock::now(); - mutation m1(partition_key::from_single_value(*s, "key1"), s); + mutation m1(s, partition_key::from_single_value(*s, "key1")); m1.partition().apply(tombstone(api::timestamp_type(1), now)); m1.set_clustered_cell(clustering_key::from_single_value(*s, bytes("A")), "v1", data_value(bytes("A:v")), 1); @@ -416,7 +416,7 @@ SEASTAR_TEST_CASE(test_partitions_with_only_expired_tombstones_are_dropped) { auto make_ring = [&] (int n) { std::vector ring; while (n--) { - ring.push_back(mutation(new_key(), s)); + ring.push_back(mutation(s, new_key())); } std::sort(ring.begin(), ring.end(), mutation_decorated_key_less_comparator()); return ring; @@ -454,7 +454,7 @@ SEASTAR_TEST_CASE(test_result_row_count) { auto now = gc_clock::now(); auto slice = partition_slice_builder(*s).build(); - mutation m1(partition_key::from_single_value(*s, "key1"), s); + mutation m1(s, partition_key::from_single_value(*s, "key1")); auto src = make_source({m1}); @@ -473,7 +473,7 @@ SEASTAR_TEST_CASE(test_result_row_count) { r = to_data_query_result(mutation_query(s, make_source({m1}), query::full_partition_range, slice, 10000, query::max_partitions, now).get0(), s, slice, inf32, inf32); BOOST_REQUIRE_EQUAL(r.row_count().value(), 2); - mutation m2(partition_key::from_single_value(*s, "key2"), s); + mutation m2(s, partition_key::from_single_value(*s, "key2")); m2.set_static_cell("s1", data_value(bytes("S_v1")), 1); r = to_data_query_result(mutation_query(s, make_source({m1, m2}), query::full_partition_range, slice, 10000, query::max_partitions, now).get0(), s, slice, inf32, inf32); BOOST_REQUIRE_EQUAL(r.row_count().value(), 3); @@ -486,11 +486,11 @@ SEASTAR_TEST_CASE(test_partition_limit) { auto s = make_schema(); auto now = gc_clock::now(); - mutation m1(partition_key::from_single_value(*s, "key1"), s); + mutation m1(s, partition_key::from_single_value(*s, "key1")); m1.partition().apply(tombstone(api::timestamp_type(1), now)); - mutation m2(partition_key::from_single_value(*s, "key2"), s); + mutation m2(s, partition_key::from_single_value(*s, "key2")); m2.set_clustered_cell(clustering_key::from_single_value(*s, bytes("A")), "v1", data_value(bytes("A:v")), 1); - mutation m3(partition_key::from_single_value(*s, "key3"), s); + mutation m3(s, partition_key::from_single_value(*s, "key3")); m3.set_clustered_cell(clustering_key::from_single_value(*s, bytes("B")), "v1", data_value(bytes("B:v")), 1); auto src = make_source({m1, m2, m3}); diff --git a/tests/mutation_reader_test.cc b/tests/mutation_reader_test.cc index e02e0f8a08..fc7c3c41e0 100644 --- a/tests/mutation_reader_test.cc +++ b/tests/mutation_reader_test.cc @@ -55,10 +55,10 @@ SEASTAR_TEST_CASE(test_combining_two_readers_with_the_same_row) { return seastar::async([] { auto s = make_schema(); - mutation m1(partition_key::from_single_value(*s, "key1"), s); + mutation m1(s, partition_key::from_single_value(*s, "key1")); m1.set_clustered_cell(clustering_key::make_empty(), "v", data_value(bytes("v1")), 1); - mutation m2(partition_key::from_single_value(*s, "key1"), s); + mutation m2(s, partition_key::from_single_value(*s, "key1")); m2.set_clustered_cell(clustering_key::make_empty(), "v", data_value(bytes("v2")), 2); assert_that(make_combined_reader(s, flat_mutation_reader_from_mutations({m1}), flat_mutation_reader_from_mutations({m2}))) @@ -71,10 +71,10 @@ SEASTAR_TEST_CASE(test_combining_two_non_overlapping_readers) { return seastar::async([] { auto s = make_schema(); - mutation m1(partition_key::from_single_value(*s, "keyB"), s); + mutation m1(s, partition_key::from_single_value(*s, "keyB")); m1.set_clustered_cell(clustering_key::make_empty(), "v", data_value(bytes("v1")), 1); - mutation m2(partition_key::from_single_value(*s, "keyA"), s); + mutation m2(s, partition_key::from_single_value(*s, "keyA")); m2.set_clustered_cell(clustering_key::make_empty(), "v", data_value(bytes("v2")), 2); auto cr = make_combined_reader(s, flat_mutation_reader_from_mutations({m1}), flat_mutation_reader_from_mutations({m2})); @@ -89,13 +89,13 @@ SEASTAR_TEST_CASE(test_combining_two_partially_overlapping_readers) { return seastar::async([] { auto s = make_schema(); - mutation m1(partition_key::from_single_value(*s, "keyA"), s); + mutation m1(s, partition_key::from_single_value(*s, "keyA")); m1.set_clustered_cell(clustering_key::make_empty(), "v", data_value(bytes("v1")), 1); - mutation m2(partition_key::from_single_value(*s, "keyB"), s); + mutation m2(s, partition_key::from_single_value(*s, "keyB")); m2.set_clustered_cell(clustering_key::make_empty(), "v", data_value(bytes("v2")), 1); - mutation m3(partition_key::from_single_value(*s, "keyC"), s); + mutation m3(s, partition_key::from_single_value(*s, "keyC")); m3.set_clustered_cell(clustering_key::make_empty(), "v", data_value(bytes("v3")), 1); assert_that(make_combined_reader(s, flat_mutation_reader_from_mutations({m1, m2}), flat_mutation_reader_from_mutations({m2, m3}))) @@ -110,13 +110,13 @@ SEASTAR_TEST_CASE(test_combining_one_reader_with_many_partitions) { return seastar::async([] { auto s = make_schema(); - mutation m1(partition_key::from_single_value(*s, "keyA"), s); + mutation m1(s, partition_key::from_single_value(*s, "keyA")); m1.set_clustered_cell(clustering_key::make_empty(), "v", data_value(bytes("v1")), 1); - mutation m2(partition_key::from_single_value(*s, "keyB"), s); + mutation m2(s, partition_key::from_single_value(*s, "keyB")); m2.set_clustered_cell(clustering_key::make_empty(), "v", data_value(bytes("v2")), 1); - mutation m3(partition_key::from_single_value(*s, "keyC"), s); + mutation m3(s, partition_key::from_single_value(*s, "keyC")); m3.set_clustered_cell(clustering_key::make_empty(), "v", data_value(bytes("v3")), 1); std::vector v; @@ -130,7 +130,7 @@ SEASTAR_TEST_CASE(test_combining_one_reader_with_many_partitions) { } static mutation make_mutation_with_key(schema_ptr s, dht::decorated_key dk) { - mutation m(std::move(dk), s); + mutation m(s, std::move(dk)); m.set_clustered_cell(clustering_key::make_empty(), "v", data_value(bytes("v1")), 1); return m; } @@ -209,7 +209,7 @@ SEASTAR_TEST_CASE(test_filtering) { SEASTAR_TEST_CASE(test_combining_two_readers_with_one_reader_empty) { return seastar::async([] { auto s = make_schema(); - mutation m1(partition_key::from_single_value(*s, "key1"), s); + mutation m1(s, partition_key::from_single_value(*s, "key1")); m1.set_clustered_cell(clustering_key::make_empty(), "v", data_value(bytes("v1")), 1); assert_that(make_combined_reader(s, flat_mutation_reader_from_mutations({m1}), make_empty_flat_reader(s))) @@ -327,7 +327,7 @@ SEASTAR_TEST_CASE(test_sm_fast_forwarding_combining_reader) { const auto ckeys = s.make_ckeys(4); auto make_mutation = [&] (uint32_t n) { - mutation m(pkeys[n], s.schema()); + mutation m(s.schema(), pkeys[n]); int i{0}; s.add_row(m, ckeys[i], sprint("val_%i", i)); @@ -411,7 +411,7 @@ SEASTAR_TEST_CASE(combined_mutation_reader_test) { const auto ckeys = s.make_ckeys(4); std::vector base_mutations = boost::copy_range>( - pkeys | boost::adaptors::transformed([&s](const auto& k) { return mutation(k, s.schema()); })); + pkeys | boost::adaptors::transformed([&s](const auto& k) { return mutation(s.schema(), k); })); // Data layout: // d[xx] @@ -511,7 +511,7 @@ SEASTAR_TEST_CASE(combined_mutation_reader_test) { // merge c[0] with d[1] i = 2; - auto c_d_merged = mutation(pkeys[i], s.schema()); + auto c_d_merged = mutation(s.schema(), pkeys[i]); s.add_row(c_d_merged, ckeys[i], sprint("val_c_%i", i), t_row); s.add_static_row(c_d_merged, sprint("%i_static_val", i), t_static_row); @@ -532,7 +532,7 @@ SEASTAR_TEST_CASE(combined_mutation_reader_test) { static mutation make_mutation_with_key(simple_schema& s, dht::decorated_key dk) { static int i{0}; - mutation m(std::move(dk), s.schema()); + mutation m(s.schema(), std::move(dk)); s.add_row(m, s.make_ckey(++i), sprint("val_%i", i)); return m; } @@ -726,7 +726,7 @@ sstables::shared_sstable create_sstable(simple_schema& sschema, const sstring& p mutations.reserve(1 << 14); for (std::size_t p = 0; p < (1 << 10); ++p) { - mutation m(sschema.make_pkey(p), sschema.schema()); + mutation m(sschema.schema(), sschema.make_pkey(p)); sschema.add_static_row(m, sprint("%i_static_val", p)); for (std::size_t c = 0; c < (1 << 4); ++c) { @@ -1171,7 +1171,7 @@ SEASTAR_TEST_CASE(test_fast_forwarding_combined_reader_is_consistent_with_slicin std::vector ranges = gen.make_random_ranges(3); auto check_next_partition = [&] (const mutation& expected) { - mutation result(expected.decorated_key(), expected.schema()); + mutation result(expected.schema(), expected.decorated_key()); rd.consume_pausable([&](mutation_fragment&& mf) { position_in_partition::less_compare less(*s); @@ -1239,7 +1239,7 @@ SEASTAR_TEST_CASE(test_combined_reader_slicing_with_overlapping_range_tombstones streamed_mutation::forwarding::no, mutation_reader::forwarding::no); auto prange = position_range(range); - mutation result(m1.decorated_key(), m1.schema()); + mutation result(m1.schema(), m1.decorated_key()); rd.consume_pausable([&] (mutation_fragment&& mf) { if (mf.position().has_clustering_key() && !mf.range().overlaps(*s, prange.start(), prange.end())) { @@ -1264,7 +1264,7 @@ SEASTAR_TEST_CASE(test_combined_reader_slicing_with_overlapping_range_tombstones streamed_mutation::forwarding::yes, mutation_reader::forwarding::no); auto prange = position_range(range); - mutation result(m1.decorated_key(), m1.schema()); + mutation result(m1.schema(), m1.decorated_key()); rd.consume_pausable([&](mutation_fragment&& mf) { BOOST_REQUIRE(!mf.position().has_clustering_key()); @@ -1308,7 +1308,7 @@ SEASTAR_TEST_CASE(test_combined_mutation_source_is_a_mutation_source) { int source_index = 0; for (auto&& m : muts) { flat_mutation_reader_from_mutations({m}).consume_pausable([&] (mutation_fragment&& mf) { - mutation mf_m(m.decorated_key(), m.schema()); + mutation mf_m(m.schema(), m.decorated_key()); mf_m.partition().apply(*s, mf); memtables[source_index++ % memtables.size()]->apply(mf_m); return stop_iteration::no; diff --git a/tests/mutation_source_test.cc b/tests/mutation_source_test.cc index 1093b823c3..f60e2ce71d 100644 --- a/tests/mutation_source_test.cc +++ b/tests/mutation_source_test.cc @@ -146,7 +146,7 @@ static void test_streamed_mutation_forwarding_guarantees(populate_fn populate) { const int n_keys = 1001; assert(!contains_key(n_keys - 1)); // so that we can form a range with position greater than all keys - mutation m(table.make_pkey(), s); + mutation m(s, table.make_pkey()); std::vector keys; for (int i = 0; i < n_keys; ++i) { keys.push_back(table.make_ckey(i)); @@ -284,7 +284,7 @@ static void test_fast_forwarding_across_partitions_to_empty_range(populate_fn po unsigned next_ckey = 0; for (auto&& key : keys) { - mutation m(key, s); + mutation m(s, key); sstring val(sstring::initialized_later(), 1024); for (auto i : boost::irange(0u, ckeys_per_part)) { table.add_row(m, table.make_ckey(next_ckey + i), val); @@ -343,7 +343,7 @@ static void test_streamed_mutation_slicing_returns_only_relevant_tombstones(popu simple_schema table; schema_ptr s = table.schema(); - mutation m(table.make_pkey(), s); + mutation m(s, table.make_pkey()); std::vector keys; for (int i = 0; i < 20; ++i) { @@ -434,7 +434,7 @@ static void test_streamed_mutation_forwarding_across_range_tombstones(populate_f simple_schema table; schema_ptr s = table.schema(); - mutation m(table.make_pkey(), s); + mutation m(s, table.make_pkey()); std::vector keys; for (int i = 0; i < 20; ++i) { @@ -527,7 +527,7 @@ static void test_range_queries(populate_fn populate) { .build(); auto make_partition_mutation = [s] (bytes key) -> mutation { - mutation m(partition_key::from_single_value(*s, key), s); + mutation m(s, partition_key::from_single_value(*s, key)); m.set_clustered_cell(clustering_key::make_empty(), "v", data_value(bytes("v1")), 1); return m; }; @@ -696,13 +696,13 @@ static void test_clustering_slices(populate_fn populate) { auto pk = keys[1]; auto make_row = [&] (clustering_key k, int v) { - mutation m(pk, s); + mutation m(s, pk); m.set_clustered_cell(k, "v", data_value(bytes("v1")), v); return m; }; auto make_delete = [&] (const query::clustering_range& r) { - mutation m(pk, s); + mutation m(s, pk); auto bv_range = bound_view::from_range(r); range_tombstone rt(bv_range.first, bv_range.second, tombstone(new_timestamp(), gc_clock::now())); m.partition().apply_delete(*s, rt); @@ -821,7 +821,7 @@ static void test_query_only_static_row(populate_fn populate) { auto pkeys = s.make_pkeys(1); - mutation m1(pkeys[0], s.schema()); + mutation m1(s.schema(), pkeys[0]); s.add_static_row(m1, "s1"); s.add_row(m1, s.make_ckey(0), "v1"); s.add_row(m1, s.make_ckey(1), "v2"); @@ -853,7 +853,7 @@ void test_streamed_mutation_forwarding_succeeds_with_no_data(populate_fn populat auto cks = s.make_ckeys(6); auto pkey = s.make_pkey(); - mutation m(pkey, s.schema()); + mutation m(s.schema(), pkey); s.add_row(m, cks[0], "data"); auto source = populate(s.schema(), {m}); @@ -909,7 +909,7 @@ void test_slicing_with_overlapping_range_tombstones(populate_fn populate) { auto rd = ds.make_reader(s, query::full_partition_range, slice); auto prange = position_range(range); - mutation result(m1.decorated_key(), m1.schema()); + mutation result(m1.schema(), m1.decorated_key()); rd.consume_pausable([&] (mutation_fragment&& mf) { if (mf.position().has_clustering_key() && !mf.range().overlaps(*s, prange.start(), prange.end())) { @@ -928,7 +928,7 @@ void test_slicing_with_overlapping_range_tombstones(populate_fn populate) { nullptr, streamed_mutation::forwarding::yes); auto prange = position_range(range); - mutation result(m1.decorated_key(), m1.schema()); + mutation result(m1.schema(), m1.decorated_key()); rd.consume_pausable([&](mutation_fragment&& mf) { BOOST_REQUIRE(!mf.position().has_clustering_key()); @@ -992,7 +992,7 @@ void test_next_partition(populate_fn populate) { std::vector mutations; for (auto key : pkeys) { - mutation m(key, s.schema()); + mutation m(s.schema(), key); s.add_static_row(m, "s1"); s.add_row(m, s.make_ckey(0), "v1"); s.add_row(m, s.make_ckey(1), "v2"); @@ -1069,12 +1069,12 @@ static mutation_sets generate_mutation_sets() { // Differing keys result.unequal.emplace_back(mutations{ - mutation(partition_key::from_single_value(*s1, to_bytes(key1)), s1), - mutation(partition_key::from_single_value(*s2, to_bytes(key2)), s2) + mutation(s1, partition_key::from_single_value(*s1, to_bytes(key1))), + mutation(s2, partition_key::from_single_value(*s2, to_bytes(key2))) }); - auto m1 = mutation(partition_key::from_single_value(*s1, to_bytes(key1)), s1); - auto m2 = mutation(partition_key::from_single_value(*s2, to_bytes(key1)), s2); + auto m1 = mutation(s1, partition_key::from_single_value(*s1, to_bytes(key1))); + auto m2 = mutation(s2, partition_key::from_single_value(*s2, to_bytes(key1))); result.equal.emplace_back(mutations{m1, m2}); clustering_key ck1 = clustering_key::from_deeply_exploded(*s1, {data_value(bytes("ck1_0")), data_value(bytes("ck1_1"))}); @@ -1376,7 +1376,7 @@ public: std::uniform_int_distribution timestamp_dist(api::min_timestamp, api::min_timestamp + 2); // 3 values auto pkey = partition_key::from_single_value(*_schema, _blobs[0]); - mutation m(pkey, _schema); + mutation m(_schema, pkey); std::map> counter_used_clock_values; std::vector counter_ids; diff --git a/tests/mutation_test.cc b/tests/mutation_test.cc index 906d82643e..d72678cc2e 100644 --- a/tests/mutation_test.cc +++ b/tests/mutation_test.cc @@ -96,7 +96,7 @@ SEASTAR_TEST_CASE(test_mutation_is_applied) { auto key = partition_key::from_exploded(*s, {to_bytes("key1")}); auto c_key = clustering_key::from_exploded(*s, {int32_type->decompose(2)}); - mutation m(key, s); + mutation m(s, key); m.set_clustered_cell(c_key, r1_col, make_atomic_cell(int32_type->decompose(3))); mt->apply(std::move(m)); @@ -118,7 +118,7 @@ SEASTAR_TEST_CASE(test_multi_level_row_tombstones) { auto ttl = gc_clock::now() + std::chrono::seconds(1); - mutation m(partition_key::from_exploded(*s, {to_bytes("key1")}), s); + mutation m(s, partition_key::from_exploded(*s, {to_bytes("key1")})); auto make_prefix = [s] (const std::vector& v) { return clustering_key_prefix::from_deeply_exploded(*s, v); @@ -157,7 +157,7 @@ SEASTAR_TEST_CASE(test_row_tombstone_updates) { auto ttl = gc_clock::now() + std::chrono::seconds(1); - mutation m(key, s); + mutation m(s, key); m.partition().apply_row_tombstone(*s, c_key1_prefix, tombstone(1, ttl)); m.partition().apply_row_tombstone(*s, c_key2_prefix, tombstone(0, ttl)); @@ -178,19 +178,19 @@ SEASTAR_TEST_CASE(test_map_mutations) { auto key = partition_key::from_exploded(*s, {to_bytes("key1")}); auto& column = *s->get_column_definition("s1"); map_type_impl::mutation mmut1{{}, {{int32_type->decompose(101), make_atomic_cell(utf8_type->decompose(sstring("101")))}}}; - mutation m1(key, s); + mutation m1(s, key); m1.set_static_cell(column, my_map_type->serialize_mutation_form(mmut1)); mt->apply(m1); map_type_impl::mutation mmut2{{}, {{int32_type->decompose(102), make_atomic_cell(utf8_type->decompose(sstring("102")))}}}; - mutation m2(key, s); + mutation m2(s, key); m2.set_static_cell(column, my_map_type->serialize_mutation_form(mmut2)); mt->apply(m2); map_type_impl::mutation mmut3{{}, {{int32_type->decompose(103), make_atomic_cell(utf8_type->decompose(sstring("103")))}}}; - mutation m3(key, s); + mutation m3(s, key); m3.set_static_cell(column, my_map_type->serialize_mutation_form(mmut3)); mt->apply(m3); map_type_impl::mutation mmut2o{{}, {{int32_type->decompose(102), make_atomic_cell(utf8_type->decompose(sstring("102 override")))}}}; - mutation m2o(key, s); + mutation m2o(s, key); m2o.set_static_cell(column, my_map_type->serialize_mutation_form(mmut2o)); mt->apply(m2o); @@ -214,19 +214,19 @@ SEASTAR_TEST_CASE(test_set_mutations) { auto key = partition_key::from_exploded(*s, {to_bytes("key1")}); auto& column = *s->get_column_definition("s1"); map_type_impl::mutation mmut1{{}, {{int32_type->decompose(101), make_atomic_cell({})}}}; - mutation m1(key, s); + mutation m1(s, key); m1.set_static_cell(column, my_set_type->serialize_mutation_form(mmut1)); mt->apply(m1); map_type_impl::mutation mmut2{{}, {{int32_type->decompose(102), make_atomic_cell({})}}}; - mutation m2(key, s); + mutation m2(s, key); m2.set_static_cell(column, my_set_type->serialize_mutation_form(mmut2)); mt->apply(m2); map_type_impl::mutation mmut3{{}, {{int32_type->decompose(103), make_atomic_cell({})}}}; - mutation m3(key, s); + mutation m3(s, key); m3.set_static_cell(column, my_set_type->serialize_mutation_form(mmut3)); mt->apply(m3); map_type_impl::mutation mmut2o{{}, {{int32_type->decompose(102), make_atomic_cell({})}}}; - mutation m2o(key, s); + mutation m2o(s, key); m2o.set_static_cell(column, my_set_type->serialize_mutation_form(mmut2o)); mt->apply(m2o); @@ -251,19 +251,19 @@ SEASTAR_TEST_CASE(test_list_mutations) { auto& column = *s->get_column_definition("s1"); auto make_key = [] { return timeuuid_type->decompose(utils::UUID_gen::get_time_UUID()); }; collection_type_impl::mutation mmut1{{}, {{make_key(), make_atomic_cell(int32_type->decompose(101))}}}; - mutation m1(key, s); + mutation m1(s, key); m1.set_static_cell(column, my_list_type->serialize_mutation_form(mmut1)); mt->apply(m1); collection_type_impl::mutation mmut2{{}, {{make_key(), make_atomic_cell(int32_type->decompose(102))}}}; - mutation m2(key, s); + mutation m2(s, key); m2.set_static_cell(column, my_list_type->serialize_mutation_form(mmut2)); mt->apply(m2); collection_type_impl::mutation mmut3{{}, {{make_key(), make_atomic_cell(int32_type->decompose(103))}}}; - mutation m3(key, s); + mutation m3(s, key); m3.set_static_cell(column, my_list_type->serialize_mutation_form(mmut3)); mt->apply(m3); collection_type_impl::mutation mmut2o{{}, {{make_key(), make_atomic_cell(int32_type->decompose(102))}}}; - mutation m2o(key, s); + mutation m2o(s, key); m2o.set_static_cell(column, my_list_type->serialize_mutation_form(mmut2o)); mt->apply(m2o); @@ -297,7 +297,7 @@ SEASTAR_TEST_CASE(test_multiple_memtables_one_partition) { auto insert_row = [&] (int32_t c1, int32_t r1) { auto c_key = clustering_key::from_exploded(*s, {int32_type->decompose(c1)}); - mutation m(key, s); + mutation m(s, key); m.set_clustered_cell(c_key, r1_col, make_atomic_cell(int32_type->decompose(r1))); cf.apply(std::move(m)); return cf.flush(); @@ -353,7 +353,7 @@ SEASTAR_TEST_CASE(test_flush_in_the_middle_of_a_scan) { partition_key::from_single_value(*s, to_bytes(sprint("key%d", next++)))); }; auto make_mutation = [&] { - mutation m(new_key(), s); + mutation m(s, new_key()); m.set_clustered_cell(clustering_key::make_empty(), "v", data_value(to_bytes("value")), 1); return m; }; @@ -429,7 +429,7 @@ SEASTAR_TEST_CASE(test_multiple_memtables_multiple_partitions) { auto insert_row = [&] (int32_t p1, int32_t c1, int32_t r1) { auto key = partition_key::from_exploded(*s, {int32_type->decompose(p1)}); auto c_key = clustering_key::from_exploded(*s, {int32_type->decompose(c1)}); - mutation m(key, s); + mutation m(s, key); m.set_clustered_cell(c_key, r1_col, atomic_cell::make_live(ts++, int32_type->decompose(r1))); cf.apply(std::move(m)); shadow[p1][c1] = r1; @@ -567,7 +567,7 @@ SEASTAR_TEST_CASE(test_querying_of_mutation) { return query::result_set::from_raw_result(s, slice, m.query(slice)); }; - mutation m(partition_key::from_single_value(*s, "key1"), s); + mutation m(s, partition_key::from_single_value(*s, "key1")); m.set_clustered_cell(clustering_key::make_empty(), "v", data_value(bytes("v1")), 1); assert_that(resultify(m)) @@ -590,7 +590,7 @@ SEASTAR_TEST_CASE(test_partition_with_no_live_data_is_absent_in_data_query_resul .with_column("v", bytes_type, column_kind::regular_column) .build(); - mutation m(partition_key::from_single_value(*s, "key1"), s); + mutation m(s, partition_key::from_single_value(*s, "key1")); m.partition().apply(tombstone(1, gc_clock::now())); m.partition().static_row().apply(*s->get_column_definition("sc1"), atomic_cell::make_dead(2, gc_clock::now())); @@ -613,7 +613,7 @@ SEASTAR_TEST_CASE(test_partition_with_live_data_in_static_row_is_present_in_the_ .with_column("v", bytes_type, column_kind::regular_column) .build(); - mutation m(partition_key::from_single_value(*s, "key1"), s); + mutation m(s, partition_key::from_single_value(*s, "key1")); m.partition().static_row().apply(*s->get_column_definition("sc1"), atomic_cell::make_live(2, bytes_type->decompose(data_value(bytes("sc1:value"))))); @@ -638,7 +638,7 @@ SEASTAR_TEST_CASE(test_query_result_with_one_regular_column_missing) { .with_column("v2", bytes_type, column_kind::regular_column) .build(); - mutation m(partition_key::from_single_value(*s, "key1"), s); + mutation m(s, partition_key::from_single_value(*s, "key1")); m.set_clustered_cell(clustering_key::from_single_value(*s, bytes("ck:A")), *s->get_column_definition("v1"), atomic_cell::make_live(2, bytes_type->decompose(data_value(bytes("v1:value"))))); @@ -665,7 +665,7 @@ SEASTAR_TEST_CASE(test_row_counting) { auto col_v = *s->get_column_definition("v"); - mutation m(partition_key::from_single_value(*s, "key1"), s); + mutation m(s, partition_key::from_single_value(*s, "key1")); BOOST_REQUIRE_EQUAL(0, m.live_row_count()); @@ -713,11 +713,11 @@ SEASTAR_TEST_CASE(test_tombstone_apply) { auto pkey = partition_key::from_single_value(*s, "key1"); - mutation m1(pkey, s); + mutation m1(s, pkey); BOOST_REQUIRE_EQUAL(m1.partition().partition_tombstone(), tombstone()); - mutation m2(pkey, s); + mutation m2(s, pkey); auto tomb = tombstone(api::new_timestamp(), gc_clock::now()); m2.partition().apply(tomb); BOOST_REQUIRE_EQUAL(m2.partition().partition_tombstone(), tomb); @@ -740,13 +740,13 @@ SEASTAR_TEST_CASE(test_marker_apply) { auto ckey = clustering_key::from_single_value(*s, "ck1"); auto mutation_with_marker = [&] (row_marker rm) { - mutation m(pkey, s); + mutation m(s, pkey); m.partition().clustered_row(*s, ckey).marker() = rm; return m; }; { - mutation m(pkey, s); + mutation m(s, pkey); auto marker = row_marker(api::new_timestamp()); auto mm = mutation_with_marker(marker); m.apply(mm); @@ -754,7 +754,7 @@ SEASTAR_TEST_CASE(test_marker_apply) { } { - mutation m(pkey, s); + mutation m(s, pkey); auto marker = row_marker(api::new_timestamp(), std::chrono::seconds(1), gc_clock::now()); m.apply(mutation_with_marker(marker)); BOOST_REQUIRE_EQUAL(m.partition().clustered_row(*s, ckey).marker(), marker); @@ -810,7 +810,7 @@ SEASTAR_TEST_CASE(test_mutation_diff) { auto ckey1 = clustering_key::from_single_value(*s, bytes_type->decompose(data_value(bytes("A")))); auto ckey2 = clustering_key::from_single_value(*s, bytes_type->decompose(data_value(bytes("B")))); - mutation m1(partition_key::from_single_value(*s, "key1"), s); + mutation m1(s, partition_key::from_single_value(*s, "key1")); m1.set_static_cell(*s->get_column_definition("sc1"), atomic_cell::make_dead(2, gc_clock::now())); @@ -827,7 +827,7 @@ SEASTAR_TEST_CASE(test_mutation_diff) { m1.set_clustered_cell(ckey2, *s->get_column_definition("v3"), my_set_type->serialize_mutation_form(mset1)); - mutation m2(partition_key::from_single_value(*s, "key1"), s); + mutation m2(s, partition_key::from_single_value(*s, "key1")); m2.set_clustered_cell(ckey1, *s->get_column_definition("v1"), atomic_cell::make_live(1, bytes_type->decompose(data_value(bytes("v1:value1a"))))); m2.set_clustered_cell(ckey1, *s->get_column_definition("v2"), @@ -841,7 +841,7 @@ SEASTAR_TEST_CASE(test_mutation_diff) { m2.set_clustered_cell(ckey2, *s->get_column_definition("v3"), my_set_type->serialize_mutation_form(mset2)); - mutation m3(partition_key::from_single_value(*s, "key1"), s); + mutation m3(s, partition_key::from_single_value(*s, "key1")); m3.set_clustered_cell(ckey1, *s->get_column_definition("v1"), atomic_cell::make_live(2, bytes_type->decompose(data_value(bytes("v1:value1"))))); @@ -853,7 +853,7 @@ SEASTAR_TEST_CASE(test_mutation_diff) { m3.set_clustered_cell(ckey2, *s->get_column_definition("v3"), my_set_type->serialize_mutation_form(mset3)); - mutation m12(partition_key::from_single_value(*s, "key1"), s); + mutation m12(s, partition_key::from_single_value(*s, "key1")); m12.apply(m1); m12.apply(m2); @@ -868,7 +868,7 @@ SEASTAR_TEST_CASE(test_mutation_diff) { BOOST_REQUIRE(cm.cells.size() == 1); BOOST_REQUIRE(cm.cells.front().first == int32_type->decompose(3)); - mutation m12_1(partition_key::from_single_value(*s, "key1"), s); + mutation m12_1(s, partition_key::from_single_value(*s, "key1")); m12_1.apply(m1); m12_1.partition().apply(*s, m2_1, *s); BOOST_REQUIRE_EQUAL(m12, m12_1); @@ -885,7 +885,7 @@ SEASTAR_TEST_CASE(test_mutation_diff) { BOOST_REQUIRE(cm.cells.size() == 1); BOOST_REQUIRE(cm.cells.front().first == int32_type->decompose(2)); - mutation m12_2(partition_key::from_single_value(*s, "key1"), s); + mutation m12_2(s, partition_key::from_single_value(*s, "key1")); m12_2.apply(m2); m12_2.partition().apply(*s, m1_2, *s); BOOST_REQUIRE_EQUAL(m12, m12_2); @@ -896,7 +896,7 @@ SEASTAR_TEST_CASE(test_mutation_diff) { auto m12_3 = m12.partition().difference(s, m3.partition()); BOOST_REQUIRE_EQUAL(m12_3.partition_tombstone(), m12.partition().partition_tombstone()); - mutation m123(partition_key::from_single_value(*s, "key1"), s); + mutation m123(s, partition_key::from_single_value(*s, "key1")); m123.apply(m3); m123.partition().apply(*s, m12_3, *s); BOOST_REQUIRE_EQUAL(m12, m123); @@ -917,7 +917,7 @@ SEASTAR_TEST_CASE(test_large_blobs) { const column_definition& s1_col = *s->get_column_definition("s1"); auto key = partition_key::from_exploded(*s, {to_bytes("key1")}); - mutation m(key, s); + mutation m(s, key); m.set_static_cell(s1_col, make_atomic_cell(bytes_type->decompose(data_value(blob1)))); mt->apply(std::move(m)); @@ -930,7 +930,7 @@ SEASTAR_TEST_CASE(test_large_blobs) { BOOST_REQUIRE(bytes_type->equal(cell.value(), bytes_type->decompose(data_value(blob1)))); // Stress managed_bytes::linearize and scatter by merging a value into the cell - mutation m2(key, s); + mutation m2(s, key); m2.set_static_cell(s1_col, atomic_cell::make_live(7, bytes_type->decompose(data_value(blob2)))); mt->apply(std::move(m2)); @@ -1058,7 +1058,7 @@ SEASTAR_TEST_CASE(test_mutation_upgrade) { auto ckey1 = clustering_key::from_singular(*s, data_value(bytes("A"))); { - mutation m(pk, s); + mutation m(s, pk); m.set_clustered_cell(ckey1, "v2", data_value(bytes("v2:value")), 1); assert_that(m).is_upgrade_equivalent( @@ -1098,7 +1098,7 @@ SEASTAR_TEST_CASE(test_mutation_upgrade) { } { - mutation m(pk, s); + mutation m(s, pk); m.set_clustered_cell(ckey1, "v1", data_value(bytes("v2:value")), 1); m.set_clustered_cell(ckey1, "v2", data_value(bytes("v2:value")), 1); @@ -1108,17 +1108,17 @@ SEASTAR_TEST_CASE(test_mutation_upgrade) { m.upgrade(s2); - mutation m2(pk, s2); + mutation m2(s2, pk); m2.partition().clustered_row(*s2, ckey1); assert_that(m).is_equal_to(m2); } { - mutation m(pk, make_builder() + mutation m(make_builder() .with_column("v1", bytes_type, column_kind::regular_column) .with_column("v2", bytes_type, column_kind::regular_column) .with_column("v3", bytes_type, column_kind::regular_column) - .build()); + .build(), pk); m.set_clustered_cell(ckey1, "v1", data_value(bytes("v1:value")), 1); m.set_clustered_cell(ckey1, "v2", data_value(bytes("v2:value")), 1); m.set_clustered_cell(ckey1, "v3", data_value(bytes("v3:value")), 1); @@ -1131,7 +1131,7 @@ SEASTAR_TEST_CASE(test_mutation_upgrade) { m.upgrade(s2); - mutation m2(pk, s2); + mutation m2(s2, pk); m2.set_clustered_cell(ckey1, "v1", data_value(bytes("v1:value")), 1); m2.set_clustered_cell(ckey1, "v3", data_value(bytes("v3:value")), 1); @@ -1181,7 +1181,7 @@ SEASTAR_TEST_CASE(test_querying_expired_cells) { }; { - mutation m(pk, s); + mutation m(s, pk); m.set_clustered_cell(ckey1, *s->get_column_definition("v1"), atomic_cell::make_live(api::new_timestamp(), v1.serialize(), t1, ttl)); m.set_clustered_cell(ckey1, *s->get_column_definition("v2"), atomic_cell::make_live(api::new_timestamp(), v2.serialize(), t2, ttl)); m.set_clustered_cell(ckey1, *s->get_column_definition("v3"), atomic_cell::make_live(api::new_timestamp(), v3.serialize(), t3, ttl)); @@ -1217,7 +1217,7 @@ SEASTAR_TEST_CASE(test_querying_expired_cells) { } { - mutation m(pk, s); + mutation m(s, pk); m.set_clustered_cell(ckey1, *s->get_column_definition("v1"), atomic_cell::make_live(api::new_timestamp(), v1.serialize(), t1, ttl)); m.set_static_cell(*s->get_column_definition("s1"), atomic_cell::make_live(api::new_timestamp(), v1.serialize(), t3, ttl)); @@ -1239,7 +1239,7 @@ SEASTAR_TEST_CASE(test_tombstone_purge) { auto key = partition_key::from_exploded(*s, {to_bytes("key1")}); const column_definition& col = *s->get_column_definition("value"); - mutation m(key, s); + mutation m(s, key); m.set_clustered_cell(clustering_key::make_empty(), col, make_atomic_cell(int32_type->decompose(1))); tombstone tomb(api::new_timestamp(), gc_clock::now() - std::chrono::seconds(1)); m.partition().apply(tomb); @@ -1261,7 +1261,7 @@ SEASTAR_TEST_CASE(test_slicing_mutation) { .build(); auto pk = partition_key::from_exploded(*s, { int32_type->decompose(0) }); - mutation m(pk, s); + mutation m(s, pk); constexpr auto row_count = 8; for (auto i = 0; i < row_count; i++) { m.set_clustered_cell(clustering_key_prefix::from_single_value(*s, int32_type->decompose(i)), @@ -1338,7 +1338,7 @@ SEASTAR_TEST_CASE(test_trim_rows) { .build(); auto pk = partition_key::from_exploded(*s, { int32_type->decompose(0) }); - mutation m(pk, s); + mutation m(s, pk); constexpr auto row_count = 8; for (auto i = 0; i < row_count; i++) { m.set_clustered_cell(clustering_key_prefix::from_single_value(*s, int32_type->decompose(i)), @@ -1387,7 +1387,7 @@ SEASTAR_TEST_CASE(test_collection_cell_diff) { auto& col = s->column_at(column_kind::regular_column, 0); auto k = dht::global_partitioner().decorate_key(*s, partition_key::from_single_value(*s, to_bytes("key"))); - mutation m1(k, s); + mutation m1(s, k); auto uuid = utils::UUID_gen::get_time_UUID_bytes(); collection_type_impl::mutation mcol1; mcol1.cells.emplace_back( @@ -1395,7 +1395,7 @@ SEASTAR_TEST_CASE(test_collection_cell_diff) { atomic_cell::make_live(api::timestamp_type(1), to_bytes("element"))); m1.set_clustered_cell(clustering_key::make_empty(), col, list_type_impl::serialize_mutation_form(mcol1)); - mutation m2(k, s); + mutation m2(s, k); collection_type_impl::mutation mcol2; mcol2.tomb = tombstone(api::timestamp_type(2), gc_clock::now()); m2.set_clustered_cell(clustering_key::make_empty(), col, list_type_impl::serialize_mutation_form(mcol2)); @@ -1451,7 +1451,7 @@ SEASTAR_TEST_CASE(test_continuity_merging) { auto&& s = *table.schema(); auto new_mutation = [&] { - return mutation(table.make_pkey(0), table.schema()); + return mutation(table.schema(), table.make_pkey(0)); }; { @@ -1497,8 +1497,8 @@ SEASTAR_TEST_CASE(test_continuity_merging) { // static row continuity { - auto complete = mutation(table.make_pkey(0), table.schema()); - auto incomplete = mutation(table.make_pkey(0), table.schema()); + auto complete = mutation(table.schema(), table.make_pkey(0)); + auto incomplete = mutation(table.schema(), table.make_pkey(0)); incomplete.partition().set_static_row_continuous(false); assert_that(complete + complete).has_same_continuity(complete); diff --git a/tests/mvcc_test.cc b/tests/mvcc_test.cc index fd64fa260e..37c42afd58 100644 --- a/tests/mvcc_test.cc +++ b/tests/mvcc_test.cc @@ -152,7 +152,7 @@ SEASTAR_TEST_CASE(test_apply_to_incomplete) { auto&& s = *table.schema(); auto new_mutation = [&] { - return mutation(table.make_pkey(0), table.schema()); + return mutation(table.schema(), table.make_pkey(0)); }; auto mutation_with_row = [&] (clustering_key ck) { @@ -216,7 +216,7 @@ SEASTAR_TEST_CASE(test_schema_upgrade_preserves_continuity) { simple_schema table; auto new_mutation = [&] { - return mutation(table.make_pkey(0), table.schema()); + return mutation(table.schema(), table.make_pkey(0)); }; auto mutation_with_row = [&] (clustering_key ck) { diff --git a/tests/perf/perf_cache_eviction.cc b/tests/perf/perf_cache_eviction.cc index b5df83c660..ad45349383 100644 --- a/tests/perf/perf_cache_eviction.cc +++ b/tests/perf/perf_cache_eviction.cc @@ -164,7 +164,7 @@ int main(int argc, char** argv) { auto mutator = seastar::async([&] { int32_t ckey_seq = 0; while (!cancelled) { - mutation m(pkey, s); + mutation m(s, pkey); auto ck = clustering_key::from_single_value(*s, data_value(ckey_seq++).serialize()); auto&& col = *s->get_column_definition(to_bytes("v")); m.set_clustered_cell(ck, col, atomic_cell::make_live(api::new_timestamp(), data_value(value).serialize())); diff --git a/tests/perf/perf_mutation.cc b/tests/perf/perf_mutation.cc index 9626f1f6e7..0798bab606 100644 --- a/tests/perf/perf_mutation.cc +++ b/tests/perf/perf_mutation.cc @@ -42,7 +42,7 @@ int main(int argc, char* argv[]) { bytes value = int32_type->decompose(3); time_it([&] { - mutation m(key, s); + mutation m(s, key); const column_definition& col = *s->get_column_definition("r1"); m.set_clustered_cell(c_key, col, make_atomic_cell(value)); mt.apply(std::move(m)); diff --git a/tests/perf/perf_mutation_readers.cc b/tests/perf/perf_mutation_readers.cc index dcbb762127..eca83d1eb0 100644 --- a/tests/perf/perf_mutation_readers.cc +++ b/tests/perf/perf_mutation_readers.cc @@ -66,7 +66,7 @@ std::vector combined::create_one_row(simple_schema& s) return boost::copy_range>( s.make_pkeys(1) | boost::adaptors::transformed([&] (auto& dkey) { - auto m = mutation(dkey, s.schema()); + auto m = mutation(s.schema(), dkey); m.apply(s.make_row(s.make_ckey(0), "value")); return m; }) @@ -78,7 +78,7 @@ std::vector combined::create_single_stream(simple_schema& s) return boost::copy_range>( s.make_pkeys(32) | boost::adaptors::transformed([&] (auto& dkey) { - auto m = mutation(dkey, s.schema()); + auto m = mutation(s.schema(), dkey); for (auto i = 0; i < 16; i++) { m.apply(s.make_row(s.make_ckey(i), "value")); } @@ -158,7 +158,7 @@ PERF_TEST_F(combined, many_overlapping) PERF_TEST_F(combined, disjoint_interleaved) { - return consume_all(make_combined_reader(schema().schema(), + return consume_all(make_combined_reader(schema().schema(), boost::copy_range>( disjoint_interleaved_streams() | boost::adaptors::transformed([] (auto&& ms) { @@ -170,7 +170,7 @@ PERF_TEST_F(combined, disjoint_interleaved) PERF_TEST_F(combined, disjoint_ranges) { - return consume_all(make_combined_reader(schema().schema(), + return consume_all(make_combined_reader(schema().schema(), boost::copy_range>( disjoint_ranges_streams() | boost::adaptors::transformed([] (auto&& ms) { diff --git a/tests/perf/perf_sstable.hh b/tests/perf/perf_sstable.hh index 1eff26f020..38dd2b9f26 100644 --- a/tests/perf/perf_sstable.hh +++ b/tests/perf/perf_sstable.hh @@ -109,7 +109,7 @@ public: auto idx = boost::irange(0, int(_cfg.partitions / _cfg.sstables)); return do_for_each(idx.begin(), idx.end(), [this] (auto iteration) { auto key = partition_key::from_deeply_exploded(*s, { this->random_key() }); - auto mut = mutation(key, this->s); + auto mut = mutation(this->s, key); for (auto& cdef: this->s->regular_columns()) { mut.set_clustered_cell(clustering_key::make_empty(), cdef, atomic_cell::make_live(0, utf8_type->decompose(this->random_column()))); } diff --git a/tests/perf_row_cache_update.cc b/tests/perf_row_cache_update.cc index 5cf43bcb4d..f0f80eb907 100644 --- a/tests/perf_row_cache_update.cc +++ b/tests/perf_row_cache_update.cc @@ -77,7 +77,7 @@ int main(int argc, char** argv) { std::vector mutations; for (unsigned i = 0; i < partitions; ++i) { - mutation m(new_key(s), s); + mutation m(s, new_key(s)); for (size_t j = 0; j < row_count; j++) { m.set_clustered_cell(new_ckey(s), "v", data_value(bytes(bytes::initialized_later(), cell_size)), 2); } diff --git a/tests/row_cache_alloc_stress.cc b/tests/row_cache_alloc_stress.cc index 9f3fcee2f2..3bafc3ddce 100644 --- a/tests/row_cache_alloc_stress.cc +++ b/tests/row_cache_alloc_stress.cc @@ -76,13 +76,13 @@ int main(int argc, char** argv) { size_t large_cell_size = cell_size * row_count; auto make_small_mutation = [&] { - mutation m(new_key(s), s); + mutation m(s, new_key(s)); m.set_clustered_cell(new_ckey(s), "v", data_value(bytes(bytes::initialized_later(), cell_size)), 1); return m; }; auto make_large_mutation = [&] { - mutation m(new_key(s), s); + mutation m(s, new_key(s)); m.set_clustered_cell(new_ckey(s), "v", data_value(bytes(bytes::initialized_later(), large_cell_size)), 2); return m; }; @@ -93,12 +93,12 @@ int main(int argc, char** argv) { for (int i = 0; i < 10; i++) { auto key = dht::global_partitioner().decorate_key(*s, new_key(s)); - mutation m1(key, s); + mutation m1(s, key); m1.set_clustered_cell(new_ckey(s), "v", data_value(bytes(bytes::initialized_later(), cell_size)), 1); cache.populate(m1); // Putting large mutations into the memtable. Should take about row_count*cell_size each. - mutation m2(key, s); + mutation m2(s, key); for (size_t j = 0; j < row_count; j++) { m2.set_clustered_cell(new_ckey(s), "v", data_value(bytes(bytes::initialized_later(), cell_size)), 2); } diff --git a/tests/row_cache_stress_test.cc b/tests/row_cache_stress_test.cc index fcb72f3717..eaadd64f4d 100644 --- a/tests/row_cache_stress_test.cc +++ b/tests/row_cache_stress_test.cc @@ -76,7 +76,7 @@ struct table { } mutation get_mutation(int key, api::timestamp_type t, const sstring& tag) { - mutation m(p_keys[key], s.schema()); + mutation m(s.schema(), p_keys[key]); for (auto ck : c_keys) { s.add_row(m, ck, tag, t); } diff --git a/tests/row_cache_test.cc b/tests/row_cache_test.cc index 8682ea6648..b19894d2a7 100644 --- a/tests/row_cache_test.cc +++ b/tests/row_cache_test.cc @@ -55,7 +55,7 @@ static thread_local api::timestamp_type next_timestamp = 1; static mutation make_new_mutation(schema_ptr s, partition_key key) { - mutation m(key, s); + mutation m(s, key); static thread_local int next_value = 1; m.set_clustered_cell(clustering_key::make_empty(), "v", data_value(to_bytes(sprint("v%d", next_value++))), next_timestamp++); return m; @@ -63,7 +63,7 @@ mutation make_new_mutation(schema_ptr s, partition_key key) { static inline mutation make_new_large_mutation(schema_ptr s, partition_key key) { - mutation m(key, s); + mutation m(s, key); static thread_local int next_value = 1; static constexpr size_t blob_size = 64 * 1024; std::vector data; @@ -311,7 +311,7 @@ SEASTAR_TEST_CASE(test_cache_delegates_to_underlying_only_once_multiple_mutation .build(); auto make_partition_mutation = [s] (bytes key) -> mutation { - mutation m(partition_key::from_single_value(*s, key), s); + mutation m(s, partition_key::from_single_value(*s, key)); m.set_clustered_cell(clustering_key::make_empty(), "v", data_value(bytes("v1")), 1); return m; }; @@ -784,7 +784,7 @@ SEASTAR_TEST_CASE(test_single_partition_update) { auto ck7 = make_ck(7); memtable_snapshot_source cache_mt(s); { - mutation m(pk, s); + mutation m(s, pk); m.set_clustered_cell(ck1, "v", data_value(101), 1); m.set_clustered_cell(ck2, "v", data_value(101), 1); m.set_clustered_cell(ck4, "v", data_value(101), 1); @@ -806,7 +806,7 @@ SEASTAR_TEST_CASE(test_single_partition_update) { auto mt = make_lw_shared(s); cache.update([&] { - mutation m(pk, s); + mutation m(s, pk); m.set_clustered_cell(ck3, "v", data_value(101), 1); mt->apply(m); cache_mt.apply(m); @@ -1415,7 +1415,7 @@ SEASTAR_TEST_CASE(test_mvcc) { auto m1 = m1_; m1.partition().make_fully_continuous(); - auto m2 = mutation(m1.decorated_key(), m1.schema()); + auto m2 = mutation(m1.schema(), m1.decorated_key()); m2.partition().apply(*s, m2_.partition(), *s); m2.partition().make_fully_continuous(); @@ -1434,7 +1434,7 @@ SEASTAR_TEST_CASE(test_slicing_mutation_reader) { .build(); auto pk = partition_key::from_exploded(*s, { int32_type->decompose(0) }); - mutation m(pk, s); + mutation m(s, pk); constexpr auto row_count = 8; for (auto i = 0; i < row_count; i++) { m.set_clustered_cell(clustering_key_prefix::from_single_value(*s, int32_type->decompose(i)), @@ -1579,7 +1579,7 @@ SEASTAR_TEST_CASE(test_update_invalidating) { memtable_snapshot_source underlying(s.schema()); auto mutation_for_key = [&] (dht::decorated_key key) { - mutation m(key, s.schema()); + mutation m(s.schema(), key); s.add_row(m, s.make_ckey(0), "val"); return m; }; @@ -1629,20 +1629,20 @@ SEASTAR_TEST_CASE(test_scan_with_partial_partitions) { auto pkeys = s.make_pkeys(3); - mutation m1(pkeys[0], s.schema()); + mutation m1(s.schema(), pkeys[0]); s.add_row(m1, s.make_ckey(0), "v1"); s.add_row(m1, s.make_ckey(1), "v2"); s.add_row(m1, s.make_ckey(2), "v3"); s.add_row(m1, s.make_ckey(3), "v4"); cache_mt->apply(m1); - mutation m2(pkeys[1], s.schema()); + mutation m2(s.schema(), pkeys[1]); s.add_row(m2, s.make_ckey(0), "v5"); s.add_row(m2, s.make_ckey(1), "v6"); s.add_row(m2, s.make_ckey(2), "v7"); cache_mt->apply(m2); - mutation m3(pkeys[2], s.schema()); + mutation m3(s.schema(), pkeys[2]); s.add_row(m3, s.make_ckey(0), "v8"); s.add_row(m3, s.make_ckey(1), "v9"); s.add_row(m3, s.make_ckey(2), "v10"); @@ -1696,12 +1696,12 @@ SEASTAR_TEST_CASE(test_cache_populates_partition_tombstone) { auto pkeys = s.make_pkeys(2); - mutation m1(pkeys[0], s.schema()); + mutation m1(s.schema(), pkeys[0]); s.add_static_row(m1, "val"); m1.partition().apply(tombstone(s.new_timestamp(), gc_clock::now())); cache_mt->apply(m1); - mutation m2(pkeys[1], s.schema()); + mutation m2(s.schema(), pkeys[1]); s.add_static_row(m2, "val"); m2.partition().apply(tombstone(s.new_timestamp(), gc_clock::now())); cache_mt->apply(m2); @@ -1751,12 +1751,12 @@ SEASTAR_TEST_CASE(test_tombstone_merging_in_partial_partition) { tombstone t0{s.new_timestamp(), gc_clock::now()}; tombstone t1{s.new_timestamp(), gc_clock::now()}; - mutation m1(pk, s.schema()); + mutation m1(s.schema(), pk); m1.partition().apply_delete(*s.schema(), s.make_range_tombstone(query::clustering_range::make(s.make_ckey(0), s.make_ckey(10)), t0)); underlying.apply(m1); - mutation m2(pk, s.schema()); + mutation m2(s.schema(), pk); m2.partition().apply_delete(*s.schema(), s.make_range_tombstone(query::clustering_range::make(s.make_ckey(3), s.make_ckey(6)), t1)); m2.partition().apply_delete(*s.schema(), @@ -1886,7 +1886,7 @@ SEASTAR_TEST_CASE(test_tombstones_are_not_missed_when_range_is_invalidated) { auto pk = s.make_pkey(0); auto pr = dht::partition_range::make_singular(pk); - mutation m1(pk, s.schema()); + mutation m1(s.schema(), pk); s.add_row(m1, s.make_ckey(0), "v0"); auto rt1 = s.make_range_tombstone(query::clustering_range::make(s.make_ckey(1), s.make_ckey(2)), s.new_tombstone()); @@ -1945,7 +1945,7 @@ SEASTAR_TEST_CASE(test_tombstones_are_not_missed_when_range_is_invalidated) { sma.produces_row_with_key(s.make_ckey(0)); sma.produces_range_tombstone(rt1); - mutation m2(pk, s.schema()); + mutation m2(s.schema(), pk); s.add_row(m2, s.make_ckey(7), "v7"); cache.invalidate([&] { @@ -2038,7 +2038,7 @@ SEASTAR_TEST_CASE(test_exception_safety_of_transitioning_from_underlying_read_to auto pk = s.make_pkey(0); auto pr = dht::partition_range::make_singular(pk); - mutation mut(pk, s.schema()); + mutation mut(s.schema(), pk); s.add_row(mut, s.make_ckey(6), "v"); auto rt = s.make_range_tombstone(s.make_ckey_range(3, 4)); mut.partition().apply_row_tombstone(*s.schema(), rt); @@ -2090,7 +2090,7 @@ SEASTAR_TEST_CASE(test_exception_safety_of_partition_scan) { std::vector muts; for (auto&& pk : pkeys) { - mutation mut(pk, s.schema()); + mutation mut(s.schema(), pk); s.add_row(mut, s.make_ckey(1), "v"); muts.push_back(mut); underlying.apply(mut); @@ -2128,7 +2128,7 @@ SEASTAR_TEST_CASE(test_concurrent_population_before_latest_version_iterator) { auto pk = s.make_pkey(0); auto pr = dht::partition_range::make_singular(pk); - mutation m1(pk, s.schema()); + mutation m1(s.schema(), pk); s.add_row(m1, s.make_ckey(0), "v"); s.add_row(m1, s.make_ckey(1), "v"); underlying.apply(m1); @@ -2148,7 +2148,7 @@ SEASTAR_TEST_CASE(test_concurrent_population_before_latest_version_iterator) { populate_range(cache, pr, s.make_ckey_range(0, 1)); auto rd = make_sm(s.schema()->full_slice()); // to keep current version alive - mutation m2(pk, s.schema()); + mutation m2(s.schema(), pk); s.add_row(m2, s.make_ckey(2), "v"); s.add_row(m2, s.make_ckey(3), "v"); s.add_row(m2, s.make_ckey(4), "v"); @@ -2213,7 +2213,7 @@ SEASTAR_TEST_CASE(test_concurrent_populating_partition_range_reads) { std::vector muts; for (auto&& k : keys) { - mutation m(k, s.schema()); + mutation m(s.schema(), k); m.partition().apply(s.new_tombstone()); muts.push_back(m); underlying.apply(m); @@ -2282,7 +2282,7 @@ SEASTAR_TEST_CASE(test_random_row_population) { auto pk = s.make_pkey(0); auto pr = dht::partition_range::make_singular(pk); - mutation m1(pk, s.schema()); + mutation m1(s.schema(), pk); s.add_row(m1, s.make_ckey(0), "v0"); s.add_row(m1, s.make_ckey(2), "v2"); s.add_row(m1, s.make_ckey(4), "v4"); @@ -2326,7 +2326,7 @@ SEASTAR_TEST_CASE(test_random_row_population) { for (auto&& r : ranges) { auto slice = std::make_unique(partition_slice_builder(*s.schema()).with_range(r).build()); auto sm = make_sm(slice.get()); - readers.push_back(read{std::move(slice), std::move(sm), mutation(pk, s.schema())}); + readers.push_back(read{std::move(slice), std::move(sm), mutation(s.schema(), pk)}); } while (!readers.empty()) { @@ -2386,20 +2386,20 @@ SEASTAR_TEST_CASE(test_continuity_is_populated_when_read_overlaps_with_older_ver auto pk = s.make_pkey(0); auto pr = dht::partition_range::make_singular(pk); - mutation m1(pk, s.schema()); + mutation m1(s.schema(), pk); s.add_row(m1, s.make_ckey(2), "v2"); s.add_row(m1, s.make_ckey(4), "v4"); underlying.apply(m1); - mutation m2(pk, s.schema()); + mutation m2(s.schema(), pk); s.add_row(m2, s.make_ckey(6), "v6"); s.add_row(m2, s.make_ckey(8), "v8"); - mutation m3(pk, s.schema()); + mutation m3(s.schema(), pk); s.add_row(m3, s.make_ckey(10), "v"); s.add_row(m3, s.make_ckey(12), "v"); - mutation m4(pk, s.schema()); + mutation m4(s.schema(), pk); s.add_row(m4, s.make_ckey(14), "v"); row_cache cache(s.schema(), snapshot_source([&] { return underlying(); }), tracker); @@ -2520,16 +2520,16 @@ SEASTAR_TEST_CASE(test_continuity_population_with_multicolumn_clustering_key) { return tombstone(api::new_timestamp(), gc_clock::now()); }; - mutation m34(pk, s); + mutation m34(s, pk); m34.partition().clustered_row(*s, ck3).apply(new_tombstone()); m34.partition().clustered_row(*s, ck4).apply(new_tombstone()); - mutation m1(pk, s); + mutation m1(s, pk); m1.partition().clustered_row(*s, ck2).apply(new_tombstone()); m1.apply(m34); underlying.apply(m1); - mutation m2(pk, s); + mutation m2(s, pk); m2.partition().clustered_row(*s, ck6).apply(new_tombstone()); row_cache cache(s, snapshot_source([&] { return underlying(); }), tracker); @@ -2591,7 +2591,7 @@ SEASTAR_TEST_CASE(test_continuity_is_populated_for_single_row_reads) { auto pk = s.make_pkey(0); auto pr = dht::partition_range::make_singular(pk); - mutation m1(pk, s.schema()); + mutation m1(s.schema(), pk); s.add_row(m1, s.make_ckey(2), "v2"); s.add_row(m1, s.make_ckey(4), "v4"); s.add_row(m1, s.make_ckey(6), "v6"); @@ -2635,14 +2635,14 @@ SEASTAR_TEST_CASE(test_concurrent_setting_of_continuity_on_read_upper_bound) { auto pk = s.make_pkey(0); auto pr = dht::partition_range::make_singular(pk); - mutation m1(pk, s.schema()); + mutation m1(s.schema(), pk); s.add_row(m1, s.make_ckey(0), "v1"); s.add_row(m1, s.make_ckey(1), "v1"); s.add_row(m1, s.make_ckey(2), "v1"); s.add_row(m1, s.make_ckey(3), "v1"); underlying.apply(m1); - mutation m2(pk, s.schema()); + mutation m2(s.schema(), pk); s.add_row(m2, s.make_ckey(4), "v2"); row_cache cache(s.schema(), snapshot_source([&] { return underlying(); }), tracker); @@ -2698,14 +2698,14 @@ SEASTAR_TEST_CASE(test_tombstone_merging_of_overlapping_tombstones_in_many_versi auto pk = s.make_pkey(0); auto pr = dht::partition_range::make_singular(pk); - mutation m1(pk, s.schema()); + mutation m1(s.schema(), pk); m1.partition().apply_delete(*s.schema(), s.make_range_tombstone(s.make_ckey_range(2, 107), s.new_tombstone())); s.add_row(m1, s.make_ckey(5), "val"); // What is important here is that it contains a newer range tombstone // which trims [2, 107] from m1 into (100, 107], which starts after ck=5. - mutation m2(pk, s.schema()); + mutation m2(s.schema(), pk); m2.partition().apply_delete(*s.schema(), s.make_range_tombstone(s.make_ckey_range(1, 100), s.new_tombstone())); diff --git a/tests/schema_change_test.cc b/tests/schema_change_test.cc index 30ddab994b..da9069f21c 100644 --- a/tests/schema_change_test.cc +++ b/tests/schema_change_test.cc @@ -111,7 +111,7 @@ SEASTAR_TEST_CASE(test_tombstones_are_ignored_in_version_calculation) { BOOST_TEST_MESSAGE("Applying a no-op tombstone to v1 column definition"); auto s = db::schema_tables::columns(); auto pkey = partition_key::from_singular(*s, table_schema->ks_name()); - mutation m(pkey, s); + mutation m(s, pkey); auto ckey = clustering_key::from_exploded(*s, {utf8_type->decompose(table_schema->cf_name()), "v1"}); m.partition().apply_delete(*s, ckey, tombstone(api::min_timestamp, gc_clock::now())); service::get_local_migration_manager().announce(std::vector({m}), true).get(); diff --git a/tests/simple_schema.hh b/tests/simple_schema.hh index 1ff86cd07d..150f06c3cc 100644 --- a/tests/simple_schema.hh +++ b/tests/simple_schema.hh @@ -138,7 +138,7 @@ public: } mutation new_mutation(sstring pk) { - return mutation(make_pkey(pk), _s); + return mutation(_s, make_pkey(pk)); } schema_ptr schema() { diff --git a/tests/sstable_datafile_test.cc b/tests/sstable_datafile_test.cc index 7ab140af76..4bca92c965 100644 --- a/tests/sstable_datafile_test.cc +++ b/tests/sstable_datafile_test.cc @@ -103,7 +103,7 @@ SEASTAR_TEST_CASE(datafile_generation_01) { auto key = partition_key::from_exploded(*s, {to_bytes("key1")}); auto c_key = clustering_key::from_exploded(*s, {to_bytes("abc")}); - mutation m(key, s); + mutation m(s, key); m.set_clustered_cell(c_key, r1_col, make_atomic_cell(int32_type->decompose(1))); mt->apply(std::move(m)); @@ -171,7 +171,7 @@ SEASTAR_TEST_CASE(datafile_generation_02) { auto key = partition_key::from_exploded(*s, {to_bytes("key1"), to_bytes("key2")}); auto c_key = clustering_key::from_exploded(*s, {to_bytes("abc")}); - mutation m(key, s); + mutation m(s, key); m.set_clustered_cell(c_key, r1_col, make_atomic_cell(int32_type->decompose(1))); mt->apply(std::move(m)); @@ -241,7 +241,7 @@ SEASTAR_TEST_CASE(datafile_generation_03) { auto key = partition_key::from_exploded(*s, {to_bytes("key1")}); auto c_key = clustering_key::from_exploded(*s, {to_bytes("abc"), to_bytes("cde")}); - mutation m(key, s); + mutation m(s, key); m.set_clustered_cell(c_key, r1_col, make_atomic_cell(int32_type->decompose(1))); mt->apply(std::move(m)); @@ -313,7 +313,7 @@ SEASTAR_TEST_CASE(datafile_generation_04) { auto key = partition_key::from_exploded(*s, {to_bytes("key1")}); auto c_key = clustering_key::from_exploded(*s, {to_bytes("abc")}); - mutation m(key, s); + mutation m(s, key); m.set_static_cell(s1_col, make_atomic_cell(int32_type->decompose(10))); m.set_clustered_cell(c_key, r1_col, make_atomic_cell(int32_type->decompose(1))); mt->apply(std::move(m)); @@ -386,7 +386,7 @@ SEASTAR_TEST_CASE(datafile_generation_05) { auto key = partition_key::from_exploded(*s, {to_bytes("key1")}); auto c_key = clustering_key::from_exploded(*s, {to_bytes("abc")}); - mutation m(key, s); + mutation m(s, key); m.set_clustered_cell(c_key, r1_col, make_atomic_cell(int32_type->decompose(1), 3600, 3600)); mt->apply(std::move(m)); @@ -461,7 +461,7 @@ SEASTAR_TEST_CASE(datafile_generation_06) { auto key = partition_key::from_exploded(*s, {to_bytes("key1")}); auto c_key = clustering_key::from_exploded(*s, {to_bytes("abc")}); - mutation m(key, s); + mutation m(s, key); m.set_clustered_cell(c_key, r1_col, make_dead_atomic_cell(3600)); mt->apply(std::move(m)); @@ -530,14 +530,14 @@ SEASTAR_TEST_CASE(datafile_generation_07) { auto key = partition_key::from_exploded(*s, {to_bytes("key1")}); auto c_key = clustering_key::from_exploded(*s, {to_bytes("abc")}); - mutation m(key, s); + mutation m(s, key); m.set_clustered_cell(c_key, r1_col, make_atomic_cell(int32_type->decompose(1))); mt->apply(std::move(m)); auto key2 = partition_key::from_exploded(*s, {to_bytes("key2")}); auto c_key2 = clustering_key::from_exploded(*s, {to_bytes("cde")}); - mutation m2(key2, s); + mutation m2(s, key2); m2.set_clustered_cell(c_key2, r1_col, make_atomic_cell(int32_type->decompose(1))); mt->apply(std::move(m2)); @@ -592,7 +592,7 @@ SEASTAR_TEST_CASE(datafile_generation_08) { auto key = partition_key::from_exploded(*s, {int32_type->decompose(i)}); auto c_key = clustering_key::from_exploded(*s, {to_bytes("abc")}); - mutation m(key, s); + mutation m(s, key); m.set_clustered_cell(c_key, r1_col, make_atomic_cell(int32_type->decompose(1))); mt->apply(std::move(m)); } @@ -652,7 +652,7 @@ SEASTAR_TEST_CASE(datafile_generation_09) { auto key = partition_key::from_exploded(*s, {to_bytes("key1")}); auto c_key = clustering_key::from_exploded(*s, {to_bytes("abc")}); - mutation m(key, s); + mutation m(s, key); m.set_clustered_cell(c_key, r1_col, make_atomic_cell(int32_type->decompose(1))); mt->apply(std::move(m)); @@ -700,7 +700,7 @@ SEASTAR_TEST_CASE(datafile_generation_10) { auto key = partition_key::from_exploded(*s, {to_bytes("key1")}); auto c_key = clustering_key::from_exploded(*s, {to_bytes("abc")}); - mutation m(key, s); + mutation m(s, key); m.set_clustered_cell(c_key, r1_col, make_atomic_cell(int32_type->decompose(1))); mt->apply(std::move(m)); @@ -775,7 +775,7 @@ SEASTAR_TEST_CASE(datafile_generation_11) { auto key = partition_key::from_exploded(*s, {to_bytes("key1")}); auto c_key = clustering_key::from_exploded(*s, {to_bytes("c1"), to_bytes("c2")}); - mutation m(key, s); + mutation m(s, key); tombstone tomb(api::new_timestamp(), gc_clock::now()); set_type_impl::mutation set_mut{{ tomb }, { @@ -791,7 +791,7 @@ SEASTAR_TEST_CASE(datafile_generation_11) { m.set_static_cell(static_set_col, static_set_type->serialize_mutation_form(set_mut)); auto key2 = partition_key::from_exploded(*s, {to_bytes("key2")}); - mutation m2(key2, s); + mutation m2(s, key2); set_type_impl::mutation set_mut_single{{}, {{ to_bytes("4"), make_atomic_cell({}) }}}; m2.set_clustered_cell(c_key, set_col, set_type->serialize_mutation_form(set_mut_single)); @@ -867,7 +867,7 @@ SEASTAR_TEST_CASE(datafile_generation_12) { auto key = partition_key::from_exploded(*s, {to_bytes("key1")}); auto cp = clustering_key_prefix::from_exploded(*s, {to_bytes("c1")}); - mutation m(key, s); + mutation m(s, key); tombstone tomb(api::new_timestamp(), gc_clock::now()); m.partition().apply_delete(*s, cp, tomb); @@ -903,7 +903,7 @@ static future<> sstable_compression_test(compressor c, unsigned generation) { auto key = partition_key::from_exploded(*s, {to_bytes("key1")}); auto cp = clustering_key_prefix::from_exploded(*s, {to_bytes("c1")}); - mutation m(key, s); + mutation m(s, key); tombstone tomb(api::new_timestamp(), gc_clock::now()); m.partition().apply_delete(*s, cp, tomb); @@ -948,7 +948,7 @@ SEASTAR_TEST_CASE(datafile_generation_16) { for (int i = 0; i < 0x80; ++i) { sstring k = "key" + to_sstring(i); auto key = partition_key::from_exploded(*s, {to_bytes(k)}); - mutation m(key, s); + mutation m(s, key); auto c_key = clustering_key::make_empty(); m.set_clustered_cell(c_key, to_bytes("col2"), i, api::max_timestamp); @@ -1041,7 +1041,7 @@ SEASTAR_TEST_CASE(compaction_manager_test) { auto key = partition_key::from_exploded(*s, {to_bytes(k)}); auto c_key = clustering_key::from_exploded(*s, {to_bytes("abc")}); - mutation m(key, s); + mutation m(s, key); m.set_clustered_cell(c_key, r1_col, make_atomic_cell(int32_type->decompose(1))); mt->apply(std::move(m)); @@ -1226,7 +1226,7 @@ static future> compact_sstables(std::vectorapply(std::move(m)); @@ -1376,7 +1376,7 @@ SEASTAR_TEST_CASE(datafile_generation_37) { auto mtp = make_lw_shared(s); auto key = partition_key::from_exploded(*s, {to_bytes("key1")}); - mutation m(key, s); + mutation m(s, key); auto c_key = clustering_key_prefix::from_exploded(*s, {to_bytes("cl1")}); const column_definition& cl2 = *s->get_column_definition("cl2"); @@ -1411,7 +1411,7 @@ SEASTAR_TEST_CASE(datafile_generation_38) { auto mtp = make_lw_shared(s); auto key = partition_key::from_exploded(*s, {to_bytes("key1")}); - mutation m(key, s); + mutation m(s, key); auto c_key = clustering_key_prefix::from_exploded(*s, {to_bytes("cl1"), to_bytes("cl2")}); @@ -1445,7 +1445,7 @@ SEASTAR_TEST_CASE(datafile_generation_39) { auto mtp = make_lw_shared(s); auto key = partition_key::from_exploded(*s, {to_bytes("key1")}); - mutation m(key, s); + mutation m(s, key); auto c_key = clustering_key::make_empty(); @@ -1497,7 +1497,7 @@ SEASTAR_TEST_CASE(datafile_generation_40) { auto mt = make_lw_shared(s); auto key = partition_key::from_exploded(*s, {to_bytes("key1")}); - mutation m(key, s); + mutation m(s, key); const column_definition& r1_col = *s->get_column_definition("r1"); auto ca = clustering_key::from_exploded(*s, {to_bytes("a")}); @@ -1545,7 +1545,7 @@ SEASTAR_TEST_CASE(datafile_generation_41) { auto key = partition_key::from_exploded(*s, {to_bytes("key1")}); auto c_key = clustering_key::from_exploded(*s, {to_bytes("c1")}); - mutation m(key, s); + mutation m(s, key); tombstone tomb(api::new_timestamp(), gc_clock::now()); m.partition().apply_delete(*s, std::move(c_key), tomb); @@ -1606,7 +1606,7 @@ SEASTAR_TEST_CASE(datafile_generation_47) { auto key = partition_key::from_exploded(*s, {to_bytes("key1")}); auto c_key = clustering_key::from_exploded(*s, {to_bytes("c1")}); - mutation m(key, s); + mutation m(s, key); m.set_clustered_cell(c_key, r1_col, make_atomic_cell(bytes(512*1024, 'a'))); mt->apply(std::move(m)); @@ -1645,7 +1645,7 @@ SEASTAR_TEST_CASE(test_counter_write) { auto c_key = clustering_key::from_exploded(*s, {to_bytes("c1")}); auto c_key2 = clustering_key::from_exploded(*s, {to_bytes("c2")}); - mutation m(key, s); + mutation m(s, key); std::vector ids; std::generate_n(std::back_inserter(ids), 3, counter_id::generate_random); @@ -2329,20 +2329,20 @@ SEASTAR_TEST_CASE(tombstone_purge_test) { }; auto make_insert = [&] (partition_key key) { - mutation m(key, s); + mutation m(s, key); m.set_clustered_cell(clustering_key::make_empty(), bytes("value"), data_value(int32_t(1)), next_timestamp()); return m; }; auto make_expiring = [&] (partition_key key, int ttl) { - mutation m(key, s); + mutation m(s, key); m.set_clustered_cell(clustering_key::make_empty(), bytes("value"), data_value(int32_t(1)), gc_clock::now().time_since_epoch().count(), gc_clock::duration(ttl)); return m; }; auto make_delete = [&] (partition_key key) { - mutation m(key, s); + mutation m(s, key); tombstone tomb(next_timestamp(), gc_clock::now()); m.partition().apply(tomb); return m; @@ -2554,7 +2554,7 @@ SEASTAR_TEST_CASE(sstable_rewrite) { auto apply_key = [mt, s, &r1_col] (sstring key_to_write) { auto key = partition_key::from_exploded(*s, {to_bytes(key_to_write)}); auto c_key = clustering_key::from_exploded(*s, {to_bytes("c1")}); - mutation m(key, s); + mutation m(s, key); m.set_clustered_cell(c_key, r1_col, make_atomic_cell(bytes("a"))); mt->apply(std::move(m)); }; @@ -2889,7 +2889,7 @@ SEASTAR_TEST_CASE(test_sstable_max_local_deletion_time) { for (auto i = 0; i < 10; i++) { auto key = partition_key::from_exploded(*s, {to_bytes("key" + to_sstring(i))}); - mutation m(key, s); + mutation m(s, key); auto c_key = clustering_key::from_exploded(*s, {to_bytes("c1")}); last_expiry = (gc_clock::now() + gc_clock::duration(3600 + i)).time_since_epoch().count(); m.set_clustered_cell(c_key, *s->get_column_definition("r1"), make_atomic_cell(bytes("a"), 3600 + i, last_expiry)); @@ -2931,7 +2931,7 @@ SEASTAR_TEST_CASE(test_sstable_max_local_deletion_time_2) { }); }; - mutation m(partition_key::from_exploded(*s, {to_bytes("deletetest")}), s); + mutation m(s, partition_key::from_exploded(*s, {to_bytes("deletetest")})); for (auto i = 0; i < 5; i++) { add_row(m, to_bytes("deletecolumn" + to_sstring(i)), 100); } @@ -2940,7 +2940,7 @@ SEASTAR_TEST_CASE(test_sstable_max_local_deletion_time_2) { BOOST_REQUIRE(last_expiry == sst1->get_stats_metadata().max_local_deletion_time); mt = make_lw_shared(s); - m = mutation(partition_key::from_exploded(*s, {to_bytes("deletetest")}), s); + m = mutation(s, partition_key::from_exploded(*s, {to_bytes("deletetest")})); tombstone tomb(api::new_timestamp(), now); m.partition().apply_delete(*s, clustering_key::from_exploded(*s, {to_bytes("todelete")}), tomb); mt->apply(std::move(m)); @@ -3024,7 +3024,7 @@ SEASTAR_TEST_CASE(compaction_with_fully_expired_table) { }; auto mt = make_lw_shared(s); - mutation m(key, s); + mutation m(s, key); tombstone tomb(api::new_timestamp(), gc_clock::now() - std::chrono::seconds(3600)); m.partition().apply_delete(*s, c_key, tomb); mt->apply(std::move(m)); @@ -3185,7 +3185,7 @@ SEASTAR_TEST_CASE(time_window_strategy_correctness_test) { }; auto make_insert = [&] (partition_key key, api::timestamp_type t) { - mutation m(key, s); + mutation m(s, key); m.set_clustered_cell(clustering_key::make_empty(), bytes("value"), data_value(int32_t(1)), t); return m; }; @@ -3341,14 +3341,14 @@ static void test_min_max_clustering_key(schema_ptr s, std::vector explode if (!exploded_ck.empty()) { c_key = clustering_key::from_exploded(*s, exploded_ck); } - mutation m(key, s); + mutation m(s, key); m.set_clustered_cell(c_key, r1_col, make_atomic_cell(int32_type->decompose(1))); mt->apply(std::move(m)); }; auto remove_data = [&mt, &s] (std::vector& exploded_pk, std::vector&& exploded_ck) { auto key = partition_key::from_exploded(*s, exploded_pk); auto c_key = clustering_key::from_exploded(*s, exploded_ck); - mutation m(key, s); + mutation m(s, key); tombstone tomb(api::new_timestamp(), gc_clock::now()); m.partition().apply_delete(*s, c_key, tomb); mt->apply(std::move(m)); @@ -3437,7 +3437,7 @@ SEASTAR_TEST_CASE(min_max_clustering_key_test_2) { for (auto j = 0; j < 8; j++) { auto key = partition_key::from_exploded(*s, {to_bytes("key" + to_sstring(j))}); - mutation m(key, s); + mutation m(s, key); for (auto i = 100; i < 150; i++) { auto c_key = clustering_key::from_exploded(*s, {to_bytes(to_sstring(j) + "ck" + to_sstring(i))}); m.set_clustered_cell(c_key, r1_col, make_atomic_cell(int32_type->decompose(1))); @@ -3451,7 +3451,7 @@ SEASTAR_TEST_CASE(min_max_clustering_key_test_2) { mt = make_lw_shared(s); auto key = partition_key::from_exploded(*s, {to_bytes("key9")}); - mutation m(key, s); + mutation m(s, key); for (auto i = 101; i < 299; i++) { auto c_key = clustering_key::from_exploded(*s, {to_bytes(to_sstring(9) + "ck" + to_sstring(i))}); m.set_clustered_cell(c_key, r1_col, make_atomic_cell(int32_type->decompose(1))); @@ -3484,7 +3484,7 @@ SEASTAR_TEST_CASE(sstable_tombstone_metadata_check) { { auto mt = make_lw_shared(s); - mutation m(key, s); + mutation m(s, key); tombstone tomb(api::new_timestamp(), gc_clock::now()); m.partition().apply_delete(*s, c_key, tomb); mt->apply(std::move(m)); @@ -3496,7 +3496,7 @@ SEASTAR_TEST_CASE(sstable_tombstone_metadata_check) { { auto mt = make_lw_shared(s); - mutation m(key, s); + mutation m(s, key); m.set_clustered_cell(c_key, r1_col, make_dead_atomic_cell(3600)); mt->apply(std::move(m)); auto sst = make_sstable(s, tmp->path, 2, la, big); @@ -3507,7 +3507,7 @@ SEASTAR_TEST_CASE(sstable_tombstone_metadata_check) { { auto mt = make_lw_shared(s); - mutation m(key, s); + mutation m(s, key); m.set_clustered_cell(c_key, r1_col, make_atomic_cell(int32_type->decompose(1))); mt->apply(std::move(m)); auto sst = make_sstable(s, tmp->path, 3, la, big); @@ -3519,13 +3519,13 @@ SEASTAR_TEST_CASE(sstable_tombstone_metadata_check) { { auto mt = make_lw_shared(s); - mutation m(key, s); + mutation m(s, key); tombstone tomb(api::new_timestamp(), gc_clock::now()); m.partition().apply_delete(*s, c_key, tomb); mt->apply(std::move(m)); auto key2 = partition_key::from_exploded(*s, {to_bytes("key2")}); - mutation m2(key2, s); + mutation m2(s, key2); m2.set_clustered_cell(c_key, r1_col, make_atomic_cell(int32_type->decompose(1))); mt->apply(std::move(m2)); @@ -3537,7 +3537,7 @@ SEASTAR_TEST_CASE(sstable_tombstone_metadata_check) { { auto mt = make_lw_shared(s); - mutation m(key, s); + mutation m(s, key); tombstone tomb(api::new_timestamp(), gc_clock::now()); m.partition().apply(tomb); mt->apply(std::move(m)); @@ -3549,7 +3549,7 @@ SEASTAR_TEST_CASE(sstable_tombstone_metadata_check) { { auto mt = make_lw_shared(s); - mutation m(key, s); + mutation m(s, key); tombstone tomb(api::new_timestamp(), gc_clock::now()); range_tombstone rt(clustering_key_prefix::from_single_value(*s, bytes("a")), clustering_key_prefix::from_single_value(*s, bytes("a")), tomb); m.partition().apply_delete(*s, std::move(rt)); @@ -3667,7 +3667,7 @@ SEASTAR_TEST_CASE(test_repeated_tombstone_skipping) { tmpdir dir; sstable_writer_config cfg; cfg.promoted_index_block_size = 100; - auto mut = mutation(table.make_pkey("key"), table.schema()); + auto mut = mutation(table.schema(), table.make_pkey("key")); for (auto&& mf : fragments) { mut.apply(mf); } @@ -3720,7 +3720,7 @@ SEASTAR_TEST_CASE(test_skipping_using_index) { std::vector partitions; uint32_t row_id = 0; for (auto&& key : keys) { - mutation m(key, table.schema()); + mutation m(table.schema(), key); for (unsigned j = 0; j < rows_per_part; ++j) { table.add_row(m, table.make_ckey(row_id++), make_random_string(1)); } @@ -3991,7 +3991,7 @@ SEASTAR_TEST_CASE(sstable_tombstone_histogram_test) { }; auto make_delete = [&] (partition_key key) { - mutation m(key, s); + mutation m(s, key); tombstone tomb(next_timestamp(), gc_clock::now()); m.partition().apply(tomb); return m; @@ -4045,7 +4045,7 @@ SEASTAR_TEST_CASE(sstable_expired_data_ratio) { auto insert_key = [&] (bytes k, uint32_t ttl, uint32_t expiration_time) { auto key = partition_key::from_exploded(*s, {k}); - mutation m(key, s); + mutation m(s, key); auto c_key = clustering_key::from_exploded(*s, {to_bytes("c1")}); m.set_clustered_cell(c_key, *s->get_column_definition("r1"), make_atomic_cell(bytes("a"), ttl, expiration_time)); mt->apply(std::move(m)); @@ -4152,7 +4152,7 @@ SEASTAR_TEST_CASE(sstable_owner_shards) { }; auto make_insert = [&] (auto p) { auto key = partition_key::from_exploded(*s, {to_bytes(p.first)}); - mutation m(key, s); + mutation m(s, key); m.set_clustered_cell(clustering_key::make_empty(), bytes("value"), data_value(int32_t(1)), 1); BOOST_REQUIRE(m.decorated_key().token() == p.second); return m; @@ -4218,7 +4218,7 @@ SEASTAR_TEST_CASE(test_summary_entry_spanning_more_keys_than_min_interval) { for (auto i = 0; i < s->min_index_interval()*1.5; i++) { auto key = partition_key::from_exploded(*s, {int32_type->decompose(i)}); auto c_key = clustering_key::from_exploded(*s, {to_bytes("abc")}); - mutation m(key, s); + mutation m(s, key); m.set_clustered_cell(c_key, r1_col, make_atomic_cell(int32_type->decompose(1))); mutations.push_back(std::move(m)); keys_written++; @@ -4361,7 +4361,7 @@ SEASTAR_TEST_CASE(compaction_correctness_with_partitioned_sstable_set) { auto make_insert = [&] (auto p) { auto key = partition_key::from_exploded(*s, {to_bytes(p.first)}); - mutation m(key, s); + mutation m(s, key); m.set_clustered_cell(clustering_key::make_empty(), bytes("value"), data_value(int32_t(1)), 1 /* ts */); BOOST_REQUIRE(m.decorated_key().token() == p.second); return m; @@ -4493,7 +4493,7 @@ SEASTAR_TEST_CASE(test_old_format_non_compound_range_tombstone_is_read) { auto pk = partition_key::from_exploded(*s, { int32_type->decompose(1) }); auto dk = dht::global_partitioner().decorate_key(*s, pk); auto ck = clustering_key::from_exploded(*s, {int32_type->decompose(2)}); - mutation m(dk, s); + mutation m(s, dk); m.set_clustered_cell(ck, *s->get_column_definition("v"), atomic_cell::make_live(1511270919978349, int32_type->decompose(1), { })); m.partition().apply_delete(*s, ck, {1511270943827278, gc_clock::from_time_t(1511270943)}); @@ -4517,7 +4517,7 @@ SEASTAR_TEST_CASE(summary_rebuild_sanity) { const column_definition& col = *s->get_column_definition("value"); auto make_insert = [&] (partition_key key) { - mutation m(key, s); + mutation m(s, key); m.set_clustered_cell(clustering_key::make_empty(), col, make_atomic_cell(bytes(1024, 'a'))); return m; }; diff --git a/tests/sstable_mutation_test.cc b/tests/sstable_mutation_test.cc index b5c863555a..ad177ee6ff 100644 --- a/tests/sstable_mutation_test.cc +++ b/tests/sstable_mutation_test.cc @@ -412,7 +412,7 @@ SEASTAR_TEST_CASE(test_sstable_can_write_and_read_range_tombstone) { auto c_key_start = clustering_key::from_exploded(*s, {int32_type->decompose(1)}); auto c_key_end = clustering_key::from_exploded(*s, {int32_type->decompose(2)}); - mutation m(key, s); + mutation m(s, key); auto ttl = gc_clock::now() + std::chrono::seconds(1); m.partition().apply_delete(*s, range_tombstone(c_key_start, bound_kind::excl_start, c_key_end, bound_kind::excl_end, tombstone(9, ttl))); @@ -778,7 +778,7 @@ SEASTAR_TEST_CASE(test_non_compound_table_row_is_not_marked_as_static) { auto k = partition_key::from_exploded(*s, {to_bytes(make_local_key(s))}); auto ck = clustering_key::from_exploded(*s, {int32_type->decompose(static_cast(0xffff0000))}); - mutation m(k, s); + mutation m(s, k); auto cell = atomic_cell::make_live(1, int32_type->decompose(17), { }); m.set_clustered_cell(ck, *s->get_column_definition("v"), std::move(cell)); @@ -811,7 +811,7 @@ SEASTAR_TEST_CASE(test_promoted_index_blocks_are_monotonic) { auto k = partition_key::from_exploded(*s, {to_bytes(make_local_key(s))}); auto cell = atomic_cell::make_live(1, int32_type->decompose(88), { }); - mutation m(k, s); + mutation m(s, k); auto ck = clustering_key::from_exploded(*s, {int32_type->decompose(1), int32_type->decompose(2)}); m.set_clustered_cell(ck, *s->get_column_definition("v"), cell); @@ -861,7 +861,7 @@ SEASTAR_TEST_CASE(test_promoted_index_blocks_are_monotonic_compound_dense) { auto dk = dht::global_partitioner().decorate_key(*s, partition_key::from_exploded(*s, {to_bytes(make_local_key(s))})); auto cell = atomic_cell::make_live(1, int32_type->decompose(88), { }); - mutation m(dk, s); + mutation m(s, dk); auto ck1 = clustering_key::from_exploded(*s, {int32_type->decompose(1), int32_type->decompose(2)}); m.set_clustered_cell(ck1, *s->get_column_definition("v"), cell); @@ -920,7 +920,7 @@ SEASTAR_TEST_CASE(test_promoted_index_blocks_are_monotonic_non_compound_dense) { auto dk = dht::global_partitioner().decorate_key(*s, partition_key::from_exploded(*s, {to_bytes(make_local_key(s))})); auto cell = atomic_cell::make_live(1, int32_type->decompose(88), { }); - mutation m(dk, s); + mutation m(s, dk); auto ck1 = clustering_key::from_exploded(*s, {int32_type->decompose(1)}); m.set_clustered_cell(ck1, *s->get_column_definition("v"), cell); @@ -978,7 +978,7 @@ SEASTAR_TEST_CASE(test_promoted_index_repeats_open_tombstones) { auto dk = dht::global_partitioner().decorate_key(*s, partition_key::from_exploded(*s, {to_bytes(make_local_key(s))})); auto cell = atomic_cell::make_live(1, int32_type->decompose(88), { }); - mutation m(dk, s); + mutation m(s, dk); m.partition().apply_row_tombstone(*s, range_tombstone( clustering_key_prefix::from_exploded(*s, {bytes_type->decompose(data_value(to_bytes("ck1")))}), @@ -1024,7 +1024,7 @@ SEASTAR_TEST_CASE(test_range_tombstones_are_correctly_seralized_for_non_compound auto s = builder.build(schema_builder::compact_storage::yes); auto dk = dht::global_partitioner().decorate_key(*s, partition_key::from_exploded(*s, {to_bytes(make_local_key(s))})); - mutation m(dk, s); + mutation m(s, dk); m.partition().apply_row_tombstone(*s, range_tombstone( clustering_key_prefix::from_exploded(*s, {int32_type->decompose(1)}), @@ -1064,7 +1064,7 @@ SEASTAR_TEST_CASE(test_promoted_index_is_absent_for_schemas_without_clustering_k auto s = builder.build(schema_builder::compact_storage::yes); auto dk = dht::global_partitioner().decorate_key(*s, partition_key::from_exploded(*s, {to_bytes(make_local_key(s))})); - mutation m(dk, s); + mutation m(s, dk); for (auto&& v : { 1, 2, 3, 4 }) { auto cell = atomic_cell::make_live(1, int32_type->decompose(v), { }); m.set_clustered_cell(clustering_key_prefix::make_empty(), *s->get_column_definition("v"), cell); @@ -1097,7 +1097,7 @@ SEASTAR_TEST_CASE(test_can_write_and_read_non_compound_range_tombstone_as_compou auto s = builder.build(schema_builder::compact_storage::yes); auto dk = dht::global_partitioner().decorate_key(*s, partition_key::from_exploded(*s, {to_bytes(make_local_key(s))})); - mutation m(dk, s); + mutation m(s, dk); m.partition().apply_row_tombstone(*s, range_tombstone( clustering_key_prefix::from_exploded(*s, {int32_type->decompose(1)}), diff --git a/tests/sstable_resharding_test.cc b/tests/sstable_resharding_test.cc index 9554663f7a..2cb815a750 100644 --- a/tests/sstable_resharding_test.cc +++ b/tests/sstable_resharding_test.cc @@ -76,7 +76,7 @@ void run_sstable_resharding_test() { auto mt = make_lw_shared(s); auto get_mutation = [mt, s] (sstring key_to_write, auto value) { auto key = partition_key::from_exploded(*s, {to_bytes(key_to_write)}); - mutation m(key, s); + mutation m(s, key); m.set_clustered_cell(clustering_key::make_empty(), bytes("value"), data_value(int32_t(value)), api::timestamp_type(0)); return m; }; diff --git a/tests/sstable_test.cc b/tests/sstable_test.cc index 754c20d36e..5ca9fb738b 100644 --- a/tests/sstable_test.cc +++ b/tests/sstable_test.cc @@ -1225,7 +1225,7 @@ SEASTAR_TEST_CASE(promoted_index_write) { auto s = large_partition_schema(); auto mtp = make_lw_shared(s); auto key = partition_key::from_exploded(*s, {to_bytes("v1")}); - mutation m(key, s); + mutation m(s, key); auto col = s->get_column_definition("t3"); BOOST_REQUIRE(col && !col->is_static()); for (char i = 'a'; i <= 'z'; i++) { diff --git a/tests/streamed_mutation_test.cc b/tests/streamed_mutation_test.cc index fd8bdb5a1a..03683a945c 100644 --- a/tests/streamed_mutation_test.cc +++ b/tests/streamed_mutation_test.cc @@ -171,7 +171,7 @@ SEASTAR_TEST_CASE(test_mutation_merger_conforms_to_mutation_source) { for (auto&& m : partitions) { std::vector muts; for (int i = 0; i < n; ++i) { - muts.push_back(mutation(m.decorated_key(), m.schema())); + muts.push_back(mutation(m.schema(), m.decorated_key())); } fragment_scatterer c{muts}; auto sm = streamed_mutation_from_mutation(m); diff --git a/thrift/handler.cc b/thrift/handler.cc index 70481088e4..328a48c975 100644 --- a/thrift/handler.cc +++ b/thrift/handler.cc @@ -474,7 +474,7 @@ public: throw make_exception("Cannot modify Materialized Views directly"); } - mutation m_to_apply(key_from_thrift(*schema, to_bytes_view(key)), schema); + mutation m_to_apply(schema, key_from_thrift(*schema, to_bytes_view(key))); add_to_mutation(*schema, column, m_to_apply); return _query_state.get_client_state().has_schema_access(*schema, auth::permission::MODIFY).then([m_to_apply = std::move(m_to_apply), consistency_level] { return service::get_local_storage_proxy().mutate({std::move(m_to_apply)}, cl_from_thrift(consistency_level), nullptr); @@ -488,7 +488,7 @@ public: fail(unimplemented::cause::SUPER); } - mutation m_to_apply(key_from_thrift(*schema, to_bytes_view(key)), schema); + mutation m_to_apply(schema, key_from_thrift(*schema, to_bytes_view(key))); add_to_mutation(*schema, column, m_to_apply); return _query_state.get_client_state().has_schema_access(*schema, auth::permission::MODIFY).then([m_to_apply = std::move(m_to_apply), consistency_level] { return service::get_local_storage_proxy().mutate({std::move(m_to_apply)}, cl_from_thrift(consistency_level), nullptr); @@ -509,7 +509,7 @@ public: throw make_exception("Cannot modify Materialized Views directly"); } - mutation m_to_apply(key_from_thrift(*schema, to_bytes_view(key)), schema); + mutation m_to_apply(schema, key_from_thrift(*schema, to_bytes_view(key))); if (column_path.__isset.super_column) { fail(unimplemented::cause::SUPER); @@ -532,7 +532,7 @@ public: void remove_counter(tcxx::function cob, tcxx::function exn_cob, const std::string& key, const ColumnPath& column_path, const ConsistencyLevel::type consistency_level) { with_schema(std::move(cob), std::move(exn_cob), column_path.column_family, [&](schema_ptr schema) { - mutation m_to_apply(key_from_thrift(*schema, to_bytes_view(key)), schema); + mutation m_to_apply(schema, key_from_thrift(*schema, to_bytes_view(key))); auto timestamp = api::new_timestamp(); if (column_path.__isset.super_column) { @@ -1889,7 +1889,7 @@ private: } schemas.emplace_back(schema); for (auto&& key_mutations : cf_key.second) { - mutation m_to_apply(key_from_thrift(*schema, to_bytes_view(key_mutations.first)), schema); + mutation m_to_apply(schema, key_from_thrift(*schema, to_bytes_view(key_mutations.first))); for (auto&& m : key_mutations.second) { add_to_mutation(*schema, m, m_to_apply); }