diff --git a/query-result-set.cc b/query-result-set.cc index e221f14ef7..15d61d015f 100644 --- a/query-result-set.cc +++ b/query-result-set.cc @@ -25,6 +25,7 @@ #include "mutation.hh" #include "types/map.hh" #include "utils/exceptions.hh" +#include "mutation_query.hh" #include @@ -221,7 +222,7 @@ result_set::from_raw_result(schema_ptr s, const partition_slice& slice, const re result_set::result_set(const mutation& m) : result_set([&m] { auto slice = partition_slice_builder(*m.schema()).build(); - auto qr = mutation(m).query(slice, query::result_memory_accounter{ query::result_memory_limiter::unlimited_result_size }, result_options::only_result()); + auto qr = query_mutation(mutation(m), slice); return result_set::from_raw_result(m.schema(), slice, qr); }()) { } diff --git a/test/boost/mutation_test.cc b/test/boost/mutation_test.cc index a9e6f0b751..663f8f9146 100644 --- a/test/boost/mutation_test.cc +++ b/test/boost/mutation_test.cc @@ -770,8 +770,7 @@ SEASTAR_TEST_CASE(test_querying_of_mutation) { auto resultify = [s] (const mutation& m) -> query::result_set { auto slice = make_full_slice(*s); - return query::result_set::from_raw_result(s, slice, - m.query(slice, query::result_memory_accounter{ query::result_memory_limiter::unlimited_result_size })); + return query::result_set::from_raw_result(s, slice, query_mutation(mutation(m), slice)); }; mutation m(s, partition_key::from_single_value(*s, "key1")); @@ -806,8 +805,7 @@ SEASTAR_TEST_CASE(test_partition_with_no_live_data_is_absent_in_data_query_resul auto slice = make_full_slice(*s); - assert_that(query::result_set::from_raw_result(s, slice, - m.query(slice, query::result_memory_accounter{ query::result_memory_limiter::unlimited_result_size }))) + assert_that(query::result_set::from_raw_result(s, slice, query_mutation(mutation(m), slice))) .is_empty(); }); } @@ -831,7 +829,7 @@ SEASTAR_TEST_CASE(test_partition_with_live_data_in_static_row_is_present_in_the_ .build(); assert_that(query::result_set::from_raw_result(s, slice, - m.query(slice, query::result_memory_accounter{ query::result_memory_limiter::unlimited_result_size }))) + query_mutation(mutation(m), slice))) .has_only(a_row() .with_column("pk", data_value(bytes("key1"))) .with_column("v", data_value::make_null(bytes_type))); @@ -855,7 +853,7 @@ SEASTAR_TEST_CASE(test_query_result_with_one_regular_column_missing) { auto slice = partition_slice_builder(*s).build(); assert_that(query::result_set::from_raw_result(s, slice, - m.query(slice, query::result_memory_accounter{ query::result_memory_limiter::unlimited_result_size }))) + query_mutation(mutation(m), slice))) .has_only(a_row() .with_column("pk", data_value(bytes("key1"))) .with_column("ck", data_value(bytes("ck:A"))) @@ -1236,26 +1234,13 @@ SEASTAR_TEST_CASE(test_query_digest) { auto check_digests_equal = [] (const mutation& m1, const mutation& m2) { auto ps1 = partition_slice_builder(*m1.schema()).build(); auto ps2 = partition_slice_builder(*m2.schema()).build(); - auto digest1_old = *m1.query(ps1, query::result_memory_accounter{ query::result_memory_limiter::unlimited_result_size }, + auto digest1 = *query_mutation(mutation(m1), ps1, query::max_rows, gc_clock::now(), query::result_options::only_digest(query::digest_algorithm::xxHash)).digest(); - auto digest1_new = *query_mutation(mutation(m1), ps1, query::max_rows, gc_clock::now(), - query::result_options::only_digest(query::digest_algorithm::xxHash)).digest(); - auto digest2_old = *m2.query(ps2, query::result_memory_accounter{ query::result_memory_limiter::unlimited_result_size }, - query::result_options::only_digest(query::digest_algorithm::xxHash)).digest(); - auto digest2_new = *query_mutation(mutation(m2), ps2, query::max_rows, gc_clock::now(), + auto digest2 = *query_mutation( mutation(m2), ps2, query::max_rows, gc_clock::now(), query::result_options::only_digest(query::digest_algorithm::xxHash)).digest(); - if (digest1_old != digest1_new) { - BOOST_FAIL(format("Digest should be the same with old and new method for {}", m1)); - } - if (digest2_old != digest2_new) { - BOOST_FAIL(format("Digest should be the same with old and new method for {}", m2)); - } - if (digest1_old != digest2_old) { - BOOST_FAIL(format("Digest (old) should be the same for {} and {}", m1, m2)); - } - if (digest1_new != digest2_new) { - BOOST_FAIL(format("Digest (new) should be the same for {} and {}", m1, m2)); + if (digest1 != digest2) { + BOOST_FAIL(format("Digest should be the same for {} and {}", m1, m2)); } }; @@ -1502,8 +1487,7 @@ SEASTAR_THREAD_TEST_CASE(test_querying_expired_rows) { .without_partition_key_columns() .build(); auto opts = query::result_options{query::result_request::result_and_digest, query::digest_algorithm::xxHash}; - return query::result_set::from_raw_result(s, slice, - m.query(slice, query::result_memory_accounter{ query::result_memory_limiter::unlimited_result_size }, opts, t)); + return query::result_set::from_raw_result(s, slice, query_mutation(mutation(m), slice, query::max_rows, t, opts)); }; mutation m(s, pk); @@ -1567,8 +1551,7 @@ SEASTAR_TEST_CASE(test_querying_expired_cells) { .without_partition_key_columns() .build(); auto opts = query::result_options{query::result_request::result_and_digest, query::digest_algorithm::xxHash}; - return query::result_set::from_raw_result(s, slice, - m.query(slice, query::result_memory_accounter{ query::result_memory_limiter::unlimited_result_size }, opts, t)); + return query::result_set::from_raw_result(s, slice, query_mutation(mutation(m), slice, query::max_rows, t, opts)); }; { diff --git a/test/perf/memory_footprint_test.cc b/test/perf/memory_footprint_test.cc index 92cba64ae2..8e48526b13 100644 --- a/test/perf/memory_footprint_test.cc +++ b/test/perf/memory_footprint_test.cc @@ -196,8 +196,7 @@ static sizes calculate_sizes(cache_tracker& tracker, const mutation_settings& se result.cache = tracker.region().occupancy().used_space() - cache_initial_occupancy; result.frozen = freeze(m).representation().size(); result.canonical = canonical_mutation(m).representation().size(); - result.query_result = m.query(partition_slice_builder(*s).build(), - query::result_memory_accounter{ query::result_memory_limiter::unlimited_result_size }, query::result_options::only_result()).buf().size(); + result.query_result = query_mutation(mutation(m), partition_slice_builder(*s).build()).buf().size(); tmpdir sstable_dir; sstables::test_env::do_with_async([&] (sstables::test_env& env) {