From f7023501d6dfe06283e90c5cf183b2198e8f02e4 Mon Sep 17 00:00:00 2001 From: Avi Kivity Date: Sun, 27 Aug 2017 18:55:52 +0300 Subject: [PATCH] treewide: use shared_sstable, make_sstable in place of lw_shared_ptr Since shared_sstable is going to be its own type soon, we can't use the old alias. --- compaction_strategy.hh | 8 +- database.cc | 24 ++--- database.hh | 6 +- sstable_mutation_readers.hh | 4 +- sstables/compaction_strategy.cc | 2 +- sstables/compaction_strategy_impl.hh | 2 +- sstables/leveled_compaction_strategy.hh | 4 +- sstables/sstables.cc | 2 +- tests/combined_mutation_reader_test.cc | 2 +- tests/memory_footprint.cc | 2 +- tests/perf/perf_sstable.hh | 4 +- tests/sstable_datafile_test.cc | 126 ++++++++++++------------ tests/sstable_mutation_test.cc | 10 +- tests/sstable_resharding_test.cc | 8 +- tests/sstable_test.cc | 14 +-- tests/sstable_test.hh | 10 +- 16 files changed, 115 insertions(+), 113 deletions(-) diff --git a/compaction_strategy.hh b/compaction_strategy.hh index 32be96d6798d..c4cf99265260 100644 --- a/compaction_strategy.hh +++ b/compaction_strategy.hh @@ -42,6 +42,8 @@ class sstable_set; struct compaction_descriptor; struct resharding_descriptor; +using shared_sstable = lw_shared_ptr; + class compaction_strategy { ::shared_ptr _compaction_strategy_impl; public: @@ -54,13 +56,13 @@ public: compaction_strategy& operator=(compaction_strategy&&); // Return a list of sstables to be compacted after applying the strategy. - compaction_descriptor get_sstables_for_compaction(column_family& cfs, std::vector> candidates); + compaction_descriptor get_sstables_for_compaction(column_family& cfs, std::vector candidates); - std::vector get_resharding_jobs(column_family& cf, std::vector> candidates); + std::vector get_resharding_jobs(column_family& cf, std::vector candidates); // Some strategies may look at the compacted and resulting sstables to // get some useful information for subsequent compactions. - void notify_completion(const std::vector>& removed, const std::vector>& added); + void notify_completion(const std::vector& removed, const std::vector& added); // Return if parallel compaction is allowed by strategy. bool parallel_compaction() const; diff --git a/database.cc b/database.cc index aedcec0d90c8..fe8175463e86 100644 --- a/database.cc +++ b/database.cc @@ -503,7 +503,7 @@ class single_key_sstable_reader final : public mutation_reader::impl { } auto candidates = filter_sstable_for_reader(_sstables->select(_pr), *_cf, _schema, _key, _slice); return parallel_for_each(std::move(candidates), - [this](const lw_shared_ptr& sstable) { + [this](const sstables::shared_sstable& sstable) { tracing::trace(_trace_state, "Reading key {} from sstable {}", _pr, seastar::value_of([&sstable] { return sstable->get_filename(); })); return sstable->read_row(_schema, _pr.start()->value(), _slice, _pc, _fwd).then([this](auto smo) { if (smo) { @@ -751,7 +751,7 @@ static bool belongs_to_other_shard(const std::vector& shards) { future column_family::open_sstable(sstables::foreign_sstable_open_info info, sstring dir, int64_t generation, sstables::sstable::version_types v, sstables::sstable::format_types f) { - auto sst = make_lw_shared(_schema, dir, generation, v, f); + auto sst = sstables::make_sstable(_schema, dir, generation, v, f); if (!belongs_to_current_shard(info.owners)) { dblog.debug("sstable {} not relevant for this shard, ignoring", sst->get_filename()); sst->mark_for_deletion(); @@ -798,7 +798,7 @@ void column_family::update_stats_for_new_sstable(uint64_t disk_space_used_by_sst } } -void column_family::add_sstable(lw_shared_ptr sstable, std::vector&& shards_for_the_sstable) { +void column_family::add_sstable(sstables::shared_sstable sstable, std::vector&& shards_for_the_sstable) { // allow in-progress reads to continue using old list auto new_sstables = make_lw_shared(*_sstables); new_sstables->insert(sstable); @@ -866,7 +866,7 @@ column_family::seal_active_streaming_memtable_immediate(flush_permit&& permit) { auto f = current_waiters.get_shared_future(); // for this seal with_lock(_sstables_lock.for_read(), [this, old, permit = std::move(permit)] () mutable { - auto newtab = make_lw_shared(_schema, + auto newtab = sstables::make_sstable(_schema, _config.datadir, calculate_generation_for_new_table(), sstables::sstable::version_types::ka, sstables::sstable::format_types::big); @@ -924,7 +924,7 @@ future<> column_family::seal_active_streaming_memtable_big(streaming_memtable_bi return with_gate(_streaming_flush_gate, [this, old, &smb, permit = std::move(permit)] () mutable { return with_gate(smb.flush_in_progress, [this, old, &smb, permit = std::move(permit)] () mutable { return with_lock(_sstables_lock.for_read(), [this, old, &smb, permit = std::move(permit)] () mutable { - auto newtab = make_lw_shared(_schema, + auto newtab = sstables::make_sstable(_schema, _config.datadir, calculate_generation_for_new_table(), sstables::sstable::version_types::ka, sstables::sstable::format_types::big); @@ -999,7 +999,7 @@ future column_family::try_flush_memtable_to_sstable(lw_shared_ptr old, sstable_write_permit&& permit) { auto gen = calculate_generation_for_new_table(); - auto newtab = make_lw_shared(_schema, + auto newtab = sstables::make_sstable(_schema, _config.datadir, gen, sstables::sstable::version_types::ka, sstables::sstable::format_types::big); @@ -1098,7 +1098,7 @@ distributed_loader::flush_upload_dir(distributed& db, sstring ks_name, [ks_name, cf_name, comps = pair.second] (database& db) { auto& cf = db.find_column_family(ks_name, cf_name); - auto sst = make_lw_shared(cf.schema(), cf._config.datadir + "/upload", comps.generation, + auto sst = sstables::make_sstable(cf.schema(), cf._config.datadir + "/upload", comps.generation, comps.version, comps.format, gc_clock::now(), [] (disk_error_signal_type&) { return error_handler_for_upload_dir(); }); auto gen = cf.calculate_generation_for_new_table(); @@ -1151,7 +1151,7 @@ column_family::reshuffle_sstables(std::set all_generations, int64_t sta if (work.all_generations.count(comps.generation) != 0) { return make_ready_future<>(); } - auto sst = make_lw_shared(_schema, + auto sst = sstables::make_sstable(_schema, _config.datadir, comps.generation, comps.version, comps.format); work.sstables.emplace(comps.generation, std::move(sst)); @@ -1348,7 +1348,7 @@ column_family::compact_sstables(sstables::compaction_descriptor descriptor, bool auto create_sstable = [this] { auto gen = this->calculate_generation_for_new_table(); - auto sst = make_lw_shared(_schema, _config.datadir, gen, + auto sst = sstables::make_sstable(_schema, _config.datadir, gen, sstables::sstable::version_types::ka, sstables::sstable::format_types::big); sst->set_unshared(); @@ -1362,7 +1362,7 @@ column_family::compact_sstables(sstables::compaction_descriptor descriptor, bool }); } -static bool needs_cleanup(const lw_shared_ptr& sst, +static bool needs_cleanup(const sstables::shared_sstable& sst, const dht::token_range_vector& owned_ranges, schema_ptr s) { auto first = sst->get_first_partition_key(); @@ -1592,7 +1592,7 @@ load_sstables_with_open_info(std::vector ss if (!pred(info)) { return make_ready_future<>(); } - auto sst = make_lw_shared(s, dir, info.generation, info.version, info.format); + auto sst = sstables::make_sstable(s, dir, info.generation, info.version, info.format); return sst->load(std::move(info)).then([&ssts, sst] { ssts.push_back(std::move(sst)); return make_ready_future<>(); @@ -1724,7 +1724,7 @@ void distributed_loader::reshard(distributed& db, sstring ks_name, sst return cf->calculate_generation_for_new_table(); }).get0(); - auto sst = make_lw_shared(cf->schema(), cf->dir(), gen, + auto sst = sstables::make_sstable(cf->schema(), cf->dir(), gen, sstables::sstable::version_types::ka, sstables::sstable::format_types::big, gc_clock::now(), default_io_error_handler_gen()); return sst; diff --git a/database.hh b/database.hh index 51ccc50329a2..3beb2138b579 100644 --- a/database.hh +++ b/database.hh @@ -448,11 +448,11 @@ private: // Cache must be synchronized atomically with this, otherwise write atomicity may not be respected. // Doesn't trigger compaction. // Strong exception guarantees. - void add_sstable(lw_shared_ptr sstable, std::vector&& shards_for_the_sstable); + void add_sstable(sstables::shared_sstable sstable, std::vector&& shards_for_the_sstable); // returns an empty pointer if sstable doesn't belong to current shard. - future> open_sstable(sstables::foreign_sstable_open_info info, sstring dir, + future open_sstable(sstables::foreign_sstable_open_info info, sstring dir, int64_t generation, sstables::sstable_version_types v, sstables::sstable_format_types f); - void load_sstable(lw_shared_ptr& sstable, bool reset_level = false); + void load_sstable(sstables::shared_sstable& sstable, bool reset_level = false); lw_shared_ptr new_memtable(); lw_shared_ptr new_streaming_memtable(); future try_flush_memtable_to_sstable(lw_shared_ptr memt, sstable_write_permit&& permit); diff --git a/sstable_mutation_readers.hh b/sstable_mutation_readers.hh index 9995e4f50f56..778ad180c48b 100644 --- a/sstable_mutation_readers.hh +++ b/sstable_mutation_readers.hh @@ -26,10 +26,10 @@ #include "mutation_reader.hh" class sstable_range_wrapping_reader final : public mutation_reader::impl { - lw_shared_ptr _sst; + sstables::shared_sstable _sst; sstables::mutation_reader _smr; public: - sstable_range_wrapping_reader(lw_shared_ptr sst, + sstable_range_wrapping_reader(sstables::shared_sstable sst, schema_ptr s, const dht::partition_range& pr, const query::partition_slice& slice, diff --git a/sstables/compaction_strategy.cc b/sstables/compaction_strategy.cc index 4c0291bcb0a3..16f26d9cc33f 100644 --- a/sstables/compaction_strategy.cc +++ b/sstables/compaction_strategy.cc @@ -419,7 +419,7 @@ std::vector compaction_strategy::get_resharding_jobs(colu return _compaction_strategy_impl->get_resharding_jobs(cf, std::move(candidates)); } -void compaction_strategy::notify_completion(const std::vector>& removed, const std::vector>& added) { +void compaction_strategy::notify_completion(const std::vector& removed, const std::vector& added) { _compaction_strategy_impl->notify_completion(removed, added); } diff --git a/sstables/compaction_strategy_impl.hh b/sstables/compaction_strategy_impl.hh index bac0bd17f480..29535ffd8f21 100644 --- a/sstables/compaction_strategy_impl.hh +++ b/sstables/compaction_strategy_impl.hh @@ -65,7 +65,7 @@ public: virtual ~compaction_strategy_impl() {} virtual compaction_descriptor get_sstables_for_compaction(column_family& cfs, std::vector candidates) = 0; virtual std::vector get_resharding_jobs(column_family& cf, std::vector candidates); - virtual void notify_completion(const std::vector>& removed, const std::vector>& added) { } + virtual void notify_completion(const std::vector& removed, const std::vector& added) { } virtual compaction_strategy_type type() const = 0; virtual bool parallel_compaction() const { return true; diff --git a/sstables/leveled_compaction_strategy.hh b/sstables/leveled_compaction_strategy.hh index dbded3798b5a..450f97a29c20 100644 --- a/sstables/leveled_compaction_strategy.hh +++ b/sstables/leveled_compaction_strategy.hh @@ -54,7 +54,7 @@ public: virtual std::vector get_resharding_jobs(column_family& cf, std::vector candidates) override; - virtual void notify_completion(const std::vector>& removed, const std::vector>& added) override; + virtual void notify_completion(const std::vector& removed, const std::vector& added) override; // for each level > 0, get newest sstable and use its last key as last // compacted key for the previous level. @@ -145,7 +145,7 @@ std::vector leveled_compaction_strategy::get_resharding_j return descriptors; } -void leveled_compaction_strategy::notify_completion(const std::vector>& removed, const std::vector>& added) { +void leveled_compaction_strategy::notify_completion(const std::vector& removed, const std::vector& added) { if (removed.empty() || added.empty()) { return; } diff --git a/sstables/sstables.cc b/sstables/sstables.cc index d5c330220e66..d32e8081c485 100644 --- a/sstables/sstables.cc +++ b/sstables/sstables.cc @@ -1380,7 +1380,7 @@ future<> sstable::load(sstables::foreign_sstable_open_info info) { future sstable::load_shared_components(const schema_ptr& s, sstring dir, int generation, version_types v, format_types f, const io_priority_class& pc) { - auto sst = make_lw_shared(s, dir, generation, v, f); + auto sst = sstables::make_sstable(s, dir, generation, v, f); return sst->load(pc).then([sst] () mutable { auto shards = sst->get_shards_for_this_sstable(); auto info = sstable_open_info{make_lw_shared(std::move(*sst->_components)), diff --git a/tests/combined_mutation_reader_test.cc b/tests/combined_mutation_reader_test.cc index 6107a5294bc6..a5cd247282eb 100644 --- a/tests/combined_mutation_reader_test.cc +++ b/tests/combined_mutation_reader_test.cc @@ -58,7 +58,7 @@ struct sst_factory { {} sstables::shared_sstable operator()() { - auto sst = make_lw_shared(s, path, gen, sstables::sstable::version_types::la, sstables::sstable::format_types::big); + auto sst = sstables::make_sstable(s, path, gen, sstables::sstable::version_types::la, sstables::sstable::format_types::big); sst->set_unshared(); //TODO set sstable level, to make the test more interesting diff --git a/tests/memory_footprint.cc b/tests/memory_footprint.cc index 6889251702f4..57099a488e0c 100644 --- a/tests/memory_footprint.cc +++ b/tests/memory_footprint.cc @@ -191,7 +191,7 @@ static sizes calculate_sizes(const mutation& m) { result.query_result = m.query(partition_slice_builder(*s).build(), query::result_request::only_result).buf().size(); tmpdir sstable_dir; - auto sst = make_lw_shared(s, + auto sst = sstables::make_sstable(s, sstable_dir.path, 1 /* generation */, sstables::sstable::version_types::la, diff --git a/tests/perf/perf_sstable.hh b/tests/perf/perf_sstable.hh index 96b0087f4b87..544ad967d2e3 100644 --- a/tests/perf/perf_sstable.hh +++ b/tests/perf/perf_sstable.hh @@ -67,7 +67,7 @@ private: std::default_random_engine _generator; std::uniform_int_distribution _distribution; lw_shared_ptr _mt; - std::vector> _sst; + std::vector _sst; schema_ptr create_schema() { std::vector columns; @@ -116,7 +116,7 @@ public: } future<> load_sstables(unsigned iterations) { - _sst.push_back(make_lw_shared(s, this->dir(), 0, sstable::version_types::ka, sstable::format_types::big)); + _sst.push_back(make_sstable(s, this->dir(), 0, sstable::version_types::ka, sstable::format_types::big)); return _sst.back()->load(); } diff --git a/tests/sstable_datafile_test.cc b/tests/sstable_datafile_test.cc index 64b76824c25e..d23b2b911546 100644 --- a/tests/sstable_datafile_test.cc +++ b/tests/sstable_datafile_test.cc @@ -104,7 +104,7 @@ SEASTAR_TEST_CASE(datafile_generation_01) { m.set_clustered_cell(c_key, r1_col, make_atomic_cell(int32_type->decompose(1))); mt->apply(std::move(m)); - auto sst = make_lw_shared(s, "tests/sstables/tests-temporary", 1, la, big); + auto sst = make_sstable(s, "tests/sstables/tests-temporary", 1, la, big); auto fname = sstable::filename("tests/sstables/tests-temporary", "ks", "cf", la, 1, big, sstable::component_type::Data); return write_memtable_to_sstable(*mt, sst).then([mt, sst, s, fname] { @@ -172,7 +172,7 @@ SEASTAR_TEST_CASE(datafile_generation_02) { m.set_clustered_cell(c_key, r1_col, make_atomic_cell(int32_type->decompose(1))); mt->apply(std::move(m)); - auto sst = make_lw_shared(s, "tests/sstables/tests-temporary", 2, la, big); + auto sst = make_sstable(s, "tests/sstables/tests-temporary", 2, la, big); auto fname = sstable::filename("tests/sstables/tests-temporary", "ks", "cf", la, 2, big, sstable::component_type::Data); return write_memtable_to_sstable(*mt, sst).then([mt, sst, s, fname] { @@ -242,7 +242,7 @@ SEASTAR_TEST_CASE(datafile_generation_03) { m.set_clustered_cell(c_key, r1_col, make_atomic_cell(int32_type->decompose(1))); mt->apply(std::move(m)); - auto sst = make_lw_shared(s, "tests/sstables/tests-temporary", 3, la, big); + auto sst = make_sstable(s, "tests/sstables/tests-temporary", 3, la, big); auto fname = sstable::filename("tests/sstables/tests-temporary", "ks", "cf", la, 3, big, sstable::component_type::Data); return write_memtable_to_sstable(*mt, sst).then([mt, sst, s, fname] { @@ -315,7 +315,7 @@ SEASTAR_TEST_CASE(datafile_generation_04) { m.set_clustered_cell(c_key, r1_col, make_atomic_cell(int32_type->decompose(1))); mt->apply(std::move(m)); - auto sst = make_lw_shared(s, "tests/sstables/tests-temporary", 4, la, big); + auto sst = make_sstable(s, "tests/sstables/tests-temporary", 4, la, big); auto fname = sstable::filename("tests/sstables/tests-temporary", "ks", "cf", la, 4, big, sstable::component_type::Data); return write_memtable_to_sstable(*mt, sst).then([mt, sst, s, fname] { @@ -388,7 +388,7 @@ SEASTAR_TEST_CASE(datafile_generation_05) { mt->apply(std::move(m)); auto now = to_gc_clock(db_clock::from_time_t(0)); - auto sst = make_lw_shared(s, "tests/sstables/tests-temporary", 5, la, big, now); + auto sst = make_sstable(s, "tests/sstables/tests-temporary", 5, la, big, now); return write_memtable_to_sstable(*mt, sst).then([mt, sst, s] { auto fname = sstable::filename("tests/sstables/tests-temporary", "ks", "cf", la, 5, big, sstable::component_type::Data); @@ -462,7 +462,7 @@ SEASTAR_TEST_CASE(datafile_generation_06) { m.set_clustered_cell(c_key, r1_col, make_dead_atomic_cell(3600)); mt->apply(std::move(m)); - auto sst = make_lw_shared(s, "tests/sstables/tests-temporary", 6, la, big); + auto sst = make_sstable(s, "tests/sstables/tests-temporary", 6, la, big); return write_memtable_to_sstable(*mt, sst).then([mt, sst, s] { auto fname = sstable::filename("tests/sstables/tests-temporary", "ks", "cf", la, 6, big, sstable::component_type::Data); @@ -538,7 +538,7 @@ SEASTAR_TEST_CASE(datafile_generation_07) { m2.set_clustered_cell(c_key2, r1_col, make_atomic_cell(int32_type->decompose(1))); mt->apply(std::move(m2)); - auto sst = make_lw_shared(s, "tests/sstables/tests-temporary", 7, la, big); + auto sst = make_sstable(s, "tests/sstables/tests-temporary", 7, la, big); return write_memtable_to_sstable(*mt, sst).then([mt, sst, s] { auto fname = sstable::filename("tests/sstables/tests-temporary", "ks", "cf", la, 7, big, sstable::component_type::Index); @@ -594,7 +594,7 @@ SEASTAR_TEST_CASE(datafile_generation_08) { mt->apply(std::move(m)); } - auto sst = make_lw_shared(s, "tests/sstables/tests-temporary", 8, la, big); + auto sst = make_sstable(s, "tests/sstables/tests-temporary", 8, la, big); return write_memtable_to_sstable(*mt, sst).then([mt, sst, s] { auto fname = sstable::filename("tests/sstables/tests-temporary", "ks", "cf", la, 8, big, sstable::component_type::Summary); @@ -653,10 +653,10 @@ SEASTAR_TEST_CASE(datafile_generation_09) { m.set_clustered_cell(c_key, r1_col, make_atomic_cell(int32_type->decompose(1))); mt->apply(std::move(m)); - auto sst = make_lw_shared(s, "tests/sstables/tests-temporary", 9, la, big); + auto sst = make_sstable(s, "tests/sstables/tests-temporary", 9, la, big); return write_memtable_to_sstable(*mt, sst).then([mt, sst, s] { - auto sst2 = make_lw_shared(s, "tests/sstables/tests-temporary", 9, la, big); + auto sst2 = make_sstable(s, "tests/sstables/tests-temporary", 9, la, big); return sstables::test(sst2).read_summary().then([sst, sst2] { summary& sst1_s = sstables::test(sst).get_summary(); @@ -701,7 +701,7 @@ SEASTAR_TEST_CASE(datafile_generation_10) { m.set_clustered_cell(c_key, r1_col, make_atomic_cell(int32_type->decompose(1))); mt->apply(std::move(m)); - auto sst = make_lw_shared(s, "tests/sstables/tests-temporary", 10, la, big); + auto sst = make_sstable(s, "tests/sstables/tests-temporary", 10, la, big); return write_memtable_to_sstable(*mt, sst).then([mt, sst, s] { auto fname = sstable::filename("tests/sstables/tests-temporary", "ks", "cf", la, 10, big, sstable::component_type::Data); @@ -809,7 +809,7 @@ SEASTAR_TEST_CASE(datafile_generation_11) { return t->deserialize_mutation_form(cell->as_collection_mutation()); }; - auto sst = make_lw_shared(s, "tests/sstables/tests-temporary", 11, la, big); + auto sst = make_sstable(s, "tests/sstables/tests-temporary", 11, la, big); return write_memtable_to_sstable(*mt, sst).then([s, sst, mt, verifier, tomb, &static_set_col] { return reusable_sst(s, "tests/sstables/tests-temporary", 11).then([s, verifier, tomb, &static_set_col] (auto sstp) mutable { return do_with(sstables::key("key1"), [sstp, s, verifier, tomb, &static_set_col] (auto& key) { @@ -872,7 +872,7 @@ SEASTAR_TEST_CASE(datafile_generation_12) { m.partition().apply_delete(*s, cp, tomb); mt->apply(std::move(m)); - auto sst = make_lw_shared(s, "tests/sstables/tests-temporary", 12, la, big); + auto sst = make_sstable(s, "tests/sstables/tests-temporary", 12, la, big); return write_memtable_to_sstable(*mt, sst).then([s, tomb] { return reusable_sst(s, "tests/sstables/tests-temporary", 12).then([s, tomb] (auto sstp) mutable { return do_with(sstables::key("key1"), [sstp, s, tomb] (auto& key) { @@ -909,7 +909,7 @@ static future<> sstable_compression_test(compressor c, unsigned generation) { m.partition().apply_delete(*s, cp, tomb); mtp->apply(std::move(m)); - auto sst = make_lw_shared(s, "tests/sstables/tests-temporary", generation, la, big); + auto sst = make_sstable(s, "tests/sstables/tests-temporary", generation, la, big); return write_memtable_to_sstable(*mtp, sst).then([s, tomb, generation] { return reusable_sst(s, "tests/sstables/tests-temporary", generation).then([s, tomb] (auto sstp) mutable { return do_with(sstables::key("key1"), [sstp, s, tomb] (auto& key) { @@ -956,7 +956,7 @@ SEASTAR_TEST_CASE(datafile_generation_16) { mtp->apply(std::move(m)); } - auto sst = make_lw_shared(s, "tests/sstables/tests-temporary", 16, la, big); + auto sst = make_sstable(s, "tests/sstables/tests-temporary", 16, la, big); return write_memtable_to_sstable(*mtp, sst).then([s] { return reusable_sst(s, "tests/sstables/tests-temporary", 16).then([] (auto s) { // Not crashing is enough @@ -975,7 +975,7 @@ SEASTAR_TEST_CASE(datafile_generation_16) { // counting pointer to an sstable - allowing for the returned handle to // be passed around until no longer needed. static future open_sstable(schema_ptr schema, sstring dir, unsigned long generation) { - auto sst = make_lw_shared(std::move(schema), dir, generation, + auto sst = sstables::make_sstable(std::move(schema), dir, generation, sstables::sstable::version_types::la, sstables::sstable::format_types::big); auto fut = sst->load(); @@ -1044,7 +1044,7 @@ SEASTAR_TEST_CASE(compaction_manager_test) { m.set_clustered_cell(c_key, r1_col, make_atomic_cell(int32_type->decompose(1))); mt->apply(std::move(m)); - auto sst = make_lw_shared(s, tmp->path, generation, la, big); + auto sst = make_sstable(s, tmp->path, generation, la, big); return write_memtable_to_sstable(*mt, sst).then([mt, sst, cf] { return sst->load().then([sst, cf] { @@ -1110,7 +1110,7 @@ SEASTAR_TEST_CASE(compact) { return open_sstables(s, "tests/sstables/compaction", {1,2,3}).then([s, cf, cm, generation] (auto sstables) { return test_setup::do_with_test_directory([sstables, s, generation, cf, cm] { auto new_sstable = [generation, s] { - return make_lw_shared(s, "tests/sstables/tests-temporary", + return sstables::make_sstable(s, "tests/sstables/tests-temporary", generation, sstables::sstable::version_types::la, sstables::sstable::format_types::big); }; return sstables::compact_sstables(std::move(sstables), *cf, new_sstable, std::numeric_limits::max(), 0).then([s, generation, cf, cm] (auto) { @@ -1236,7 +1236,7 @@ static future> compact_sstables(std::vectorapply(std::move(m)); - auto sst = make_lw_shared(s, "tests/sstables/tests-temporary", generation, la, big); + auto sst = make_sstable(s, "tests/sstables/tests-temporary", generation, la, big); return write_memtable_to_sstable(*mt, sst).then([mt, sst, s, sstables] { return sst->load().then([sst, sstables] { @@ -1250,7 +1250,7 @@ static future> compact_sstables(std::vectorpush_back(gen); - return make_lw_shared(s, "tests/sstables/tests-temporary", + return sstables::make_sstable(s, "tests/sstables/tests-temporary", gen, sstables::sstable::version_types::la, sstables::sstable::format_types::big); }; // We must have opened at least all original candidates. @@ -1388,7 +1388,7 @@ SEASTAR_TEST_CASE(datafile_generation_37) { m.set_clustered_cell(c_key, cl2, make_atomic_cell(bytes_type->decompose(data_value(to_bytes("cl2"))))); mtp->apply(std::move(m)); - auto sst = make_lw_shared(s, "tests/sstables/tests-temporary", 37, la, big); + auto sst = make_sstable(s, "tests/sstables/tests-temporary", 37, la, big); return write_memtable_to_sstable(*mtp, sst).then([s] { return reusable_sst(s, "tests/sstables/tests-temporary", 37).then([s] (auto sstp) { return do_with(sstables::key("key1"), [sstp, s] (auto& key) { @@ -1424,7 +1424,7 @@ SEASTAR_TEST_CASE(datafile_generation_38) { m.set_clustered_cell(c_key, cl3, make_atomic_cell(bytes_type->decompose(data_value(to_bytes("cl3"))))); mtp->apply(std::move(m)); - auto sst = make_lw_shared(s, "tests/sstables/tests-temporary", 38, la, big); + auto sst = make_sstable(s, "tests/sstables/tests-temporary", 38, la, big); return write_memtable_to_sstable(*mtp, sst).then([s] { return reusable_sst(s, "tests/sstables/tests-temporary", 38).then([s] (auto sstp) { return do_with(sstables::key("key1"), [sstp, s] (auto& key) { @@ -1461,7 +1461,7 @@ SEASTAR_TEST_CASE(datafile_generation_39) { m.set_clustered_cell(c_key, cl2, make_atomic_cell(bytes_type->decompose(data_value(to_bytes("cl2"))))); mtp->apply(std::move(m)); - auto sst = make_lw_shared(s, "tests/sstables/tests-temporary", 39, la, big); + auto sst = make_sstable(s, "tests/sstables/tests-temporary", 39, la, big); return write_memtable_to_sstable(*mtp, sst).then([s] { return reusable_sst(s, "tests/sstables/tests-temporary", 39).then([s] (auto sstp) { return do_with(sstables::key("key1"), [sstp, s] (auto& key) { @@ -1515,7 +1515,7 @@ SEASTAR_TEST_CASE(datafile_generation_40) { m.set_clustered_cell(cb, r1_col, make_atomic_cell(int32_type->decompose(1))); mt->apply(std::move(m)); - auto sst = make_lw_shared(s, "tests/sstables/tests-temporary", 40, la, big); + auto sst = make_sstable(s, "tests/sstables/tests-temporary", 40, la, big); return write_memtable_to_sstable(*mt, sst).then([mt, sst, s] { auto fname = sstable::filename("tests/sstables/tests-temporary", "ks", "cf", la, 40, big, sstable::component_type::Data); @@ -1558,7 +1558,7 @@ SEASTAR_TEST_CASE(datafile_generation_41) { m.partition().apply_delete(*s, std::move(c_key), tomb); mt->apply(std::move(m)); - auto sst = make_lw_shared(s, "tests/sstables/tests-temporary", 41, la, big); + auto sst = make_sstable(s, "tests/sstables/tests-temporary", 41, la, big); return write_memtable_to_sstable(*mt, sst).then([s, tomb] { return reusable_sst(s, "tests/sstables/tests-temporary", 41).then([s, tomb] (auto sstp) mutable { return do_with(sstables::key("key1"), [sstp, s, tomb] (auto& key) { @@ -1618,7 +1618,7 @@ SEASTAR_TEST_CASE(datafile_generation_47) { m.set_clustered_cell(c_key, r1_col, make_atomic_cell(bytes(512*1024, 'a'))); mt->apply(std::move(m)); - auto sst = make_lw_shared(s, "tests/sstables/tests-temporary", 47, la, big); + auto sst = make_sstable(s, "tests/sstables/tests-temporary", 47, la, big); return write_memtable_to_sstable(*mt, sst).then([s] { return reusable_sst(s, "tests/sstables/tests-temporary", 47).then([s] (auto sstp) mutable { auto reader = make_lw_shared(sstable_reader(sstp, s)); @@ -1677,7 +1677,7 @@ SEASTAR_TEST_CASE(test_counter_write) { mt->apply(m); - auto sst = make_lw_shared(s, "tests/sstables/tests-temporary", 900, la, big); + auto sst = make_sstable(s, "tests/sstables/tests-temporary", 900, la, big); write_memtable_to_sstable(*mt, sst).get(); auto sstp = reusable_sst(s, "tests/sstables/tests-temporary", 900).get0(); @@ -1734,7 +1734,7 @@ static std::vector> token_generation_for_current_ static void add_sstable_for_leveled_test(lw_shared_ptr& cf, int64_t gen, uint64_t fake_data_size, uint32_t sstable_level, sstring first_key, sstring last_key, int64_t max_timestamp = 0) { - auto sst = make_lw_shared(cf->schema(), "", gen, la, big); + auto sst = make_sstable(cf->schema(), "", gen, la, big); sstables::test(sst).set_values_for_leveled_strategy(fake_data_size, sstable_level, max_timestamp, std::move(first_key), std::move(last_key)); assert(sst->data_size() == fake_data_size); assert(sst->get_sstable_level() == sstable_level); @@ -1743,14 +1743,14 @@ static void add_sstable_for_leveled_test(lw_shared_ptr& cf, int64 column_family_test(cf).add_sstable(sst); } -static lw_shared_ptr add_sstable_for_overlapping_test(lw_shared_ptr& cf, int64_t gen, sstring first_key, sstring last_key, stats_metadata stats = {}) { - auto sst = make_lw_shared(cf->schema(), "", gen, la, big); +static shared_sstable add_sstable_for_overlapping_test(lw_shared_ptr& cf, int64_t gen, sstring first_key, sstring last_key, stats_metadata stats = {}) { + auto sst = make_sstable(cf->schema(), "", gen, la, big); sstables::test(sst).set_values(std::move(first_key), std::move(last_key), std::move(stats)); column_family_test(cf).add_sstable(sst); return sst; } -static lw_shared_ptr sstable_for_overlapping_test(const schema_ptr& schema, int64_t gen, sstring first_key, sstring last_key, uint32_t level = 0) { - auto sst = make_lw_shared(schema, "", gen, la, big); +static shared_sstable sstable_for_overlapping_test(const schema_ptr& schema, int64_t gen, sstring first_key, sstring last_key, uint32_t level = 0) { + auto sst = make_sstable(schema, "", gen, la, big); sstables::test(sst).set_values_for_leveled_strategy(0, level, 0, std::move(first_key), std::move(last_key)); return sst; } @@ -2274,7 +2274,7 @@ SEASTAR_TEST_CASE(check_read_indexes) { builder.set_min_index_interval(256); auto s = builder.build(); - auto sst = make_lw_shared(s, "tests/sstables/summary_test", 1, + auto sst = make_sstable(s, "tests/sstables/summary_test", 1, sstables::sstable::version_types::ka, big); auto fut = sst->load(); @@ -2301,7 +2301,7 @@ SEASTAR_TEST_CASE(tombstone_purge_test) { auto tmp = make_lw_shared(); auto sst_gen = [s, tmp, gen = make_lw_shared(1)] () mutable { - return make_lw_shared(s, tmp->path, (*gen)++, la, big); + return make_sstable(s, tmp->path, (*gen)++, la, big); }; auto compact = [&, s] (std::vector all, std::vector to_compact) -> std::vector { @@ -2510,7 +2510,7 @@ SEASTAR_TEST_CASE(check_multi_schema) { .with_column("e", bytes_type); auto s = builder.build(); - auto sst = make_lw_shared(s, "tests/sstables/multi_schema_test", 1, sstables::sstable::version_types::ka, big); + auto sst = make_sstable(s, "tests/sstables/multi_schema_test", 1, sstables::sstable::version_types::ka, big); auto f = sst->load(); return f.then([sst, s] { auto reader = make_lw_shared(sstable_reader(sst, s)); @@ -2553,13 +2553,13 @@ SEASTAR_TEST_CASE(sstable_rewrite) { }; apply_key(key_for_this_shard[0].first); - auto sst = make_lw_shared(s, "tests/sstables/tests-temporary", 51, la, big); + auto sst = make_sstable(s, "tests/sstables/tests-temporary", 51, la, big); return write_memtable_to_sstable(*mt, sst).then([s, sst] { return reusable_sst(s, "tests/sstables/tests-temporary", 51); }).then([s, key = key_for_this_shard[0].first] (auto sstp) mutable { auto new_tables = make_lw_shared>(); auto creator = [new_tables, s] { - auto sst = make_lw_shared(s, "tests/sstables/tests-temporary", 52, la, big); + auto sst = sstables::make_sstable(s, "tests/sstables/tests-temporary", 52, la, big); sst->set_unshared(); new_tables->emplace_back(sst); return sst; @@ -2655,7 +2655,7 @@ SEASTAR_TEST_CASE(test_sliced_mutation_reads) { .with_column("v2", set_of_ints_type); auto s = builder.build(); - auto sst = make_lw_shared(s, "tests/sstables/sliced_mutation_reads", 1, sstables::sstable::version_types::ka, big); + auto sst = make_sstable(s, "tests/sstables/sliced_mutation_reads", 1, sstables::sstable::version_types::ka, big); sst->load().get0(); { @@ -2746,7 +2746,7 @@ SEASTAR_TEST_CASE(test_wrong_range_tombstone_order) { .build(); clustering_key::equality ck_eq(*s); - auto sst = make_lw_shared(s, "tests/sstables/wrong_range_tombstone_order", 1, sstables::sstable::version_types::ka, big); + auto sst = make_sstable(s, "tests/sstables/wrong_range_tombstone_order", 1, sstables::sstable::version_types::ka, big); sst->load().get0(); auto reader = sstable_reader(sst, s); @@ -2813,7 +2813,7 @@ SEASTAR_TEST_CASE(test_counter_read) { auto node1 = counter_id(utils::UUID("8379ab99-4507-4ab1-805d-ac85a863092b")); auto node2 = counter_id(utils::UUID("b8a6c3f3-e222-433f-9ce9-de56a8466e07")); - auto sst = make_lw_shared(s, "tests/sstables/counter_test", 5, sstables::sstable::version_types::ka, big); + auto sst = make_sstable(s, "tests/sstables/counter_test", 5, sstables::sstable::version_types::ka, big); sst->load().get(); auto reader = sstable_reader(sst, s); @@ -2885,7 +2885,7 @@ SEASTAR_TEST_CASE(test_sstable_max_local_deletion_time) { m.set_clustered_cell(c_key, *s->get_column_definition("r1"), make_atomic_cell(bytes("a"), 3600 + i, last_expiry)); mt->apply(std::move(m)); } - auto sst = make_lw_shared(s, "tests/sstables/tests-temporary", 53, la, big); + auto sst = make_sstable(s, "tests/sstables/tests-temporary", 53, la, big); return write_memtable_to_sstable(*mt, sst).then([s, sst] { return reusable_sst(s, "tests/sstables/tests-temporary", 53); }).then([s, last_expiry] (auto sstp) mutable { @@ -2915,7 +2915,7 @@ SEASTAR_TEST_CASE(test_sstable_max_local_deletion_time_2) { mt->apply(std::move(m)); }; auto get_usable_sst = [s] (memtable& mt, int64_t gen) -> future { - auto sst = make_lw_shared(s, "tests/sstables/tests-temporary", gen, la, big); + auto sst = make_sstable(s, "tests/sstables/tests-temporary", gen, la, big); return write_memtable_to_sstable(mt, sst).then([sst, gen, s] { return reusable_sst(s, "tests/sstables/tests-temporary", gen); }); @@ -2937,7 +2937,7 @@ SEASTAR_TEST_CASE(test_sstable_max_local_deletion_time_2) { auto sst2 = get_usable_sst(*mt, 55).get0(); BOOST_REQUIRE(now.time_since_epoch().count() == sst2->get_stats_metadata().max_local_deletion_time); - auto creator = [s] { return make_lw_shared(s, "tests/sstables/tests-temporary", 56, la, big); }; + auto creator = [s] { return sstables::make_sstable(s, "tests/sstables/tests-temporary", 56, la, big); }; auto new_sstables = sstables::compact_sstables({ sst1, sst2 }, *cf, creator, std::numeric_limits::max(), 0).get0(); BOOST_REQUIRE(new_sstables.size() == 1); BOOST_REQUIRE(((now + gc_clock::duration(100)).time_since_epoch().count()) == new_sstables.front()->get_stats_metadata().max_local_deletion_time); @@ -3111,7 +3111,7 @@ SEASTAR_TEST_CASE(time_window_strategy_correctness_test) { auto tmp = make_lw_shared(); auto sst_gen = [s, tmp, gen = make_lw_shared(1)] () mutable { - return make_lw_shared(s, tmp->path, (*gen)++, la, big); + return make_sstable(s, tmp->path, (*gen)++, la, big); }; auto make_insert = [&] (partition_key key, api::timestamp_type t) { @@ -3233,7 +3233,7 @@ SEASTAR_TEST_CASE(test_promoted_index_read) { .with_column("v", int32_type) .build(); - auto sst = make_lw_shared(s, "tests/sstables/promoted_index_read", 1, sstables::sstable::version_types::ka, big); + auto sst = make_sstable(s, "tests/sstables/promoted_index_read", 1, sstables::sstable::version_types::ka, big); sst->load().get0(); auto rd = sstable_reader(sst, s); @@ -3294,7 +3294,7 @@ static void test_min_max_clustering_key(schema_ptr s, std::vector explode } } auto tmp = make_lw_shared(); - auto sst = make_lw_shared(s, tmp->path, 1, la, big); + auto sst = make_sstable(s, tmp->path, 1, la, big); write_memtable_to_sstable(*mt, sst).get(); sst = reusable_sst(s, tmp->path, 1).get0(); check_min_max_column_names(sst, std::move(min_components), std::move(max_components)); @@ -3370,7 +3370,7 @@ SEASTAR_TEST_CASE(min_max_clustering_key_test_2) { } mt->apply(std::move(m)); } - auto sst = make_lw_shared(s, tmp->path, 1, la, big); + auto sst = make_sstable(s, tmp->path, 1, la, big); write_memtable_to_sstable(*mt, sst).get(); sst = reusable_sst(s, tmp->path, 1).get0(); check_min_max_column_names(sst, { "0ck100" }, { "7ck149" }); @@ -3383,12 +3383,12 @@ SEASTAR_TEST_CASE(min_max_clustering_key_test_2) { m.set_clustered_cell(c_key, r1_col, make_atomic_cell(int32_type->decompose(1))); } mt->apply(std::move(m)); - auto sst2 = make_lw_shared(s, tmp->path, 2, la, big); + auto sst2 = make_sstable(s, tmp->path, 2, la, big); write_memtable_to_sstable(*mt, sst2).get(); sst2 = reusable_sst(s, tmp->path, 2).get0(); check_min_max_column_names(sst2, { "9ck101" }, { "9ck298" }); - auto creator = [s, tmp] { return make_lw_shared(s, tmp->path, 3, la, big); }; + auto creator = [s, tmp] { return sstables::make_sstable(s, tmp->path, 3, la, big); }; auto new_sstables = sstables::compact_sstables({ sst, sst2 }, *cf, creator, std::numeric_limits::max(), 0).get0(); BOOST_REQUIRE(new_sstables.size() == 1); check_min_max_column_names(new_sstables.front(), { "0ck100" }, { "9ck298" }); @@ -3413,7 +3413,7 @@ SEASTAR_TEST_CASE(sstable_tombstone_metadata_check) { tombstone tomb(api::new_timestamp(), gc_clock::now()); m.partition().apply_delete(*s, c_key, tomb); mt->apply(std::move(m)); - auto sst = make_lw_shared(s, tmp->path, 1, la, big); + auto sst = make_sstable(s, tmp->path, 1, la, big); write_memtable_to_sstable(*mt, sst).get(); sst = reusable_sst(s, tmp->path, 1).get0(); BOOST_REQUIRE(sst->get_stats_metadata().estimated_tombstone_drop_time.bin.size()); @@ -3424,7 +3424,7 @@ SEASTAR_TEST_CASE(sstable_tombstone_metadata_check) { mutation m(key, s); m.set_clustered_cell(c_key, r1_col, make_dead_atomic_cell(3600)); mt->apply(std::move(m)); - auto sst = make_lw_shared(s, tmp->path, 2, la, big); + auto sst = make_sstable(s, tmp->path, 2, la, big); write_memtable_to_sstable(*mt, sst).get(); sst = reusable_sst(s, tmp->path, 2).get0(); BOOST_REQUIRE(sst->get_stats_metadata().estimated_tombstone_drop_time.bin.size()); @@ -3435,7 +3435,7 @@ SEASTAR_TEST_CASE(sstable_tombstone_metadata_check) { mutation m(key, s); m.set_clustered_cell(c_key, r1_col, make_atomic_cell(int32_type->decompose(1))); mt->apply(std::move(m)); - auto sst = make_lw_shared(s, tmp->path, 3, la, big); + auto sst = make_sstable(s, tmp->path, 3, la, big); write_memtable_to_sstable(*mt, sst).get(); sst = reusable_sst(s, tmp->path, 3).get0(); BOOST_REQUIRE(!sst->get_stats_metadata().estimated_tombstone_drop_time.bin.size()); @@ -3454,7 +3454,7 @@ SEASTAR_TEST_CASE(sstable_tombstone_metadata_check) { m2.set_clustered_cell(c_key, r1_col, make_atomic_cell(int32_type->decompose(1))); mt->apply(std::move(m2)); - auto sst = make_lw_shared(s, tmp->path, 4, la, big); + auto sst = make_sstable(s, tmp->path, 4, la, big); write_memtable_to_sstable(*mt, sst).get(); sst = reusable_sst(s, tmp->path, 4).get0(); BOOST_REQUIRE(sst->get_stats_metadata().estimated_tombstone_drop_time.bin.size()); @@ -3466,7 +3466,7 @@ SEASTAR_TEST_CASE(sstable_tombstone_metadata_check) { tombstone tomb(api::new_timestamp(), gc_clock::now()); m.partition().apply(tomb); mt->apply(std::move(m)); - auto sst = make_lw_shared(s, tmp->path, 5, la, big); + auto sst = make_sstable(s, tmp->path, 5, la, big); write_memtable_to_sstable(*mt, sst).get(); sst = reusable_sst(s, tmp->path, 5).get0(); BOOST_REQUIRE(sst->get_stats_metadata().estimated_tombstone_drop_time.bin.size()); @@ -3479,7 +3479,7 @@ SEASTAR_TEST_CASE(sstable_tombstone_metadata_check) { 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)); mt->apply(std::move(m)); - auto sst = make_lw_shared(s, tmp->path, 6, la, big); + auto sst = make_sstable(s, tmp->path, 6, la, big); write_memtable_to_sstable(*mt, sst).get(); sst = reusable_sst(s, tmp->path, 6).get0(); BOOST_REQUIRE(sst->get_stats_metadata().estimated_tombstone_drop_time.bin.size()); @@ -3494,7 +3494,7 @@ SEASTAR_TEST_CASE(test_partition_skipping) { .with_column("v", int32_type) .build(); - auto sst = make_lw_shared(s, "tests/sstables/partition_skipping", 1, sstables::sstable::version_types::ka, big); + auto sst = make_sstable(s, "tests/sstables/partition_skipping", 1, sstables::sstable::version_types::ka, big); sst->load().get0(); std::vector keys; @@ -3551,7 +3551,7 @@ SEASTAR_TEST_CASE(test_partition_skipping) { // Must be run in a seastar thread static shared_sstable make_sstable(sstring path, schema_ptr s, ::mutation_reader rd, sstable_writer_config cfg) { - auto sst = make_lw_shared(s, path, 1, sstables::sstable::version_types::ka, big); + auto sst = make_sstable(s, path, 1, sstables::sstable::version_types::ka, big); sst->write_components(std::move(rd), 1, s, cfg).get(); sst->load().get(); return sst; @@ -3792,7 +3792,7 @@ SEASTAR_TEST_CASE(size_tiered_beyond_max_threshold_test) { int max_threshold = cf->schema()->max_compaction_threshold(); candidates.reserve(max_threshold+1); for (auto i = 0; i < (max_threshold+1); i++) { // (max_threshold+1) sstables of similar size - auto sst = make_lw_shared(s, "", i, la, big); + auto sst = make_sstable(s, "", i, la, big); sstables::test(sst).set_data_file_size(1); candidates.push_back(std::move(sst)); } @@ -3863,7 +3863,7 @@ SEASTAR_TEST_CASE(sstable_resharding_strategy_tests) { auto s = make_lw_shared(schema({}, "ks", "cf", {{"p1", utf8_type}}, {}, {}, {}, utf8_type)); auto get_sstable = [&] (int64_t gen, sstring first_key, sstring last_key) mutable { - auto sst = make_lw_shared(s, "", gen, sstables::sstable::version_types::ka, sstables::sstable::format_types::big); + auto sst = make_sstable(s, "", gen, sstables::sstable::version_types::ka, sstables::sstable::format_types::big); stats_metadata stats = {}; stats.sstable_level = 1; sstables::test(sst).set_values(std::move(first_key), std::move(last_key), std::move(stats)); @@ -3906,7 +3906,7 @@ SEASTAR_TEST_CASE(sstable_tombstone_histogram_test) { auto tmp = make_lw_shared(); auto sst_gen = [s, tmp, gen = make_lw_shared(1)] () mutable { - return make_lw_shared(s, tmp->path, (*gen)++, la, big); + return make_sstable(s, tmp->path, (*gen)++, la, big); }; auto next_timestamp = [] { @@ -3986,7 +3986,7 @@ SEASTAR_TEST_CASE(sstable_expired_data_ratio) { for (auto i = 0; i < remaining; i++) { insert_key(to_bytes("key" + to_sstring(i)), 3600, expiration_time); } - auto sst = make_lw_shared(s, tmp->path, 1, la, big); + auto sst = make_sstable(s, tmp->path, 1, la, big); write_memtable_to_sstable(*mt, sst).get(); sst = reusable_sst(s, tmp->path, 1).get0(); const auto& stats = sst->get_stats_metadata(); @@ -4001,7 +4001,7 @@ SEASTAR_TEST_CASE(sstable_expired_data_ratio) { auto cf = make_lw_shared(s, column_family::config(), column_family::no_commitlog(), *cm, *cl_stats); cf->mark_ready_for_writes(); auto creator = [&] { - auto sst = make_lw_shared(s, tmp->path, 2, la, big); + auto sst = sstables::make_sstable(s, tmp->path, 2, la, big); sst->set_unshared(); return sst; }; @@ -4076,7 +4076,7 @@ SEASTAR_TEST_CASE(test_summary_entry_spanning_more_keys_than_min_interval) { auto tmp = make_lw_shared(); auto sst_gen = [s, tmp, gen = make_lw_shared(1)] () mutable { - return make_lw_shared(s, tmp->path, (*gen)++, la, big); + return make_sstable(s, tmp->path, (*gen)++, la, big); }; auto sst = make_sstable_containing(sst_gen, mutations); sst = reusable_sst(s, tmp->path, sst->generation()).get0(); diff --git a/tests/sstable_mutation_test.cc b/tests/sstable_mutation_test.cc index 251b4c3fe4ad..a9a64841a1f9 100644 --- a/tests/sstable_mutation_test.cc +++ b/tests/sstable_mutation_test.cc @@ -364,7 +364,7 @@ void test_mutation_source(sstable_writer_config cfg, sstables::sstable::version_ std::vector dirs; run_mutation_source_tests([&dirs, &cfg, version] (schema_ptr s, const std::vector& partitions) -> mutation_source { tmpdir sstable_dir; - auto sst = make_lw_shared(s, + auto sst = sstables::make_sstable(s, sstable_dir.path, 1 /* generation */, version, @@ -414,7 +414,7 @@ SEASTAR_TEST_CASE(test_sstable_can_write_and_read_range_tombstone) { auto mt = make_lw_shared(s); mt->apply(std::move(m)); - auto sst = make_lw_shared(s, + auto sst = sstables::make_sstable(s, dir->path, 1 /* generation */, sstables::sstable::version_types::la, @@ -553,7 +553,7 @@ static schema_ptr tombstone_overlap_schema() { static future ka_sst(schema_ptr schema, sstring dir, unsigned long generation) { - auto sst = make_lw_shared(std::move(schema), dir, generation, sstables::sstable::version_types::ka, big); + auto sst = make_sstable(std::move(schema), dir, generation, sstables::sstable::version_types::ka, big); auto fut = sst->load(); return std::move(fut).then([sst = std::move(sst)] { return make_ready_future(std::move(sst)); @@ -790,7 +790,7 @@ SEASTAR_TEST_CASE(test_non_compound_table_row_is_not_marked_as_static) { auto mt = make_lw_shared(s); mt->apply(std::move(m)); - auto sst = make_lw_shared(s, + auto sst = sstables::make_sstable(s, dir->path, 1 /* generation */, sstables::sstable::version_types::ka, @@ -840,7 +840,7 @@ SEASTAR_TEST_CASE(test_promoted_index_blocks_are_monotonic) { auto mt = make_lw_shared(s); mt->apply(std::move(m)); - auto sst = make_lw_shared(s, + auto sst = sstables::make_sstable(s, dir->path, 1 /* generation */, sstables::sstable::version_types::ka, diff --git a/tests/sstable_resharding_test.cc b/tests/sstable_resharding_test.cc index f278adcfc04b..04f77b7a38a8 100644 --- a/tests/sstable_resharding_test.cc +++ b/tests/sstable_resharding_test.cc @@ -89,10 +89,10 @@ void run_sstable_resharding_test() { muts.emplace(i, m); mt->apply(std::move(m)); } - auto sst = make_lw_shared(s, tmp->path, 0, sstables::sstable::version_types::ka, sstables::sstable::format_types::big); + auto sst = sstables::make_sstable(s, tmp->path, 0, sstables::sstable::version_types::ka, sstables::sstable::format_types::big); write_memtable_to_sstable(*mt, sst).get(); } - auto sst = make_lw_shared(s, tmp->path, 0, sstables::sstable::version_types::ka, sstables::sstable::format_types::big); + auto sst = sstables::make_sstable(s, tmp->path, 0, sstables::sstable::version_types::ka, sstables::sstable::format_types::big); sst->load().get(); auto creator = [&cf, tmp] (shard_id shard) mutable { @@ -102,7 +102,7 @@ void run_sstable_resharding_test() { return column_family_test::calculate_generation_for_new_table(*cf); }).get0(); - auto sst = make_lw_shared(cf->schema(), tmp->path, gen, + auto sst = sstables::make_sstable(cf->schema(), tmp->path, gen, sstables::sstable::version_types::ka, sstables::sstable::format_types::big, gc_clock::now(), default_io_error_handler_gen()); return sst; @@ -111,7 +111,7 @@ void run_sstable_resharding_test() { BOOST_REQUIRE(new_sstables.size() == smp::count); for (auto& sstable : new_sstables) { - auto new_sst = make_lw_shared(s, tmp->path, sstable->generation(), + auto new_sst = sstables::make_sstable(s, tmp->path, sstable->generation(), sstables::sstable::version_types::ka, sstables::sstable::format_types::big); new_sst->load().get(); auto shards = new_sst->get_shards_for_this_sstable(); diff --git a/tests/sstable_test.cc b/tests/sstable_test.cc index 00b7987499f1..5c46e5bb14e8 100644 --- a/tests/sstable_test.cc +++ b/tests/sstable_test.cc @@ -218,7 +218,7 @@ SEASTAR_TEST_CASE(missing_summary_first_last_sane) { } static future do_write_sst(schema_ptr schema, sstring load_dir, sstring write_dir, unsigned long generation) { - auto sst = make_lw_shared(std::move(schema), load_dir, generation, la, big); + auto sst = sstables::make_sstable(std::move(schema), load_dir, generation, la, big); return sst->load().then([sst, write_dir, generation] { sstables::test(sst).change_generation_number(generation + 1); sstables::test(sst).change_dir(write_dir); @@ -289,7 +289,7 @@ SEASTAR_TEST_CASE(check_summary_func) { auto tmp = make_lw_shared(); auto s = make_lw_shared(schema({}, "ks", "cf", {}, {}, {}, {}, utf8_type)); return do_write_sst(s, "tests/sstables/compressed", tmp->path, 1).then([tmp, s] (auto sst1) { - auto sst2 = make_lw_shared(s, tmp->path, 2, la, big); + auto sst2 = make_sstable(s, tmp->path, 2, la, big); return sstables::test(sst2).read_summary().then([sst1, sst2] { summary& sst1_s = sstables::test(sst1).get_summary(); summary& sst2_s = sstables::test(sst2).get_summary(); @@ -311,7 +311,7 @@ SEASTAR_TEST_CASE(check_statistics_func) { auto tmp = make_lw_shared(); auto s = make_lw_shared(schema({}, "ks", "cf", {}, {}, {}, {}, utf8_type)); return do_write_sst(s, "tests/sstables/compressed", tmp->path, 1).then([tmp, s] (auto sst1) { - auto sst2 = make_lw_shared(s, tmp->path, 2, la, big); + auto sst2 = make_sstable(s, tmp->path, 2, la, big); return sstables::test(sst2).read_statistics().then([sst1, sst2] { statistics& sst1_s = sstables::test(sst1).get_statistics(); statistics& sst2_s = sstables::test(sst2).get_statistics(); @@ -333,7 +333,7 @@ SEASTAR_TEST_CASE(check_toc_func) { auto tmp = make_lw_shared(); auto s = make_lw_shared(schema({}, "ks", "cf", {}, {}, {}, {}, utf8_type)); return do_write_sst(s, "tests/sstables/compressed", tmp->path, 1).then([tmp, s] (auto sst1) { - auto sst2 = make_lw_shared(s, tmp->path, 2, la, big); + auto sst2 = sstables::make_sstable(s, tmp->path, 2, la, big); return sstables::test(sst2).read_toc().then([sst1, sst2] { auto& sst1_c = sstables::test(sst1).get_components(); auto& sst2_c = sstables::test(sst2).get_components(); @@ -1020,8 +1020,8 @@ static schema_ptr large_partition_schema() { return s; } -static future> load_large_partition_sst() { - auto sst = make_lw_shared(large_partition_schema(), "tests/sstables/large_partition", 3, +static future load_large_partition_sst() { + auto sst = make_sstable(large_partition_schema(), "tests/sstables/large_partition", 3, sstables::sstable::version_types::ka, big); auto fut = sst->load(); return std::move(fut).then([sst = std::move(sst)] { @@ -1249,7 +1249,7 @@ SEASTAR_TEST_CASE(promoted_index_write) { } } mtp->apply(std::move(m)); - auto sst = make_lw_shared(s, + auto sst = make_sstable(s, "tests/sstables/tests-temporary", 100, sstables::sstable::version_types::ka, big); return write_memtable_to_sstable(*mtp, sst).then([s] { diff --git a/tests/sstable_test.hh b/tests/sstable_test.hh index 6e7fdab3302e..b7c36d655f30 100644 --- a/tests/sstable_test.hh +++ b/tests/sstable_test.hh @@ -38,7 +38,7 @@ class column_family_test { public: column_family_test(lw_shared_ptr cf) : _cf(cf) {} - void add_sstable(lw_shared_ptr sstable) { + void add_sstable(sstables::shared_sstable sstable) { _cf->_sstables->insert(std::move(sstable)); } @@ -57,7 +57,7 @@ public: namespace sstables { -using sstable_ptr = lw_shared_ptr; +using sstable_ptr = shared_sstable; class test { sstable_ptr _sst; @@ -140,7 +140,7 @@ public: static sstable_ptr make_test_sstable(size_t buffer_size, schema_ptr schema, sstring dir, unsigned long generation, sstable::version_types v, sstable::format_types f, gc_clock::time_point now = gc_clock::now()) { - return make_lw_shared(std::move(schema), dir, generation, v, f, now, default_io_error_handler_gen(), buffer_size); + return sstables::make_sstable(std::move(schema), dir, generation, v, f, now, default_io_error_handler_gen(), buffer_size); } // Used to create synthetic sstables for testing leveled compaction strategy. @@ -167,7 +167,7 @@ public: }; inline future reusable_sst(schema_ptr schema, sstring dir, unsigned long generation) { - auto sst = make_lw_shared(std::move(schema), dir, generation, la, big); + auto sst = sstables::make_sstable(std::move(schema), dir, generation, la, big); auto fut = sst->load(); return std::move(fut).then([sst = std::move(sst)] { return make_ready_future(std::move(sst)); @@ -613,6 +613,6 @@ public: } inline -::mutation_source as_mutation_source(lw_shared_ptr sst) { +::mutation_source as_mutation_source(sstables::shared_sstable sst) { return sst->as_mutation_source(); }