From da2f2164e9c97576b1af29a869322456f82778bb Mon Sep 17 00:00:00 2001 From: Piotr Jastrzebski Date: Mon, 20 Nov 2017 09:36:49 +0100 Subject: [PATCH 1/3] sstable_mutation_test: use read_rows_flat instead of read_rows Signed-off-by: Piotr Jastrzebski --- tests/sstable_mutation_test.cc | 28 ++++++++++------------------ 1 file changed, 10 insertions(+), 18 deletions(-) diff --git a/tests/sstable_mutation_test.cc b/tests/sstable_mutation_test.cc index f66b95860f..07ed26a267 100644 --- a/tests/sstable_mutation_test.cc +++ b/tests/sstable_mutation_test.cc @@ -421,9 +421,8 @@ SEASTAR_TEST_CASE(test_sstable_can_write_and_read_range_tombstone) { sstables::sstable::format_types::big); write_memtable_to_sstable(*mt, sst).get(); sst->load().get(); - auto mr = sst->read_rows(s); - auto sm = mr().get0(); - auto mut = mutation_from_streamed_mutation(std::move(sm)).get0(); + auto mr = sst->read_rows_flat(s); + auto mut = read_mutation_from_flat_mutation_reader(s, mr).get0(); BOOST_REQUIRE(bool(mut)); auto& rts = mut->partition().row_tombstones(); BOOST_REQUIRE(rts.size() == 1); @@ -569,11 +568,9 @@ static future ka_sst(schema_ptr schema, sstring dir, unsigned long SEASTAR_TEST_CASE(tombstone_in_tombstone) { return ka_sst(tombstone_overlap_schema(), "tests/sstables/tombstone_overlap", 1).then([] (auto sstp) { auto s = tombstone_overlap_schema(); - return do_with(sstp->read_rows(s), [sstp, s] (auto& reader) { + return do_with(sstp->read_rows_flat(s), [sstp, s] (auto& reader) { return repeat([sstp, s, &reader] { - return reader().then([] (auto sm) { - return mutation_from_streamed_mutation(std::move(sm)); - }).then([s] (mutation_opt mut) { + return read_mutation_from_flat_mutation_reader(s, reader).then([s] (mutation_opt mut) { if (!mut) { return stop_iteration::yes; } @@ -634,11 +631,9 @@ SEASTAR_TEST_CASE(tombstone_in_tombstone) { SEASTAR_TEST_CASE(range_tombstone_reading) { return ka_sst(tombstone_overlap_schema(), "tests/sstables/tombstone_overlap", 4).then([] (auto sstp) { auto s = tombstone_overlap_schema(); - return do_with(sstp->read_rows(s), [sstp, s] (auto& reader) { + return do_with(sstp->read_rows_flat(s), [sstp, s] (auto& reader) { return repeat([sstp, s, &reader] { - return reader().then([] (auto sm) { - return mutation_from_streamed_mutation(std::move(sm)); - }).then([s] (mutation_opt mut) { + return read_mutation_from_flat_mutation_reader(s, reader).then([s] (mutation_opt mut) { if (!mut) { return stop_iteration::yes; } @@ -713,11 +708,9 @@ static schema_ptr tombstone_overlap_schema2() { SEASTAR_TEST_CASE(tombstone_in_tombstone2) { return ka_sst(tombstone_overlap_schema2(), "tests/sstables/tombstone_overlap", 3).then([] (auto sstp) { auto s = tombstone_overlap_schema2(); - return do_with(sstp->read_rows(s), [sstp, s] (auto& reader) { + return do_with(sstp->read_rows_flat(s), [sstp, s] (auto& reader) { return repeat([sstp, s, &reader] { - return reader().then([] (auto sm) { - return mutation_from_streamed_mutation(std::move(sm)); - }).then([s] (mutation_opt mut) { + return read_mutation_from_flat_mutation_reader(s, reader).then([s] (mutation_opt mut) { if (!mut) { return stop_iteration::yes; } @@ -797,9 +790,8 @@ SEASTAR_TEST_CASE(test_non_compound_table_row_is_not_marked_as_static) { sstables::sstable::format_types::big); write_memtable_to_sstable(*mt, sst).get(); sst->load().get(); - auto mr = sst->read_rows(s); - auto sm = mr().get0(); - auto mut = mutation_from_streamed_mutation(std::move(sm)).get0(); + auto mr = sst->read_rows_flat(s); + auto mut = read_mutation_from_flat_mutation_reader(s, mr).get0(); BOOST_REQUIRE(bool(mut)); }); } From 571bac7336fbceb13aa65107dea6293d637c8ff1 Mon Sep 17 00:00:00 2001 From: Piotr Jastrzebski Date: Mon, 20 Nov 2017 09:44:20 +0100 Subject: [PATCH 2/3] perf_sstable: use read_rows_flat instead of read_rows Signed-off-by: Piotr Jastrzebski --- tests/perf/perf_sstable.hh | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/tests/perf/perf_sstable.hh b/tests/perf/perf_sstable.hh index 52f880571f..3b0cf7d687 100644 --- a/tests/perf/perf_sstable.hh +++ b/tests/perf/perf_sstable.hh @@ -153,14 +153,12 @@ public: } future read_sequential_partitions(int idx) { - return do_with(_sst[0]->read_rows(s), [this] (mutation_reader& r) { + return do_with(_sst[0]->read_rows_flat(s), [this] (flat_mutation_reader& r) { auto start = test_env::now(); auto total = make_lw_shared(0); auto done = make_lw_shared(false); return do_until([done] { return *done; }, [this, done, total, &r] { - return r().then([] (auto sm) { - return mutation_from_streamed_mutation(std::move(sm)); - }).then([this, done, total] (mutation_opt m) { + return read_mutation_from_flat_mutation_reader(s, r).then([this, done, total] (mutation_opt m) { if (!m) { *done = true; } else { From 0fdfd2c5bc71acee0b6a78de496aa8392158dc48 Mon Sep 17 00:00:00 2001 From: Piotr Jastrzebski Date: Mon, 20 Nov 2017 11:25:53 +0100 Subject: [PATCH 3/3] Remove sstable::read_rows It's no longer used. read_rows_flat is used everything instead. Signed-off-by: Piotr Jastrzebski --- sstables/partition.cc | 4 ---- sstables/sstables.hh | 6 +----- 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/sstables/partition.cc b/sstables/partition.cc index e3ae511cc1..0c009bb636 100644 --- a/sstables/partition.cc +++ b/sstables/partition.cc @@ -1174,10 +1174,6 @@ public: } }; -mutation_reader sstable::read_rows(schema_ptr schema, const io_priority_class& pc, streamed_mutation::forwarding fwd) { - return mutation_reader_from_flat_mutation_reader(read_rows_flat(std::move(schema), pc, fwd)); -} - flat_mutation_reader sstable::read_rows_flat(schema_ptr schema, const io_priority_class& pc, streamed_mutation::forwarding fwd) { return make_flat_mutation_reader(shared_from_this(), std::move(schema), pc, no_resource_tracking(), fwd); } diff --git a/sstables/sstables.hh b/sstables/sstables.hh index d221138c7c..c9ece1c29e 100644 --- a/sstables/sstables.hh +++ b/sstables/sstables.hh @@ -356,7 +356,7 @@ public: return read_range_rows_flat(std::move(schema), range, full_slice); } - // read_rows() returns each of the rows in the sstable, in sequence, + // read_rows_flat() returns each of the rows in the sstable, in sequence, // converted to a "mutation" data structure. // This function is implemented efficiently - doing buffered, sequential // read of the data file (no need to access the index file). @@ -367,10 +367,6 @@ public: // The caller must ensure (e.g., using do_with()) that the context object, // as well as the sstable, remains alive as long as a read() is in // progress (i.e., returned a future which hasn't completed yet). - mutation_reader read_rows(schema_ptr schema, - const io_priority_class& pc = default_priority_class(), - streamed_mutation::forwarding fwd = streamed_mutation::forwarding::no); - flat_mutation_reader read_rows_flat(schema_ptr schema, const io_priority_class& pc = default_priority_class(), streamed_mutation::forwarding fwd = streamed_mutation::forwarding::no);