Merge "Remove sstable::read_rows" from Piotr

* seastar-dev.git haaawk/flat_reader_remove_read_rows:
  sstable_mutation_test: use read_rows_flat instead of read_rows
  perf_sstable: use read_rows_flat instead of read_rows
  Remove sstable::read_rows
This commit is contained in:
Tomasz Grabiec
2017-11-22 15:50:12 +01:00
4 changed files with 13 additions and 31 deletions

View File

@@ -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<sstable_mutation_reader>(shared_from_this(), std::move(schema), pc, no_resource_tracking(), fwd);
}

View File

@@ -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);

View File

@@ -153,14 +153,12 @@ public:
}
future<double> 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<size_t>(0);
auto done = make_lw_shared<bool>(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 {

View File

@@ -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<sstable_ptr> 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));
});
}