code: Switch to seastar API level 7
In that level no io_priority_class-es exist. Instead, all the IO happens in the context of current sched-group. File API no longer accepts prio class argument (and makes io_intent arg mandatory to impls). So the change consists of - removing all usage of io_priority_class - patching file_impl's inheritants to updated API - priority manager goes away altogether - IO bandwidth update is performed on respective sched group - tune-up scylla-gdb.py io_queues command The first change is huge and was made semi-autimatically by: - grep io_priority_class | default_priority_class - remove all calls, found methods' args and class' fields Patching file_impl-s is smaller, but also mechanical: - replace io_priority_class& argument with io_intent* one - pass intent to lower file (if applicatble) Dropping the priority manager is: - git-rm .cc and .hh - sed out all the #include-s - fix configure.py and cmakefile The scylla-gdb.py update is a bit hairry -- it needs to use task queues list for IO classes names and shares, but to detect it should it checks for the "commitlog" group is present. Signed-off-by: Pavel Emelyanov <xemul@scylladb.com> Closes #13963
This commit is contained in:
committed by
Avi Kivity
parent
156d771101
commit
66e43912d6
@@ -26,7 +26,7 @@ set(CMAKE_CXX_EXTENSIONS ON CACHE INTERNAL "")
|
||||
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
|
||||
|
||||
set(Seastar_TESTING ON CACHE BOOL "" FORCE)
|
||||
set(Seastar_API_LEVEL 6 CACHE STRING "" FORCE)
|
||||
set(Seastar_API_LEVEL 7 CACHE STRING "" FORCE)
|
||||
add_subdirectory(seastar)
|
||||
|
||||
# System libraries dependencies
|
||||
|
||||
@@ -39,7 +39,6 @@ class backlog_controller {
|
||||
public:
|
||||
struct scheduling_group {
|
||||
seastar::scheduling_group cpu = default_scheduling_group();
|
||||
seastar::io_priority_class io = default_priority_class();
|
||||
};
|
||||
future<> shutdown() {
|
||||
_update_timer.cancel();
|
||||
|
||||
@@ -21,27 +21,27 @@ public:
|
||||
: file_impl(*get_file_impl(f)), _error_handler(error_handler), _file(f) {
|
||||
}
|
||||
|
||||
virtual future<size_t> write_dma(uint64_t pos, const void* buffer, size_t len, const io_priority_class& pc) override {
|
||||
virtual future<size_t> write_dma(uint64_t pos, const void* buffer, size_t len, io_intent* intent) override {
|
||||
return do_io_check(_error_handler, [&] {
|
||||
return get_file_impl(_file)->write_dma(pos, buffer, len, pc);
|
||||
return get_file_impl(_file)->write_dma(pos, buffer, len, intent);
|
||||
});
|
||||
}
|
||||
|
||||
virtual future<size_t> write_dma(uint64_t pos, std::vector<iovec> iov, const io_priority_class& pc) override {
|
||||
virtual future<size_t> write_dma(uint64_t pos, std::vector<iovec> iov, io_intent* intent) override {
|
||||
return do_io_check(_error_handler, [&] {
|
||||
return get_file_impl(_file)->write_dma(pos, iov, pc);
|
||||
return get_file_impl(_file)->write_dma(pos, iov, intent);
|
||||
});
|
||||
}
|
||||
|
||||
virtual future<size_t> read_dma(uint64_t pos, void* buffer, size_t len, const io_priority_class& pc) override {
|
||||
virtual future<size_t> read_dma(uint64_t pos, void* buffer, size_t len, io_intent* intent) override {
|
||||
return do_io_check(_error_handler, [&] {
|
||||
return get_file_impl(_file)->read_dma(pos, buffer, len, pc);
|
||||
return get_file_impl(_file)->read_dma(pos, buffer, len, intent);
|
||||
});
|
||||
}
|
||||
|
||||
virtual future<size_t> read_dma(uint64_t pos, std::vector<iovec> iov, const io_priority_class& pc) override {
|
||||
virtual future<size_t> read_dma(uint64_t pos, std::vector<iovec> iov, io_intent* intent) override {
|
||||
return do_io_check(_error_handler, [&] {
|
||||
return get_file_impl(_file)->read_dma(pos, iov, pc);
|
||||
return get_file_impl(_file)->read_dma(pos, iov, intent);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -99,9 +99,9 @@ public:
|
||||
});
|
||||
}
|
||||
|
||||
virtual future<temporary_buffer<uint8_t>> dma_read_bulk(uint64_t offset, size_t range_size, const io_priority_class& pc) override {
|
||||
virtual future<temporary_buffer<uint8_t>> dma_read_bulk(uint64_t offset, size_t range_size, io_intent* intent) override {
|
||||
return do_io_check(_error_handler, [&] {
|
||||
return get_file_impl(_file)->dma_read_bulk(offset, range_size, pc);
|
||||
return get_file_impl(_file)->dma_read_bulk(offset, range_size, intent);
|
||||
});
|
||||
}
|
||||
private:
|
||||
|
||||
@@ -37,7 +37,6 @@
|
||||
#include "compaction_manager.hh"
|
||||
#include "schema/schema.hh"
|
||||
#include "db/system_keyspace.hh"
|
||||
#include "service/priority_manager.hh"
|
||||
#include "db_clock.hh"
|
||||
#include "mutation/mutation_compactor.hh"
|
||||
#include "leveled_manifest.hh"
|
||||
@@ -472,7 +471,6 @@ protected:
|
||||
mutation_source_metadata _ms_metadata = {};
|
||||
compaction_sstable_replacer_fn _replacer;
|
||||
run_id _run_identifier;
|
||||
::io_priority_class _io_priority;
|
||||
// optional clone of sstable set to be used for expiration purposes, so it will be set if expiration is enabled.
|
||||
std::optional<sstable_set> _sstable_set;
|
||||
// used to incrementally calculate max purgeable timestamp, as we iterate through decorated keys.
|
||||
@@ -505,7 +503,6 @@ protected:
|
||||
, _can_split_large_partition(descriptor.can_split_large_partition)
|
||||
, _replacer(std::move(descriptor.replacer))
|
||||
, _run_identifier(descriptor.run_identifier)
|
||||
, _io_priority(descriptor.io_priority)
|
||||
, _sstable_set(std::move(descriptor.all_sstables_snapshot))
|
||||
, _selector(_sstable_set ? _sstable_set->make_incremental_selector() : std::optional<sstable_set::incremental_selector>{})
|
||||
, _compacting_for_max_purgeable_func(std::unordered_set<shared_sstable>(_sstables.begin(), _sstables.end()))
|
||||
@@ -584,12 +581,11 @@ protected:
|
||||
compaction_writer create_gc_compaction_writer() const {
|
||||
auto sst = _sstable_creator(this_shard_id());
|
||||
|
||||
auto&& priority = _io_priority;
|
||||
auto monitor = std::make_unique<compaction_write_monitor>(sst, _table_s, maximum_timestamp(), _sstable_level);
|
||||
sstable_writer_config cfg = _table_s.configure_writer("garbage_collection");
|
||||
cfg.run_identifier = _run_identifier;
|
||||
cfg.monitor = monitor.get();
|
||||
auto writer = sst->get_writer(*schema(), partitions_per_sstable(), cfg, get_encoding_stats(), priority);
|
||||
auto writer = sst->get_writer(*schema(), partitions_per_sstable(), cfg, get_encoding_stats());
|
||||
return compaction_writer(std::move(monitor), std::move(writer), std::move(sst));
|
||||
}
|
||||
|
||||
@@ -1043,7 +1039,6 @@ public:
|
||||
_permit,
|
||||
query::full_partition_range,
|
||||
_schema->full_slice(),
|
||||
_io_priority,
|
||||
tracing::trace_state_ptr(),
|
||||
::streamed_mutation::forwarding::no,
|
||||
::mutation_reader::forwarding::no,
|
||||
@@ -1063,7 +1058,7 @@ public:
|
||||
setup_new_sstable(sst);
|
||||
|
||||
sstable_writer_config cfg = make_sstable_writer_config(compaction_type::Reshape);
|
||||
return compaction_writer{sst->get_writer(*_schema, partitions_per_sstable(), cfg, get_encoding_stats(), _io_priority), sst};
|
||||
return compaction_writer{sst->get_writer(*_schema, partitions_per_sstable(), cfg, get_encoding_stats()), sst};
|
||||
}
|
||||
|
||||
virtual void stop_sstable_writer(compaction_writer* writer) override {
|
||||
@@ -1089,7 +1084,6 @@ public:
|
||||
_permit,
|
||||
query::full_partition_range,
|
||||
_schema->full_slice(),
|
||||
_io_priority,
|
||||
tracing::trace_state_ptr(),
|
||||
::streamed_mutation::forwarding::no,
|
||||
::mutation_reader::forwarding::no,
|
||||
@@ -1111,7 +1105,7 @@ public:
|
||||
auto monitor = std::make_unique<compaction_write_monitor>(sst, _table_s, maximum_timestamp(), _sstable_level);
|
||||
sstable_writer_config cfg = make_sstable_writer_config(_type);
|
||||
cfg.monitor = monitor.get();
|
||||
return compaction_writer{std::move(monitor), sst->get_writer(*_schema, partitions_per_sstable(), cfg, get_encoding_stats(), _io_priority), sst};
|
||||
return compaction_writer{std::move(monitor), sst->get_writer(*_schema, partitions_per_sstable(), cfg, get_encoding_stats()), sst};
|
||||
}
|
||||
|
||||
virtual void stop_sstable_writer(compaction_writer* writer) override {
|
||||
@@ -1478,7 +1472,7 @@ public:
|
||||
}
|
||||
|
||||
flat_mutation_reader_v2 make_sstable_reader() const override {
|
||||
auto crawling_reader = _compacting->make_crawling_reader(_schema, _permit, _io_priority, nullptr);
|
||||
auto crawling_reader = _compacting->make_crawling_reader(_schema, _permit, nullptr);
|
||||
return make_flat_mutation_reader_v2<reader>(std::move(crawling_reader), _options.operation_mode, _validation_errors);
|
||||
}
|
||||
|
||||
@@ -1497,7 +1491,7 @@ public:
|
||||
return end_consumer;
|
||||
}
|
||||
return [this, end_consumer = std::move(end_consumer)] (flat_mutation_reader_v2 reader) mutable -> future<> {
|
||||
auto cfg = mutation_writer::segregate_config{_io_priority, memory::stats().total_memory() / 10};
|
||||
auto cfg = mutation_writer::segregate_config{memory::stats().total_memory() / 10};
|
||||
return mutation_writer::segregate_by_partition(std::move(reader), cfg,
|
||||
[consumer = std::move(end_consumer), this] (flat_mutation_reader_v2 rd) {
|
||||
++_bucket_count;
|
||||
@@ -1574,7 +1568,6 @@ public:
|
||||
_permit,
|
||||
query::full_partition_range,
|
||||
_schema->full_slice(),
|
||||
_io_priority,
|
||||
nullptr,
|
||||
::streamed_mutation::forwarding::no,
|
||||
::mutation_reader::forwarding::no);
|
||||
@@ -1607,7 +1600,7 @@ public:
|
||||
auto cfg = make_sstable_writer_config(compaction_type::Reshard);
|
||||
// sstables generated for a given shard will share the same run identifier.
|
||||
cfg.run_identifier = _run_identifiers.at(shard);
|
||||
return compaction_writer{sst->get_writer(*_schema, partitions_per_sstable(shard), cfg, get_encoding_stats(), _io_priority, shard), sst};
|
||||
return compaction_writer{sst->get_writer(*_schema, partitions_per_sstable(shard), cfg, get_encoding_stats(), shard), sst};
|
||||
}
|
||||
|
||||
void stop_sstable_writer(compaction_writer* writer) override {
|
||||
@@ -1687,7 +1680,7 @@ static future<compaction_result> scrub_sstables_validate_mode(sstables::compacti
|
||||
for (const auto& sst : descriptor.sstables) {
|
||||
clogger.info("Scrubbing in validate mode {}", sst->get_filename());
|
||||
|
||||
validation_errors += co_await sst->validate(permit, descriptor.io_priority, cdata.abort, [&schema] (sstring what) {
|
||||
validation_errors += co_await sst->validate(permit, cdata.abort, [&schema] (sstring what) {
|
||||
scrub_compaction::report_validation_error(compaction_type::Scrub, *schema, what);
|
||||
});
|
||||
// Did validation actually finish because aborted?
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
#include "compaction/compaction_descriptor.hh"
|
||||
#include "gc_clock.hh"
|
||||
#include "compaction_weight_registration.hh"
|
||||
#include "service/priority_manager.hh"
|
||||
#include "utils/UUID.hh"
|
||||
#include "table_state.hh"
|
||||
#include <seastar/core/thread.hh>
|
||||
|
||||
@@ -155,8 +155,6 @@ struct compaction_descriptor {
|
||||
compaction_sstable_creator_fn creator;
|
||||
compaction_sstable_replacer_fn replacer;
|
||||
|
||||
::io_priority_class io_priority = default_priority_class();
|
||||
|
||||
// Denotes if this compaction task is comprised solely of completely expired SSTables
|
||||
sstables::has_only_fully_expired has_only_fully_expired = has_only_fully_expired::no;
|
||||
|
||||
@@ -166,7 +164,6 @@ struct compaction_descriptor {
|
||||
static constexpr uint64_t default_max_sstable_bytes = std::numeric_limits<uint64_t>::max();
|
||||
|
||||
explicit compaction_descriptor(std::vector<sstables::shared_sstable> sstables,
|
||||
::io_priority_class io_priority,
|
||||
int level = default_level,
|
||||
uint64_t max_sstable_bytes = default_max_sstable_bytes,
|
||||
run_id run_identifier = run_id::create_random_id(),
|
||||
@@ -178,18 +175,15 @@ struct compaction_descriptor {
|
||||
, run_identifier(run_identifier)
|
||||
, options(options)
|
||||
, owned_ranges(std::move(owned_ranges_))
|
||||
, io_priority(io_priority)
|
||||
{}
|
||||
|
||||
explicit compaction_descriptor(sstables::has_only_fully_expired has_only_fully_expired,
|
||||
std::vector<sstables::shared_sstable> sstables,
|
||||
::io_priority_class io_priority)
|
||||
std::vector<sstables::shared_sstable> sstables)
|
||||
: sstables(std::move(sstables))
|
||||
, level(default_level)
|
||||
, max_sstable_bytes(default_max_sstable_bytes)
|
||||
, run_identifier(run_id::create_random_id())
|
||||
, options(compaction_type_options::make_regular())
|
||||
, io_priority(io_priority)
|
||||
, has_only_fully_expired(has_only_fully_expired)
|
||||
{}
|
||||
|
||||
|
||||
@@ -774,7 +774,7 @@ compaction_manager::~compaction_manager() {
|
||||
|
||||
future<> compaction_manager::update_throughput(uint32_t value_mbs) {
|
||||
uint64_t bps = ((uint64_t)(value_mbs != 0 ? value_mbs : std::numeric_limits<uint32_t>::max())) << 20;
|
||||
return compaction_sg().io.update_bandwidth(bps).then_wrapped([value_mbs] (auto f) {
|
||||
return compaction_sg().cpu.update_io_bandwidth(bps).then_wrapped([value_mbs] (auto f) {
|
||||
if (f.failed()) {
|
||||
cmlog.warn("Couldn't update compaction bandwidth: {}", f.get_exception());
|
||||
} else if (value_mbs != 0) {
|
||||
@@ -1186,8 +1186,7 @@ private:
|
||||
});
|
||||
|
||||
auto get_next_job = [&] () -> std::optional<sstables::compaction_descriptor> {
|
||||
auto& iop = service::get_local_streaming_priority(); // run reshape in maintenance mode
|
||||
auto desc = t.get_compaction_strategy().get_reshaping_job(reshape_candidates, t.schema(), iop, sstables::reshape_mode::strict);
|
||||
auto desc = t.get_compaction_strategy().get_reshaping_job(reshape_candidates, t.schema(), sstables::reshape_mode::strict);
|
||||
return desc.sstables.size() ? std::make_optional(std::move(desc)) : std::nullopt;
|
||||
};
|
||||
|
||||
@@ -1341,7 +1340,7 @@ private:
|
||||
auto sstable_level = sst->get_sstable_level();
|
||||
auto run_identifier = sst->run_identifier();
|
||||
// FIXME: this compaction should run with maintenance priority.
|
||||
auto descriptor = sstables::compaction_descriptor({ sst }, service::get_local_compaction_priority(),
|
||||
auto descriptor = sstables::compaction_descriptor({ sst },
|
||||
sstable_level, sstables::compaction_descriptor::default_max_sstable_bytes, run_identifier, _options, _owned_ranges_ptr);
|
||||
|
||||
// Releases reference to cleaned sstable such that respective used disk space can be freed.
|
||||
@@ -1439,7 +1438,6 @@ private:
|
||||
try {
|
||||
auto desc = sstables::compaction_descriptor(
|
||||
{ sst },
|
||||
_cm.maintenance_sg().io,
|
||||
sst->get_sstable_level(),
|
||||
sstables::compaction_descriptor::default_max_sstable_bytes,
|
||||
sst->run_identifier(),
|
||||
|
||||
@@ -39,14 +39,14 @@ namespace sstables {
|
||||
|
||||
compaction_descriptor compaction_strategy_impl::make_major_compaction_job(std::vector<sstables::shared_sstable> candidates, int level, uint64_t max_sstable_bytes) {
|
||||
// run major compaction in maintenance priority
|
||||
return compaction_descriptor(std::move(candidates), service::get_local_streaming_priority(), level, max_sstable_bytes);
|
||||
return compaction_descriptor(std::move(candidates), level, max_sstable_bytes);
|
||||
}
|
||||
|
||||
std::vector<compaction_descriptor> compaction_strategy_impl::get_cleanup_compaction_jobs(table_state& table_s, std::vector<shared_sstable> candidates) const {
|
||||
// The default implementation is suboptimal and causes the writeamp problem described issue in #10097.
|
||||
// The compaction strategy relying on it should strive to implement its own method, to make cleanup bucket aware.
|
||||
return boost::copy_range<std::vector<compaction_descriptor>>(candidates | boost::adaptors::transformed([] (const shared_sstable& sst) {
|
||||
return compaction_descriptor({ sst }, service::get_local_compaction_priority(),
|
||||
return compaction_descriptor({ sst },
|
||||
sst->get_sstable_level(), sstables::compaction_descriptor::default_max_sstable_bytes, sst->run_identifier());
|
||||
}));
|
||||
}
|
||||
@@ -75,7 +75,7 @@ reader_consumer_v2 compaction_strategy_impl::make_interposer_consumer(const muta
|
||||
}
|
||||
|
||||
compaction_descriptor
|
||||
compaction_strategy_impl::get_reshaping_job(std::vector<shared_sstable> input, schema_ptr schema, const ::io_priority_class& iop, reshape_mode mode) const {
|
||||
compaction_strategy_impl::get_reshaping_job(std::vector<shared_sstable> input, schema_ptr schema, reshape_mode mode) const {
|
||||
return compaction_descriptor();
|
||||
}
|
||||
|
||||
@@ -665,7 +665,7 @@ compaction_descriptor date_tiered_compaction_strategy::get_sstables_for_compacti
|
||||
|
||||
if (!sstables.empty()) {
|
||||
date_tiered_manifest::logger.debug("datetiered: Compacting {} out of {} sstables", sstables.size(), candidates.size());
|
||||
return sstables::compaction_descriptor(std::move(sstables), service::get_local_compaction_priority());
|
||||
return sstables::compaction_descriptor(std::move(sstables));
|
||||
}
|
||||
|
||||
// filter out sstables which droppable tombstone ratio isn't greater than the defined threshold.
|
||||
@@ -681,7 +681,7 @@ compaction_descriptor date_tiered_compaction_strategy::get_sstables_for_compacti
|
||||
auto it = std::min_element(candidates.begin(), candidates.end(), [] (auto& i, auto& j) {
|
||||
return i->get_stats_metadata().min_timestamp < j->get_stats_metadata().min_timestamp;
|
||||
});
|
||||
return sstables::compaction_descriptor({ *it }, service::get_local_compaction_priority());
|
||||
return sstables::compaction_descriptor({ *it });
|
||||
}
|
||||
|
||||
std::unique_ptr<compaction_backlog_tracker::impl> date_tiered_compaction_strategy::make_backlog_tracker() const {
|
||||
@@ -746,8 +746,8 @@ compaction_backlog_tracker compaction_strategy::make_backlog_tracker() const {
|
||||
}
|
||||
|
||||
sstables::compaction_descriptor
|
||||
compaction_strategy::get_reshaping_job(std::vector<shared_sstable> input, schema_ptr schema, const ::io_priority_class& iop, reshape_mode mode) const {
|
||||
return _compaction_strategy_impl->get_reshaping_job(std::move(input), schema, iop, mode);
|
||||
compaction_strategy::get_reshaping_job(std::vector<shared_sstable> input, schema_ptr schema, reshape_mode mode) const {
|
||||
return _compaction_strategy_impl->get_reshaping_job(std::move(input), schema, mode);
|
||||
}
|
||||
|
||||
uint64_t compaction_strategy::adjust_partition_estimate(const mutation_source_metadata& ms_meta, uint64_t partition_estimate) const {
|
||||
|
||||
@@ -126,7 +126,7 @@ public:
|
||||
//
|
||||
// The caller should also pass a maximum number of SSTables which is the maximum amount of
|
||||
// SSTables that can be added into a single job.
|
||||
compaction_descriptor get_reshaping_job(std::vector<shared_sstable> input, schema_ptr schema, const ::io_priority_class& iop, reshape_mode mode) const;
|
||||
compaction_descriptor get_reshaping_job(std::vector<shared_sstable> input, schema_ptr schema, reshape_mode mode) const;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -73,6 +73,6 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
virtual compaction_descriptor get_reshaping_job(std::vector<shared_sstable> input, schema_ptr schema, const ::io_priority_class& iop, reshape_mode mode) const;
|
||||
virtual compaction_descriptor get_reshaping_job(std::vector<shared_sstable> input, schema_ptr schema, reshape_mode mode) const;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ compaction_descriptor leveled_compaction_strategy::get_sstables_for_compaction(t
|
||||
auto gc_before2 = j->get_gc_before_for_drop_estimation(compaction_time, table_s.get_tombstone_gc_state());
|
||||
return i->estimate_droppable_tombstone_ratio(gc_before1) < j->estimate_droppable_tombstone_ratio(gc_before2);
|
||||
});
|
||||
return sstables::compaction_descriptor({ sst }, service::get_local_compaction_priority(), sst->get_sstable_level());
|
||||
return sstables::compaction_descriptor({ sst }, sst->get_sstable_level());
|
||||
}
|
||||
return {};
|
||||
}
|
||||
@@ -145,7 +145,7 @@ int64_t leveled_compaction_strategy::estimated_pending_compactions(table_state&
|
||||
}
|
||||
|
||||
compaction_descriptor
|
||||
leveled_compaction_strategy::get_reshaping_job(std::vector<shared_sstable> input, schema_ptr schema, const ::io_priority_class& iop, reshape_mode mode) const {
|
||||
leveled_compaction_strategy::get_reshaping_job(std::vector<shared_sstable> input, schema_ptr schema, reshape_mode mode) const {
|
||||
std::array<std::vector<shared_sstable>, leveled_manifest::MAX_LEVELS> level_info;
|
||||
|
||||
auto is_disjoint = [schema] (const std::vector<shared_sstable>& sstables, unsigned tolerance) -> std::tuple<bool, unsigned> {
|
||||
@@ -162,7 +162,7 @@ leveled_compaction_strategy::get_reshaping_job(std::vector<shared_sstable> input
|
||||
|
||||
// This is really unexpected, so we'll just compact it all to fix it
|
||||
auto ideal_level = ideal_level_for_input(input, max_sstable_size_in_bytes);
|
||||
compaction_descriptor desc(std::move(input), iop, ideal_level, max_sstable_size_in_bytes);
|
||||
compaction_descriptor desc(std::move(input), ideal_level, max_sstable_size_in_bytes);
|
||||
desc.options = compaction_type_options::make_reshape();
|
||||
return desc;
|
||||
}
|
||||
@@ -193,14 +193,14 @@ leveled_compaction_strategy::get_reshaping_job(std::vector<shared_sstable> input
|
||||
unsigned ideal_level = ideal_level_for_input(level_info[0], max_sstable_size_in_bytes);
|
||||
|
||||
leveled_manifest::logger.info("Reshaping {} disjoint sstables in level 0 into level {}", level_info[0].size(), ideal_level);
|
||||
compaction_descriptor desc(std::move(input), iop, ideal_level, max_sstable_size_in_bytes);
|
||||
compaction_descriptor desc(std::move(input), ideal_level, max_sstable_size_in_bytes);
|
||||
desc.options = compaction_type_options::make_reshape();
|
||||
return desc;
|
||||
}
|
||||
|
||||
if (level_info[0].size() > offstrategy_threshold) {
|
||||
size_tiered_compaction_strategy stcs(_stcs_options);
|
||||
return stcs.get_reshaping_job(std::move(level_info[0]), schema, iop, mode);
|
||||
return stcs.get_reshaping_job(std::move(level_info[0]), schema, mode);
|
||||
}
|
||||
|
||||
for (unsigned level = leveled_manifest::MAX_LEVELS - 1; level > 0; --level) {
|
||||
@@ -211,7 +211,7 @@ leveled_compaction_strategy::get_reshaping_job(std::vector<shared_sstable> input
|
||||
auto [disjoint, overlapping_sstables] = is_disjoint(level_info[level], tolerance(level));
|
||||
if (!disjoint) {
|
||||
leveled_manifest::logger.warn("Turns out that level {} is not disjoint, found {} overlapping SSTables, so the level will be entirely compacted on behalf of {}.{}", level, overlapping_sstables, schema->ks_name(), schema->cf_name());
|
||||
compaction_descriptor desc(std::move(level_info[level]), iop, level, max_sstable_size_in_bytes);
|
||||
compaction_descriptor desc(std::move(level_info[level]), level, max_sstable_size_in_bytes);
|
||||
desc.options = compaction_type_options::make_reshape();
|
||||
return desc;
|
||||
}
|
||||
@@ -231,7 +231,7 @@ leveled_compaction_strategy::get_cleanup_compaction_jobs(table_state& table_s, s
|
||||
if (levels[level].empty()) {
|
||||
continue;
|
||||
}
|
||||
ret.push_back(compaction_descriptor(std::move(levels[level]), service::get_local_compaction_priority(), level, _max_sstable_size_in_mb * 1024 * 1024));
|
||||
ret.push_back(compaction_descriptor(std::move(levels[level]), level, _max_sstable_size_in_mb * 1024 * 1024));
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -73,7 +73,7 @@ public:
|
||||
|
||||
virtual std::unique_ptr<compaction_backlog_tracker::impl> make_backlog_tracker() const override;
|
||||
|
||||
virtual compaction_descriptor get_reshaping_job(std::vector<shared_sstable> input, schema_ptr schema, const ::io_priority_class& iop, reshape_mode mode) const override;
|
||||
virtual compaction_descriptor get_reshaping_job(std::vector<shared_sstable> input, schema_ptr schema, reshape_mode mode) const override;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
#include "log.hh"
|
||||
#include <boost/range/algorithm/sort.hpp>
|
||||
#include <boost/range/algorithm/partial_sort.hpp>
|
||||
#include "service/priority_manager.hh"
|
||||
|
||||
class leveled_manifest {
|
||||
table_state& _table_s;
|
||||
@@ -149,8 +148,7 @@ public:
|
||||
if (info.can_promote) {
|
||||
info.candidates = get_overlapping_starved_sstables(next_level, std::move(info.candidates), compaction_counter);
|
||||
}
|
||||
return sstables::compaction_descriptor(std::move(info.candidates),
|
||||
service::get_local_compaction_priority(), next_level, _max_sstable_size_in_bytes);
|
||||
return sstables::compaction_descriptor(std::move(info.candidates), next_level, _max_sstable_size_in_bytes);
|
||||
} else {
|
||||
logger.debug("No compaction candidates for L{}", level);
|
||||
return sstables::compaction_descriptor();
|
||||
@@ -214,8 +212,7 @@ public:
|
||||
_table_s.min_compaction_threshold(), _schema->max_compaction_threshold(), _stcs_options);
|
||||
if (!most_interesting.empty()) {
|
||||
logger.debug("L0 is too far behind, performing size-tiering there first");
|
||||
return sstables::compaction_descriptor(std::move(most_interesting),
|
||||
service::get_local_compaction_priority());
|
||||
return sstables::compaction_descriptor(std::move(most_interesting));
|
||||
}
|
||||
}
|
||||
auto descriptor = get_descriptor_for_level(i, last_compacted_keys, compaction_counter);
|
||||
@@ -229,8 +226,7 @@ public:
|
||||
auto info = get_candidates_for(0, last_compacted_keys);
|
||||
if (!info.candidates.empty()) {
|
||||
auto next_level = get_next_level(info.candidates, info.can_promote);
|
||||
return sstables::compaction_descriptor(std::move(info.candidates),
|
||||
service::get_local_compaction_priority(), next_level, _max_sstable_size_in_bytes);
|
||||
return sstables::compaction_descriptor(std::move(info.candidates), next_level, _max_sstable_size_in_bytes);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -155,13 +155,13 @@ size_tiered_compaction_strategy::get_sstables_for_compaction(table_state& table_
|
||||
|
||||
if (is_any_bucket_interesting(buckets, min_threshold)) {
|
||||
std::vector<sstables::shared_sstable> most_interesting = most_interesting_bucket(std::move(buckets), min_threshold, max_threshold);
|
||||
return sstables::compaction_descriptor(std::move(most_interesting), service::get_local_compaction_priority());
|
||||
return sstables::compaction_descriptor(std::move(most_interesting));
|
||||
}
|
||||
|
||||
// If we are not enforcing min_threshold explicitly, try any pair of SStables in the same tier.
|
||||
if (!table_s.compaction_enforce_min_threshold() && is_any_bucket_interesting(buckets, 2)) {
|
||||
std::vector<sstables::shared_sstable> most_interesting = most_interesting_bucket(std::move(buckets), 2, max_threshold);
|
||||
return sstables::compaction_descriptor(std::move(most_interesting), service::get_local_compaction_priority());
|
||||
return sstables::compaction_descriptor(std::move(most_interesting));
|
||||
}
|
||||
|
||||
if (!table_s.tombstone_gc_enabled()) {
|
||||
@@ -185,7 +185,7 @@ size_tiered_compaction_strategy::get_sstables_for_compaction(table_state& table_
|
||||
auto it = std::min_element(sstables.begin(), sstables.end(), [] (auto& i, auto& j) {
|
||||
return i->get_stats_metadata().min_timestamp < j->get_stats_metadata().min_timestamp;
|
||||
});
|
||||
return sstables::compaction_descriptor({ *it }, service::get_local_compaction_priority());
|
||||
return sstables::compaction_descriptor({ *it });
|
||||
}
|
||||
return sstables::compaction_descriptor();
|
||||
}
|
||||
@@ -229,7 +229,7 @@ size_tiered_compaction_strategy::most_interesting_bucket(const std::vector<sstab
|
||||
}
|
||||
|
||||
compaction_descriptor
|
||||
size_tiered_compaction_strategy::get_reshaping_job(std::vector<shared_sstable> input, schema_ptr schema, const ::io_priority_class& iop, reshape_mode mode) const
|
||||
size_tiered_compaction_strategy::get_reshaping_job(std::vector<shared_sstable> input, schema_ptr schema, reshape_mode mode) const
|
||||
{
|
||||
size_t offstrategy_threshold = std::max(schema->min_compaction_threshold(), 4);
|
||||
size_t max_sstables = std::max(schema->max_compaction_threshold(), int(offstrategy_threshold));
|
||||
@@ -245,7 +245,7 @@ size_tiered_compaction_strategy::get_reshaping_job(std::vector<shared_sstable> i
|
||||
// All sstables can be reshaped at once if the amount of overlapping will not cause memory usage to be high,
|
||||
// which is possible because partitioned set is able to incrementally open sstables during compaction
|
||||
if (sstable_set_overlapping_count(schema, input) <= max_sstables) {
|
||||
compaction_descriptor desc(std::move(input), iop);
|
||||
compaction_descriptor desc(std::move(input));
|
||||
desc.options = compaction_type_options::make_reshape();
|
||||
return desc;
|
||||
}
|
||||
@@ -261,7 +261,7 @@ size_tiered_compaction_strategy::get_reshaping_job(std::vector<shared_sstable> i
|
||||
});
|
||||
bucket.resize(max_sstables);
|
||||
}
|
||||
compaction_descriptor desc(std::move(bucket), iop);
|
||||
compaction_descriptor desc(std::move(bucket));
|
||||
desc.options = compaction_type_options::make_reshape();
|
||||
return desc;
|
||||
}
|
||||
@@ -289,7 +289,7 @@ size_tiered_compaction_strategy::get_cleanup_compaction_jobs(table_state& table_
|
||||
unsigned needed = std::min(remaining, max_threshold);
|
||||
std::vector<shared_sstable> sstables;
|
||||
std::move(it, it + needed, std::back_inserter(sstables));
|
||||
ret.push_back(compaction_descriptor(std::move(sstables), service::get_local_compaction_priority()));
|
||||
ret.push_back(compaction_descriptor(std::move(sstables)));
|
||||
std::advance(it, needed);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -129,7 +129,7 @@ public:
|
||||
|
||||
virtual std::unique_ptr<compaction_backlog_tracker::impl> make_backlog_tracker() const override;
|
||||
|
||||
virtual compaction_descriptor get_reshaping_job(std::vector<shared_sstable> input, schema_ptr schema, const ::io_priority_class& iop, reshape_mode mode) const override;
|
||||
virtual compaction_descriptor get_reshaping_job(std::vector<shared_sstable> input, schema_ptr schema, reshape_mode mode) const override;
|
||||
|
||||
friend class ::size_tiered_backlog_tracker;
|
||||
};
|
||||
|
||||
@@ -138,7 +138,7 @@ reader_consumer_v2 time_window_compaction_strategy::make_interposer_consumer(con
|
||||
}
|
||||
|
||||
compaction_descriptor
|
||||
time_window_compaction_strategy::get_reshaping_job(std::vector<shared_sstable> input, schema_ptr schema, const ::io_priority_class& iop, reshape_mode mode) const {
|
||||
time_window_compaction_strategy::get_reshaping_job(std::vector<shared_sstable> input, schema_ptr schema, reshape_mode mode) const {
|
||||
std::vector<shared_sstable> single_window;
|
||||
std::vector<shared_sstable> multi_window;
|
||||
|
||||
@@ -192,7 +192,7 @@ time_window_compaction_strategy::get_reshaping_job(std::vector<shared_sstable> i
|
||||
});
|
||||
multi_window.resize(max_sstables);
|
||||
}
|
||||
compaction_descriptor desc(std::move(multi_window), iop);
|
||||
compaction_descriptor desc(std::move(multi_window));
|
||||
desc.options = compaction_type_options::make_reshape();
|
||||
return desc;
|
||||
}
|
||||
@@ -211,14 +211,14 @@ time_window_compaction_strategy::get_reshaping_job(std::vector<shared_sstable> i
|
||||
}
|
||||
// reuse STCS reshape logic which will only compact similar-sized files, to increase overall efficiency
|
||||
// when reshaping time buckets containing a huge amount of files
|
||||
auto desc = size_tiered_compaction_strategy(_stcs_options).get_reshaping_job(std::move(ssts), schema, iop, mode);
|
||||
auto desc = size_tiered_compaction_strategy(_stcs_options).get_reshaping_job(std::move(ssts), schema, mode);
|
||||
if (!desc.sstables.empty()) {
|
||||
return desc;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!single_window.empty()) {
|
||||
compaction_descriptor desc(std::move(single_window), iop);
|
||||
compaction_descriptor desc(std::move(single_window));
|
||||
desc.options = compaction_type_options::make_reshape();
|
||||
return desc;
|
||||
}
|
||||
@@ -244,7 +244,7 @@ time_window_compaction_strategy::get_sstables_for_compaction(table_state& table_
|
||||
auto expired = table_s.fully_expired_sstables(candidates, compaction_time);
|
||||
if (!expired.empty()) {
|
||||
clogger.debug("[{}] Going to compact {} expired sstables", fmt::ptr(this), expired.size());
|
||||
return compaction_descriptor(has_only_fully_expired::yes, std::vector<shared_sstable>(expired.begin(), expired.end()), service::get_local_compaction_priority());
|
||||
return compaction_descriptor(has_only_fully_expired::yes, std::vector<shared_sstable>(expired.begin(), expired.end()));
|
||||
}
|
||||
// Keep checking for fully_expired_sstables until we don't find
|
||||
// any among the candidates, meaning they are either already compacted
|
||||
@@ -256,7 +256,7 @@ time_window_compaction_strategy::get_sstables_for_compaction(table_state& table_
|
||||
|
||||
auto compaction_candidates = get_next_non_expired_sstables(table_s, control, std::move(candidates), compaction_time);
|
||||
clogger.debug("[{}] Going to compact {} non-expired sstables", fmt::ptr(this), compaction_candidates.size());
|
||||
return compaction_descriptor(std::move(compaction_candidates), service::get_local_compaction_priority());
|
||||
return compaction_descriptor(std::move(compaction_candidates));
|
||||
}
|
||||
|
||||
time_window_compaction_strategy::bucket_compaction_mode
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
#include "timestamp.hh"
|
||||
#include "exceptions/exceptions.hh"
|
||||
#include "sstables/shared_sstable.hh"
|
||||
#include "service/priority_manager.hh"
|
||||
|
||||
namespace sstables {
|
||||
|
||||
@@ -172,7 +171,7 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
virtual compaction_descriptor get_reshaping_job(std::vector<shared_sstable> input, schema_ptr schema, const ::io_priority_class& iop, reshape_mode mode) const override;
|
||||
virtual compaction_descriptor get_reshaping_job(std::vector<shared_sstable> input, schema_ptr schema, reshape_mode mode) const override;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -862,7 +862,6 @@ scylla_core = (['message/messaging_service.cc',
|
||||
'utils/big_decimal.cc',
|
||||
'types/types.cc',
|
||||
'validation.cc',
|
||||
'service/priority_manager.cc',
|
||||
'service/migration_manager.cc',
|
||||
'service/tablet_allocator.cc',
|
||||
'service/storage_proxy.cc',
|
||||
@@ -1640,7 +1639,7 @@ def configure_seastar(build_dir, mode, mode_config):
|
||||
'-DSeastar_CXX_FLAGS=SHELL:{}'.format(mode_config['lib_cflags']),
|
||||
'-DSeastar_LD_FLAGS={}'.format(semicolon_separated(mode_config['lib_ldflags'], mode_config['cxx_ld_flags'])),
|
||||
'-DSeastar_CXX_DIALECT=gnu++20',
|
||||
'-DSeastar_API_LEVEL=6',
|
||||
'-DSeastar_API_LEVEL=7',
|
||||
'-DSeastar_UNUSED_RESULT_ERROR=ON',
|
||||
'-DCMAKE_EXPORT_COMPILE_COMMANDS=ON',
|
||||
'-DSeastar_SCHEDULING_GROUPS_COUNT=16',
|
||||
|
||||
@@ -52,7 +52,6 @@
|
||||
#include "log.hh"
|
||||
#include "commitlog_entry.hh"
|
||||
#include "commitlog_extensions.hh"
|
||||
#include "service/priority_manager.hh"
|
||||
#include "serializer.hh"
|
||||
|
||||
#include <boost/range/numeric.hpp>
|
||||
@@ -281,8 +280,8 @@ public:
|
||||
|
||||
// NOT overrides. Nothing virtual. Will rely on exact type
|
||||
template <typename CharType>
|
||||
auto dma_write(uint64_t pos, const CharType* buffer, size_t len, const io_priority_class& pc = default_priority_class(), io_intent* intent = nullptr) noexcept;
|
||||
auto dma_write(uint64_t pos, std::vector<iovec> iov, const io_priority_class& pc = default_priority_class(), io_intent* intent = nullptr) noexcept;
|
||||
auto dma_write(uint64_t pos, const CharType* buffer, size_t len, io_intent* intent = nullptr) noexcept;
|
||||
auto dma_write(uint64_t pos, std::vector<iovec> iov, io_intent* intent = nullptr) noexcept;
|
||||
|
||||
auto truncate(uint64_t length) noexcept;
|
||||
auto allocate(uint64_t position, uint64_t length) noexcept;
|
||||
@@ -577,15 +576,15 @@ auto db::commitlog::segment_manager::named_file::make_awaiter(future<Args...> f,
|
||||
}
|
||||
|
||||
template <typename CharType>
|
||||
auto db::commitlog::segment_manager::named_file::dma_write(uint64_t pos, const CharType* buffer, size_t len, const io_priority_class& pc, io_intent* intent) noexcept {
|
||||
return make_awaiter(file::dma_write(pos, buffer, len, pc, intent), [this, pos](size_t res) {
|
||||
auto db::commitlog::segment_manager::named_file::dma_write(uint64_t pos, const CharType* buffer, size_t len, io_intent* intent) noexcept {
|
||||
return make_awaiter(file::dma_write(pos, buffer, len, intent), [this, pos](size_t res) {
|
||||
maybe_update_size(pos + res);
|
||||
return res;
|
||||
});
|
||||
}
|
||||
|
||||
auto db::commitlog::segment_manager::named_file::dma_write(uint64_t pos, std::vector<iovec> iov, const io_priority_class& pc, io_intent* intent) noexcept {
|
||||
return make_awaiter(file::dma_write(pos, std::move(iov), pc, intent), [this, pos](size_t res) {
|
||||
auto db::commitlog::segment_manager::named_file::dma_write(uint64_t pos, std::vector<iovec> iov, io_intent* intent) noexcept {
|
||||
return make_awaiter(file::dma_write(pos, std::move(iov), intent), [this, pos](size_t res) {
|
||||
maybe_update_size(pos + res);
|
||||
return res;
|
||||
});
|
||||
@@ -1023,8 +1022,6 @@ public:
|
||||
co_return;
|
||||
}
|
||||
|
||||
auto&& priority_class = service::get_local_commitlog_priority();
|
||||
|
||||
auto finally = defer([&] () noexcept {
|
||||
_segment_manager->notify_memory_written(size);
|
||||
_segment_manager->totals.buffer_list_bytes -= buf.size_bytes();
|
||||
@@ -1038,7 +1035,7 @@ public:
|
||||
for (;;) {
|
||||
auto current = *view.begin();
|
||||
try {
|
||||
auto bytes = co_await _file.dma_write(off, current.data(), current.size(), priority_class);
|
||||
auto bytes = co_await _file.dma_write(off, current.data(), current.size());
|
||||
_segment_manager->totals.bytes_written += bytes;
|
||||
_segment_manager->totals.active_size_on_disk += bytes;
|
||||
++_segment_manager->totals.cycle_count;
|
||||
@@ -1716,7 +1713,7 @@ future<db::commitlog::segment_manager::sseg_ptr> db::commitlog::segment_manager:
|
||||
v.emplace_back(iovec{ buf.get_write(), s});
|
||||
m += s;
|
||||
}
|
||||
auto s = co_await f.dma_write(max_size - rem, std::move(v), service::get_local_commitlog_priority());
|
||||
auto s = co_await f.dma_write(max_size - rem, std::move(v));
|
||||
if (!s) [[unlikely]] {
|
||||
on_internal_error(clogger, format("dma_write returned 0: max_size={} rem={} iovec.n={}", max_size, rem, n));
|
||||
}
|
||||
@@ -2551,14 +2548,13 @@ const db::commitlog::config& db::commitlog::active_config() const {
|
||||
// No commit_io_check needed in the log reader since the database will fail
|
||||
// on error at startup if required
|
||||
future<>
|
||||
db::commitlog::read_log_file(sstring filename, sstring pfx, seastar::io_priority_class read_io_prio_class, commit_load_reader_func next, position_type off, const db::extensions* exts) {
|
||||
db::commitlog::read_log_file(sstring filename, sstring pfx, commit_load_reader_func next, position_type off, const db::extensions* exts) {
|
||||
struct work {
|
||||
private:
|
||||
file_input_stream_options make_file_input_stream_options(seastar::io_priority_class read_io_prio_class) {
|
||||
file_input_stream_options make_file_input_stream_options() {
|
||||
file_input_stream_options fo;
|
||||
fo.buffer_size = db::commitlog::segment::default_size;
|
||||
fo.read_ahead = 10;
|
||||
fo.io_priority_class = read_io_prio_class;
|
||||
return fo;
|
||||
}
|
||||
public:
|
||||
@@ -2578,8 +2574,8 @@ db::commitlog::read_log_file(sstring filename, sstring pfx, seastar::io_priority
|
||||
bool failed = false;
|
||||
fragmented_temporary_buffer::reader frag_reader;
|
||||
|
||||
work(file f, descriptor din, commit_load_reader_func fn, seastar::io_priority_class read_io_prio_class, position_type o = 0)
|
||||
: f(f), d(din), func(std::move(fn)), fin(make_file_input_stream(f, 0, make_file_input_stream_options(read_io_prio_class))), start_off(o) {
|
||||
work(file f, descriptor din, commit_load_reader_func fn, position_type o = 0)
|
||||
: f(f), d(din), func(std::move(fn)), fin(make_file_input_stream(f, 0, make_file_input_stream_options())), start_off(o) {
|
||||
}
|
||||
work(work&&) = default;
|
||||
|
||||
@@ -2878,7 +2874,7 @@ db::commitlog::read_log_file(sstring filename, sstring pfx, seastar::io_priority
|
||||
f = make_checked_file(commit_error_handler, std::move(f));
|
||||
|
||||
descriptor d(filename, pfx);
|
||||
work w(std::move(f), d, std::move(next), read_io_prio_class, off);
|
||||
work w(std::move(f), d, std::move(next), off);
|
||||
|
||||
co_await w.read_file();
|
||||
}
|
||||
|
||||
@@ -386,7 +386,7 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
static future<> read_log_file(sstring filename, sstring prefix, seastar::io_priority_class read_io_prio_class, commit_load_reader_func, position_type = 0, const db::extensions* = nullptr);
|
||||
static future<> read_log_file(sstring filename, sstring prefix, commit_load_reader_func, position_type = 0, const db::extensions* = nullptr);
|
||||
private:
|
||||
commitlog(config);
|
||||
|
||||
|
||||
@@ -25,7 +25,6 @@
|
||||
#include "converting_mutation_partition_applier.hh"
|
||||
#include "schema/schema_registry.hh"
|
||||
#include "commitlog_entry.hh"
|
||||
#include "service/priority_manager.hh"
|
||||
#include "db/extensions.hh"
|
||||
#include "utils/fragmented_temporary_buffer.hh"
|
||||
#include "validation.hh"
|
||||
@@ -194,7 +193,7 @@ db::commitlog_replayer::impl::recover(sstring file, const sstring& fname_prefix)
|
||||
auto s = make_lw_shared<stats>();
|
||||
auto& exts = _db.local().extensions();
|
||||
|
||||
return db::commitlog::read_log_file(file, fname_prefix, service::get_local_commitlog_priority(),
|
||||
return db::commitlog::read_log_file(file, fname_prefix,
|
||||
std::bind(&impl::process, this, s.get(), std::placeholders::_1),
|
||||
p, &exts).then_wrapped([s](future<> f) {
|
||||
try {
|
||||
|
||||
@@ -26,7 +26,6 @@
|
||||
#include "utils/disk-error-handler.hh"
|
||||
#include "utils/lister.hh"
|
||||
#include "db/timeout_clock.hh"
|
||||
#include "service/priority_manager.hh"
|
||||
#include "replica/database.hh"
|
||||
#include "service_permit.hh"
|
||||
#include "utils/directories.hh"
|
||||
@@ -1035,7 +1034,7 @@ bool manager::end_point_hints_manager::sender::send_one_file(const sstring& fnam
|
||||
lw_shared_ptr<send_one_file_ctx> ctx_ptr = make_lw_shared<send_one_file_ctx>(_last_schema_ver_to_column_mapping);
|
||||
|
||||
try {
|
||||
commitlog::read_log_file(fname, manager::FILENAME_PREFIX, service::get_local_streaming_priority(), [this, secs_since_file_mod, &fname, ctx_ptr] (commitlog::buffer_and_replay_position buf_rp) -> future<> {
|
||||
commitlog::read_log_file(fname, manager::FILENAME_PREFIX, [this, secs_since_file_mod, &fname, ctx_ptr] (commitlog::buffer_and_replay_position buf_rp) -> future<> {
|
||||
auto& buf = buf_rp.buffer;
|
||||
auto& rp = buf_rp.position;
|
||||
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
#include <seastar/core/io_priority_class.hh>
|
||||
#include "readers/flat_mutation_reader_fwd.hh"
|
||||
#include "readers/flat_mutation_reader_v2.hh"
|
||||
#include "db/system_keyspace.hh"
|
||||
@@ -61,7 +60,6 @@ struct virtual_reader {
|
||||
reader_permit permit,
|
||||
const dht::partition_range& range,
|
||||
const query::partition_slice& slice,
|
||||
const io_priority_class& pc,
|
||||
tracing::trace_state_ptr trace_state,
|
||||
streamed_mutation::forwarding fwd,
|
||||
mutation_reader::forwarding fwd_mr) {
|
||||
|
||||
@@ -54,7 +54,6 @@ class build_progress_virtual_reader {
|
||||
replica::column_family& scylla_views_build_progress,
|
||||
const dht::partition_range& range,
|
||||
const query::partition_slice& slice,
|
||||
const io_priority_class& pc,
|
||||
tracing::trace_state_ptr trace_state,
|
||||
streamed_mutation::forwarding fwd,
|
||||
mutation_reader::forwarding fwd_mr)
|
||||
@@ -70,7 +69,6 @@ class build_progress_virtual_reader {
|
||||
std::move(permit),
|
||||
range,
|
||||
slice,
|
||||
pc,
|
||||
std::move(trace_state),
|
||||
fwd,
|
||||
fwd_mr))
|
||||
@@ -192,7 +190,6 @@ public:
|
||||
reader_permit permit,
|
||||
const dht::partition_range& range,
|
||||
const query::partition_slice& slice,
|
||||
const io_priority_class& pc,
|
||||
tracing::trace_state_ptr trace_state,
|
||||
streamed_mutation::forwarding fwd,
|
||||
mutation_reader::forwarding fwd_mr) {
|
||||
@@ -202,7 +199,6 @@ public:
|
||||
_db.find_column_family(s->ks_name(), system_keyspace::v3::SCYLLA_VIEWS_BUILDS_IN_PROGRESS),
|
||||
range,
|
||||
slice,
|
||||
pc,
|
||||
std::move(trace_state),
|
||||
fwd,
|
||||
fwd_mr));
|
||||
|
||||
@@ -1898,7 +1898,6 @@ future<> view_builder::initialize_reader_at_current_token(build_step& step) {
|
||||
_permit,
|
||||
step.prange,
|
||||
step.pslice,
|
||||
default_priority_class(),
|
||||
nullptr,
|
||||
streamed_mutation::forwarding::no,
|
||||
mutation_reader::forwarding::no);
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
#include <boost/range/adaptor/map.hpp>
|
||||
#include "replica/database.hh"
|
||||
#include "view_update_generator.hh"
|
||||
#include "service/priority_manager.hh"
|
||||
#include "utils/error_injection.hh"
|
||||
#include "db/view/view_updating_consumer.hh"
|
||||
#include "sstables/sstables.hh"
|
||||
@@ -147,11 +146,10 @@ future<> view_update_generator::start() {
|
||||
reader_permit permit,
|
||||
const dht::partition_range& pr,
|
||||
const query::partition_slice& ps,
|
||||
const io_priority_class& pc,
|
||||
tracing::trace_state_ptr ts,
|
||||
streamed_mutation::forwarding fwd_ms,
|
||||
mutation_reader::forwarding fwd_mr) {
|
||||
return ssts->make_range_sstable_reader(s, std::move(permit), pr, ps, pc, std::move(ts), fwd_ms, fwd_mr, *_progress_tracker);
|
||||
return ssts->make_range_sstable_reader(s, std::move(permit), pr, ps, std::move(ts), fwd_ms, fwd_mr, *_progress_tracker);
|
||||
});
|
||||
auto [staging_sstable_reader, staging_sstable_reader_handle] = make_manually_paused_evictable_reader_v2(
|
||||
std::move(ms),
|
||||
@@ -159,7 +157,6 @@ future<> view_update_generator::start() {
|
||||
permit,
|
||||
query::full_partition_range,
|
||||
s->full_slice(),
|
||||
service::get_local_streaming_priority(),
|
||||
nullptr,
|
||||
::mutation_reader::forwarding::no);
|
||||
auto close_sr = deferred_close(staging_sstable_reader);
|
||||
|
||||
@@ -40,7 +40,6 @@ mutation_source memtable_filling_virtual_table::as_mutation_source() {
|
||||
reader_permit permit,
|
||||
const dht::partition_range& range,
|
||||
const query::partition_slice& slice,
|
||||
const io_priority_class& pc,
|
||||
tracing::trace_state_ptr trace_state,
|
||||
streamed_mutation::forwarding fwd,
|
||||
mutation_reader::forwarding fwd_mr) {
|
||||
@@ -54,15 +53,15 @@ mutation_source memtable_filling_virtual_table::as_mutation_source() {
|
||||
|
||||
auto units = make_lw_shared<my_units>(permit.consume_memory(0));
|
||||
|
||||
auto populate = [this, mt = make_lw_shared<replica::memtable>(schema()), s, units, range, slice, pc, trace_state, fwd, fwd_mr] () mutable {
|
||||
auto populate = [this, mt = make_lw_shared<replica::memtable>(schema()), s, units, range, slice, trace_state, fwd, fwd_mr] () mutable {
|
||||
auto mutation_sink = [units, mt] (mutation m) mutable {
|
||||
mt->apply(m);
|
||||
units->units.add(units->units.permit().consume_memory(mt->occupancy().used_space() - units->memory_used));
|
||||
units->memory_used = mt->occupancy().used_space();
|
||||
};
|
||||
|
||||
return execute(mutation_sink).then([this, mt, s, units, &range, &slice, &pc, &trace_state, &fwd, &fwd_mr] () {
|
||||
auto rd = mt->as_data_source().make_reader_v2(s, units->units.permit(), range, slice, pc, trace_state, fwd, fwd_mr);
|
||||
return execute(mutation_sink).then([this, mt, s, units, &range, &slice, &trace_state, &fwd, &fwd_mr] () {
|
||||
auto rd = mt->as_data_source().make_reader_v2(s, units->units.permit(), range, slice, trace_state, fwd, fwd_mr);
|
||||
|
||||
if (!_shard_aware) {
|
||||
rd = make_filtering_reader(std::move(rd), [this] (const dht::decorated_key& dk) -> bool {
|
||||
@@ -84,7 +83,6 @@ mutation_source streaming_virtual_table::as_mutation_source() {
|
||||
reader_permit permit,
|
||||
const dht::partition_range& pr,
|
||||
const query::partition_slice& query_slice,
|
||||
const io_priority_class& pc,
|
||||
tracing::trace_state_ptr trace_state,
|
||||
streamed_mutation::forwarding fwd,
|
||||
mutation_reader::forwarding fwd_mr) {
|
||||
|
||||
@@ -103,7 +103,6 @@ class built_indexes_virtual_reader {
|
||||
replica::column_family& built_views,
|
||||
const dht::partition_range& range,
|
||||
const query::partition_slice& slice,
|
||||
const io_priority_class& pc,
|
||||
tracing::trace_state_ptr trace_state,
|
||||
streamed_mutation::forwarding fwd,
|
||||
mutation_reader::forwarding fwd_mr)
|
||||
@@ -116,7 +115,6 @@ class built_indexes_virtual_reader {
|
||||
std::move(permit),
|
||||
range,
|
||||
_view_names_slice,
|
||||
pc,
|
||||
std::move(trace_state),
|
||||
fwd,
|
||||
fwd_mr)) {
|
||||
@@ -217,7 +215,6 @@ public:
|
||||
reader_permit permit,
|
||||
const dht::partition_range& range,
|
||||
const query::partition_slice& slice,
|
||||
const io_priority_class& pc,
|
||||
tracing::trace_state_ptr trace_state,
|
||||
streamed_mutation::forwarding fwd,
|
||||
mutation_reader::forwarding fwd_mr) {
|
||||
@@ -228,7 +225,6 @@ public:
|
||||
_db.find_column_family(s->ks_name(), system_keyspace::v3::BUILT_VIEWS),
|
||||
range,
|
||||
slice,
|
||||
pc,
|
||||
std::move(trace_state),
|
||||
fwd,
|
||||
fwd_mr);
|
||||
|
||||
4
main.cc
4
main.cc
@@ -1137,8 +1137,8 @@ To start the scylla server proper, simply invoke as: scylla server (or just scyl
|
||||
// we need the getter since updateable_value is not shard-safe (#7316)
|
||||
auto get_cm_cfg = sharded_parameter([&] {
|
||||
return compaction_manager::config {
|
||||
.compaction_sched_group = compaction_manager::scheduling_group{dbcfg.compaction_scheduling_group, service::get_local_compaction_priority()},
|
||||
.maintenance_sched_group = compaction_manager::scheduling_group{dbcfg.streaming_scheduling_group, service::get_local_streaming_priority()},
|
||||
.compaction_sched_group = compaction_manager::scheduling_group{dbcfg.compaction_scheduling_group},
|
||||
.maintenance_sched_group = compaction_manager::scheduling_group{dbcfg.streaming_scheduling_group},
|
||||
.available_memory = dbcfg.available_memory,
|
||||
.static_shares = cfg->compaction_static_shares,
|
||||
.throughput_mb_per_sec = cfg->compaction_throughput_mb_per_sec,
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
*/
|
||||
|
||||
#include "schema/schema_registry.hh"
|
||||
#include "service/priority_manager.hh"
|
||||
#include "multishard_mutation_query.hh"
|
||||
#include "mutation_query.hh"
|
||||
#include "replica/database.hh"
|
||||
@@ -245,7 +244,6 @@ public:
|
||||
reader_permit permit,
|
||||
const dht::partition_range& pr,
|
||||
const query::partition_slice& ps,
|
||||
const io_priority_class& pc,
|
||||
tracing::trace_state_ptr trace_state,
|
||||
mutation_reader::forwarding fwd_mr) override;
|
||||
|
||||
@@ -304,7 +302,6 @@ flat_mutation_reader_v2 read_context::create_reader(
|
||||
reader_permit permit,
|
||||
const dht::partition_range& pr,
|
||||
const query::partition_slice& ps,
|
||||
const io_priority_class& pc,
|
||||
tracing::trace_state_ptr trace_state,
|
||||
mutation_reader::forwarding fwd_mr) {
|
||||
const auto shard = this_shard_id();
|
||||
@@ -348,7 +345,7 @@ flat_mutation_reader_v2 read_context::create_reader(
|
||||
|
||||
rm.state = reader_state::used;
|
||||
|
||||
return table.as_mutation_source().make_reader_v2(std::move(schema), rm.rparts->permit, *rm.rparts->range, *rm.rparts->slice, pc,
|
||||
return table.as_mutation_source().make_reader_v2(std::move(schema), rm.rparts->permit, *rm.rparts->range, *rm.rparts->slice,
|
||||
std::move(trace_state), streamed_mutation::forwarding::no, fwd_mr);
|
||||
}
|
||||
|
||||
@@ -718,7 +715,7 @@ future<page_consume_result<ResultBuilder>> read_page(
|
||||
cmd.partition_limit);
|
||||
|
||||
auto reader = make_multishard_combining_reader_v2(ctx, s, ctx->permit(), ranges.front(), cmd.slice,
|
||||
service::get_local_sstable_query_read_priority(), trace_state, mutation_reader::forwarding(ranges.size() > 1));
|
||||
trace_state, mutation_reader::forwarding(ranges.size() > 1));
|
||||
if (ranges.size() > 1) {
|
||||
reader = make_flat_mutation_reader_v2<multi_range_reader>(s, ctx->permit(), std::move(reader), ranges);
|
||||
}
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
#include "reversibly_mergeable.hh"
|
||||
#include "mutation_fragment.hh"
|
||||
#include "mutation_query.hh"
|
||||
#include "service/priority_manager.hh"
|
||||
#include "mutation_compactor.hh"
|
||||
#include "counters.hh"
|
||||
#include "row_cache.hh"
|
||||
@@ -2515,7 +2514,7 @@ future<mutation_opt> counter_write_query(schema_ptr s, const mutation_source& so
|
||||
const query::partition_slice& slice,
|
||||
tracing::trace_state_ptr trace_ptr)
|
||||
: range(dht::partition_range::make_singular(dk))
|
||||
, reader(source.make_reader_v2(s, std::move(permit), range, slice, service::get_local_sstable_query_read_priority(),
|
||||
, reader(source.make_reader_v2(s, std::move(permit), range, slice,
|
||||
std::move(trace_ptr), streamed_mutation::forwarding::no,
|
||||
mutation_reader::forwarding::no))
|
||||
{ }
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
#include "reversibly_mergeable.hh"
|
||||
#include "mutation_fragment.hh"
|
||||
#include "mutation_query.hh"
|
||||
#include "service/priority_manager.hh"
|
||||
#include "mutation_compactor.hh"
|
||||
#include "counters.hh"
|
||||
#include "row_cache.hh"
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
#include "mutation_query.hh"
|
||||
#include "gc_clock.hh"
|
||||
#include "mutation/mutation_partition_serializer.hh"
|
||||
#include "service/priority_manager.hh"
|
||||
#include "query-result-writer.hh"
|
||||
|
||||
reconcilable_result::~reconcilable_result() {}
|
||||
|
||||
@@ -18,7 +18,6 @@ class partition_sorting_mutation_writer {
|
||||
schema_ptr _schema;
|
||||
reader_permit _permit;
|
||||
reader_consumer_v2 _consumer;
|
||||
const io_priority_class& _pc;
|
||||
size_t _max_memory;
|
||||
bucket_writer_v2 _bucket_writer;
|
||||
std::optional<dht::decorated_key> _last_bucket_key;
|
||||
@@ -41,7 +40,7 @@ private:
|
||||
}
|
||||
|
||||
future<> flush_memtable() {
|
||||
co_await _consumer(_memtable->make_flush_reader(_schema, _permit, _pc));
|
||||
co_await _consumer(_memtable->make_flush_reader(_schema, _permit));
|
||||
_memtable = make_lw_shared<replica::memtable>(_schema);
|
||||
}
|
||||
|
||||
@@ -75,7 +74,6 @@ public:
|
||||
: _schema(std::move(schema))
|
||||
, _permit(std::move(permit))
|
||||
, _consumer(std::move(consumer))
|
||||
, _pc(cfg.pc)
|
||||
, _max_memory(cfg.max_memory)
|
||||
, _bucket_writer(_schema, _permit, _consumer)
|
||||
, _memtable(make_lw_shared<replica::memtable>(_schema))
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <seastar/core/io_priority_class.hh>
|
||||
#include <seastar/util/noncopyable_function.hh>
|
||||
|
||||
#include "feed_writers.hh"
|
||||
@@ -16,9 +15,6 @@
|
||||
namespace mutation_writer {
|
||||
|
||||
struct segregate_config {
|
||||
// For flushing the memtable which does the in-memory segregation (sorting)
|
||||
// part.
|
||||
const io_priority_class& pc;
|
||||
// Maximum amount of memory to be used by the in-memory segregation
|
||||
// (sorting) structures. Partitions can be split across partitions
|
||||
size_t max_memory;
|
||||
|
||||
@@ -82,13 +82,13 @@ public:
|
||||
{ }
|
||||
|
||||
querier_base(schema_ptr schema, reader_permit permit, dht::partition_range range,
|
||||
query::partition_slice slice, const mutation_source& ms, const io_priority_class& pc, tracing::trace_state_ptr trace_ptr,
|
||||
query::partition_slice slice, const mutation_source& ms, tracing::trace_state_ptr trace_ptr,
|
||||
querier_config config)
|
||||
: _schema(std::move(schema))
|
||||
, _permit(std::move(permit))
|
||||
, _range(make_lw_shared<const dht::partition_range>(std::move(range)))
|
||||
, _slice(std::make_unique<const query::partition_slice>(std::move(slice)))
|
||||
, _reader(ms.make_reader_v2(_schema, _permit, *_range, *_slice, pc, std::move(trace_ptr), streamed_mutation::forwarding::no, mutation_reader::forwarding::no))
|
||||
, _reader(ms.make_reader_v2(_schema, _permit, *_range, *_slice, std::move(trace_ptr), streamed_mutation::forwarding::no, mutation_reader::forwarding::no))
|
||||
, _query_ranges(*_range)
|
||||
, _qr_config(std::move(config))
|
||||
{ }
|
||||
@@ -153,10 +153,9 @@ public:
|
||||
reader_permit permit,
|
||||
dht::partition_range range,
|
||||
query::partition_slice slice,
|
||||
const io_priority_class& pc,
|
||||
tracing::trace_state_ptr trace_ptr,
|
||||
querier_config config = {})
|
||||
: querier_base(schema, permit, std::move(range), std::move(slice), ms, pc, std::move(trace_ptr), std::move(config))
|
||||
: querier_base(schema, permit, std::move(range), std::move(slice), ms, std::move(trace_ptr), std::move(config))
|
||||
, _compaction_state(make_lw_shared<compact_for_query_state_v2>(*schema, gc_clock::time_point{}, *_slice, 0, 0)) {
|
||||
}
|
||||
|
||||
|
||||
@@ -123,7 +123,6 @@ class read_context final : public enable_lw_shared_from_this<read_context> {
|
||||
const dht::partition_range& _range;
|
||||
const query::partition_slice& _slice;
|
||||
std::optional<query::partition_slice> _native_slice;
|
||||
const io_priority_class& _pc;
|
||||
tracing::trace_state_ptr _trace_state;
|
||||
mutation_reader::forwarding _fwd_mr;
|
||||
bool _range_query;
|
||||
@@ -149,7 +148,6 @@ public:
|
||||
reader_permit permit,
|
||||
const dht::partition_range& range,
|
||||
const query::partition_slice& slice,
|
||||
const io_priority_class& pc,
|
||||
tracing::trace_state_ptr trace_state,
|
||||
mutation_reader::forwarding fwd_mr)
|
||||
: _cache(cache)
|
||||
@@ -157,7 +155,6 @@ public:
|
||||
, _permit(std::move(permit))
|
||||
, _range(range)
|
||||
, _slice(slice)
|
||||
, _pc(pc)
|
||||
, _trace_state(std::move(trace_state))
|
||||
, _fwd_mr(fwd_mr)
|
||||
, _range_query(!query::is_single_partition(range))
|
||||
@@ -189,7 +186,6 @@ public:
|
||||
bool is_reversed() const { return _slice.options.contains(query::partition_slice::option::reversed); }
|
||||
// Returns a slice in the native format (for reversed reads, in native-reversed format).
|
||||
const query::partition_slice& native_slice() const { return is_reversed() ? *_native_slice : _slice; }
|
||||
const io_priority_class& pc() const { return _pc; }
|
||||
tracing::trace_state_ptr trace_state() const { return _trace_state; }
|
||||
mutation_reader::forwarding fwd_mr() const { return _fwd_mr; }
|
||||
bool is_range_query() const { return _range_query; }
|
||||
|
||||
@@ -1568,20 +1568,20 @@ public:
|
||||
tracking_file_impl(tracking_file_impl&&) = default;
|
||||
tracking_file_impl& operator=(tracking_file_impl&&) = default;
|
||||
|
||||
virtual future<size_t> write_dma(uint64_t pos, const void* buffer, size_t len, const io_priority_class& pc) override {
|
||||
return get_file_impl(_tracked_file)->write_dma(pos, buffer, len, pc);
|
||||
virtual future<size_t> write_dma(uint64_t pos, const void* buffer, size_t len, io_intent* intent) override {
|
||||
return get_file_impl(_tracked_file)->write_dma(pos, buffer, len, intent);
|
||||
}
|
||||
|
||||
virtual future<size_t> write_dma(uint64_t pos, std::vector<iovec> iov, const io_priority_class& pc) override {
|
||||
return get_file_impl(_tracked_file)->write_dma(pos, std::move(iov), pc);
|
||||
virtual future<size_t> write_dma(uint64_t pos, std::vector<iovec> iov, io_intent* intent) override {
|
||||
return get_file_impl(_tracked_file)->write_dma(pos, std::move(iov), intent);
|
||||
}
|
||||
|
||||
virtual future<size_t> read_dma(uint64_t pos, void* buffer, size_t len, const io_priority_class& pc) override {
|
||||
return get_file_impl(_tracked_file)->read_dma(pos, buffer, len, pc);
|
||||
virtual future<size_t> read_dma(uint64_t pos, void* buffer, size_t len, io_intent* intent) override {
|
||||
return get_file_impl(_tracked_file)->read_dma(pos, buffer, len, intent);
|
||||
}
|
||||
|
||||
virtual future<size_t> read_dma(uint64_t pos, std::vector<iovec> iov, const io_priority_class& pc) override {
|
||||
return get_file_impl(_tracked_file)->read_dma(pos, iov, pc);
|
||||
virtual future<size_t> read_dma(uint64_t pos, std::vector<iovec> iov, io_intent* intent) override {
|
||||
return get_file_impl(_tracked_file)->read_dma(pos, iov, intent);
|
||||
}
|
||||
|
||||
virtual future<> flush(void) override {
|
||||
@@ -1620,9 +1620,9 @@ public:
|
||||
return get_file_impl(_tracked_file)->list_directory(std::move(next));
|
||||
}
|
||||
|
||||
virtual future<temporary_buffer<uint8_t>> dma_read_bulk(uint64_t offset, size_t range_size, const io_priority_class& pc) override {
|
||||
return _permit.request_memory(range_size).then([this, offset, range_size, &pc] (reader_permit::resource_units units) {
|
||||
return get_file_impl(_tracked_file)->dma_read_bulk(offset, range_size, pc).then([units = std::move(units)] (temporary_buffer<uint8_t> buf) mutable {
|
||||
virtual future<temporary_buffer<uint8_t>> dma_read_bulk(uint64_t offset, size_t range_size, io_intent* intent) override {
|
||||
return _permit.request_memory(range_size).then([this, offset, range_size, intent] (reader_permit::resource_units units) {
|
||||
return get_file_impl(_tracked_file)->dma_read_bulk(offset, range_size, intent).then([units = std::move(units)] (temporary_buffer<uint8_t> buf) mutable {
|
||||
return make_ready_future<temporary_buffer<uint8_t>>(make_tracked_temporary_buffer(std::move(buf), std::move(units)));
|
||||
});
|
||||
});
|
||||
|
||||
@@ -13,10 +13,6 @@
|
||||
#include "schema/schema_fwd.hh"
|
||||
#include "seastarx.hh"
|
||||
|
||||
namespace seastar {
|
||||
class io_priority_class;
|
||||
}
|
||||
|
||||
class reader_permit;
|
||||
class mutation_source;
|
||||
|
||||
@@ -41,7 +37,6 @@ flat_mutation_reader_v2 make_auto_paused_evictable_reader_v2(
|
||||
reader_permit permit,
|
||||
const dht::partition_range& pr,
|
||||
const query::partition_slice& ps,
|
||||
const io_priority_class& pc,
|
||||
tracing::trace_state_ptr trace_state,
|
||||
mutation_reader::forwarding fwd_mr);
|
||||
|
||||
@@ -49,7 +44,7 @@ class evictable_reader_v2;
|
||||
|
||||
class evictable_reader_handle_v2 {
|
||||
friend std::pair<flat_mutation_reader_v2, evictable_reader_handle_v2> make_manually_paused_evictable_reader_v2(mutation_source, schema_ptr, reader_permit,
|
||||
const dht::partition_range&, const query::partition_slice&, const io_priority_class&, tracing::trace_state_ptr, mutation_reader::forwarding);
|
||||
const dht::partition_range&, const query::partition_slice&, tracing::trace_state_ptr, mutation_reader::forwarding);
|
||||
|
||||
private:
|
||||
evictable_reader_v2* _r;
|
||||
@@ -78,6 +73,5 @@ std::pair<flat_mutation_reader_v2, evictable_reader_handle_v2> make_manually_pau
|
||||
reader_permit permit,
|
||||
const dht::partition_range& pr,
|
||||
const query::partition_slice& ps,
|
||||
const io_priority_class& pc,
|
||||
tracing::trace_state_ptr trace_state,
|
||||
mutation_reader::forwarding fwd_mr);
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
#include "dht/i_partitioner_fwd.hh"
|
||||
#include <functional>
|
||||
#include <optional>
|
||||
#include <seastar/core/io_priority_class.hh>
|
||||
#include "readers/flat_mutation_reader_fwd.hh"
|
||||
#include "tracing/trace_state.hh"
|
||||
|
||||
@@ -38,7 +37,7 @@ namespace query {
|
||||
flat_mutation_reader_v2
|
||||
make_flat_multi_range_reader(
|
||||
schema_ptr s, reader_permit permit, mutation_source source, const dht::partition_range_vector& ranges,
|
||||
const query::partition_slice& slice, const io_priority_class& pc = default_priority_class(),
|
||||
const query::partition_slice& slice,
|
||||
tracing::trace_state_ptr trace_state = nullptr,
|
||||
mutation_reader::forwarding fwd_mr = mutation_reader::forwarding::yes);
|
||||
|
||||
@@ -53,6 +52,5 @@ make_flat_multi_range_reader(
|
||||
mutation_source source,
|
||||
std::function<std::optional<dht::partition_range>()> generator,
|
||||
const query::partition_slice& slice,
|
||||
const io_priority_class& pc = default_priority_class(),
|
||||
tracing::trace_state_ptr trace_state = nullptr,
|
||||
mutation_reader::forwarding fwd_mr = mutation_reader::forwarding::yes);
|
||||
|
||||
@@ -213,7 +213,6 @@ private:
|
||||
mutation_source _ms;
|
||||
const dht::partition_range* _pr;
|
||||
const query::partition_slice& _ps;
|
||||
const io_priority_class& _pc;
|
||||
tracing::global_trace_state_ptr _trace_state;
|
||||
const mutation_reader::forwarding _fwd_mr;
|
||||
reader_concurrency_semaphore::inactive_read_handle _irh;
|
||||
@@ -251,7 +250,6 @@ public:
|
||||
reader_permit permit,
|
||||
const dht::partition_range& pr,
|
||||
const query::partition_slice& ps,
|
||||
const io_priority_class& pc,
|
||||
tracing::trace_state_ptr trace_state,
|
||||
mutation_reader::forwarding fwd_mr);
|
||||
virtual future<> fill_buffer() override;
|
||||
@@ -397,7 +395,6 @@ flat_mutation_reader_v2 evictable_reader_v2::recreate_reader() {
|
||||
_permit,
|
||||
*range,
|
||||
*slice,
|
||||
_pc,
|
||||
_trace_state,
|
||||
streamed_mutation::forwarding::no,
|
||||
_fwd_mr);
|
||||
@@ -547,7 +544,6 @@ evictable_reader_v2::evictable_reader_v2(
|
||||
reader_permit permit,
|
||||
const dht::partition_range& pr,
|
||||
const query::partition_slice& ps,
|
||||
const io_priority_class& pc,
|
||||
tracing::trace_state_ptr trace_state,
|
||||
mutation_reader::forwarding fwd_mr)
|
||||
: impl(std::move(schema), std::move(permit))
|
||||
@@ -555,7 +551,6 @@ evictable_reader_v2::evictable_reader_v2(
|
||||
, _ms(std::move(ms))
|
||||
, _pr(&pr)
|
||||
, _ps(ps)
|
||||
, _pc(pc)
|
||||
, _trace_state(std::move(trace_state))
|
||||
, _fwd_mr(fwd_mr)
|
||||
, _tri_cmp(*_schema)
|
||||
@@ -671,11 +666,10 @@ flat_mutation_reader_v2 make_auto_paused_evictable_reader_v2(
|
||||
reader_permit permit,
|
||||
const dht::partition_range& pr,
|
||||
const query::partition_slice& ps,
|
||||
const io_priority_class& pc,
|
||||
tracing::trace_state_ptr trace_state,
|
||||
mutation_reader::forwarding fwd_mr) {
|
||||
return make_flat_mutation_reader_v2<evictable_reader_v2>(evictable_reader_v2::auto_pause::yes, std::move(ms), std::nullopt, std::move(schema), std::move(permit), pr, ps,
|
||||
pc, std::move(trace_state), fwd_mr);
|
||||
std::move(trace_state), fwd_mr);
|
||||
}
|
||||
|
||||
std::pair<flat_mutation_reader_v2, evictable_reader_handle_v2> make_manually_paused_evictable_reader_v2(
|
||||
@@ -684,11 +678,10 @@ std::pair<flat_mutation_reader_v2, evictable_reader_handle_v2> make_manually_pau
|
||||
reader_permit permit,
|
||||
const dht::partition_range& pr,
|
||||
const query::partition_slice& ps,
|
||||
const io_priority_class& pc,
|
||||
tracing::trace_state_ptr trace_state,
|
||||
mutation_reader::forwarding fwd_mr) {
|
||||
auto reader = std::make_unique<evictable_reader_v2>(evictable_reader_v2::auto_pause::no, std::move(ms), std::nullopt, std::move(schema), std::move(permit), pr, ps,
|
||||
pc, std::move(trace_state), fwd_mr);
|
||||
std::move(trace_state), fwd_mr);
|
||||
auto handle = evictable_reader_handle_v2(*reader.get());
|
||||
return std::pair(flat_mutation_reader_v2(std::move(reader)), handle);
|
||||
}
|
||||
@@ -710,7 +703,6 @@ private:
|
||||
const unsigned _shard;
|
||||
foreign_ptr<lw_shared_ptr<const dht::partition_range>> _pr;
|
||||
const query::partition_slice& _ps;
|
||||
const io_priority_class& _pc;
|
||||
tracing::global_trace_state_ptr _trace_state;
|
||||
const mutation_reader::forwarding _fwd_mr;
|
||||
std::optional<future<>> _read_ahead;
|
||||
@@ -727,7 +719,6 @@ public:
|
||||
unsigned shard,
|
||||
const dht::partition_range& pr,
|
||||
const query::partition_slice& ps,
|
||||
const io_priority_class& pc,
|
||||
tracing::trace_state_ptr trace_state,
|
||||
mutation_reader::forwarding fwd_mr)
|
||||
: impl(std::move(schema), std::move(permit))
|
||||
@@ -735,7 +726,6 @@ public:
|
||||
, _shard(shard)
|
||||
, _pr(make_foreign(make_lw_shared<const dht::partition_range>(pr)))
|
||||
, _ps(ps)
|
||||
, _pc(pc)
|
||||
, _trace_state(std::move(trace_state))
|
||||
, _fwd_mr(fwd_mr) {
|
||||
}
|
||||
@@ -817,18 +807,17 @@ future<> shard_reader_v2::do_fill_buffer() {
|
||||
reader_permit permit,
|
||||
const dht::partition_range& pr,
|
||||
const query::partition_slice& ps,
|
||||
const io_priority_class& pc,
|
||||
tracing::trace_state_ptr ts,
|
||||
streamed_mutation::forwarding,
|
||||
mutation_reader::forwarding fwd_mr) {
|
||||
return lifecycle_policy->create_reader(std::move(s), std::move(permit), pr, ps, pc, std::move(ts), fwd_mr);
|
||||
return lifecycle_policy->create_reader(std::move(s), std::move(permit), pr, ps, std::move(ts), fwd_mr);
|
||||
});
|
||||
auto s = gs.get();
|
||||
auto permit = co_await _lifecycle_policy->obtain_reader_permit(s, "shard-reader", timeout(), _trace_state);
|
||||
if (permit.needs_readmission()) {
|
||||
co_await permit.wait_readmission();
|
||||
}
|
||||
auto underlying_reader = _lifecycle_policy->create_reader(s, permit, *_pr, _ps, _pc, _trace_state, _fwd_mr);
|
||||
auto underlying_reader = _lifecycle_policy->create_reader(s, permit, *_pr, _ps, _trace_state, _fwd_mr);
|
||||
|
||||
std::exception_ptr ex;
|
||||
|
||||
@@ -851,7 +840,7 @@ future<> shard_reader_v2::do_fill_buffer() {
|
||||
}
|
||||
|
||||
auto rreader = make_foreign(std::make_unique<evictable_reader_v2>(evictable_reader_v2::auto_pause::yes, std::move(ms),
|
||||
std::move(underlying_reader), s, std::move(permit), *_pr, _ps, _pc, _trace_state, _fwd_mr));
|
||||
std::move(underlying_reader), s, std::move(permit), *_pr, _ps, _trace_state, _fwd_mr));
|
||||
|
||||
try {
|
||||
tracing::trace(_trace_state, "Creating shard reader on shard: {}", this_shard_id());
|
||||
@@ -989,7 +978,6 @@ public:
|
||||
reader_permit permit,
|
||||
const dht::partition_range& pr,
|
||||
const query::partition_slice& ps,
|
||||
const io_priority_class& pc,
|
||||
tracing::trace_state_ptr trace_state,
|
||||
mutation_reader::forwarding fwd_mr);
|
||||
|
||||
@@ -1088,7 +1076,6 @@ multishard_combining_reader_v2::multishard_combining_reader_v2(
|
||||
reader_permit permit,
|
||||
const dht::partition_range& pr,
|
||||
const query::partition_slice& ps,
|
||||
const io_priority_class& pc,
|
||||
tracing::trace_state_ptr trace_state,
|
||||
mutation_reader::forwarding fwd_mr)
|
||||
: impl(std::move(s), std::move(permit)), _sharder(sharder) {
|
||||
@@ -1097,7 +1084,7 @@ multishard_combining_reader_v2::multishard_combining_reader_v2(
|
||||
|
||||
_shard_readers.reserve(_sharder.shard_count());
|
||||
for (unsigned i = 0; i < _sharder.shard_count(); ++i) {
|
||||
_shard_readers.emplace_back(std::make_unique<shard_reader_v2>(_schema, _permit, lifecycle_policy, i, pr, ps, pc, trace_state, fwd_mr));
|
||||
_shard_readers.emplace_back(std::make_unique<shard_reader_v2>(_schema, _permit, lifecycle_policy, i, pr, ps, trace_state, fwd_mr));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1153,11 +1140,10 @@ flat_mutation_reader_v2 make_multishard_combining_reader_v2(
|
||||
reader_permit permit,
|
||||
const dht::partition_range& pr,
|
||||
const query::partition_slice& ps,
|
||||
const io_priority_class& pc,
|
||||
tracing::trace_state_ptr trace_state,
|
||||
mutation_reader::forwarding fwd_mr) {
|
||||
const dht::sharder& sharder = schema->get_sharder();
|
||||
return make_flat_mutation_reader_v2<multishard_combining_reader_v2>(sharder, std::move(lifecycle_policy), std::move(schema), std::move(permit), pr, ps, pc,
|
||||
return make_flat_mutation_reader_v2<multishard_combining_reader_v2>(sharder, std::move(lifecycle_policy), std::move(schema), std::move(permit), pr, ps,
|
||||
std::move(trace_state), fwd_mr);
|
||||
}
|
||||
|
||||
@@ -1168,9 +1154,8 @@ flat_mutation_reader_v2 make_multishard_combining_reader_v2_for_tests(
|
||||
reader_permit permit,
|
||||
const dht::partition_range& pr,
|
||||
const query::partition_slice& ps,
|
||||
const io_priority_class& pc,
|
||||
tracing::trace_state_ptr trace_state,
|
||||
mutation_reader::forwarding fwd_mr) {
|
||||
return make_flat_mutation_reader_v2<multishard_combining_reader_v2>(sharder, std::move(lifecycle_policy), std::move(schema), std::move(permit), pr, ps, pc,
|
||||
return make_flat_mutation_reader_v2<multishard_combining_reader_v2>(sharder, std::move(lifecycle_policy), std::move(schema), std::move(permit), pr, ps,
|
||||
std::move(trace_state), fwd_mr);
|
||||
}
|
||||
|
||||
@@ -14,10 +14,6 @@
|
||||
#include "tracing/trace_state.hh"
|
||||
#include "seastarx.hh"
|
||||
|
||||
namespace seastar {
|
||||
class io_priority_class;
|
||||
}
|
||||
|
||||
/// Reader lifecycle policy for the mulitshard combining reader.
|
||||
///
|
||||
/// This policy is expected to make sure any additional resource the readers
|
||||
@@ -53,7 +49,6 @@ public:
|
||||
reader_permit permit,
|
||||
const dht::partition_range& range,
|
||||
const query::partition_slice& slice,
|
||||
const io_priority_class& pc,
|
||||
tracing::trace_state_ptr trace_state,
|
||||
mutation_reader::forwarding fwd_mr) = 0;
|
||||
|
||||
@@ -131,7 +126,6 @@ flat_mutation_reader_v2 make_multishard_combining_reader_v2(
|
||||
reader_permit permit,
|
||||
const dht::partition_range& pr,
|
||||
const query::partition_slice& ps,
|
||||
const io_priority_class& pc,
|
||||
tracing::trace_state_ptr trace_state = nullptr,
|
||||
mutation_reader::forwarding fwd_mr = mutation_reader::forwarding::no);
|
||||
|
||||
@@ -142,7 +136,6 @@ flat_mutation_reader_v2 make_multishard_combining_reader_v2_for_tests(
|
||||
reader_permit permit,
|
||||
const dht::partition_range& pr,
|
||||
const query::partition_slice& ps,
|
||||
const io_priority_class& pc,
|
||||
tracing::trace_state_ptr trace_state = nullptr,
|
||||
mutation_reader::forwarding fwd_mr = mutation_reader::forwarding::no);
|
||||
|
||||
|
||||
@@ -515,11 +515,10 @@ public:
|
||||
const dht::partition_range& first_range,
|
||||
Generator generator,
|
||||
const query::partition_slice& slice,
|
||||
const io_priority_class& pc,
|
||||
tracing::trace_state_ptr trace_state)
|
||||
: impl(s, std::move(permit))
|
||||
, _generator(std::move(generator))
|
||||
, _reader(source.make_reader_v2(s, _permit, first_range, slice, pc, trace_state, streamed_mutation::forwarding::no, mutation_reader::forwarding::yes))
|
||||
, _reader(source.make_reader_v2(s, _permit, first_range, slice, trace_state, streamed_mutation::forwarding::no, mutation_reader::forwarding::yes))
|
||||
{
|
||||
}
|
||||
|
||||
@@ -576,7 +575,6 @@ public:
|
||||
class forwardable_empty_mutation_reader : public flat_mutation_reader_v2::impl {
|
||||
mutation_source _source;
|
||||
const query::partition_slice& _slice;
|
||||
const io_priority_class& _pc;
|
||||
tracing::trace_state_ptr _trace_state;
|
||||
flat_mutation_reader_v2_opt _reader;
|
||||
public:
|
||||
@@ -584,12 +582,10 @@ public:
|
||||
reader_permit permit,
|
||||
mutation_source source,
|
||||
const query::partition_slice& slice,
|
||||
const io_priority_class& pc,
|
||||
tracing::trace_state_ptr trace_state)
|
||||
: impl(s, std::move(permit))
|
||||
, _source(std::move(source))
|
||||
, _slice(slice)
|
||||
, _pc(pc)
|
||||
, _trace_state(std::move(trace_state)) {
|
||||
_end_of_stream = true;
|
||||
}
|
||||
@@ -610,7 +606,7 @@ public:
|
||||
}
|
||||
virtual future<> fast_forward_to(const dht::partition_range& pr) override {
|
||||
if (!_reader) {
|
||||
_reader = _source.make_reader_v2(_schema, _permit, pr, _slice, _pc, std::move(_trace_state), streamed_mutation::forwarding::no,
|
||||
_reader = _source.make_reader_v2(_schema, _permit, pr, _slice, std::move(_trace_state), streamed_mutation::forwarding::no,
|
||||
mutation_reader::forwarding::yes);
|
||||
_end_of_stream = false;
|
||||
return make_ready_future<>();
|
||||
@@ -639,7 +635,7 @@ public:
|
||||
};
|
||||
flat_mutation_reader_v2
|
||||
make_flat_multi_range_reader(schema_ptr s, reader_permit permit, mutation_source source, const dht::partition_range_vector& ranges,
|
||||
const query::partition_slice& slice, const io_priority_class& pc,
|
||||
const query::partition_slice& slice,
|
||||
tracing::trace_state_ptr trace_state,
|
||||
mutation_reader::forwarding fwd_mr)
|
||||
{
|
||||
@@ -660,16 +656,16 @@ make_flat_multi_range_reader(schema_ptr s, reader_permit permit, mutation_source
|
||||
|
||||
if (ranges.empty()) {
|
||||
if (fwd_mr) {
|
||||
return make_flat_mutation_reader_v2<forwardable_empty_mutation_reader>(std::move(s), std::move(permit), std::move(source), slice, pc,
|
||||
return make_flat_mutation_reader_v2<forwardable_empty_mutation_reader>(std::move(s), std::move(permit), std::move(source), slice,
|
||||
std::move(trace_state));
|
||||
} else {
|
||||
return make_empty_flat_reader_v2(std::move(s), std::move(permit));
|
||||
}
|
||||
} else if (ranges.size() == 1) {
|
||||
return source.make_reader_v2(std::move(s), std::move(permit), ranges.front(), slice, pc, std::move(trace_state), streamed_mutation::forwarding::no, fwd_mr);
|
||||
return source.make_reader_v2(std::move(s), std::move(permit), ranges.front(), slice, std::move(trace_state), streamed_mutation::forwarding::no, fwd_mr);
|
||||
} else {
|
||||
return make_flat_mutation_reader_v2<flat_multi_range_mutation_reader<adapter>>(std::move(s), std::move(permit), std::move(source),
|
||||
ranges.front(), adapter(std::next(ranges.cbegin()), ranges.cend()), slice, pc, std::move(trace_state));
|
||||
ranges.front(), adapter(std::next(ranges.cbegin()), ranges.cend()), slice, std::move(trace_state));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -680,7 +676,6 @@ make_flat_multi_range_reader(
|
||||
mutation_source source,
|
||||
std::function<std::optional<dht::partition_range>()> generator,
|
||||
const query::partition_slice& slice,
|
||||
const io_priority_class& pc,
|
||||
tracing::trace_state_ptr trace_state,
|
||||
mutation_reader::forwarding fwd_mr) {
|
||||
class adapter {
|
||||
@@ -709,13 +704,13 @@ make_flat_multi_range_reader(
|
||||
auto* first_range = adapted_generator();
|
||||
if (!first_range) {
|
||||
if (fwd_mr) {
|
||||
return make_flat_mutation_reader_v2<forwardable_empty_mutation_reader>(std::move(s), std::move(permit), std::move(source), slice, pc, std::move(trace_state));
|
||||
return make_flat_mutation_reader_v2<forwardable_empty_mutation_reader>(std::move(s), std::move(permit), std::move(source), slice, std::move(trace_state));
|
||||
} else {
|
||||
return make_empty_flat_reader_v2(std::move(s), std::move(permit));
|
||||
}
|
||||
} else {
|
||||
return make_flat_mutation_reader_v2<flat_multi_range_mutation_reader<adapter>>(std::move(s), std::move(permit), std::move(source),
|
||||
*first_range, std::move(adapted_generator), slice, pc, std::move(trace_state));
|
||||
*first_range, std::move(adapted_generator), slice, std::move(trace_state));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1192,7 +1187,6 @@ mutation_source make_empty_mutation_source() {
|
||||
reader_permit permit,
|
||||
const dht::partition_range& pr,
|
||||
const query::partition_slice& slice,
|
||||
const io_priority_class& pc,
|
||||
tracing::trace_state_ptr tr,
|
||||
streamed_mutation::forwarding fwd,
|
||||
mutation_reader::forwarding) {
|
||||
@@ -1209,14 +1203,13 @@ mutation_source make_combined_mutation_source(std::vector<mutation_source> adden
|
||||
reader_permit permit,
|
||||
const dht::partition_range& pr,
|
||||
const query::partition_slice& slice,
|
||||
const io_priority_class& pc,
|
||||
tracing::trace_state_ptr tr,
|
||||
streamed_mutation::forwarding fwd_sm,
|
||||
mutation_reader::forwarding fwd_mr) {
|
||||
std::vector<flat_mutation_reader_v2> rd;
|
||||
rd.reserve(addends.size());
|
||||
for (auto&& ms : addends) {
|
||||
rd.emplace_back(ms.make_reader_v2(s, permit, pr, slice, pc, tr, fwd_sm, fwd_mr));
|
||||
rd.emplace_back(ms.make_reader_v2(s, permit, pr, slice, tr, fwd_sm, fwd_mr));
|
||||
}
|
||||
return make_combined_reader(s, std::move(permit), std::move(rd), fwd_sm, fwd_mr);
|
||||
});
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <seastar/core/io_priority_class.hh>
|
||||
#include "dht/i_partitioner.hh"
|
||||
#include "query-request.hh"
|
||||
#include "tracing/trace_state.hh"
|
||||
@@ -42,12 +41,10 @@ partition_presence_checker make_default_partition_presence_checker() {
|
||||
// Partition-range forwarding is not yet supported in reverse mode.
|
||||
class mutation_source {
|
||||
using partition_range = const dht::partition_range&;
|
||||
using io_priority = const io_priority_class&;
|
||||
using flat_reader_v2_factory_type = std::function<flat_mutation_reader_v2(schema_ptr,
|
||||
reader_permit,
|
||||
partition_range,
|
||||
const query::partition_slice&,
|
||||
io_priority,
|
||||
tracing::trace_state_ptr,
|
||||
streamed_mutation::forwarding,
|
||||
mutation_reader::forwarding)>;
|
||||
@@ -66,36 +63,22 @@ public:
|
||||
, _presence_checker_factory(make_lw_shared<std::function<partition_presence_checker()>>(std::move(pcf)))
|
||||
{ }
|
||||
|
||||
mutation_source(std::function<flat_mutation_reader_v2(schema_ptr, reader_permit, partition_range, const query::partition_slice&, io_priority,
|
||||
mutation_source(std::function<flat_mutation_reader_v2(schema_ptr, reader_permit, partition_range, const query::partition_slice&,
|
||||
tracing::trace_state_ptr, streamed_mutation::forwarding)> fn)
|
||||
: mutation_source([fn = std::move(fn)] (schema_ptr s,
|
||||
reader_permit permit,
|
||||
partition_range range,
|
||||
const query::partition_slice& slice,
|
||||
io_priority pc,
|
||||
tracing::trace_state_ptr tr,
|
||||
streamed_mutation::forwarding fwd,
|
||||
mutation_reader::forwarding) {
|
||||
return fn(std::move(s), std::move(permit), range, slice, pc, std::move(tr), fwd);
|
||||
}) {}
|
||||
mutation_source(std::function<flat_mutation_reader_v2(schema_ptr, reader_permit, partition_range, const query::partition_slice&, io_priority)> fn)
|
||||
: mutation_source([fn = std::move(fn)] (schema_ptr s,
|
||||
reader_permit permit,
|
||||
partition_range range,
|
||||
const query::partition_slice& slice,
|
||||
io_priority pc,
|
||||
tracing::trace_state_ptr,
|
||||
streamed_mutation::forwarding fwd,
|
||||
mutation_reader::forwarding) {
|
||||
assert(!fwd);
|
||||
return fn(std::move(s), std::move(permit), range, slice, pc);
|
||||
return fn(std::move(s), std::move(permit), range, slice, std::move(tr), fwd);
|
||||
}) {}
|
||||
mutation_source(std::function<flat_mutation_reader_v2(schema_ptr, reader_permit, partition_range, const query::partition_slice&)> fn)
|
||||
: mutation_source([fn = std::move(fn)] (schema_ptr s,
|
||||
reader_permit permit,
|
||||
partition_range range,
|
||||
const query::partition_slice& slice,
|
||||
io_priority,
|
||||
tracing::trace_state_ptr,
|
||||
streamed_mutation::forwarding fwd,
|
||||
mutation_reader::forwarding) {
|
||||
@@ -107,7 +90,6 @@ public:
|
||||
reader_permit permit,
|
||||
partition_range range,
|
||||
const query::partition_slice&,
|
||||
io_priority,
|
||||
tracing::trace_state_ptr,
|
||||
streamed_mutation::forwarding fwd,
|
||||
mutation_reader::forwarding) {
|
||||
@@ -126,13 +108,12 @@ public:
|
||||
reader_permit permit,
|
||||
partition_range range,
|
||||
const query::partition_slice& slice,
|
||||
io_priority pc = default_priority_class(),
|
||||
tracing::trace_state_ptr trace_state = nullptr,
|
||||
streamed_mutation::forwarding fwd = streamed_mutation::forwarding::no,
|
||||
mutation_reader::forwarding fwd_mr = mutation_reader::forwarding::yes) const
|
||||
{
|
||||
return mutation_fragment_v1_stream(
|
||||
(*_fn)(std::move(s), std::move(permit), range, slice, pc, std::move(trace_state), fwd, fwd_mr));
|
||||
(*_fn)(std::move(s), std::move(permit), range, slice, std::move(trace_state), fwd, fwd_mr));
|
||||
}
|
||||
|
||||
mutation_fragment_v1_stream
|
||||
@@ -155,12 +136,11 @@ public:
|
||||
reader_permit permit,
|
||||
partition_range range,
|
||||
const query::partition_slice& slice,
|
||||
io_priority pc = default_priority_class(),
|
||||
tracing::trace_state_ptr trace_state = nullptr,
|
||||
streamed_mutation::forwarding fwd = streamed_mutation::forwarding::no,
|
||||
mutation_reader::forwarding fwd_mr = mutation_reader::forwarding::yes) const
|
||||
{
|
||||
return (*_fn)(std::move(s), std::move(permit), range, slice, pc, std::move(trace_state), fwd, fwd_mr);
|
||||
return (*_fn)(std::move(s), std::move(permit), range, slice, std::move(trace_state), fwd, fwd_mr);
|
||||
}
|
||||
|
||||
flat_mutation_reader_v2
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
#include "gms/inet_address.hh"
|
||||
#include "utils/fb_utilities.hh"
|
||||
#include "gms/gossiper.hh"
|
||||
#include "service/priority_manager.hh"
|
||||
#include "message/messaging_service.hh"
|
||||
#include "sstables/sstables.hh"
|
||||
#include "replica/database.hh"
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
#include "utils/xx_hasher.hh"
|
||||
#include "utils/UUID.hh"
|
||||
#include "utils/hash.hh"
|
||||
#include "service/priority_manager.hh"
|
||||
#include "replica/database.hh"
|
||||
#include <seastar/util/bool_class.hh>
|
||||
#include <seastar/core/metrics_registration.hh>
|
||||
@@ -291,7 +290,6 @@ private:
|
||||
reader_permit permit,
|
||||
const dht::partition_range& pr,
|
||||
const query::partition_slice& ps,
|
||||
const io_priority_class& pc,
|
||||
tracing::trace_state_ptr,
|
||||
streamed_mutation::forwarding,
|
||||
mutation_reader::forwarding fwd_mr) {
|
||||
@@ -304,7 +302,6 @@ private:
|
||||
_permit,
|
||||
_range,
|
||||
_schema->full_slice(),
|
||||
service::get_local_streaming_priority(),
|
||||
{},
|
||||
mutation_reader::forwarding::no);
|
||||
return rd;
|
||||
|
||||
@@ -321,7 +321,7 @@ database::database(const db::config& cfg, database_config dbcfg, service::migrat
|
||||
, _system_dirty_memory_manager(*this, 10 << 20, cfg.unspooled_dirty_soft_limit(), default_scheduling_group())
|
||||
, _dirty_memory_manager(*this, dbcfg.available_memory * 0.50, cfg.unspooled_dirty_soft_limit(), dbcfg.statement_scheduling_group)
|
||||
, _dbcfg(dbcfg)
|
||||
, _flush_sg(backlog_controller::scheduling_group{dbcfg.memtable_scheduling_group, service::get_local_memtable_flush_priority()})
|
||||
, _flush_sg(backlog_controller::scheduling_group{dbcfg.memtable_scheduling_group})
|
||||
, _memtable_controller(make_flush_controller(_cfg, _flush_sg, [this, limit = float(_dirty_memory_manager.throttle_threshold())] {
|
||||
auto backlog = (_dirty_memory_manager.unspooled_dirty_memory()) / limit;
|
||||
if (_dirty_memory_manager.has_extraneous_flushes_requested()) {
|
||||
@@ -460,10 +460,6 @@ float backlog_controller::backlog_of_shares(float shares) const {
|
||||
|
||||
void backlog_controller::update_controller(float shares) {
|
||||
_scheduling_group.cpu.set_shares(shares);
|
||||
if (!_inflight_update.available()) {
|
||||
return; // next timer will fix it
|
||||
}
|
||||
_inflight_update = _scheduling_group.io.update_shares(uint32_t(shares));
|
||||
}
|
||||
|
||||
|
||||
@@ -2805,7 +2801,6 @@ flat_mutation_reader_v2 make_multishard_streaming_reader(distributed<replica::da
|
||||
reader_permit permit,
|
||||
const dht::partition_range& range,
|
||||
const query::partition_slice& slice,
|
||||
const io_priority_class& pc,
|
||||
tracing::trace_state_ptr,
|
||||
mutation_reader::forwarding fwd_mr) override {
|
||||
const auto shard = this_shard_id();
|
||||
@@ -2850,17 +2845,16 @@ flat_mutation_reader_v2 make_multishard_streaming_reader(distributed<replica::da
|
||||
reader_permit permit,
|
||||
const dht::partition_range& pr,
|
||||
const query::partition_slice& ps,
|
||||
const io_priority_class& pc,
|
||||
tracing::trace_state_ptr trace_state,
|
||||
streamed_mutation::forwarding,
|
||||
mutation_reader::forwarding fwd_mr) {
|
||||
auto table_id = s->id();
|
||||
return make_multishard_combining_reader_v2(make_shared<streaming_reader_lifecycle_policy>(db, table_id), std::move(s), std::move(permit), pr, ps, pc,
|
||||
return make_multishard_combining_reader_v2(make_shared<streaming_reader_lifecycle_policy>(db, table_id), std::move(s), std::move(permit), pr, ps,
|
||||
std::move(trace_state), fwd_mr);
|
||||
});
|
||||
auto&& full_slice = schema->full_slice();
|
||||
return make_flat_multi_range_reader(schema, std::move(permit), std::move(ms),
|
||||
std::move(range_generator), std::move(full_slice), service::get_local_streaming_priority(), {}, mutation_reader::forwarding::no);
|
||||
std::move(range_generator), std::move(full_slice), {}, mutation_reader::forwarding::no);
|
||||
}
|
||||
|
||||
std::ostream& operator<<(std::ostream& os, gc_clock::time_point tp) {
|
||||
|
||||
@@ -590,7 +590,6 @@ private:
|
||||
lw_shared_ptr<sstables::sstable_set> sstables,
|
||||
const dht::partition_range& range,
|
||||
const query::partition_slice& slice,
|
||||
const io_priority_class& pc,
|
||||
tracing::trace_state_ptr trace_state,
|
||||
streamed_mutation::forwarding fwd,
|
||||
mutation_reader::forwarding fwd_mr) const;
|
||||
@@ -614,7 +613,6 @@ private:
|
||||
const reader_permit& permit,
|
||||
const dht::partition_range& range,
|
||||
const query::partition_slice& slice,
|
||||
const io_priority_class& pc,
|
||||
const tracing::trace_state_ptr& trace_state,
|
||||
streamed_mutation::forwarding fwd,
|
||||
mutation_reader::forwarding fwd_mr,
|
||||
@@ -664,13 +662,10 @@ public:
|
||||
// Note: for data queries use query() instead.
|
||||
// The 'range' parameter must be live as long as the reader is used.
|
||||
// Mutations returned by the reader will all have given schema.
|
||||
// If I/O needs to be issued to read anything in the specified range, the operations
|
||||
// will be scheduled under the priority class given by pc.
|
||||
flat_mutation_reader_v2 make_reader_v2(schema_ptr schema,
|
||||
reader_permit permit,
|
||||
const dht::partition_range& range,
|
||||
const query::partition_slice& slice,
|
||||
const io_priority_class& pc = default_priority_class(),
|
||||
tracing::trace_state_ptr trace_state = nullptr,
|
||||
streamed_mutation::forwarding fwd = streamed_mutation::forwarding::no,
|
||||
mutation_reader::forwarding fwd_mr = mutation_reader::forwarding::yes) const;
|
||||
@@ -679,7 +674,6 @@ public:
|
||||
std::vector<sstables::shared_sstable>& sst,
|
||||
const dht::partition_range& range,
|
||||
const query::partition_slice& slice,
|
||||
const io_priority_class& pc = default_priority_class(),
|
||||
tracing::trace_state_ptr trace_state = nullptr,
|
||||
streamed_mutation::forwarding fwd = streamed_mutation::forwarding::no,
|
||||
mutation_reader::forwarding fwd_mr = mutation_reader::forwarding::yes) const;
|
||||
@@ -1078,7 +1072,7 @@ public:
|
||||
|
||||
private:
|
||||
future<row_locker::lock_holder> do_push_view_replica_updates(shared_ptr<db::view::view_update_generator> gen, schema_ptr s, mutation m, db::timeout_clock::time_point timeout, mutation_source source,
|
||||
tracing::trace_state_ptr tr_state, reader_concurrency_semaphore& sem, const io_priority_class& io_priority, query::partition_slice::option_set custom_opts) const;
|
||||
tracing::trace_state_ptr tr_state, reader_concurrency_semaphore& sem, query::partition_slice::option_set custom_opts) const;
|
||||
std::vector<view_ptr> affected_views(shared_ptr<db::view::view_update_generator> gen, const schema_ptr& base, const mutation& update) const;
|
||||
future<> generate_and_propagate_view_updates(shared_ptr<db::view::view_update_generator> gen, const schema_ptr& base,
|
||||
reader_permit permit,
|
||||
|
||||
@@ -26,7 +26,6 @@
|
||||
#include "sstables/sstables.hh"
|
||||
#include "sstables/sstables_manager.hh"
|
||||
#include "sstables/sstable_directory.hh"
|
||||
#include "service/priority_manager.hh"
|
||||
#include "auth/common.hh"
|
||||
#include "tracing/trace_keyspace_helper.hh"
|
||||
#include "db/view/view_update_checks.hh"
|
||||
@@ -222,7 +221,7 @@ distribute_reshard_jobs(sstables::sstable_directory::sstable_open_info_vector so
|
||||
// A creator function must be passed that will create an SSTable object in the correct shard,
|
||||
// and an I/O priority must be specified.
|
||||
future<> reshard(sstables::sstable_directory& dir, sstables::sstable_directory::sstable_open_info_vector shared_info, replica::table& table,
|
||||
sstables::compaction_sstable_creator_fn creator, io_priority_class iop, compaction::owned_ranges_ptr owned_ranges_ptr)
|
||||
sstables::compaction_sstable_creator_fn creator, compaction::owned_ranges_ptr owned_ranges_ptr)
|
||||
{
|
||||
// Resharding doesn't like empty sstable sets, so bail early. There is nothing
|
||||
// to reshard in this shard.
|
||||
@@ -253,7 +252,7 @@ future<> reshard(sstables::sstable_directory& dir, sstables::sstable_directory::
|
||||
auto& t = table.as_table_state();
|
||||
co_await coroutine::parallel_for_each(buckets, [&] (std::vector<sstables::shared_sstable>& sstlist) mutable {
|
||||
return table.get_compaction_manager().run_custom_job(table.as_table_state(), sstables::compaction_type::Reshard, "Reshard compaction", [&] (sstables::compaction_data& info) -> future<> {
|
||||
sstables::compaction_descriptor desc(sstlist, iop);
|
||||
sstables::compaction_descriptor desc(sstlist);
|
||||
desc.options = sstables::compaction_type_options::make_reshard();
|
||||
desc.creator = creator;
|
||||
desc.owned_ranges = owned_ranges_ptr;
|
||||
@@ -268,7 +267,7 @@ future<> reshard(sstables::sstable_directory& dir, sstables::sstable_directory::
|
||||
|
||||
future<> run_resharding_jobs(sharded<sstables::sstable_directory>& dir, std::vector<reshard_shard_descriptor> reshard_jobs,
|
||||
sharded<replica::database>& db, sstring ks_name, sstring table_name, sstables::compaction_sstable_creator_fn creator,
|
||||
io_priority_class iop, compaction::owned_ranges_ptr owned_ranges_ptr) {
|
||||
compaction::owned_ranges_ptr owned_ranges_ptr) {
|
||||
|
||||
uint64_t total_size = boost::accumulate(reshard_jobs | boost::adaptors::transformed(std::mem_fn(&reshard_shard_descriptor::size)), uint64_t(0));
|
||||
if (total_size == 0) {
|
||||
@@ -286,7 +285,7 @@ future<> run_resharding_jobs(sharded<sstables::sstable_directory>& dir, std::vec
|
||||
if (owned_ranges_ptr) {
|
||||
local_owned_ranges_ptr = make_lw_shared<const dht::token_range_vector>(*owned_ranges_ptr);
|
||||
}
|
||||
co_await ::replica::reshard(d, std::move(info_vec), table, creator, iop, std::move(local_owned_ranges_ptr));
|
||||
co_await ::replica::reshard(d, std::move(info_vec), table, creator, std::move(local_owned_ranges_ptr));
|
||||
co_await d.move_foreign_sstables(dir);
|
||||
}));
|
||||
|
||||
@@ -300,10 +299,10 @@ future<> run_resharding_jobs(sharded<sstables::sstable_directory>& dir, std::vec
|
||||
// - The second part calls each shard's distributed object to reshard the SSTables they were
|
||||
// assigned.
|
||||
future<>
|
||||
distributed_loader::reshard(sharded<sstables::sstable_directory>& dir, sharded<replica::database>& db, sstring ks_name, sstring table_name, sstables::compaction_sstable_creator_fn creator, io_priority_class iop, compaction::owned_ranges_ptr owned_ranges_ptr) {
|
||||
distributed_loader::reshard(sharded<sstables::sstable_directory>& dir, sharded<replica::database>& db, sstring ks_name, sstring table_name, sstables::compaction_sstable_creator_fn creator, compaction::owned_ranges_ptr owned_ranges_ptr) {
|
||||
auto all_jobs = co_await collect_all_shared_sstables(dir, db, ks_name, table_name, owned_ranges_ptr);
|
||||
auto destinations = co_await distribute_reshard_jobs(std::move(all_jobs));
|
||||
co_await run_resharding_jobs(dir, std::move(destinations), db, ks_name, table_name, std::move(creator), iop, std::move(owned_ranges_ptr));
|
||||
co_await run_resharding_jobs(dir, std::move(destinations), db, ks_name, table_name, std::move(creator), std::move(owned_ranges_ptr));
|
||||
}
|
||||
|
||||
future<sstables::sstable::version_types>
|
||||
@@ -317,7 +316,7 @@ highest_version_seen(sharded<sstables::sstable_directory>& dir, sstables::sstabl
|
||||
using sstable_filter_func_t = std::function<bool (const sstables::shared_sstable&)>;
|
||||
|
||||
future<uint64_t> reshape(sstables::sstable_directory& dir, replica::table& table, sstables::compaction_sstable_creator_fn creator,
|
||||
sstables::reshape_mode mode, sstable_filter_func_t filter, io_priority_class iop)
|
||||
sstables::reshape_mode mode, sstable_filter_func_t filter)
|
||||
{
|
||||
uint64_t reshaped_size = 0;
|
||||
|
||||
@@ -326,7 +325,7 @@ future<uint64_t> reshape(sstables::sstable_directory& dir, replica::table& table
|
||||
| boost::adaptors::filtered([&filter] (const auto& sst) {
|
||||
return filter(sst);
|
||||
}));
|
||||
auto desc = table.get_compaction_strategy().get_reshaping_job(std::move(reshape_candidates), table.schema(), iop, mode);
|
||||
auto desc = table.get_compaction_strategy().get_reshaping_job(std::move(reshape_candidates), table.schema(), mode);
|
||||
if (desc.sstables.empty()) {
|
||||
break;
|
||||
}
|
||||
@@ -375,12 +374,12 @@ future<uint64_t> reshape(sstables::sstable_directory& dir, replica::table& table
|
||||
future<>
|
||||
distributed_loader::reshape(sharded<sstables::sstable_directory>& dir, sharded<replica::database>& db, sstables::reshape_mode mode,
|
||||
sstring ks_name, sstring table_name, sstables::compaction_sstable_creator_fn creator,
|
||||
std::function<bool (const sstables::shared_sstable&)> filter, io_priority_class iop) {
|
||||
std::function<bool (const sstables::shared_sstable&)> filter) {
|
||||
|
||||
auto start = std::chrono::steady_clock::now();
|
||||
auto total_size = co_await dir.map_reduce0([&db, ks_name = std::move(ks_name), table_name = std::move(table_name), creator = std::move(creator), mode, filter, iop] (sstables::sstable_directory& d) {
|
||||
auto total_size = co_await dir.map_reduce0([&db, ks_name = std::move(ks_name), table_name = std::move(table_name), creator = std::move(creator), mode, filter] (sstables::sstable_directory& d) {
|
||||
auto& table = db.local().find_column_family(ks_name, table_name);
|
||||
return ::replica::reshape(d, table, creator, mode, filter, iop);
|
||||
return ::replica::reshape(d, table, creator, mode, filter);
|
||||
}, uint64_t(0), std::plus<uint64_t>());
|
||||
|
||||
if (total_size > 0) {
|
||||
@@ -440,8 +439,7 @@ distributed_loader::process_upload_dir(distributed<replica::database>& db, distr
|
||||
sharded_parameter([&global_table] { return std::ref(global_table->get_sstables_manager()); }),
|
||||
sharded_parameter([&global_table] { return global_table->schema(); }),
|
||||
sharded_parameter([&global_table] { return global_table->get_storage_options_ptr(); }),
|
||||
upload, service::get_local_streaming_priority(),
|
||||
&error_handler_gen_for_upload_dir
|
||||
upload, &error_handler_gen_for_upload_dir
|
||||
).get();
|
||||
|
||||
auto stop_directory = deferred_stop(directory);
|
||||
@@ -478,12 +476,9 @@ distributed_loader::process_upload_dir(distributed<replica::database>& db, distr
|
||||
// - split the keyspace local ranges per compaction_group as done in table::perform_cleanup_compaction
|
||||
// so that cleanup can be considered per compaction group
|
||||
auto owned_ranges_ptr = compaction::make_owned_ranges_ptr(db.local().get_keyspace_local_ranges(ks));
|
||||
reshard(directory, db, ks, cf, make_sstable,
|
||||
service::get_local_streaming_priority(),
|
||||
owned_ranges_ptr).get();
|
||||
reshard(directory, db, ks, cf, make_sstable, owned_ranges_ptr).get();
|
||||
reshape(directory, db, sstables::reshape_mode::strict, ks, cf, make_sstable,
|
||||
[] (const sstables::shared_sstable&) { return true; },
|
||||
service::get_local_streaming_priority()).get();
|
||||
[] (const sstables::shared_sstable&) { return true; }).get();
|
||||
|
||||
// Move to staging directory to avoid clashes with future uploads. Unique generation number ensures no collisions.
|
||||
const bool use_view_update_path = db::view::check_needs_view_update_path(sys_dist_ks.local(), db.local().get_token_metadata(), *global_table, streaming::stream_reason::repair).get0();
|
||||
@@ -508,8 +503,7 @@ distributed_loader::get_sstables_from_upload_dir(distributed<replica::database>&
|
||||
sharded_parameter([&global_table] { return std::ref(global_table->get_sstables_manager()); }),
|
||||
sharded_parameter([&global_table] { return global_table->schema(); }),
|
||||
sharded_parameter([&global_table] { return global_table->get_storage_options_ptr(); }),
|
||||
upload, service::get_local_streaming_priority(),
|
||||
&error_handler_gen_for_upload_dir
|
||||
upload, &error_handler_gen_for_upload_dir
|
||||
).get();
|
||||
|
||||
auto stop = deferred_stop(directory);
|
||||
@@ -605,7 +599,7 @@ future<> table_populator::start_subdir(sstring subdir) {
|
||||
sharded_parameter([&global_table] { return std::ref(global_table->get_sstables_manager()); }),
|
||||
sharded_parameter([&global_table] { return global_table->schema(); }),
|
||||
sharded_parameter([&global_table] { return global_table->get_storage_options_ptr(); }),
|
||||
fs::path(sstdir), default_priority_class(),
|
||||
fs::path(sstdir),
|
||||
default_io_error_handler_gen()
|
||||
);
|
||||
|
||||
@@ -662,7 +656,7 @@ future<> table_populator::populate_subdir(sstring subdir, allow_offstrategy_comp
|
||||
}).get0();
|
||||
|
||||
return make_sstable(*_global_table, sstdir, gen, _highest_version);
|
||||
}, default_priority_class());
|
||||
});
|
||||
|
||||
// The node is offline at this point so we are very lenient with what we consider
|
||||
// offstrategy.
|
||||
@@ -679,7 +673,7 @@ future<> table_populator::populate_subdir(sstring subdir, allow_offstrategy_comp
|
||||
co_await distributed_loader::reshape(directory, _db, sstables::reshape_mode::relaxed, _ks, _cf, [this, sstdir] (shard_id shard) {
|
||||
auto gen = _global_table->calculate_generation_for_new_table();
|
||||
return make_sstable(*_global_table, sstdir, gen, _highest_version);
|
||||
}, eligible_for_reshape_on_boot, default_priority_class());
|
||||
}, eligible_for_reshape_on_boot);
|
||||
|
||||
co_await directory.invoke_on_all([this, &eligible_for_reshape_on_boot, do_allow_offstrategy_compaction] (sstables::sstable_directory& dir) -> future<> {
|
||||
co_await dir.do_for_each_sstable([this, &eligible_for_reshape_on_boot, do_allow_offstrategy_compaction] (sstables::shared_sstable sst) {
|
||||
|
||||
@@ -67,9 +67,9 @@ class distributed_loader {
|
||||
friend class table_populator;
|
||||
|
||||
static future<> reshape(sharded<sstables::sstable_directory>& dir, sharded<replica::database>& db, sstables::reshape_mode mode,
|
||||
sstring ks_name, sstring table_name, sstables::compaction_sstable_creator_fn creator, std::function<bool (const sstables::shared_sstable&)> filter, io_priority_class iop);
|
||||
sstring ks_name, sstring table_name, sstables::compaction_sstable_creator_fn creator, std::function<bool (const sstables::shared_sstable&)> filter);
|
||||
static future<> reshard(sharded<sstables::sstable_directory>& dir, sharded<replica::database>& db, sstring ks_name, sstring table_name, sstables::compaction_sstable_creator_fn creator,
|
||||
io_priority_class iop, compaction::owned_ranges_ptr owned_ranges_ptr = nullptr);
|
||||
compaction::owned_ranges_ptr owned_ranges_ptr = nullptr);
|
||||
static future<> process_sstable_dir(sharded<sstables::sstable_directory>& dir, sstables::sstable_directory::process_flags flags);
|
||||
static future<> lock_table(sharded<sstables::sstable_directory>& dir, sharded<replica::database>& db, sstring ks_name, sstring cf_name);
|
||||
static future<size_t> make_sstables_available(sstables::sstable_directory& dir,
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
|
||||
#include "sstables/shared_sstable.hh"
|
||||
#include <seastar/core/future.hh>
|
||||
#include <seastar/core/io_priority_class.hh>
|
||||
|
||||
class flat_mutation_reader_v2;
|
||||
class reader_permit;
|
||||
@@ -34,16 +33,14 @@ write_memtable_to_sstable(flat_mutation_reader_v2 reader,
|
||||
memtable& mt, sstables::shared_sstable sst,
|
||||
size_t estimated_partitions,
|
||||
sstables::write_monitor& monitor,
|
||||
sstables::sstable_writer_config& cfg,
|
||||
const seastar::io_priority_class& pc);
|
||||
sstables::sstable_writer_config& cfg);
|
||||
|
||||
seastar::future<>
|
||||
write_memtable_to_sstable(reader_permit permit,
|
||||
memtable& mt,
|
||||
sstables::shared_sstable sst,
|
||||
sstables::write_monitor& mon,
|
||||
sstables::sstable_writer_config& cfg,
|
||||
const seastar::io_priority_class& pc = seastar::default_priority_class());
|
||||
sstables::sstable_writer_config& cfg);
|
||||
|
||||
seastar::future<>
|
||||
write_memtable_to_sstable(memtable& mt,
|
||||
|
||||
@@ -364,10 +364,9 @@ protected:
|
||||
flat_mutation_reader_v2 delegate_reader(reader_permit permit,
|
||||
const dht::partition_range& delegate,
|
||||
const query::partition_slice& slice,
|
||||
const io_priority_class& pc,
|
||||
streamed_mutation::forwarding fwd,
|
||||
mutation_reader::forwarding fwd_mr) {
|
||||
auto ret = _memtable->_underlying->make_reader_v2(_schema, std::move(permit), delegate, slice, pc, nullptr, fwd, fwd_mr);
|
||||
auto ret = _memtable->_underlying->make_reader_v2(_schema, std::move(permit), delegate, slice, nullptr, fwd, fwd_mr);
|
||||
_memtable = {};
|
||||
_last = {};
|
||||
return ret;
|
||||
@@ -400,7 +399,6 @@ public:
|
||||
class scanning_reader final : public flat_mutation_reader_v2::impl, private iterator_reader {
|
||||
std::optional<dht::partition_range> _delegate_range;
|
||||
flat_mutation_reader_v2_opt _delegate;
|
||||
const io_priority_class& _pc;
|
||||
const query::partition_slice& _slice;
|
||||
mutation_reader::forwarding _fwd_mr;
|
||||
|
||||
@@ -436,11 +434,9 @@ public:
|
||||
reader_permit permit,
|
||||
const dht::partition_range& range,
|
||||
const query::partition_slice& slice,
|
||||
const io_priority_class& pc,
|
||||
mutation_reader::forwarding fwd_mr)
|
||||
: impl(s, std::move(permit))
|
||||
, iterator_reader(s, std::move(m), range)
|
||||
, _pc(pc)
|
||||
, _slice(slice)
|
||||
, _fwd_mr(fwd_mr)
|
||||
{ }
|
||||
@@ -450,7 +446,7 @@ public:
|
||||
if (!_delegate) {
|
||||
_delegate_range = get_delegate_range();
|
||||
if (_delegate_range) {
|
||||
_delegate = delegate_reader(_permit, *_delegate_range, _slice, _pc, streamed_mutation::forwarding::no, _fwd_mr);
|
||||
_delegate = delegate_reader(_permit, *_delegate_range, _slice, streamed_mutation::forwarding::no, _fwd_mr);
|
||||
} else {
|
||||
auto key_and_snp = read_section()(region(), [&] () -> std::optional<std::pair<dht::decorated_key, partition_snapshot_ptr>> {
|
||||
memtable_entry *e = fetch_entry();
|
||||
@@ -704,7 +700,6 @@ memtable::make_flat_reader_opt(schema_ptr s,
|
||||
reader_permit permit,
|
||||
const dht::partition_range& range,
|
||||
const query::partition_slice& slice,
|
||||
const io_priority_class& pc,
|
||||
tracing::trace_state_ptr trace_state_ptr,
|
||||
streamed_mutation::forwarding fwd,
|
||||
mutation_reader::forwarding fwd_mr) {
|
||||
@@ -734,7 +729,7 @@ memtable::make_flat_reader_opt(schema_ptr s,
|
||||
rd.upgrade_schema(s);
|
||||
return rd;
|
||||
} else {
|
||||
auto res = make_flat_mutation_reader_v2<scanning_reader>(std::move(s), shared_from_this(), std::move(permit), range, slice, pc, fwd_mr);
|
||||
auto res = make_flat_mutation_reader_v2<scanning_reader>(std::move(s), shared_from_this(), std::move(permit), range, slice, fwd_mr);
|
||||
if (fwd == streamed_mutation::forwarding::yes) {
|
||||
return make_forwardable(std::move(res));
|
||||
} else {
|
||||
@@ -744,13 +739,13 @@ memtable::make_flat_reader_opt(schema_ptr s,
|
||||
}
|
||||
|
||||
flat_mutation_reader_v2
|
||||
memtable::make_flush_reader(schema_ptr s, reader_permit permit, const io_priority_class& pc) {
|
||||
memtable::make_flush_reader(schema_ptr s, reader_permit permit) {
|
||||
if (!_merged_into_cache) {
|
||||
return make_flat_mutation_reader_v2<flush_reader>(std::move(s), std::move(permit), shared_from_this());
|
||||
} else {
|
||||
auto& full_slice = s->full_slice();
|
||||
return make_flat_mutation_reader_v2<scanning_reader>(std::move(s), shared_from_this(), std::move(permit),
|
||||
query::full_partition_range, full_slice, pc, mutation_reader::forwarding::no);
|
||||
query::full_partition_range, full_slice, mutation_reader::forwarding::no);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -812,11 +807,10 @@ mutation_source memtable::as_data_source() {
|
||||
reader_permit permit,
|
||||
const dht::partition_range& range,
|
||||
const query::partition_slice& slice,
|
||||
const io_priority_class& pc,
|
||||
tracing::trace_state_ptr trace_state,
|
||||
streamed_mutation::forwarding fwd,
|
||||
mutation_reader::forwarding fwd_mr) {
|
||||
return mt->make_flat_reader(std::move(s), std::move(permit), range, slice, pc, std::move(trace_state), fwd, fwd_mr);
|
||||
return mt->make_flat_reader(std::move(s), std::move(permit), range, slice, std::move(trace_state), fwd, fwd_mr);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -236,11 +236,10 @@ public:
|
||||
reader_permit permit,
|
||||
const dht::partition_range& range,
|
||||
const query::partition_slice& slice,
|
||||
const io_priority_class& pc = default_priority_class(),
|
||||
tracing::trace_state_ptr trace_state_ptr = nullptr,
|
||||
streamed_mutation::forwarding fwd = streamed_mutation::forwarding::no,
|
||||
mutation_reader::forwarding fwd_mr = mutation_reader::forwarding::yes) {
|
||||
if (auto reader_opt = make_flat_reader_opt(s, permit, range, slice, pc, std::move(trace_state_ptr), fwd, fwd_mr)) {
|
||||
if (auto reader_opt = make_flat_reader_opt(s, permit, range, slice, std::move(trace_state_ptr), fwd, fwd_mr)) {
|
||||
return std::move(*reader_opt);
|
||||
}
|
||||
[[unlikely]] return make_empty_flat_reader_v2(std::move(s), std::move(permit));
|
||||
@@ -251,7 +250,6 @@ public:
|
||||
reader_permit permit,
|
||||
const dht::partition_range& range,
|
||||
const query::partition_slice& slice,
|
||||
const io_priority_class& pc = default_priority_class(),
|
||||
tracing::trace_state_ptr trace_state_ptr = nullptr,
|
||||
streamed_mutation::forwarding fwd = streamed_mutation::forwarding::no,
|
||||
mutation_reader::forwarding fwd_mr = mutation_reader::forwarding::yes);
|
||||
@@ -263,7 +261,7 @@ public:
|
||||
return make_flat_reader(s, std::move(permit), range, full_slice);
|
||||
}
|
||||
|
||||
flat_mutation_reader_v2 make_flush_reader(schema_ptr, reader_permit permit, const io_priority_class& pc = default_priority_class());
|
||||
flat_mutation_reader_v2 make_flush_reader(schema_ptr, reader_permit permit);
|
||||
|
||||
mutation_source as_data_source();
|
||||
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
#include "replica/compaction_group.hh"
|
||||
#include "sstables/sstables.hh"
|
||||
#include "sstables/sstables_manager.hh"
|
||||
#include "service/priority_manager.hh"
|
||||
#include "db/schema_tables.hh"
|
||||
#include "cell_locking.hh"
|
||||
#include "utils/logalloc.hh"
|
||||
@@ -94,7 +93,6 @@ table::make_sstable_reader(schema_ptr s,
|
||||
lw_shared_ptr<sstables::sstable_set> sstables,
|
||||
const dht::partition_range& pr,
|
||||
const query::partition_slice& slice,
|
||||
const io_priority_class& pc,
|
||||
tracing::trace_state_ptr trace_state,
|
||||
streamed_mutation::forwarding fwd,
|
||||
mutation_reader::forwarding fwd_mr) const {
|
||||
@@ -109,9 +107,9 @@ table::make_sstable_reader(schema_ptr s,
|
||||
}
|
||||
|
||||
return sstables->create_single_key_sstable_reader(const_cast<column_family*>(this), std::move(s), std::move(permit),
|
||||
_stats.estimated_sstable_per_read, pr, slice, pc, std::move(trace_state), fwd, fwd_mr);
|
||||
_stats.estimated_sstable_per_read, pr, slice, std::move(trace_state), fwd, fwd_mr);
|
||||
} else {
|
||||
return sstables->make_local_shard_sstable_reader(std::move(s), std::move(permit), pr, slice, pc,
|
||||
return sstables->make_local_shard_sstable_reader(std::move(s), std::move(permit), pr, slice,
|
||||
std::move(trace_state), fwd, fwd_mr);
|
||||
}
|
||||
}
|
||||
@@ -184,14 +182,13 @@ table::add_memtables_to_reader_list(std::vector<flat_mutation_reader_v2>& reader
|
||||
const reader_permit& permit,
|
||||
const dht::partition_range& range,
|
||||
const query::partition_slice& slice,
|
||||
const io_priority_class& pc,
|
||||
const tracing::trace_state_ptr& trace_state,
|
||||
streamed_mutation::forwarding fwd,
|
||||
mutation_reader::forwarding fwd_mr,
|
||||
std::function<void(size_t)> reserve_fn) const {
|
||||
auto add_memtables_from_cg = [&] (compaction_group& cg) mutable {
|
||||
for (auto&& mt: *cg.memtables()) {
|
||||
if (auto reader_opt = mt->make_flat_reader_opt(s, permit, range, slice, pc, trace_state, fwd, fwd_mr)) {
|
||||
if (auto reader_opt = mt->make_flat_reader_opt(s, permit, range, slice, trace_state, fwd, fwd_mr)) {
|
||||
readers.emplace_back(std::move(*reader_opt));
|
||||
}
|
||||
}
|
||||
@@ -217,12 +214,11 @@ table::make_reader_v2(schema_ptr s,
|
||||
reader_permit permit,
|
||||
const dht::partition_range& range,
|
||||
const query::partition_slice& query_slice,
|
||||
const io_priority_class& pc,
|
||||
tracing::trace_state_ptr trace_state,
|
||||
streamed_mutation::forwarding fwd,
|
||||
mutation_reader::forwarding fwd_mr) const {
|
||||
if (_virtual_reader) [[unlikely]] {
|
||||
return (*_virtual_reader).make_reader_v2(s, std::move(permit), range, query_slice, pc, trace_state, fwd, fwd_mr);
|
||||
return (*_virtual_reader).make_reader_v2(s, std::move(permit), range, query_slice, trace_state, fwd, fwd_mr);
|
||||
}
|
||||
|
||||
bool reversed = query_slice.is_reversed();
|
||||
@@ -257,17 +253,17 @@ table::make_reader_v2(schema_ptr s,
|
||||
// https://github.com/scylladb/scylla/issues/309
|
||||
// https://github.com/scylladb/scylla/issues/185
|
||||
|
||||
add_memtables_to_reader_list(readers, s, permit, range, slice, pc, trace_state, fwd, fwd_mr, [&] (size_t memtable_count) {
|
||||
add_memtables_to_reader_list(readers, s, permit, range, slice, trace_state, fwd, fwd_mr, [&] (size_t memtable_count) {
|
||||
readers.reserve(memtable_count + 1);
|
||||
});
|
||||
|
||||
const auto bypass_cache = slice.options.contains(query::partition_slice::option::bypass_cache);
|
||||
if (cache_enabled() && !bypass_cache && !(reversed && _config.reversed_reads_auto_bypass_cache())) {
|
||||
if (auto reader_opt = _cache.make_reader_opt(s, permit, range, slice, pc, std::move(trace_state), fwd, fwd_mr)) {
|
||||
if (auto reader_opt = _cache.make_reader_opt(s, permit, range, slice, std::move(trace_state), fwd, fwd_mr)) {
|
||||
readers.emplace_back(std::move(*reader_opt));
|
||||
}
|
||||
} else {
|
||||
readers.emplace_back(make_sstable_reader(s, permit, _sstables, range, slice, pc, std::move(trace_state), fwd, fwd_mr));
|
||||
readers.emplace_back(make_sstable_reader(s, permit, _sstables, range, slice, std::move(trace_state), fwd, fwd_mr));
|
||||
}
|
||||
|
||||
auto rd = make_combined_reader(s, permit, std::move(readers), fwd, fwd_mr);
|
||||
@@ -301,43 +297,40 @@ flat_mutation_reader_v2
|
||||
table::make_streaming_reader(schema_ptr s, reader_permit permit,
|
||||
const dht::partition_range_vector& ranges) const {
|
||||
auto& slice = s->full_slice();
|
||||
auto& pc = service::get_local_streaming_priority();
|
||||
|
||||
auto source = mutation_source([this] (schema_ptr s, reader_permit permit, const dht::partition_range& range, const query::partition_slice& slice,
|
||||
const io_priority_class& pc, tracing::trace_state_ptr trace_state, streamed_mutation::forwarding fwd, mutation_reader::forwarding fwd_mr) {
|
||||
tracing::trace_state_ptr trace_state, streamed_mutation::forwarding fwd, mutation_reader::forwarding fwd_mr) {
|
||||
std::vector<flat_mutation_reader_v2> readers;
|
||||
add_memtables_to_reader_list(readers, s, permit, range, slice, pc, trace_state, fwd, fwd_mr, [&] (size_t memtable_count) {
|
||||
add_memtables_to_reader_list(readers, s, permit, range, slice, trace_state, fwd, fwd_mr, [&] (size_t memtable_count) {
|
||||
readers.reserve(memtable_count + 1);
|
||||
});
|
||||
readers.emplace_back(make_sstable_reader(s, permit, _sstables, range, slice, pc, std::move(trace_state), fwd, fwd_mr));
|
||||
readers.emplace_back(make_sstable_reader(s, permit, _sstables, range, slice, std::move(trace_state), fwd, fwd_mr));
|
||||
return make_combined_reader(s, std::move(permit), std::move(readers), fwd, fwd_mr);
|
||||
});
|
||||
|
||||
return make_flat_multi_range_reader(s, std::move(permit), std::move(source), ranges, slice, pc, nullptr, mutation_reader::forwarding::no);
|
||||
return make_flat_multi_range_reader(s, std::move(permit), std::move(source), ranges, slice, nullptr, mutation_reader::forwarding::no);
|
||||
}
|
||||
|
||||
flat_mutation_reader_v2 table::make_streaming_reader(schema_ptr schema, reader_permit permit, const dht::partition_range& range,
|
||||
const query::partition_slice& slice, mutation_reader::forwarding fwd_mr) const {
|
||||
const auto& pc = service::get_local_streaming_priority();
|
||||
auto trace_state = tracing::trace_state_ptr();
|
||||
const auto fwd = streamed_mutation::forwarding::no;
|
||||
|
||||
std::vector<flat_mutation_reader_v2> readers;
|
||||
add_memtables_to_reader_list(readers, schema, permit, range, slice, pc, trace_state, fwd, fwd_mr, [&] (size_t memtable_count) {
|
||||
add_memtables_to_reader_list(readers, schema, permit, range, slice, trace_state, fwd, fwd_mr, [&] (size_t memtable_count) {
|
||||
readers.reserve(memtable_count + 1);
|
||||
});
|
||||
readers.emplace_back(make_sstable_reader(schema, permit, _sstables, range, slice, pc, std::move(trace_state), fwd, fwd_mr));
|
||||
readers.emplace_back(make_sstable_reader(schema, permit, _sstables, range, slice, std::move(trace_state), fwd, fwd_mr));
|
||||
return make_combined_reader(std::move(schema), std::move(permit), std::move(readers), fwd, fwd_mr);
|
||||
}
|
||||
|
||||
flat_mutation_reader_v2 table::make_streaming_reader(schema_ptr schema, reader_permit permit, const dht::partition_range& range,
|
||||
lw_shared_ptr<sstables::sstable_set> sstables) const {
|
||||
auto& slice = schema->full_slice();
|
||||
const auto& pc = service::get_local_streaming_priority();
|
||||
auto trace_state = tracing::trace_state_ptr();
|
||||
const auto fwd = streamed_mutation::forwarding::no;
|
||||
const auto fwd_mr = mutation_reader::forwarding::no;
|
||||
return sstables->make_range_sstable_reader(std::move(schema), std::move(permit), range, slice, pc,
|
||||
return sstables->make_range_sstable_reader(std::move(schema), std::move(permit), range, slice,
|
||||
std::move(trace_state), fwd, fwd_mr);
|
||||
}
|
||||
|
||||
@@ -878,7 +871,6 @@ table::try_flush_memtable_to_sstable(compaction_group& cg, lw_shared_ptr<memtabl
|
||||
auto consumer = _compaction_strategy.make_interposer_consumer(metadata, [this, old, permit, &newtabs, estimated_partitions, &cg] (flat_mutation_reader_v2 reader) mutable -> future<> {
|
||||
std::exception_ptr ex;
|
||||
try {
|
||||
auto&& priority = service::get_local_memtable_flush_priority();
|
||||
sstables::sstable_writer_config cfg = get_sstables_manager().configure_writer("memtable");
|
||||
cfg.backup = incremental_backups_enabled();
|
||||
|
||||
@@ -889,7 +881,7 @@ table::try_flush_memtable_to_sstable(compaction_group& cg, lw_shared_ptr<memtabl
|
||||
auto monitor = database_sstable_write_monitor(permit, newtab, cg,
|
||||
old->get_max_timestamp());
|
||||
|
||||
co_return co_await write_memtable_to_sstable(std::move(reader), *old, newtab, estimated_partitions, monitor, cfg, priority);
|
||||
co_return co_await write_memtable_to_sstable(std::move(reader), *old, newtab, estimated_partitions, monitor, cfg);
|
||||
} catch (...) {
|
||||
ex = std::current_exception();
|
||||
}
|
||||
@@ -899,8 +891,7 @@ table::try_flush_memtable_to_sstable(compaction_group& cg, lw_shared_ptr<memtabl
|
||||
|
||||
auto f = consumer(old->make_flush_reader(
|
||||
old->schema(),
|
||||
compaction_concurrency_semaphore().make_tracking_only_permit(old->schema().get(), "try_flush_memtable_to_sstable()", db::no_timeout, {}),
|
||||
service::get_local_memtable_flush_priority()));
|
||||
compaction_concurrency_semaphore().make_tracking_only_permit(old->schema().get(), "try_flush_memtable_to_sstable()", db::no_timeout, {})));
|
||||
|
||||
// Switch back to default scheduling group for post-flush actions, to avoid them being staved by the memtable flush
|
||||
// controller. Cache update does not affect the input of the memtable cpu controller, so it can be subject to
|
||||
@@ -1589,11 +1580,10 @@ table::sstables_as_snapshot_source() {
|
||||
reader_permit permit,
|
||||
const dht::partition_range& r,
|
||||
const query::partition_slice& slice,
|
||||
const io_priority_class& pc,
|
||||
tracing::trace_state_ptr trace_state,
|
||||
streamed_mutation::forwarding fwd,
|
||||
mutation_reader::forwarding fwd_mr) {
|
||||
auto reader = make_sstable_reader(std::move(s), std::move(permit), sst_set, r, slice, pc, std::move(trace_state), fwd, fwd_mr);
|
||||
auto reader = make_sstable_reader(std::move(s), std::move(permit), sst_set, r, slice, std::move(trace_state), fwd, fwd_mr);
|
||||
return make_compacting_reader(
|
||||
std::move(reader),
|
||||
gc_clock::now(),
|
||||
@@ -2296,21 +2286,19 @@ write_memtable_to_sstable(flat_mutation_reader_v2 reader,
|
||||
memtable& mt, sstables::shared_sstable sst,
|
||||
size_t estimated_partitions,
|
||||
sstables::write_monitor& monitor,
|
||||
sstables::sstable_writer_config& cfg,
|
||||
const io_priority_class& pc) {
|
||||
sstables::sstable_writer_config& cfg) {
|
||||
cfg.replay_position = mt.replay_position();
|
||||
cfg.monitor = &monitor;
|
||||
cfg.origin = "memtable";
|
||||
schema_ptr s = reader.schema();
|
||||
return sst->write_components(std::move(reader), estimated_partitions, s, cfg, mt.get_encoding_stats(), pc);
|
||||
return sst->write_components(std::move(reader), estimated_partitions, s, cfg, mt.get_encoding_stats());
|
||||
}
|
||||
|
||||
future<>
|
||||
write_memtable_to_sstable(reader_permit permit, memtable& mt, sstables::shared_sstable sst,
|
||||
sstables::write_monitor& monitor,
|
||||
sstables::sstable_writer_config& cfg,
|
||||
const io_priority_class& pc) {
|
||||
return write_memtable_to_sstable(mt.make_flush_reader(mt.schema(), std::move(permit), pc), mt, std::move(sst), mt.partition_count(), monitor, cfg, pc);
|
||||
sstables::sstable_writer_config& cfg) {
|
||||
return write_memtable_to_sstable(mt.make_flush_reader(mt.schema(), std::move(permit)), mt, std::move(sst), mt.partition_count(), monitor, cfg);
|
||||
}
|
||||
|
||||
future<>
|
||||
@@ -2400,8 +2388,7 @@ table::query(schema_ptr s,
|
||||
|
||||
if (!querier_opt) {
|
||||
query::querier_base::querier_config conf(_config.tombstone_warn_threshold);
|
||||
querier_opt = query::querier(as_mutation_source(), s, permit, range, qs.cmd.slice,
|
||||
service::get_local_sstable_query_read_priority(), trace_state, conf);
|
||||
querier_opt = query::querier(as_mutation_source(), s, permit, range, qs.cmd.slice, trace_state, conf);
|
||||
}
|
||||
auto& q = *querier_opt;
|
||||
|
||||
@@ -2455,8 +2442,7 @@ table::mutation_query(schema_ptr s,
|
||||
}
|
||||
if (!querier_opt) {
|
||||
query::querier_base::querier_config conf(_config.tombstone_warn_threshold);
|
||||
querier_opt = query::querier(as_mutation_source(), s, permit, range, cmd.slice,
|
||||
service::get_local_sstable_query_read_priority(), trace_state, conf);
|
||||
querier_opt = query::querier(as_mutation_source(), s, permit, range, cmd.slice, trace_state, conf);
|
||||
}
|
||||
auto& q = *querier_opt;
|
||||
|
||||
@@ -2490,11 +2476,10 @@ table::as_mutation_source() const {
|
||||
reader_permit permit,
|
||||
const dht::partition_range& range,
|
||||
const query::partition_slice& slice,
|
||||
const io_priority_class& pc,
|
||||
tracing::trace_state_ptr trace_state,
|
||||
streamed_mutation::forwarding fwd,
|
||||
mutation_reader::forwarding fwd_mr) {
|
||||
return this->make_reader_v2(std::move(s), std::move(permit), range, slice, pc, std::move(trace_state), fwd, fwd_mr);
|
||||
return this->make_reader_v2(std::move(s), std::move(permit), range, slice, std::move(trace_state), fwd, fwd_mr);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -2570,13 +2555,12 @@ table::make_reader_v2_excluding_sstables(schema_ptr s,
|
||||
std::vector<sstables::shared_sstable>& excluded,
|
||||
const dht::partition_range& range,
|
||||
const query::partition_slice& slice,
|
||||
const io_priority_class& pc,
|
||||
tracing::trace_state_ptr trace_state,
|
||||
streamed_mutation::forwarding fwd,
|
||||
mutation_reader::forwarding fwd_mr) const {
|
||||
std::vector<flat_mutation_reader_v2> readers;
|
||||
|
||||
add_memtables_to_reader_list(readers, s, permit, range, slice, pc, trace_state, fwd, fwd_mr, [&] (size_t memtable_count) {
|
||||
add_memtables_to_reader_list(readers, s, permit, range, slice, trace_state, fwd, fwd_mr, [&] (size_t memtable_count) {
|
||||
readers.reserve(memtable_count + 1);
|
||||
});
|
||||
|
||||
@@ -2589,7 +2573,7 @@ table::make_reader_v2_excluding_sstables(schema_ptr s,
|
||||
effective_sstables->insert(sst);
|
||||
});
|
||||
|
||||
readers.emplace_back(make_sstable_reader(s, permit, std::move(effective_sstables), range, slice, pc, std::move(trace_state), fwd, fwd_mr));
|
||||
readers.emplace_back(make_sstable_reader(s, permit, std::move(effective_sstables), range, slice, std::move(trace_state), fwd, fwd_mr));
|
||||
return make_combined_reader(s, std::move(permit), std::move(readers), fwd, fwd_mr);
|
||||
}
|
||||
|
||||
@@ -2646,7 +2630,7 @@ future<row_locker::lock_holder> table::push_view_replica_updates(shared_ptr<db::
|
||||
}
|
||||
|
||||
future<row_locker::lock_holder> table::do_push_view_replica_updates(shared_ptr<db::view::view_update_generator> gen, schema_ptr s, mutation m, db::timeout_clock::time_point timeout, mutation_source source,
|
||||
tracing::trace_state_ptr tr_state, reader_concurrency_semaphore& sem, const io_priority_class& io_priority, query::partition_slice::option_set custom_opts) const {
|
||||
tracing::trace_state_ptr tr_state, reader_concurrency_semaphore& sem, query::partition_slice::option_set custom_opts) const {
|
||||
if (!_config.view_update_concurrency_semaphore->current()) {
|
||||
// We don't have resources to generate view updates for this write. If we reached this point, we failed to
|
||||
// throttle the client. The memory queue is already full, waiting on the semaphore would cause this node to
|
||||
@@ -2705,7 +2689,7 @@ future<row_locker::lock_holder> table::do_push_view_replica_updates(shared_ptr<d
|
||||
auto lock = co_await std::move(lockf);
|
||||
auto pk = dht::partition_range::make_singular(m.decorated_key());
|
||||
auto permit = sem.make_tracking_only_permit(base.get(), "push-view-updates-2", timeout, tr_state);
|
||||
auto reader = source.make_reader_v2(base, permit, pk, slice, io_priority, tr_state, streamed_mutation::forwarding::no, mutation_reader::forwarding::no);
|
||||
auto reader = source.make_reader_v2(base, permit, pk, slice, tr_state, streamed_mutation::forwarding::no, mutation_reader::forwarding::no);
|
||||
co_await this->generate_and_propagate_view_updates(gen, base, std::move(permit), std::move(views), std::move(m), std::move(reader), tr_state, now);
|
||||
tracing::trace(tr_state, "View updates for {}.{} were generated and propagated", base->ks_name(), base->cf_name());
|
||||
// return the local partition/row lock we have taken so it
|
||||
@@ -2718,7 +2702,7 @@ future<row_locker::lock_holder> table::do_push_view_replica_updates(shared_ptr<d
|
||||
future<row_locker::lock_holder> table::push_view_replica_updates(shared_ptr<db::view::view_update_generator> gen, const schema_ptr& s, mutation&& m, db::timeout_clock::time_point timeout,
|
||||
tracing::trace_state_ptr tr_state, reader_concurrency_semaphore& sem) const {
|
||||
return do_push_view_replica_updates(std::move(gen), s, std::move(m), timeout, as_mutation_source(),
|
||||
std::move(tr_state), sem, service::get_local_sstable_query_read_priority(), {});
|
||||
std::move(tr_state), sem, {});
|
||||
}
|
||||
|
||||
future<row_locker::lock_holder>
|
||||
@@ -2732,7 +2716,6 @@ table::stream_view_replica_updates(shared_ptr<db::view::view_update_generator> g
|
||||
as_mutation_source_excluding(excluded_sstables),
|
||||
tracing::trace_state_ptr(),
|
||||
*_config.streaming_read_concurrency_semaphore,
|
||||
service::get_local_streaming_priority(),
|
||||
query::partition_slice::option_set::of<query::partition_slice::option::bypass_cache>());
|
||||
}
|
||||
|
||||
@@ -2742,11 +2725,10 @@ table::as_mutation_source_excluding(std::vector<sstables::shared_sstable>& ssts)
|
||||
reader_permit permit,
|
||||
const dht::partition_range& range,
|
||||
const query::partition_slice& slice,
|
||||
const io_priority_class& pc,
|
||||
tracing::trace_state_ptr trace_state,
|
||||
streamed_mutation::forwarding fwd,
|
||||
mutation_reader::forwarding fwd_mr) {
|
||||
return this->make_reader_v2_excluding_sstables(std::move(s), std::move(permit), ssts, range, slice, pc, std::move(trace_state), fwd, fwd_mr);
|
||||
return this->make_reader_v2_excluding_sstables(std::move(s), std::move(permit), ssts, range, slice, std::move(trace_state), fwd, fwd_mr);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ static schema_ptr to_query_domain(const query::partition_slice& slice, schema_pt
|
||||
flat_mutation_reader_v2
|
||||
row_cache::create_underlying_reader(read_context& ctx, mutation_source& src, const dht::partition_range& pr) {
|
||||
schema_ptr entry_schema = to_query_domain(ctx.slice(), _schema);
|
||||
auto reader = src.make_reader_v2(entry_schema, ctx.permit(), pr, ctx.slice(), ctx.pc(), ctx.trace_state(), streamed_mutation::forwarding::yes);
|
||||
auto reader = src.make_reader_v2(entry_schema, ctx.permit(), pr, ctx.slice(), ctx.trace_state(), streamed_mutation::forwarding::yes);
|
||||
ctx.on_underlying_created();
|
||||
return reader;
|
||||
}
|
||||
@@ -725,13 +725,12 @@ row_cache::make_reader_opt(schema_ptr s,
|
||||
reader_permit permit,
|
||||
const dht::partition_range& range,
|
||||
const query::partition_slice& slice,
|
||||
const io_priority_class& pc,
|
||||
tracing::trace_state_ptr trace_state,
|
||||
streamed_mutation::forwarding fwd,
|
||||
mutation_reader::forwarding fwd_mr)
|
||||
{
|
||||
auto make_context = [&] {
|
||||
return std::make_unique<read_context>(*this, s, std::move(permit), range, slice, pc, trace_state, fwd_mr);
|
||||
return std::make_unique<read_context>(*this, s, std::move(permit), range, slice, trace_state, fwd_mr);
|
||||
};
|
||||
|
||||
if (query::is_single_partition(range) && !fwd_mr) {
|
||||
|
||||
@@ -361,11 +361,10 @@ public:
|
||||
reader_permit permit,
|
||||
const dht::partition_range& range,
|
||||
const query::partition_slice& slice,
|
||||
const io_priority_class& pc = default_priority_class(),
|
||||
tracing::trace_state_ptr trace_state = nullptr,
|
||||
streamed_mutation::forwarding fwd = streamed_mutation::forwarding::no,
|
||||
mutation_reader::forwarding fwd_mr = mutation_reader::forwarding::no) {
|
||||
if (auto reader_opt = make_reader_opt(s, permit, range, slice, pc, std::move(trace_state), fwd, fwd_mr)) {
|
||||
if (auto reader_opt = make_reader_opt(s, permit, range, slice, std::move(trace_state), fwd, fwd_mr)) {
|
||||
return std::move(*reader_opt);
|
||||
}
|
||||
[[unlikely]] return make_empty_flat_reader_v2(std::move(s), std::move(permit));
|
||||
@@ -376,7 +375,6 @@ public:
|
||||
reader_permit permit,
|
||||
const dht::partition_range&,
|
||||
const query::partition_slice&,
|
||||
const io_priority_class& = default_priority_class(),
|
||||
tracing::trace_state_ptr trace_state = nullptr,
|
||||
streamed_mutation::forwarding fwd = streamed_mutation::forwarding::no,
|
||||
mutation_reader::forwarding fwd_mr = mutation_reader::forwarding::no);
|
||||
|
||||
@@ -3518,6 +3518,21 @@ class scylla_io_queues(gdb.Command):
|
||||
gdb.write("{}\t{}\n".format(indent, scylla_io_queues.ticket(entry['_ticket'])))
|
||||
|
||||
def _get_classes_infos(self, ioq):
|
||||
# Starting from 5.3 priority classes are removed and IO inherits its name and
|
||||
# shares from the respective sched group, so should the infos. Not to rely on
|
||||
# gdb.parse_and_eval() to fail searching for _infos, use the secret knowledge:
|
||||
# commitlog gained its sched group at the same time, so if not present, we're
|
||||
# on some older version and should fallback to io-prio _infos (or worse)
|
||||
infos = {}
|
||||
commitlog_met = False
|
||||
for tq in get_local_task_queues():
|
||||
name = str(tq['_name'])
|
||||
if name == '"commitlog"':
|
||||
commitlog_met = True
|
||||
infos[int(tq['_id'])] = { 'name': name, 'shares': int(tq['_shares']) }
|
||||
if commitlog_met:
|
||||
return infos
|
||||
|
||||
try:
|
||||
return std_array(gdb.parse_and_eval('seastar::io_priority_class::_infos'))
|
||||
except gdb.error:
|
||||
|
||||
@@ -12,7 +12,6 @@ target_sources(service
|
||||
paxos/prepare_response.cc
|
||||
paxos/prepare_summary.cc
|
||||
paxos/proposal.cc
|
||||
priority_manager.cc
|
||||
qos/qos_common.cc
|
||||
qos/service_level_controller.cc
|
||||
qos/standard_service_level_distributed_data_accessor.cc
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
/*
|
||||
* Copyright 2016-present ScyllaDB
|
||||
*/
|
||||
/*
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
#include "priority_manager.hh"
|
||||
#include <seastar/core/reactor.hh>
|
||||
|
||||
namespace service {
|
||||
priority_manager& get_local_priority_manager() {
|
||||
static thread_local priority_manager pm = priority_manager();
|
||||
return pm;
|
||||
}
|
||||
|
||||
priority_manager::priority_manager()
|
||||
: _commitlog_priority(::io_priority_class::register_one("commitlog", 1000))
|
||||
, _mt_flush_priority(::io_priority_class::register_one("memtable_flush", 1000))
|
||||
, _streaming_priority(::io_priority_class::register_one("streaming", 200))
|
||||
, _sstable_query_read(::io_priority_class::register_one("query", 1000))
|
||||
, _compaction_priority(::io_priority_class::register_one("compaction", 1000))
|
||||
{}
|
||||
|
||||
}
|
||||
@@ -1,76 +0,0 @@
|
||||
/*
|
||||
* Copyright 2016-present ScyllaDB
|
||||
*/
|
||||
/*
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <seastar/core/file.hh>
|
||||
|
||||
#include "seastarx.hh"
|
||||
|
||||
namespace service {
|
||||
class priority_manager {
|
||||
::io_priority_class _commitlog_priority;
|
||||
::io_priority_class _mt_flush_priority;
|
||||
::io_priority_class _streaming_priority;
|
||||
::io_priority_class _sstable_query_read;
|
||||
::io_priority_class _compaction_priority;
|
||||
|
||||
public:
|
||||
const ::io_priority_class&
|
||||
commitlog_priority() const {
|
||||
return _commitlog_priority;
|
||||
}
|
||||
|
||||
const ::io_priority_class&
|
||||
memtable_flush_priority() const {
|
||||
return _mt_flush_priority;
|
||||
}
|
||||
|
||||
const ::io_priority_class&
|
||||
streaming_priority() const {
|
||||
return _streaming_priority;
|
||||
}
|
||||
|
||||
const ::io_priority_class&
|
||||
sstable_query_read_priority() const {
|
||||
return _sstable_query_read;
|
||||
}
|
||||
|
||||
const ::io_priority_class&
|
||||
compaction_priority() const {
|
||||
return _compaction_priority;
|
||||
}
|
||||
|
||||
priority_manager();
|
||||
};
|
||||
|
||||
priority_manager& get_local_priority_manager();
|
||||
const inline ::io_priority_class&
|
||||
get_local_commitlog_priority() {
|
||||
return get_local_priority_manager().commitlog_priority();
|
||||
}
|
||||
|
||||
const inline ::io_priority_class&
|
||||
get_local_memtable_flush_priority() {
|
||||
return get_local_priority_manager().memtable_flush_priority();
|
||||
}
|
||||
|
||||
const inline ::io_priority_class&
|
||||
get_local_streaming_priority() {
|
||||
return get_local_priority_manager().streaming_priority();
|
||||
}
|
||||
|
||||
const inline ::io_priority_class&
|
||||
get_local_sstable_query_read_priority() {
|
||||
return get_local_priority_manager().sstable_query_read_priority();
|
||||
}
|
||||
|
||||
const inline ::io_priority_class&
|
||||
get_local_compaction_priority() {
|
||||
return get_local_priority_manager().compaction_priority();
|
||||
}
|
||||
}
|
||||
@@ -10,7 +10,6 @@
|
||||
#include <seastar/core/sleep.hh>
|
||||
#include <seastar/core/thread.hh>
|
||||
#include "service_level_controller.hh"
|
||||
#include "service/priority_manager.hh"
|
||||
#include "message/messaging_service.hh"
|
||||
#include "db/system_distributed_keyspace.hh"
|
||||
#include "utils/fb_utilities.hh"
|
||||
|
||||
@@ -59,7 +59,6 @@
|
||||
#include "cdc/generation_service.hh"
|
||||
#include "repair/repair.hh"
|
||||
#include "repair/row_level.hh"
|
||||
#include "service/priority_manager.hh"
|
||||
#include "gms/generation-number.hh"
|
||||
#include <seastar/core/coroutine.hh>
|
||||
#include <seastar/coroutine/maybe_yield.hh>
|
||||
|
||||
@@ -335,7 +335,7 @@ std::unique_ptr<clustered_index_cursor> promoted_index::make_cursor(shared_sstab
|
||||
return std::make_unique<mc::bsearch_clustered_cursor>(*sst->get_schema(),
|
||||
_promoted_index_start, _promoted_index_size,
|
||||
promoted_index_cache_metrics, permit,
|
||||
*ck_values_fixed_lengths, cached_file_ptr, options.io_priority_class, _num_blocks, trace_state);
|
||||
*ck_values_fixed_lengths, cached_file_ptr, _num_blocks, trace_state);
|
||||
}
|
||||
|
||||
auto file = make_tracked_index_file(*sst, permit, std::move(trace_state), caching);
|
||||
@@ -427,7 +427,6 @@ struct index_bound {
|
||||
class index_reader {
|
||||
shared_sstable _sstable;
|
||||
reader_permit _permit;
|
||||
const io_priority_class& _pc;
|
||||
tracing::trace_state_ptr _trace_state;
|
||||
std::unique_ptr<partition_index_cache> _local_index_cache; // Used when caching is disabled
|
||||
partition_index_cache& _index_cache;
|
||||
@@ -757,20 +756,17 @@ private:
|
||||
file_input_stream_options options;
|
||||
options.buffer_size = _sstable->sstable_buffer_size;
|
||||
options.read_ahead = 2;
|
||||
options.io_priority_class = _pc;
|
||||
options.dynamic_adjustments = _sstable->_index_history;
|
||||
return options;
|
||||
}
|
||||
|
||||
public:
|
||||
index_reader(shared_sstable sst, reader_permit permit,
|
||||
const io_priority_class& pc = default_priority_class(),
|
||||
tracing::trace_state_ptr trace_state = {},
|
||||
use_caching caching = use_caching::yes,
|
||||
bool single_partition_read = false)
|
||||
: _sstable(std::move(sst))
|
||||
, _permit(std::move(permit))
|
||||
, _pc(pc)
|
||||
, _trace_state(std::move(trace_state))
|
||||
, _local_index_cache(caching ? nullptr
|
||||
: std::make_unique<partition_index_cache>(_sstable->manager().get_cache_tracker().get_lru(),
|
||||
|
||||
@@ -41,7 +41,7 @@ static sstring report_zeroed_4k_aligned_blocks(const temporary_buffer<int8_t>& b
|
||||
}
|
||||
|
||||
future<size_t>
|
||||
integrity_checked_file_impl::write_dma(uint64_t pos, const void* buffer, size_t len, const io_priority_class& pc) {
|
||||
integrity_checked_file_impl::write_dma(uint64_t pos, const void* buffer, size_t len, io_intent* intent) {
|
||||
auto wbuf = temporary_buffer<int8_t>(static_cast<const int8_t*>(buffer), len);
|
||||
|
||||
auto ret = report_zeroed_4k_aligned_blocks(wbuf);
|
||||
@@ -50,8 +50,8 @@ integrity_checked_file_impl::write_dma(uint64_t pos, const void* buffer, size_t
|
||||
"reason: 4k block(s) zeroed, follow their offsets: {}", _fname, len, pos, ret);
|
||||
}
|
||||
|
||||
return get_file_impl(_file)->write_dma(pos, buffer, len, pc)
|
||||
.then([this, pos, wbuf = std::move(wbuf), buffer = static_cast<const int8_t*>(buffer), len, &pc] (size_t ret) mutable {
|
||||
return get_file_impl(_file)->write_dma(pos, buffer, len, intent)
|
||||
.then([this, pos, wbuf = std::move(wbuf), buffer = static_cast<const int8_t*>(buffer), len, intent] (size_t ret) mutable {
|
||||
if (ret != len) {
|
||||
sstlog.error("integrity check failed for {}, stage: after write finished, write: {} bytes to offset {}, " \
|
||||
"reason: only {} bytes were written.", _fname, len, pos, ret);
|
||||
@@ -72,7 +72,7 @@ integrity_checked_file_impl::write_dma(uint64_t pos, const void* buffer, size_t
|
||||
return make_ready_future<size_t>(ret);
|
||||
}
|
||||
|
||||
return _file.dma_read_exactly<int8_t>(pos, len, pc).then([this, pos, wbuf = std::move(wbuf), len, ret] (auto rbuf) mutable {
|
||||
return _file.dma_read_exactly<int8_t>(pos, len, intent).then([this, pos, wbuf = std::move(wbuf), len, ret] (auto rbuf) mutable {
|
||||
if (rbuf.size() != len) {
|
||||
sstlog.error("integrity check failed for {}, stage: read after write finished, write: {} bytes to offset {}, " \
|
||||
"reason: only able to read {} bytes for further verification", _fname, len, pos, rbuf.size());
|
||||
@@ -96,9 +96,9 @@ integrity_checked_file_impl::write_dma(uint64_t pos, const void* buffer, size_t
|
||||
}
|
||||
|
||||
future<size_t>
|
||||
integrity_checked_file_impl::write_dma(uint64_t pos, std::vector<iovec> iov, const io_priority_class& pc) {
|
||||
integrity_checked_file_impl::write_dma(uint64_t pos, std::vector<iovec> iov, io_intent* intent) {
|
||||
// TODO: check integrity before and after file_impl::write_dma() like write_dma() above.
|
||||
return get_file_impl(_file)->write_dma(pos, iov, pc);
|
||||
return get_file_impl(_file)->write_dma(pos, iov, intent);
|
||||
}
|
||||
|
||||
inline file make_integrity_checked_file(std::string_view name, file f) {
|
||||
|
||||
@@ -22,16 +22,16 @@ class integrity_checked_file_impl : public file_impl {
|
||||
public:
|
||||
integrity_checked_file_impl(sstring fname, file f);
|
||||
|
||||
virtual future<size_t> write_dma(uint64_t pos, const void* buffer, size_t len, const io_priority_class& pc) override;
|
||||
virtual future<size_t> write_dma(uint64_t pos, const void* buffer, size_t len, io_intent*) override;
|
||||
|
||||
virtual future<size_t> write_dma(uint64_t pos, std::vector<iovec> iov, const io_priority_class& pc) override;
|
||||
virtual future<size_t> write_dma(uint64_t pos, std::vector<iovec> iov, io_intent*) override;
|
||||
|
||||
virtual future<size_t> read_dma(uint64_t pos, void* buffer, size_t len, const io_priority_class& pc) override {
|
||||
return get_file_impl(_file)->read_dma(pos, buffer, len, pc);
|
||||
virtual future<size_t> read_dma(uint64_t pos, void* buffer, size_t len, io_intent* intent) override {
|
||||
return get_file_impl(_file)->read_dma(pos, buffer, len, intent);
|
||||
}
|
||||
|
||||
virtual future<size_t> read_dma(uint64_t pos, std::vector<iovec> iov, const io_priority_class& pc) override {
|
||||
return get_file_impl(_file)->read_dma(pos, iov, pc);
|
||||
virtual future<size_t> read_dma(uint64_t pos, std::vector<iovec> iov, io_intent* intent) override {
|
||||
return get_file_impl(_file)->read_dma(pos, iov, intent);
|
||||
}
|
||||
|
||||
virtual future<> flush(void) override {
|
||||
@@ -72,8 +72,8 @@ public:
|
||||
return get_file_impl(_file)->list_directory(next);
|
||||
}
|
||||
|
||||
virtual future<temporary_buffer<uint8_t>> dma_read_bulk(uint64_t offset, size_t range_size, const io_priority_class& pc) override {
|
||||
return get_file_impl(_file)->dma_read_bulk(offset, range_size, pc);
|
||||
virtual future<temporary_buffer<uint8_t>> dma_read_bulk(uint64_t offset, size_t range_size, io_intent* intent) override {
|
||||
return get_file_impl(_file)->dma_read_bulk(offset, range_size, intent);
|
||||
}
|
||||
private:
|
||||
sstring _fname;
|
||||
|
||||
@@ -87,7 +87,6 @@ public:
|
||||
class mp_row_consumer_k_l {
|
||||
reader_permit _permit;
|
||||
tracing::trace_state_ptr _trace_state;
|
||||
const io_priority_class& _pc;
|
||||
|
||||
public:
|
||||
using proceed = data_consumer::proceed;
|
||||
@@ -380,13 +379,11 @@ public:
|
||||
const schema_ptr schema,
|
||||
reader_permit permit,
|
||||
const query::partition_slice& slice,
|
||||
const io_priority_class& pc,
|
||||
tracing::trace_state_ptr trace_state,
|
||||
streamed_mutation::forwarding fwd,
|
||||
const shared_sstable& sst)
|
||||
: _permit(std::move(permit))
|
||||
, _trace_state(std::move(trace_state))
|
||||
, _pc(pc)
|
||||
, _reader(reader)
|
||||
, _sst(sst)
|
||||
, _schema(schema)
|
||||
@@ -399,11 +396,10 @@ public:
|
||||
mp_row_consumer_k_l(mp_row_consumer_reader_k_l* reader,
|
||||
const schema_ptr schema,
|
||||
reader_permit permit,
|
||||
const io_priority_class& pc,
|
||||
tracing::trace_state_ptr trace_state,
|
||||
streamed_mutation::forwarding fwd,
|
||||
const shared_sstable& sst)
|
||||
: mp_row_consumer_k_l(reader, schema, std::move(permit), schema->full_slice(), pc, std::move(trace_state), fwd, sst) { }
|
||||
: mp_row_consumer_k_l(reader, schema, std::move(permit), schema->full_slice(), std::move(trace_state), fwd, sst) { }
|
||||
|
||||
// Consume the row's key and deletion_time. The latter determines if the
|
||||
// row is a tombstone, and if so, when it has been deleted.
|
||||
@@ -915,10 +911,6 @@ public:
|
||||
sstlog.trace("mp_row_consumer_k_l {}: advance_context({})", fmt::ptr(this), _ck_ranges_walker->lower_bound());
|
||||
return _ck_ranges_walker->lower_bound();
|
||||
}
|
||||
// Under which priority class to place I/O coming from this consumer
|
||||
const io_priority_class& io_priority() const {
|
||||
return _pc;
|
||||
}
|
||||
|
||||
// The permit for this read
|
||||
reader_permit& permit() {
|
||||
@@ -1161,13 +1153,12 @@ public:
|
||||
reader_permit permit,
|
||||
const dht::partition_range& pr,
|
||||
const query::partition_slice& slice,
|
||||
const io_priority_class& pc,
|
||||
tracing::trace_state_ptr trace_state,
|
||||
streamed_mutation::forwarding fwd,
|
||||
mutation_reader::forwarding fwd_mr,
|
||||
read_monitor& mon)
|
||||
: mp_row_consumer_reader_k_l(std::move(schema), permit, std::move(sst))
|
||||
, _consumer(this, _schema, std::move(permit), slice, pc, std::move(trace_state), fwd, _sst)
|
||||
, _consumer(this, _schema, std::move(permit), slice, std::move(trace_state), fwd, _sst)
|
||||
// FIXME: I want to add `&& fwd_mr == mutation_reader::forwarding::no` below
|
||||
// but can't because many call sites use the default value for
|
||||
// `mutation_reader::forwarding` which is `yes`.
|
||||
@@ -1196,7 +1187,7 @@ private:
|
||||
index_reader& get_index_reader() {
|
||||
if (!_index_reader) {
|
||||
auto caching = use_caching(global_cache_index_pages && !_slice.options.contains(query::partition_slice::option::bypass_cache));
|
||||
_index_reader = std::make_unique<index_reader>(_sst, _consumer.permit(), _consumer.io_priority(),
|
||||
_index_reader = std::make_unique<index_reader>(_sst, _consumer.permit(),
|
||||
_consumer.trace_state(), caching, _single_partition_read);
|
||||
}
|
||||
return *_index_reader;
|
||||
@@ -1501,13 +1492,12 @@ flat_mutation_reader_v2 make_reader(
|
||||
reader_permit permit,
|
||||
const dht::partition_range& range,
|
||||
const query::partition_slice& slice,
|
||||
const io_priority_class& pc,
|
||||
tracing::trace_state_ptr trace_state,
|
||||
streamed_mutation::forwarding fwd,
|
||||
mutation_reader::forwarding fwd_mr,
|
||||
read_monitor& monitor) {
|
||||
return make_flat_mutation_reader_v2<sstable_mutation_reader>(
|
||||
std::move(sstable), std::move(schema), std::move(permit), range, slice, pc, std::move(trace_state), fwd, fwd_mr, monitor);
|
||||
std::move(sstable), std::move(schema), std::move(permit), range, slice, std::move(trace_state), fwd, fwd_mr, monitor);
|
||||
}
|
||||
|
||||
class crawling_sstable_mutation_reader : public mp_row_consumer_reader_k_l {
|
||||
@@ -1520,11 +1510,10 @@ class crawling_sstable_mutation_reader : public mp_row_consumer_reader_k_l {
|
||||
public:
|
||||
crawling_sstable_mutation_reader(shared_sstable sst, schema_ptr schema,
|
||||
reader_permit permit,
|
||||
const io_priority_class &pc,
|
||||
tracing::trace_state_ptr trace_state,
|
||||
read_monitor& mon)
|
||||
: mp_row_consumer_reader_k_l(std::move(schema), permit, std::move(sst))
|
||||
, _consumer(this, _schema, std::move(permit), _schema->full_slice(), pc, std::move(trace_state), streamed_mutation::forwarding::no, _sst)
|
||||
, _consumer(this, _schema, std::move(permit), _schema->full_slice(), std::move(trace_state), streamed_mutation::forwarding::no, _sst)
|
||||
, _context(data_consume_rows<DataConsumeRowsContext>(*_schema, _sst, _consumer))
|
||||
, _monitor(mon) {
|
||||
_monitor.on_read_started(_context->reader_position());
|
||||
@@ -1567,10 +1556,9 @@ flat_mutation_reader_v2 make_crawling_reader(
|
||||
shared_sstable sstable,
|
||||
schema_ptr schema,
|
||||
reader_permit permit,
|
||||
const io_priority_class& pc,
|
||||
tracing::trace_state_ptr trace_state,
|
||||
read_monitor& monitor) {
|
||||
return make_flat_mutation_reader_v2<crawling_sstable_mutation_reader>(std::move(sstable), std::move(schema), std::move(permit), pc,
|
||||
return make_flat_mutation_reader_v2<crawling_sstable_mutation_reader>(std::move(sstable), std::move(schema), std::move(permit),
|
||||
std::move(trace_state), monitor);
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
#include "readers/flat_mutation_reader_fwd.hh"
|
||||
#include "readers/flat_mutation_reader_v2.hh"
|
||||
#include "sstables/progress_monitor.hh"
|
||||
#include <seastar/core/io_priority_class.hh>
|
||||
|
||||
namespace sstables {
|
||||
namespace kl {
|
||||
@@ -22,7 +21,6 @@ flat_mutation_reader_v2 make_reader(
|
||||
reader_permit permit,
|
||||
const dht::partition_range& range,
|
||||
const query::partition_slice& slice,
|
||||
const io_priority_class& pc,
|
||||
tracing::trace_state_ptr trace_state,
|
||||
streamed_mutation::forwarding fwd,
|
||||
mutation_reader::forwarding fwd_mr,
|
||||
@@ -34,7 +32,6 @@ flat_mutation_reader_v2 make_crawling_reader(
|
||||
shared_sstable sstable,
|
||||
schema_ptr schema,
|
||||
reader_permit permit,
|
||||
const io_priority_class& pc,
|
||||
tracing::trace_state_ptr trace_state,
|
||||
read_monitor& monitor);
|
||||
|
||||
|
||||
@@ -159,7 +159,6 @@ public:
|
||||
uint64_t _promoted_index_size;
|
||||
metrics& _metrics;
|
||||
const pi_index_type _blocks_count;
|
||||
const io_priority_class _pc;
|
||||
cached_file& _cached_file;
|
||||
data_consumer::primitive_consumer _primitive_parser;
|
||||
clustering_parser _clustering_parser;
|
||||
@@ -193,7 +192,7 @@ private:
|
||||
}
|
||||
|
||||
future<pi_offset_type> read_block_offset(pi_index_type idx, tracing::trace_state_ptr trace_state) {
|
||||
_stream = _cached_file.read(_promoted_index_start + get_offset_entry_pos(idx), _pc, _permit, trace_state);
|
||||
_stream = _cached_file.read(_promoted_index_start + get_offset_entry_pos(idx), _permit, trace_state);
|
||||
return _stream.next_page_view().then([this] (cached_file::page_view page) {
|
||||
temporary_buffer<char> buf = page.get_buf();
|
||||
static_assert(noexcept(std::declval<data_consumer::primitive_consumer>().read_32(buf)));
|
||||
@@ -209,7 +208,7 @@ private:
|
||||
// Postconditions:
|
||||
// - block.start is engaged and valid.
|
||||
future<> read_block_start(promoted_index_block& block, tracing::trace_state_ptr trace_state) {
|
||||
_stream = _cached_file.read(_promoted_index_start + block.offset, _pc, _permit, trace_state);
|
||||
_stream = _cached_file.read(_promoted_index_start + block.offset, _permit, trace_state);
|
||||
_clustering_parser.reset();
|
||||
return consume_stream(_stream, _clustering_parser).then([this, &block] {
|
||||
auto mem_before = block.memory_usage();
|
||||
@@ -221,7 +220,7 @@ private:
|
||||
// Postconditions:
|
||||
// - block.end is engaged, all fields in the block are valid
|
||||
future<> read_block(promoted_index_block& block, tracing::trace_state_ptr trace_state) {
|
||||
_stream = _cached_file.read(_promoted_index_start + block.offset, _pc, _permit, trace_state);
|
||||
_stream = _cached_file.read(_promoted_index_start + block.offset, _permit, trace_state);
|
||||
_block_parser.reset();
|
||||
return consume_stream(_stream, _block_parser).then([this, &block] {
|
||||
auto mem_before = block.memory_usage();
|
||||
@@ -267,7 +266,6 @@ public:
|
||||
reader_permit permit,
|
||||
column_values_fixed_lengths cvfl,
|
||||
cached_file& f,
|
||||
io_priority_class pc,
|
||||
pi_index_type blocks_count)
|
||||
: _blocks(block_comparator{s})
|
||||
, _s(s)
|
||||
@@ -275,7 +273,6 @@ public:
|
||||
, _promoted_index_size(promoted_index_size)
|
||||
, _metrics(m)
|
||||
, _blocks_count(blocks_count)
|
||||
, _pc(pc)
|
||||
, _cached_file(f)
|
||||
, _primitive_parser(permit)
|
||||
, _clustering_parser(s, permit, cvfl, true)
|
||||
@@ -441,7 +438,6 @@ public:
|
||||
reader_permit permit,
|
||||
column_values_fixed_lengths cvfl,
|
||||
seastar::shared_ptr<cached_file> f,
|
||||
io_priority_class pc,
|
||||
pi_index_type blocks_count,
|
||||
tracing::trace_state_ptr trace_state)
|
||||
: _s(s)
|
||||
@@ -454,7 +450,6 @@ public:
|
||||
std::move(permit),
|
||||
std::move(cvfl),
|
||||
*_cached_file,
|
||||
pc,
|
||||
blocks_count)
|
||||
, _trace_state(std::move(trace_state))
|
||||
{ }
|
||||
|
||||
@@ -365,7 +365,6 @@ class partition_reversing_data_source_impl final : public data_source_impl {
|
||||
const schema& _schema;
|
||||
shared_sstable _sst;
|
||||
index_reader& _ir;
|
||||
const ::io_priority_class& _io_priority;
|
||||
reader_permit _permit;
|
||||
tracing::trace_state_ptr _trace_state;
|
||||
std::optional<partition_header_context> _partition_header_context;
|
||||
@@ -403,10 +402,10 @@ class partition_reversing_data_source_impl final : public data_source_impl {
|
||||
} _state = state::RANGE_END;
|
||||
private:
|
||||
input_stream<char> data_stream(size_t start, size_t end) {
|
||||
return _sst->data_stream(start, end - start, _io_priority, _permit, _trace_state, {});
|
||||
return _sst->data_stream(start, end - start, _permit, _trace_state, {});
|
||||
}
|
||||
future<temporary_buffer<char>> data_read(uint64_t start, uint64_t end) {
|
||||
return _sst->data_read(start, end - start, _io_priority, _permit);
|
||||
return _sst->data_read(start, end - start, _permit);
|
||||
}
|
||||
future<input_stream<char>> last_row_stream(size_t row_size) {
|
||||
if (_cached_read.size() < row_size) {
|
||||
@@ -457,12 +456,10 @@ public:
|
||||
uint64_t partition_start,
|
||||
size_t partition_len,
|
||||
reader_permit permit,
|
||||
const io_priority_class& io_priority,
|
||||
tracing::trace_state_ptr trace_state)
|
||||
: _schema(s)
|
||||
, _sst(std::move(sst))
|
||||
, _ir(ir)
|
||||
, _io_priority(io_priority)
|
||||
, _permit(std::move(permit))
|
||||
, _trace_state(std::move(trace_state))
|
||||
, _partition_start(partition_start)
|
||||
@@ -606,9 +603,9 @@ public:
|
||||
};
|
||||
|
||||
partition_reversing_data_source make_partition_reversing_data_source(const schema& s, shared_sstable sst, index_reader& ir, uint64_t pos, size_t len,
|
||||
reader_permit permit, const io_priority_class& io_priority, tracing::trace_state_ptr trace_state) {
|
||||
reader_permit permit, tracing::trace_state_ptr trace_state) {
|
||||
auto source_impl = std::make_unique<partition_reversing_data_source_impl>(
|
||||
s, std::move(sst), ir, pos, len, std::move(permit), io_priority, trace_state);
|
||||
s, std::move(sst), ir, pos, len, std::move(permit), trace_state);
|
||||
auto& curr_pos = source_impl->current_position_in_sstable();
|
||||
return partition_reversing_data_source {
|
||||
.the_source = seastar::data_source{std::move(source_impl)},
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <seastar/core/iostream.hh>
|
||||
#include <seastar/core/io_priority_class.hh>
|
||||
#include "reader_permit.hh"
|
||||
#include "sstables/index_reader.hh"
|
||||
#include "sstables/shared_sstable.hh"
|
||||
@@ -45,7 +44,7 @@ struct partition_reversing_data_source {
|
||||
// The source must be closed before destruction unless `get()` was never called.
|
||||
partition_reversing_data_source make_partition_reversing_data_source(
|
||||
const schema& s, shared_sstable sst, index_reader& ir, uint64_t pos, size_t len,
|
||||
reader_permit permit, const io_priority_class& io_priority, tracing::trace_state_ptr trace_state);
|
||||
reader_permit permit, tracing::trace_state_ptr trace_state);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,7 +49,6 @@ class mp_row_consumer_m {
|
||||
reader_permit _permit;
|
||||
const shared_sstable& _sst;
|
||||
tracing::trace_state_ptr _trace_state;
|
||||
const io_priority_class& _pc;
|
||||
public:
|
||||
|
||||
mp_row_consumer_reader_mx* _reader;
|
||||
@@ -204,14 +203,12 @@ public:
|
||||
const schema_ptr schema,
|
||||
reader_permit permit,
|
||||
const query::partition_slice& slice,
|
||||
const io_priority_class& pc,
|
||||
tracing::trace_state_ptr trace_state,
|
||||
streamed_mutation::forwarding fwd,
|
||||
const shared_sstable& sst)
|
||||
: _permit(std::move(permit))
|
||||
, _sst(sst)
|
||||
, _trace_state(std::move(trace_state))
|
||||
, _pc(pc)
|
||||
, _reader(reader)
|
||||
, _schema(schema)
|
||||
, _slice(slice)
|
||||
@@ -225,11 +222,10 @@ public:
|
||||
mp_row_consumer_m(mp_row_consumer_reader_mx* reader,
|
||||
const schema_ptr schema,
|
||||
reader_permit permit,
|
||||
const io_priority_class& pc,
|
||||
tracing::trace_state_ptr trace_state,
|
||||
streamed_mutation::forwarding fwd,
|
||||
const shared_sstable& sst)
|
||||
: mp_row_consumer_m(reader, schema, std::move(permit), schema->full_slice(), pc, std::move(trace_state), fwd, sst)
|
||||
: mp_row_consumer_m(reader, schema, std::move(permit), schema->full_slice(), std::move(trace_state), fwd, sst)
|
||||
{ }
|
||||
|
||||
~mp_row_consumer_m() {}
|
||||
@@ -651,11 +647,6 @@ public:
|
||||
return position_in_partition_view::for_partition_start();
|
||||
}
|
||||
|
||||
// Under which priority class to place I/O coming from this consumer
|
||||
const io_priority_class& io_priority() const {
|
||||
return _pc;
|
||||
}
|
||||
|
||||
// The permit for this read
|
||||
reader_permit& permit() {
|
||||
return _permit;
|
||||
@@ -686,7 +677,6 @@ requires requires(
|
||||
bound_kind kind,
|
||||
sstables::bound_kind_m kind_m) {
|
||||
{ c.permit() } -> std::convertible_to<reader_permit>;
|
||||
{ c.io_priority() } -> std::same_as<const io_priority_class&>;
|
||||
{ c.trace_state() } -> std::same_as<tracing::trace_state_ptr>;
|
||||
{ c.consume_partition_start(pk_view, deltime) } -> std::same_as<data_consumer::proceed>;
|
||||
{ c.consume_static_row_start() } -> std::same_as<row_processing_result>;
|
||||
@@ -1314,7 +1304,6 @@ public:
|
||||
reader_permit permit,
|
||||
const dht::partition_range& pr,
|
||||
value_or_reference<query::partition_slice> slice,
|
||||
const io_priority_class& pc,
|
||||
tracing::trace_state_ptr trace_state,
|
||||
streamed_mutation::forwarding fwd,
|
||||
mutation_reader::forwarding fwd_mr,
|
||||
@@ -1322,7 +1311,7 @@ public:
|
||||
: mp_row_consumer_reader_mx(std::move(schema), permit, std::move(sst))
|
||||
, _slice_holder(std::move(slice))
|
||||
, _slice(_slice_holder.get())
|
||||
, _consumer(this, _schema, std::move(permit), _slice, pc, std::move(trace_state), fwd, _sst)
|
||||
, _consumer(this, _schema, std::move(permit), _slice, std::move(trace_state), fwd, _sst)
|
||||
// FIXME: I want to add `&& fwd_mr == mutation_reader::forwarding::no` below
|
||||
// but can't because many call sites use the default value for
|
||||
// `mutation_reader::forwarding` which is `yes`.
|
||||
@@ -1361,7 +1350,7 @@ private:
|
||||
index_reader& get_index_reader() {
|
||||
if (!_index_reader) {
|
||||
auto caching = use_caching(global_cache_index_pages && !_slice.options.contains(query::partition_slice::option::bypass_cache));
|
||||
_index_reader = std::make_unique<index_reader>(_sst, _consumer.permit(), _consumer.io_priority(),
|
||||
_index_reader = std::make_unique<index_reader>(_sst, _consumer.permit(),
|
||||
_consumer.trace_state(), caching, _single_partition_read);
|
||||
}
|
||||
return *_index_reader;
|
||||
@@ -1724,7 +1713,6 @@ static flat_mutation_reader_v2 make_reader(
|
||||
reader_permit permit,
|
||||
const dht::partition_range& range,
|
||||
value_or_reference<query::partition_slice> slice,
|
||||
const io_priority_class& pc,
|
||||
tracing::trace_state_ptr trace_state,
|
||||
streamed_mutation::forwarding fwd,
|
||||
mutation_reader::forwarding fwd_mr,
|
||||
@@ -1737,12 +1725,12 @@ static flat_mutation_reader_v2 make_reader(
|
||||
if (slice.get().is_reversed()) {
|
||||
return make_flat_mutation_reader_v2<mx_sstable_mutation_reader>(
|
||||
std::move(sstable), schema, std::move(permit), range,
|
||||
legacy_reverse_slice_to_native_reverse_slice(*schema, slice.get()), pc, std::move(trace_state), fwd, fwd_mr, monitor);
|
||||
legacy_reverse_slice_to_native_reverse_slice(*schema, slice.get()), std::move(trace_state), fwd, fwd_mr, monitor);
|
||||
}
|
||||
|
||||
return make_flat_mutation_reader_v2<mx_sstable_mutation_reader>(
|
||||
std::move(sstable), std::move(schema), std::move(permit), range,
|
||||
std::move(slice), pc, std::move(trace_state), fwd, fwd_mr, monitor);
|
||||
std::move(slice), std::move(trace_state), fwd, fwd_mr, monitor);
|
||||
}
|
||||
|
||||
flat_mutation_reader_v2 make_reader(
|
||||
@@ -1751,13 +1739,12 @@ flat_mutation_reader_v2 make_reader(
|
||||
reader_permit permit,
|
||||
const dht::partition_range& range,
|
||||
const query::partition_slice& slice,
|
||||
const io_priority_class& pc,
|
||||
tracing::trace_state_ptr trace_state,
|
||||
streamed_mutation::forwarding fwd,
|
||||
mutation_reader::forwarding fwd_mr,
|
||||
read_monitor& monitor) {
|
||||
return make_reader(std::move(sstable), std::move(schema), std::move(permit), range,
|
||||
value_or_reference(slice), pc, std::move(trace_state), fwd, fwd_mr, monitor);
|
||||
value_or_reference(slice), std::move(trace_state), fwd, fwd_mr, monitor);
|
||||
}
|
||||
|
||||
flat_mutation_reader_v2 make_reader(
|
||||
@@ -1766,13 +1753,12 @@ flat_mutation_reader_v2 make_reader(
|
||||
reader_permit permit,
|
||||
const dht::partition_range& range,
|
||||
query::partition_slice&& slice,
|
||||
const io_priority_class& pc,
|
||||
tracing::trace_state_ptr trace_state,
|
||||
streamed_mutation::forwarding fwd,
|
||||
mutation_reader::forwarding fwd_mr,
|
||||
read_monitor& monitor) {
|
||||
return make_reader(std::move(sstable), std::move(schema), std::move(permit), range,
|
||||
value_or_reference(std::move(slice)), pc, std::move(trace_state), fwd, fwd_mr, monitor);
|
||||
value_or_reference(std::move(slice)), std::move(trace_state), fwd, fwd_mr, monitor);
|
||||
}
|
||||
|
||||
class mx_crawling_sstable_mutation_reader : public mp_row_consumer_reader_mx {
|
||||
@@ -1785,11 +1771,10 @@ class mx_crawling_sstable_mutation_reader : public mp_row_consumer_reader_mx {
|
||||
public:
|
||||
mx_crawling_sstable_mutation_reader(shared_sstable sst, schema_ptr schema,
|
||||
reader_permit permit,
|
||||
const io_priority_class &pc,
|
||||
tracing::trace_state_ptr trace_state,
|
||||
read_monitor& mon)
|
||||
: mp_row_consumer_reader_mx(std::move(schema), permit, std::move(sst))
|
||||
, _consumer(this, _schema, std::move(permit), _schema->full_slice(), pc, std::move(trace_state), streamed_mutation::forwarding::no, _sst)
|
||||
, _consumer(this, _schema, std::move(permit), _schema->full_slice(), std::move(trace_state), streamed_mutation::forwarding::no, _sst)
|
||||
, _context(data_consume_rows<DataConsumeRowsContext>(*_schema, _sst, _consumer))
|
||||
, _monitor(mon) {
|
||||
_monitor.on_read_started(_context->reader_position());
|
||||
@@ -1830,10 +1815,9 @@ flat_mutation_reader_v2 make_crawling_reader(
|
||||
shared_sstable sstable,
|
||||
schema_ptr schema,
|
||||
reader_permit permit,
|
||||
const io_priority_class& pc,
|
||||
tracing::trace_state_ptr trace_state,
|
||||
read_monitor& monitor) {
|
||||
return make_flat_mutation_reader_v2<mx_crawling_sstable_mutation_reader>(std::move(sstable), std::move(schema), std::move(permit), pc,
|
||||
return make_flat_mutation_reader_v2<mx_crawling_sstable_mutation_reader>(std::move(sstable), std::move(schema), std::move(permit),
|
||||
std::move(trace_state), monitor);
|
||||
}
|
||||
|
||||
@@ -1875,7 +1859,6 @@ public:
|
||||
private:
|
||||
schema_ptr _schema;
|
||||
reader_permit _permit;
|
||||
const io_priority_class& _pc;
|
||||
std::function<void(sstring)> _error_handler;
|
||||
// For static-compact tables C* stores the only row in the static row but in our representation they're regular rows.
|
||||
const bool _treat_static_row_as_regular;
|
||||
@@ -1922,10 +1905,9 @@ private:
|
||||
}
|
||||
|
||||
public:
|
||||
validating_consumer(const schema_ptr schema, reader_permit permit, const io_priority_class& pc, const shared_sstable& sst, std::function<void(sstring)> error_handler)
|
||||
validating_consumer(const schema_ptr schema, reader_permit permit, const shared_sstable& sst, std::function<void(sstring)> error_handler)
|
||||
: _schema(schema)
|
||||
, _permit(std::move(permit))
|
||||
, _pc(pc)
|
||||
, _error_handler(std::move(error_handler))
|
||||
, _treat_static_row_as_regular(_schema->is_static_compact_table()
|
||||
&& (!sst->has_scylla_component() || sst->features().is_enabled(sstable_feature::CorrectStaticCompact))) // See #4139
|
||||
@@ -1935,7 +1917,6 @@ public:
|
||||
}
|
||||
|
||||
const reader_permit& permit() const { return _permit; }
|
||||
const io_priority_class& io_priority() const { return _pc; }
|
||||
tracing::trace_state_ptr trace_state() { return {}; }
|
||||
uint64_t error_count() const { return _error_count; }
|
||||
position_in_partition_view current_position() const { return _current_pos; }
|
||||
@@ -2069,15 +2050,14 @@ public:
|
||||
future<uint64_t> validate(
|
||||
shared_sstable sstable,
|
||||
reader_permit permit,
|
||||
const io_priority_class& pc,
|
||||
abort_source& abort,
|
||||
std::function<void(sstring)> error_handler) {
|
||||
auto schema = sstable->get_schema();
|
||||
validating_consumer consumer(schema, permit, pc, sstable, std::move(error_handler));
|
||||
validating_consumer consumer(schema, permit, sstable, std::move(error_handler));
|
||||
auto context = data_consume_rows<data_consume_rows_context_m<validating_consumer>>(*schema, sstable, consumer);
|
||||
|
||||
std::optional<sstables::index_reader> idx_reader;
|
||||
idx_reader.emplace(sstable, permit, pc, tracing::trace_state_ptr{}, sstables::use_caching::no, false);
|
||||
idx_reader.emplace(sstable, permit, tracing::trace_state_ptr{}, sstables::use_caching::no, false);
|
||||
|
||||
try {
|
||||
while (!context->eof() && !abort.abort_requested()) {
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
#include "readers/flat_mutation_reader_fwd.hh"
|
||||
#include "readers/flat_mutation_reader_v2.hh"
|
||||
#include "sstables/progress_monitor.hh"
|
||||
#include <seastar/core/io_priority_class.hh>
|
||||
|
||||
namespace sstables {
|
||||
namespace mx {
|
||||
@@ -27,7 +26,6 @@ flat_mutation_reader_v2 make_reader(
|
||||
reader_permit permit,
|
||||
const dht::partition_range& range,
|
||||
const query::partition_slice& slice,
|
||||
const io_priority_class& pc,
|
||||
tracing::trace_state_ptr trace_state,
|
||||
streamed_mutation::forwarding fwd,
|
||||
mutation_reader::forwarding fwd_mr,
|
||||
@@ -40,7 +38,6 @@ flat_mutation_reader_v2 make_reader(
|
||||
reader_permit permit,
|
||||
const dht::partition_range& range,
|
||||
query::partition_slice&& slice,
|
||||
const io_priority_class& pc,
|
||||
tracing::trace_state_ptr trace_state,
|
||||
streamed_mutation::forwarding fwd,
|
||||
mutation_reader::forwarding fwd_mr,
|
||||
@@ -52,7 +49,6 @@ flat_mutation_reader_v2 make_crawling_reader(
|
||||
shared_sstable sstable,
|
||||
schema_ptr schema,
|
||||
reader_permit permit,
|
||||
const io_priority_class& pc,
|
||||
tracing::trace_state_ptr trace_state,
|
||||
read_monitor& monitor);
|
||||
|
||||
@@ -62,7 +58,6 @@ flat_mutation_reader_v2 make_crawling_reader(
|
||||
future<uint64_t> validate(
|
||||
shared_sstable sstable,
|
||||
reader_permit permit,
|
||||
const io_priority_class& pc,
|
||||
abort_source& abort,
|
||||
std::function<void(sstring)> error_handler);
|
||||
|
||||
|
||||
@@ -749,8 +749,8 @@ public:
|
||||
|
||||
writer(sstable& sst, const schema& s, uint64_t estimated_partitions,
|
||||
const sstable_writer_config& cfg, encoding_stats enc_stats,
|
||||
const io_priority_class& pc, shard_id shard = this_shard_id())
|
||||
: sstable_writer::writer_impl(sst, s, pc, cfg)
|
||||
shard_id shard = this_shard_id())
|
||||
: sstable_writer::writer_impl(sst, s, cfg)
|
||||
, _enc_stats(enc_stats)
|
||||
, _shard(shard)
|
||||
, _tmp_bufs(_sst.sstable_buffer_size)
|
||||
@@ -788,7 +788,7 @@ public:
|
||||
// exactly what callers used to do anyway.
|
||||
estimated_partitions = std::max(uint64_t(1), estimated_partitions);
|
||||
|
||||
_sst.open_sstable(_pc);
|
||||
_sst.open_sstable();
|
||||
_sst.create_data().get();
|
||||
_compression_enabled = !_sst.has_component(component_type::CRC);
|
||||
init_file_writers();
|
||||
@@ -874,7 +874,7 @@ void writer::maybe_add_pi_block() {
|
||||
}
|
||||
|
||||
void writer::init_file_writers() {
|
||||
auto out = _sst._storage->make_data_or_index_sink(_sst, component_type::Data, _pc).get0();
|
||||
auto out = _sst._storage->make_data_or_index_sink(_sst, component_type::Data).get0();
|
||||
|
||||
if (!_compression_enabled) {
|
||||
_data_writer = std::make_unique<crc32_checksummed_file_writer>(std::move(out), _sst.sstable_buffer_size, _sst.filename(component_type::Data));
|
||||
@@ -886,7 +886,7 @@ void writer::init_file_writers() {
|
||||
_schema.get_compressor_params()), _sst.filename(component_type::Data));
|
||||
}
|
||||
|
||||
out = _sst._storage->make_data_or_index_sink(_sst, component_type::Index, _pc).get0();
|
||||
out = _sst._storage->make_data_or_index_sink(_sst, component_type::Index).get0();
|
||||
_index_writer = std::make_unique<file_writer>(output_stream<char>(std::move(out)), _sst.filename(component_type::Index));
|
||||
}
|
||||
|
||||
@@ -1456,10 +1456,10 @@ void writer::consume_end_of_stream() {
|
||||
_sst._schema->get_partitioner().name(), _schema.bloom_filter_fp_chance(),
|
||||
_sst._schema, _sst.get_first_decorated_key(), _sst.get_last_decorated_key(), _enc_stats);
|
||||
close_data_writer();
|
||||
_sst.write_summary(_pc);
|
||||
_sst.write_filter(_pc);
|
||||
_sst.write_statistics(_pc);
|
||||
_sst.write_compression(_pc);
|
||||
_sst.write_summary();
|
||||
_sst.write_filter();
|
||||
_sst.write_statistics();
|
||||
_sst.write_compression();
|
||||
auto features = sstable_enabled_features::all();
|
||||
run_identifier identifier{_run_identifier};
|
||||
std::optional<scylla_metadata::large_data_stats> ld_stats(scylla_metadata::large_data_stats{
|
||||
@@ -1471,7 +1471,7 @@ void writer::consume_end_of_stream() {
|
||||
{ large_data_type::elements_in_collection, std::move(_elements_in_collection_entry) },
|
||||
}
|
||||
});
|
||||
_sst.write_scylla_metadata(_pc, _shard, std::move(features), std::move(identifier), std::move(ld_stats), _cfg.origin);
|
||||
_sst.write_scylla_metadata(_shard, std::move(features), std::move(identifier), std::move(ld_stats), _cfg.origin);
|
||||
_sst.seal_sstable(_cfg.backup).get();
|
||||
}
|
||||
|
||||
@@ -1480,9 +1480,8 @@ std::unique_ptr<sstable_writer::writer_impl> make_writer(sstable& sst,
|
||||
uint64_t estimated_partitions,
|
||||
const sstable_writer_config& cfg,
|
||||
encoding_stats enc_stats,
|
||||
const io_priority_class& pc,
|
||||
shard_id shard) {
|
||||
return std::make_unique<writer>(sst, s, estimated_partitions, cfg, enc_stats, pc, shard);
|
||||
return std::make_unique<writer>(sst, s, estimated_partitions, cfg, enc_stats, shard);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -20,7 +20,6 @@ std::unique_ptr<sstable_writer::writer_impl> make_writer(sstable& sst,
|
||||
uint64_t estimated_partitions,
|
||||
const sstable_writer_config& cfg,
|
||||
encoding_stats enc_stats,
|
||||
const io_priority_class& pc,
|
||||
shard_id shard);
|
||||
|
||||
}
|
||||
|
||||
@@ -73,13 +73,11 @@ sstable_directory::sstable_directory(sstables_manager& manager,
|
||||
schema_ptr schema,
|
||||
lw_shared_ptr<const data_dictionary::storage_options> storage_opts,
|
||||
fs::path sstable_dir,
|
||||
::io_priority_class io_prio,
|
||||
io_error_handler_gen error_handler_gen)
|
||||
: _manager(manager)
|
||||
, _schema(std::move(schema))
|
||||
, _storage_opts(std::move(storage_opts))
|
||||
, _sstable_dir(std::move(sstable_dir))
|
||||
, _io_priority(std::move(io_prio))
|
||||
, _error_handler_gen(error_handler_gen)
|
||||
, _lister(make_components_lister())
|
||||
, _unshared_remote_sstables(smp::count)
|
||||
@@ -136,7 +134,7 @@ void sstable_directory::validate(sstables::shared_sstable sst, process_flags fla
|
||||
|
||||
future<sstables::shared_sstable> sstable_directory::load_sstable(sstables::entry_descriptor desc, sstables::sstable_open_config cfg) const {
|
||||
auto sst = _manager.make_sstable(_schema, *_storage_opts, _sstable_dir.native(), desc.generation, desc.version, desc.format, gc_clock::now(), _error_handler_gen);
|
||||
co_await sst->load(_io_priority, cfg);
|
||||
co_await sst->load(cfg);
|
||||
co_return sst;
|
||||
}
|
||||
|
||||
@@ -166,7 +164,7 @@ sstable_directory::process_descriptor(sstables::entry_descriptor desc, process_f
|
||||
|
||||
future<std::vector<shard_id>> sstable_directory::get_shards_for_this_sstable(const sstables::entry_descriptor& desc, process_flags flags) const {
|
||||
auto sst = _manager.make_sstable(_schema, *_storage_opts, _sstable_dir.native(), desc.generation, desc.version, desc.format, gc_clock::now(), _error_handler_gen);
|
||||
co_await sst->load_owner_shards(_io_priority);
|
||||
co_await sst->load_owner_shards();
|
||||
validate(sst, flags);
|
||||
co_return sst->get_shards_for_this_sstable();
|
||||
}
|
||||
|
||||
@@ -129,7 +129,6 @@ private:
|
||||
schema_ptr _schema;
|
||||
lw_shared_ptr<const data_dictionary::storage_options> _storage_opts;
|
||||
std::filesystem::path _sstable_dir;
|
||||
::io_priority_class _io_priority;
|
||||
io_error_handler_gen _error_handler_gen;
|
||||
std::unique_ptr<components_lister> _lister;
|
||||
|
||||
@@ -187,7 +186,6 @@ public:
|
||||
schema_ptr schema,
|
||||
lw_shared_ptr<const data_dictionary::storage_options> storage_opts,
|
||||
std::filesystem::path sstable_dir,
|
||||
::io_priority_class io_prio,
|
||||
io_error_handler_gen error_handler_gen);
|
||||
|
||||
std::vector<sstables::shared_sstable>& get_unsorted_sstables() {
|
||||
|
||||
@@ -117,7 +117,7 @@ inline std::unique_ptr<DataConsumeRowsContext> data_consume_rows(const schema& s
|
||||
// This potentially enables read-ahead beyond end, until last_end, which
|
||||
// can be beneficial if the user wants to fast_forward_to() on the
|
||||
// returned context, and may make small skips.
|
||||
auto input = sst->data_stream(toread.start, last_end - toread.start, consumer.io_priority(),
|
||||
auto input = sst->data_stream(toread.start, last_end - toread.start,
|
||||
consumer.permit(), consumer.trace_state(), sst->_partition_range_history);
|
||||
return std::make_unique<DataConsumeRowsContext>(s, std::move(sst), consumer, std::move(input), toread.start, toread.end - toread.start);
|
||||
}
|
||||
@@ -140,7 +140,7 @@ inline reversed_context<DataConsumeRowsContext> data_consume_reversed_partition(
|
||||
typename DataConsumeRowsContext::consumer& consumer, sstable::disk_read_range toread) {
|
||||
auto reversing_data_source = sstables::mx::make_partition_reversing_data_source(
|
||||
s, sst, ir, toread.start, toread.end - toread.start,
|
||||
consumer.permit(), consumer.io_priority(), consumer.trace_state());
|
||||
consumer.permit(), consumer.trace_state());
|
||||
return reversed_context<DataConsumeRowsContext> {
|
||||
.the_context = std::make_unique<DataConsumeRowsContext>(
|
||||
s, std::move(sst), consumer, input_stream<char>(std::move(reversing_data_source.the_source)),
|
||||
@@ -151,7 +151,7 @@ inline reversed_context<DataConsumeRowsContext> data_consume_reversed_partition(
|
||||
|
||||
template <typename DataConsumeRowsContext>
|
||||
inline std::unique_ptr<DataConsumeRowsContext> data_consume_single_partition(const schema& s, shared_sstable sst, typename DataConsumeRowsContext::consumer& consumer, sstable::disk_read_range toread) {
|
||||
auto input = sst->data_stream(toread.start, toread.end - toread.start, consumer.io_priority(),
|
||||
auto input = sst->data_stream(toread.start, toread.end - toread.start,
|
||||
consumer.permit(), consumer.trace_state(), sst->_single_partition_history);
|
||||
return std::make_unique<DataConsumeRowsContext>(s, std::move(sst), consumer, std::move(input), toread.start, toread.end - toread.start);
|
||||
}
|
||||
@@ -168,7 +168,6 @@ concept RowConsumer =
|
||||
requires(T t,
|
||||
const partition_key& pk,
|
||||
position_range cr) {
|
||||
{ t.io_priority() } -> std::convertible_to<const io_priority_class&>;
|
||||
{ t.is_mutation_end() } -> std::same_as<bool>;
|
||||
{ t.setup_for_partition(pk) } -> std::same_as<void>;
|
||||
{ t.push_ready_fragments() } -> std::same_as<void>;
|
||||
|
||||
@@ -885,7 +885,6 @@ sstable_set_impl::create_single_key_sstable_reader(
|
||||
utils::estimated_histogram& sstable_histogram,
|
||||
const dht::partition_range& pr,
|
||||
const query::partition_slice& slice,
|
||||
const io_priority_class& pc,
|
||||
tracing::trace_state_ptr trace_state,
|
||||
streamed_mutation::forwarding fwd,
|
||||
mutation_reader::forwarding fwd_mr) const
|
||||
@@ -900,7 +899,7 @@ sstable_set_impl::create_single_key_sstable_reader(
|
||||
filter_sstable_for_reader_by_ck(std::move(selected_sstables), *cf, schema, slice)
|
||||
| boost::adaptors::transformed([&] (const shared_sstable& sstable) {
|
||||
tracing::trace(trace_state, "Reading key {} from sstable {}", pos, seastar::value_of([&sstable] { return sstable->get_filename(); }));
|
||||
return sstable->make_reader(schema, permit, pr, slice, pc, trace_state, fwd);
|
||||
return sstable->make_reader(schema, permit, pr, slice, trace_state, fwd);
|
||||
})
|
||||
);
|
||||
|
||||
@@ -928,7 +927,6 @@ time_series_sstable_set::create_single_key_sstable_reader(
|
||||
utils::estimated_histogram& sstable_histogram,
|
||||
const dht::partition_range& pr,
|
||||
const query::partition_slice& slice,
|
||||
const io_priority_class& pc,
|
||||
tracing::trace_state_ptr trace_state,
|
||||
streamed_mutation::forwarding fwd_sm,
|
||||
mutation_reader::forwarding fwd_mr) const {
|
||||
@@ -953,7 +951,7 @@ time_series_sstable_set::create_single_key_sstable_reader(
|
||||
// Some of the conditions were not satisfied so we use the standard query path.
|
||||
return sstable_set_impl::create_single_key_sstable_reader(
|
||||
cf, std::move(schema), std::move(permit), sstable_histogram,
|
||||
pr, slice, pc, std::move(trace_state), fwd_sm, fwd_mr);
|
||||
pr, slice, std::move(trace_state), fwd_sm, fwd_mr);
|
||||
}
|
||||
|
||||
auto pk_filter = make_pk_filter(pos, *schema);
|
||||
@@ -966,8 +964,8 @@ time_series_sstable_set::create_single_key_sstable_reader(
|
||||
auto& stats = *cf->cf_stats();
|
||||
stats.clustering_filter_count++;
|
||||
|
||||
auto create_reader = [schema, permit, &pr, &slice, &pc, trace_state, fwd_sm] (sstable& sst) {
|
||||
return sst.make_reader(schema, permit, pr, slice, pc, trace_state, fwd_sm);
|
||||
auto create_reader = [schema, permit, &pr, &slice, trace_state, fwd_sm] (sstable& sst) {
|
||||
return sst.make_reader(schema, permit, pr, slice, trace_state, fwd_sm);
|
||||
};
|
||||
|
||||
auto ck_filter = [ranges = slice.get_all_ranges()] (const sstable& sst) { return sst.may_contain_rows(ranges); };
|
||||
@@ -1168,7 +1166,6 @@ compound_sstable_set::create_single_key_sstable_reader(
|
||||
utils::estimated_histogram& sstable_histogram,
|
||||
const dht::partition_range& pr,
|
||||
const query::partition_slice& slice,
|
||||
const io_priority_class& pc,
|
||||
tracing::trace_state_ptr trace_state,
|
||||
streamed_mutation::forwarding fwd,
|
||||
mutation_reader::forwarding fwd_mr) const {
|
||||
@@ -1182,13 +1179,13 @@ compound_sstable_set::create_single_key_sstable_reader(
|
||||
// optimize for common case where only 1 set is populated, avoiding the expensive combined reader
|
||||
if (non_empty_set_count == 1) {
|
||||
const auto& non_empty_set = *std::begin(sets);
|
||||
return non_empty_set->create_single_key_sstable_reader(cf, std::move(schema), std::move(permit), sstable_histogram, pr, slice, pc, trace_state, fwd, fwd_mr);
|
||||
return non_empty_set->create_single_key_sstable_reader(cf, std::move(schema), std::move(permit), sstable_histogram, pr, slice, trace_state, fwd, fwd_mr);
|
||||
}
|
||||
|
||||
auto readers = boost::copy_range<std::vector<flat_mutation_reader_v2>>(
|
||||
boost::make_iterator_range(sets.begin(), it)
|
||||
| boost::adaptors::transformed([&] (const lw_shared_ptr<sstable_set>& non_empty_set) {
|
||||
return non_empty_set->create_single_key_sstable_reader(cf, schema, permit, sstable_histogram, pr, slice, pc, trace_state, fwd, fwd_mr);
|
||||
return non_empty_set->create_single_key_sstable_reader(cf, schema, permit, sstable_histogram, pr, slice, trace_state, fwd, fwd_mr);
|
||||
})
|
||||
);
|
||||
return make_combined_reader(std::move(schema), std::move(permit), std::move(readers), fwd, fwd_mr);
|
||||
@@ -1202,13 +1199,12 @@ sstable_set::create_single_key_sstable_reader(
|
||||
utils::estimated_histogram& sstable_histogram,
|
||||
const dht::partition_range& pr,
|
||||
const query::partition_slice& slice,
|
||||
const io_priority_class& pc,
|
||||
tracing::trace_state_ptr trace_state,
|
||||
streamed_mutation::forwarding fwd,
|
||||
mutation_reader::forwarding fwd_mr) const {
|
||||
assert(pr.is_singular() && pr.start()->value().has_key());
|
||||
return _impl->create_single_key_sstable_reader(cf, std::move(schema),
|
||||
std::move(permit), sstable_histogram, pr, slice, pc, std::move(trace_state), fwd, fwd_mr);
|
||||
std::move(permit), sstable_histogram, pr, slice, std::move(trace_state), fwd, fwd_mr);
|
||||
}
|
||||
|
||||
flat_mutation_reader_v2
|
||||
@@ -1217,15 +1213,14 @@ sstable_set::make_range_sstable_reader(
|
||||
reader_permit permit,
|
||||
const dht::partition_range& pr,
|
||||
const query::partition_slice& slice,
|
||||
const io_priority_class& pc,
|
||||
tracing::trace_state_ptr trace_state,
|
||||
streamed_mutation::forwarding fwd,
|
||||
mutation_reader::forwarding fwd_mr,
|
||||
read_monitor_generator& monitor_generator) const
|
||||
{
|
||||
auto reader_factory_fn = [s, permit, &slice, &pc, trace_state, fwd, fwd_mr, &monitor_generator]
|
||||
auto reader_factory_fn = [s, permit, &slice, trace_state, fwd, fwd_mr, &monitor_generator]
|
||||
(shared_sstable& sst, const dht::partition_range& pr) mutable {
|
||||
return sst->make_reader(s, permit, pr, slice, pc, trace_state, fwd, fwd_mr, monitor_generator(sst));
|
||||
return sst->make_reader(s, permit, pr, slice, trace_state, fwd, fwd_mr, monitor_generator(sst));
|
||||
};
|
||||
return make_combined_reader(s, std::move(permit), std::make_unique<incremental_reader_selector>(s,
|
||||
shared_from_this(),
|
||||
@@ -1242,16 +1237,15 @@ sstable_set::make_local_shard_sstable_reader(
|
||||
reader_permit permit,
|
||||
const dht::partition_range& pr,
|
||||
const query::partition_slice& slice,
|
||||
const io_priority_class& pc,
|
||||
tracing::trace_state_ptr trace_state,
|
||||
streamed_mutation::forwarding fwd,
|
||||
mutation_reader::forwarding fwd_mr,
|
||||
read_monitor_generator& monitor_generator) const
|
||||
{
|
||||
auto reader_factory_fn = [s, permit, &slice, &pc, trace_state, fwd, fwd_mr, &monitor_generator]
|
||||
auto reader_factory_fn = [s, permit, &slice, trace_state, fwd, fwd_mr, &monitor_generator]
|
||||
(shared_sstable& sst, const dht::partition_range& pr) mutable {
|
||||
assert(!sst->is_shared());
|
||||
return sst->make_reader(s, permit, pr, slice, pc, trace_state, fwd, fwd_mr, monitor_generator(sst));
|
||||
return sst->make_reader(s, permit, pr, slice, trace_state, fwd, fwd_mr, monitor_generator(sst));
|
||||
};
|
||||
if (_impl->size() == 1) [[unlikely]] {
|
||||
auto sstables = _impl->all();
|
||||
@@ -1270,12 +1264,11 @@ sstable_set::make_local_shard_sstable_reader(
|
||||
flat_mutation_reader_v2 sstable_set::make_crawling_reader(
|
||||
schema_ptr schema,
|
||||
reader_permit permit,
|
||||
const io_priority_class& pc,
|
||||
tracing::trace_state_ptr trace_ptr,
|
||||
read_monitor_generator& monitor_generator) const {
|
||||
std::vector<flat_mutation_reader_v2> readers;
|
||||
for_each_sstable([&] (const shared_sstable& sst) mutable {
|
||||
readers.emplace_back(sst->make_crawling_reader(schema, permit, pc, trace_ptr, monitor_generator(sst)));
|
||||
readers.emplace_back(sst->make_crawling_reader(schema, permit, trace_ptr, monitor_generator(sst)));
|
||||
});
|
||||
return make_combined_reader(schema, std::move(permit), std::move(readers), streamed_mutation::forwarding::no, mutation_reader::forwarding::no);
|
||||
}
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
#include "shared_sstable.hh"
|
||||
#include "dht/i_partitioner.hh"
|
||||
#include <seastar/core/shared_ptr.hh>
|
||||
#include <seastar/core/io_priority_class.hh>
|
||||
#include <type_traits>
|
||||
#include <vector>
|
||||
|
||||
@@ -77,7 +76,6 @@ public:
|
||||
utils::estimated_histogram&,
|
||||
const dht::partition_range&,
|
||||
const query::partition_slice&,
|
||||
const io_priority_class&,
|
||||
tracing::trace_state_ptr,
|
||||
streamed_mutation::forwarding,
|
||||
mutation_reader::forwarding) const;
|
||||
@@ -167,7 +165,6 @@ public:
|
||||
utils::estimated_histogram&,
|
||||
const dht::partition_range&, // must be singular and contain a key
|
||||
const query::partition_slice&,
|
||||
const io_priority_class&,
|
||||
tracing::trace_state_ptr,
|
||||
streamed_mutation::forwarding,
|
||||
mutation_reader::forwarding) const;
|
||||
@@ -181,7 +178,6 @@ public:
|
||||
reader_permit,
|
||||
const dht::partition_range&,
|
||||
const query::partition_slice&,
|
||||
const io_priority_class&,
|
||||
tracing::trace_state_ptr,
|
||||
streamed_mutation::forwarding,
|
||||
mutation_reader::forwarding,
|
||||
@@ -193,7 +189,6 @@ public:
|
||||
reader_permit,
|
||||
const dht::partition_range&,
|
||||
const query::partition_slice&,
|
||||
const io_priority_class&,
|
||||
tracing::trace_state_ptr,
|
||||
streamed_mutation::forwarding,
|
||||
mutation_reader::forwarding,
|
||||
@@ -202,7 +197,6 @@ public:
|
||||
flat_mutation_reader_v2 make_crawling_reader(
|
||||
schema_ptr,
|
||||
reader_permit,
|
||||
const io_priority_class&,
|
||||
tracing::trace_state_ptr,
|
||||
read_monitor_generator& rmg = default_read_monitor_generator()) const;
|
||||
|
||||
|
||||
@@ -112,7 +112,6 @@ public:
|
||||
utils::estimated_histogram&,
|
||||
const dht::partition_range&,
|
||||
const query::partition_slice&,
|
||||
const io_priority_class&,
|
||||
tracing::trace_state_ptr,
|
||||
streamed_mutation::forwarding,
|
||||
mutation_reader::forwarding) const override;
|
||||
@@ -146,7 +145,6 @@ public:
|
||||
utils::estimated_histogram&,
|
||||
const dht::partition_range&,
|
||||
const query::partition_slice&,
|
||||
const io_priority_class&,
|
||||
tracing::trace_state_ptr,
|
||||
streamed_mutation::forwarding,
|
||||
mutation_reader::forwarding) const override;
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <memory>
|
||||
#include <seastar/core/io_priority_class.hh>
|
||||
#include <seastar/core/smp.hh>
|
||||
#include "schema/schema_fwd.hh"
|
||||
#include "mutation/mutation_fragment.hh"
|
||||
@@ -30,7 +29,7 @@ private:
|
||||
public:
|
||||
sstable_writer(sstable& sst, const schema& s, uint64_t estimated_partitions,
|
||||
const sstable_writer_config&, encoding_stats enc_stats,
|
||||
const io_priority_class& pc, shard_id shard = this_shard_id());
|
||||
shard_id shard = this_shard_id());
|
||||
|
||||
sstable_writer(sstable_writer&& o);
|
||||
sstable_writer& operator=(sstable_writer&& o);
|
||||
|
||||
@@ -917,9 +917,9 @@ future<file_writer> sstable::make_component_file_writer(component_type c, file_o
|
||||
});
|
||||
}
|
||||
|
||||
void sstable::open_sstable(const io_priority_class& pc) {
|
||||
void sstable::open_sstable() {
|
||||
generate_toc();
|
||||
_storage->open(*this, pc);
|
||||
_storage->open(*this);
|
||||
}
|
||||
|
||||
void sstable::write_toc(file_writer w) {
|
||||
@@ -937,7 +937,7 @@ void sstable::write_toc(file_writer w) {
|
||||
|
||||
void sstable::write_crc(const checksum& c) {
|
||||
unsigned buffer_size = 4096;
|
||||
do_write_simple(component_type::CRC, default_priority_class(), [&] (version_types v, file_writer& w) {
|
||||
do_write_simple(component_type::CRC, [&] (version_types v, file_writer& w) {
|
||||
write(v, w, c);
|
||||
}, buffer_size);
|
||||
}
|
||||
@@ -945,7 +945,7 @@ void sstable::write_crc(const checksum& c) {
|
||||
// Digest file stores the full checksum of data file converted into a string.
|
||||
void sstable::write_digest(uint32_t full_checksum) {
|
||||
unsigned buffer_size = 4096;
|
||||
do_write_simple(component_type::Digest, default_priority_class(), [&] (version_types v, file_writer& w) {
|
||||
do_write_simple(component_type::Digest, [&] (version_types v, file_writer& w) {
|
||||
auto digest = to_sstring<bytes>(full_checksum);
|
||||
write(v, w, digest);
|
||||
}, buffer_size);
|
||||
@@ -990,7 +990,7 @@ future<> sstable::do_read_simple(component_type type,
|
||||
}
|
||||
|
||||
template <component_type Type, typename T>
|
||||
future<> sstable::read_simple(T& component, const io_priority_class& pc) {
|
||||
future<> sstable::read_simple(T& component) {
|
||||
return do_read_simple(Type, [&] (version_types v, file&& f, uint64_t size) -> future<> {
|
||||
std::exception_ptr ex;
|
||||
auto r = file_random_access_reader(std::move(f), size, sstable_buffer_size);
|
||||
@@ -1012,45 +1012,44 @@ void sstable::do_write_simple(file_writer&& writer,
|
||||
writer.close();
|
||||
}
|
||||
|
||||
void sstable::do_write_simple(component_type type, const io_priority_class& pc,
|
||||
void sstable::do_write_simple(component_type type,
|
||||
noncopyable_function<void (version_types version, file_writer& writer)> write_component, unsigned buffer_size) {
|
||||
auto file_path = filename(type);
|
||||
sstlog.debug(("Writing " + sstable_version_constants::get_component_map(_version).at(type) + " file {} ").c_str(), file_path);
|
||||
|
||||
file_output_stream_options options;
|
||||
options.buffer_size = buffer_size;
|
||||
options.io_priority_class = pc;
|
||||
auto w = make_component_file_writer(type, std::move(options)).get0();
|
||||
do_write_simple(std::move(w), std::move(write_component));
|
||||
}
|
||||
|
||||
template <component_type Type, typename T>
|
||||
void sstable::write_simple(const T& component, const io_priority_class& pc) {
|
||||
do_write_simple(Type, pc, [&component] (version_types v, file_writer& w) {
|
||||
void sstable::write_simple(const T& component) {
|
||||
do_write_simple(Type, [&component] (version_types v, file_writer& w) {
|
||||
write(v, w, component);
|
||||
}, sstable_buffer_size);
|
||||
}
|
||||
|
||||
template future<> sstable::read_simple<component_type::Filter>(sstables::filter& f, const io_priority_class& pc);
|
||||
template void sstable::write_simple<component_type::Filter>(const sstables::filter& f, const io_priority_class& pc);
|
||||
template future<> sstable::read_simple<component_type::Filter>(sstables::filter& f);
|
||||
template void sstable::write_simple<component_type::Filter>(const sstables::filter& f);
|
||||
|
||||
template void sstable::write_simple<component_type::Summary>(const sstables::summary_ka&, const io_priority_class&);
|
||||
template void sstable::write_simple<component_type::Summary>(const sstables::summary_ka&);
|
||||
|
||||
future<> sstable::read_compression(const io_priority_class& pc) {
|
||||
future<> sstable::read_compression() {
|
||||
// FIXME: If there is no compression, we should expect a CRC file to be present.
|
||||
if (!has_component(component_type::CompressionInfo)) {
|
||||
return make_ready_future<>();
|
||||
}
|
||||
|
||||
return read_simple<component_type::CompressionInfo>(_components->compression, pc);
|
||||
return read_simple<component_type::CompressionInfo>(_components->compression);
|
||||
}
|
||||
|
||||
void sstable::write_compression(const io_priority_class& pc) {
|
||||
void sstable::write_compression() {
|
||||
if (!has_component(component_type::CompressionInfo)) {
|
||||
return;
|
||||
}
|
||||
|
||||
write_simple<component_type::CompressionInfo>(_components->compression, pc);
|
||||
write_simple<component_type::CompressionInfo>(_components->compression);
|
||||
}
|
||||
|
||||
void sstable::validate_partitioner() {
|
||||
@@ -1148,7 +1147,7 @@ void sstable::set_min_max_position_range() {
|
||||
}
|
||||
|
||||
future<std::optional<position_in_partition>>
|
||||
sstable::find_first_position_in_partition(reader_permit permit, const dht::decorated_key& key, bool reversed, const io_priority_class& pc) {
|
||||
sstable::find_first_position_in_partition(reader_permit permit, const dht::decorated_key& key, bool reversed) {
|
||||
using position_in_partition_opt = std::optional<position_in_partition>;
|
||||
class position_finder {
|
||||
position_in_partition_opt& _pos;
|
||||
@@ -1209,7 +1208,7 @@ sstable::find_first_position_in_partition(reader_permit permit, const dht::decor
|
||||
s = s->make_reversed();
|
||||
full_slice.options.set(query::partition_slice::option::reversed);
|
||||
}
|
||||
auto r = make_reader(s, std::move(permit), pr, full_slice, pc, {}, streamed_mutation::forwarding::no,
|
||||
auto r = make_reader(s, std::move(permit), pr, full_slice, {}, streamed_mutation::forwarding::no,
|
||||
mutation_reader::forwarding::no /* to avoid reading past the partition end */);
|
||||
|
||||
position_in_partition_opt ret = std::nullopt;
|
||||
@@ -1258,12 +1257,12 @@ double sstable::estimate_droppable_tombstone_ratio(gc_clock::time_point gc_befor
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
future<> sstable::read_statistics(const io_priority_class& pc) {
|
||||
return read_simple<component_type::Statistics>(_components->statistics, pc);
|
||||
future<> sstable::read_statistics() {
|
||||
return read_simple<component_type::Statistics>(_components->statistics);
|
||||
}
|
||||
|
||||
void sstable::write_statistics(const io_priority_class& pc) {
|
||||
write_simple<component_type::Statistics>(_components->statistics, pc);
|
||||
void sstable::write_statistics() {
|
||||
write_simple<component_type::Statistics>(_components->statistics);
|
||||
}
|
||||
|
||||
void sstable::rewrite_statistics() {
|
||||
@@ -1280,21 +1279,21 @@ void sstable::rewrite_statistics() {
|
||||
sstable_write_io_check(rename_file, file_path, filename(component_type::Statistics)).get();
|
||||
}
|
||||
|
||||
future<> sstable::read_summary(const io_priority_class& pc) noexcept {
|
||||
future<> sstable::read_summary() noexcept {
|
||||
if (_components->summary) {
|
||||
return make_ready_future<>();
|
||||
}
|
||||
|
||||
return read_toc().then([this, &pc] {
|
||||
return read_toc().then([this] {
|
||||
// We'll try to keep the main code path exception free, but if an exception does happen
|
||||
// we can try to regenerate the Summary.
|
||||
if (has_component(component_type::Summary)) {
|
||||
return read_simple<component_type::Summary>(_components->summary, pc).handle_exception([this, &pc] (auto ep) {
|
||||
return read_simple<component_type::Summary>(_components->summary).handle_exception([this] (auto ep) {
|
||||
sstlog.warn("Couldn't read summary file {}: {}. Recreating it.", this->filename(component_type::Summary), ep);
|
||||
return this->generate_summary(pc);
|
||||
return this->generate_summary();
|
||||
});
|
||||
} else {
|
||||
return generate_summary(pc);
|
||||
return generate_summary();
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -1377,15 +1376,15 @@ future<> sstable::drop_caches() {
|
||||
});
|
||||
}
|
||||
|
||||
future<> sstable::read_filter(const io_priority_class& pc, sstable_open_config cfg) {
|
||||
future<> sstable::read_filter(sstable_open_config cfg) {
|
||||
if (!cfg.load_bloom_filter || !has_component(component_type::Filter)) {
|
||||
_components->filter = std::make_unique<utils::filter::always_present_filter>();
|
||||
return make_ready_future<>();
|
||||
}
|
||||
|
||||
return seastar::async([this, &pc] () mutable {
|
||||
return seastar::async([this] () mutable {
|
||||
sstables::filter filter;
|
||||
read_simple<component_type::Filter>(filter, pc).get();
|
||||
read_simple<component_type::Filter>(filter).get();
|
||||
auto nr_bits = filter.buckets.elements.size() * std::numeric_limits<typename decltype(filter.buckets.elements)::value_type>::digits;
|
||||
large_bitset bs(nr_bits, std::move(filter.buckets.elements));
|
||||
utils::filter_format format = (_version >= sstable_version_types::mc)
|
||||
@@ -1395,7 +1394,7 @@ future<> sstable::read_filter(const io_priority_class& pc, sstable_open_config c
|
||||
});
|
||||
}
|
||||
|
||||
void sstable::write_filter(const io_priority_class& pc) {
|
||||
void sstable::write_filter() {
|
||||
if (!has_component(component_type::Filter)) {
|
||||
return;
|
||||
}
|
||||
@@ -1404,23 +1403,23 @@ void sstable::write_filter(const io_priority_class& pc) {
|
||||
|
||||
auto&& bs = f->bits();
|
||||
auto filter_ref = sstables::filter_ref(f->num_hashes(), bs.get_storage());
|
||||
write_simple<component_type::Filter>(filter_ref, pc);
|
||||
write_simple<component_type::Filter>(filter_ref);
|
||||
}
|
||||
|
||||
// This interface is only used during tests, snapshot loading and early initialization.
|
||||
// No need to set tunable priorities for it.
|
||||
future<> sstable::load(const io_priority_class& pc, sstable_open_config cfg) noexcept {
|
||||
future<> sstable::load(sstable_open_config cfg) noexcept {
|
||||
co_await read_toc();
|
||||
// read scylla-meta after toc. Might need it to parse
|
||||
// rest (hint extensions)
|
||||
co_await read_scylla_metadata(pc);
|
||||
co_await read_scylla_metadata();
|
||||
// Read statistics ahead of others - if summary is missing
|
||||
// we'll attempt to re-generate it and we need statistics for that
|
||||
co_await read_statistics(pc);
|
||||
co_await read_statistics();
|
||||
co_await coroutine::all(
|
||||
[&] { return read_compression(pc); },
|
||||
[&] { return read_filter(pc, cfg); },
|
||||
[&] { return read_summary(pc); });
|
||||
[&] { return read_compression(); },
|
||||
[&] { return read_filter(cfg); },
|
||||
[&] { return read_summary(); });
|
||||
validate_min_max_metadata();
|
||||
validate_max_local_deletion_time();
|
||||
validate_partitioner();
|
||||
@@ -1450,11 +1449,11 @@ future<foreign_sstable_open_info> sstable::get_open_info() & {
|
||||
}
|
||||
|
||||
future<>
|
||||
sstable::load_owner_shards(const io_priority_class& pc) {
|
||||
sstable::load_owner_shards() {
|
||||
if (!_shards.empty()) {
|
||||
co_return;
|
||||
}
|
||||
co_await read_scylla_metadata(pc);
|
||||
co_await read_scylla_metadata();
|
||||
|
||||
auto has_valid_sharding_metadata = std::invoke([this] {
|
||||
if (!has_component(component_type::Scylla)) {
|
||||
@@ -1468,13 +1467,13 @@ sstable::load_owner_shards(const io_priority_class& pc) {
|
||||
return sm && sm->token_ranges.elements.size();
|
||||
});
|
||||
// Statistics is needed for SSTable loading validation and possible Summary regeneration.
|
||||
co_await read_statistics(pc);
|
||||
co_await read_statistics();
|
||||
|
||||
// If sharding metadata is not available, we must load first and last keys from summary
|
||||
// for sstable::compute_shards_for_this_sstable() to operate on them.
|
||||
if (!has_valid_sharding_metadata) {
|
||||
sstlog.warn("Sharding metadata not available for {}, so Summary will be read to allow Scylla to compute shards owning the SSTable.", get_filename());
|
||||
co_await read_summary(pc);
|
||||
co_await read_summary();
|
||||
set_first_and_last_keys();
|
||||
}
|
||||
|
||||
@@ -1616,21 +1615,21 @@ size_t summary_byte_cost(double summary_ratio) {
|
||||
}
|
||||
|
||||
future<>
|
||||
sstable::read_scylla_metadata(const io_priority_class& pc) noexcept {
|
||||
sstable::read_scylla_metadata() noexcept {
|
||||
if (_components->scylla_metadata) {
|
||||
return make_ready_future<>();
|
||||
}
|
||||
return read_toc().then([this, &pc] {
|
||||
return read_toc().then([this] {
|
||||
_components->scylla_metadata.emplace(); // engaged optional means we won't try to re-read this again
|
||||
if (!has_component(component_type::Scylla)) {
|
||||
return make_ready_future<>();
|
||||
}
|
||||
return read_simple<component_type::Scylla>(*_components->scylla_metadata, pc);
|
||||
return read_simple<component_type::Scylla>(*_components->scylla_metadata);
|
||||
});
|
||||
}
|
||||
|
||||
void
|
||||
sstable::write_scylla_metadata(const io_priority_class& pc, shard_id shard, sstable_enabled_features features, struct run_identifier identifier,
|
||||
sstable::write_scylla_metadata(shard_id shard, sstable_enabled_features features, struct run_identifier identifier,
|
||||
std::optional<scylla_metadata::large_data_stats> ld_stats, sstring origin) {
|
||||
auto&& first_key = get_first_decorated_key();
|
||||
auto&& last_key = get_last_decorated_key();
|
||||
@@ -1665,7 +1664,7 @@ sstable::write_scylla_metadata(const io_priority_class& pc, shard_id shard, ssta
|
||||
build_id.value = bytes(to_bytes_view(sstring_view(get_build_id())));
|
||||
_components->scylla_metadata->data.set<scylla_metadata_type::ScyllaBuildId>(std::move(build_id));
|
||||
|
||||
write_simple<component_type::Scylla>(*_components->scylla_metadata, pc);
|
||||
write_simple<component_type::Scylla>(*_components->scylla_metadata);
|
||||
}
|
||||
|
||||
bool sstable::may_contain_rows(const query::clustering_row_ranges& ranges) const {
|
||||
@@ -1705,20 +1704,20 @@ future<> sstable::seal_sstable(bool backup)
|
||||
}
|
||||
|
||||
sstable_writer sstable::get_writer(const schema& s, uint64_t estimated_partitions,
|
||||
const sstable_writer_config& cfg, encoding_stats enc_stats, const io_priority_class& pc, shard_id shard)
|
||||
const sstable_writer_config& cfg, encoding_stats enc_stats, shard_id shard)
|
||||
{
|
||||
// Mark sstable for implicit deletion if destructed before it is sealed.
|
||||
_marked_for_deletion = mark_for_deletion::implicit;
|
||||
return sstable_writer(*this, s, estimated_partitions, cfg, enc_stats, pc, shard);
|
||||
return sstable_writer(*this, s, estimated_partitions, cfg, enc_stats, shard);
|
||||
}
|
||||
|
||||
future<uint64_t> sstable::validate(reader_permit permit, const io_priority_class& pc, abort_source& abort,
|
||||
future<uint64_t> sstable::validate(reader_permit permit, abort_source& abort,
|
||||
std::function<void(sstring)> error_handler) {
|
||||
if (_version >= sstable_version_types::mc) {
|
||||
co_return co_await mx::validate(shared_from_this(), std::move(permit), pc, abort, std::move(error_handler));
|
||||
co_return co_await mx::validate(shared_from_this(), std::move(permit), abort, std::move(error_handler));
|
||||
}
|
||||
|
||||
auto reader = make_crawling_reader(_schema, permit, pc, nullptr);
|
||||
auto reader = make_crawling_reader(_schema, permit, nullptr);
|
||||
|
||||
uint64_t errors = 0;
|
||||
std::exception_ptr ex;
|
||||
@@ -1798,19 +1797,18 @@ future<> sstable::write_components(
|
||||
uint64_t estimated_partitions,
|
||||
schema_ptr schema,
|
||||
const sstable_writer_config& cfg,
|
||||
encoding_stats stats,
|
||||
const io_priority_class& pc) {
|
||||
encoding_stats stats) {
|
||||
assert_large_data_handler_is_running();
|
||||
return seastar::async([this, mr = std::move(mr), estimated_partitions, schema = std::move(schema), cfg, stats, &pc] () mutable {
|
||||
return seastar::async([this, mr = std::move(mr), estimated_partitions, schema = std::move(schema), cfg, stats] () mutable {
|
||||
auto close_mr = deferred_close(mr);
|
||||
auto wr = get_writer(*schema, estimated_partitions, cfg, stats, pc);
|
||||
auto wr = get_writer(*schema, estimated_partitions, cfg, stats);
|
||||
mr.consume_in_thread(std::move(wr));
|
||||
}).finally([this] {
|
||||
assert_large_data_handler_is_running();
|
||||
});
|
||||
}
|
||||
|
||||
future<> sstable::generate_summary(const io_priority_class& pc) {
|
||||
future<> sstable::generate_summary() {
|
||||
if (_components->summary) {
|
||||
co_return;
|
||||
}
|
||||
@@ -1856,7 +1854,6 @@ future<> sstable::generate_summary(const io_priority_class& pc) {
|
||||
|
||||
file_input_stream_options options;
|
||||
options.buffer_size = sstable_buffer_size;
|
||||
options.io_priority_class = pc;
|
||||
|
||||
auto s = summary_generator(_schema->get_partitioner(), _components->summary, _manager.config().sstable_summary_ratio());
|
||||
auto ctx = make_lw_shared<index_consume_entry_context<summary_generator>>(
|
||||
@@ -2064,14 +2061,13 @@ sstable::make_reader(
|
||||
reader_permit permit,
|
||||
const dht::partition_range& range,
|
||||
const query::partition_slice& slice,
|
||||
const io_priority_class& pc,
|
||||
tracing::trace_state_ptr trace_state,
|
||||
streamed_mutation::forwarding fwd,
|
||||
mutation_reader::forwarding fwd_mr,
|
||||
read_monitor& mon) {
|
||||
const auto reversed = slice.is_reversed();
|
||||
if (_version >= version_types::mc && (!reversed || range.is_singular())) {
|
||||
return mx::make_reader(shared_from_this(), std::move(schema), std::move(permit), range, slice, pc, std::move(trace_state), fwd, fwd_mr, mon);
|
||||
return mx::make_reader(shared_from_this(), std::move(schema), std::move(permit), range, slice, std::move(trace_state), fwd, fwd_mr, mon);
|
||||
}
|
||||
|
||||
// Multi-partition reversed queries are not yet supported natively in the mx reader.
|
||||
@@ -2082,7 +2078,7 @@ sstable::make_reader(
|
||||
if (_version >= version_types::mc) {
|
||||
// The only mx case falling through here is reversed multi-partition reader
|
||||
auto rd = make_reversing_reader(mx::make_reader(shared_from_this(), schema->make_reversed(), std::move(permit),
|
||||
range, half_reverse_slice(*schema, slice), pc, std::move(trace_state), streamed_mutation::forwarding::no, fwd_mr, mon),
|
||||
range, half_reverse_slice(*schema, slice), std::move(trace_state), streamed_mutation::forwarding::no, fwd_mr, mon),
|
||||
max_result_size);
|
||||
if (fwd) {
|
||||
rd = make_forwardable(std::move(rd));
|
||||
@@ -2095,7 +2091,7 @@ sstable::make_reader(
|
||||
// Perform a forward query on it, then reverse the result.
|
||||
// Note: we can pass a half-reversed slice, the kl reader performs an unreversed query nevertheless.
|
||||
auto rd = make_reversing_reader(kl::make_reader(shared_from_this(), schema->make_reversed(), std::move(permit),
|
||||
range, slice, pc, std::move(trace_state), streamed_mutation::forwarding::no, fwd_mr, mon), max_result_size);
|
||||
range, slice, std::move(trace_state), streamed_mutation::forwarding::no, fwd_mr, mon), max_result_size);
|
||||
if (fwd) {
|
||||
rd = make_forwardable(std::move(rd));
|
||||
}
|
||||
@@ -2103,20 +2099,19 @@ sstable::make_reader(
|
||||
}
|
||||
|
||||
return kl::make_reader(shared_from_this(), schema, std::move(permit),
|
||||
range, slice, pc, std::move(trace_state), fwd, fwd_mr, mon);
|
||||
range, slice, std::move(trace_state), fwd, fwd_mr, mon);
|
||||
}
|
||||
|
||||
flat_mutation_reader_v2
|
||||
sstable::make_crawling_reader(
|
||||
schema_ptr schema,
|
||||
reader_permit permit,
|
||||
const io_priority_class& pc,
|
||||
tracing::trace_state_ptr trace_state,
|
||||
read_monitor& monitor) {
|
||||
if (_version >= version_types::mc) {
|
||||
return mx::make_crawling_reader(shared_from_this(), std::move(schema), std::move(permit), pc, std::move(trace_state), monitor);
|
||||
return mx::make_crawling_reader(shared_from_this(), std::move(schema), std::move(permit), std::move(trace_state), monitor);
|
||||
}
|
||||
return kl::make_crawling_reader(shared_from_this(), std::move(schema), std::move(permit), pc, std::move(trace_state), monitor);
|
||||
return kl::make_crawling_reader(shared_from_this(), std::move(schema), std::move(permit), std::move(trace_state), monitor);
|
||||
}
|
||||
|
||||
static entry_descriptor make_entry_descriptor(sstring sstdir, sstring fname, sstring* const provided_ks, sstring* const provided_cf) {
|
||||
@@ -2206,11 +2201,10 @@ component_type sstable::component_from_sstring(version_types v, const sstring &s
|
||||
}
|
||||
}
|
||||
|
||||
input_stream<char> sstable::data_stream(uint64_t pos, size_t len, const io_priority_class& pc,
|
||||
input_stream<char> sstable::data_stream(uint64_t pos, size_t len,
|
||||
reader_permit permit, tracing::trace_state_ptr trace_state, lw_shared_ptr<file_input_stream_history> history, raw_stream raw) {
|
||||
file_input_stream_options options;
|
||||
options.buffer_size = sstable_buffer_size;
|
||||
options.io_priority_class = pc;
|
||||
options.read_ahead = 4;
|
||||
options.dynamic_adjustments = std::move(history);
|
||||
|
||||
@@ -2233,8 +2227,8 @@ input_stream<char> sstable::data_stream(uint64_t pos, size_t len, const io_prior
|
||||
return make_file_input_stream(f, pos, len, std::move(options));
|
||||
}
|
||||
|
||||
future<temporary_buffer<char>> sstable::data_read(uint64_t pos, size_t len, const io_priority_class& pc, reader_permit permit) {
|
||||
return do_with(data_stream(pos, len, pc, std::move(permit), tracing::trace_state_ptr(), {}), [len] (auto& stream) {
|
||||
future<temporary_buffer<char>> sstable::data_read(uint64_t pos, size_t len, reader_permit permit) {
|
||||
return do_with(data_stream(pos, len, std::move(permit), tracing::trace_state_ptr(), {}), [len] (auto& stream) {
|
||||
return stream.read_exactly(len).finally([&stream] {
|
||||
return stream.close();
|
||||
});
|
||||
@@ -2398,11 +2392,9 @@ future<checksum> sstable::read_checksum() {
|
||||
}
|
||||
|
||||
future<bool> validate_checksums(shared_sstable sst, reader_permit permit) {
|
||||
auto& pc = default_priority_class();
|
||||
|
||||
const auto digest = co_await sst->read_digest();
|
||||
|
||||
auto data_stream = sst->data_stream(0, sst->ondisk_data_size(), pc, permit, nullptr, nullptr, sstable::raw_stream::yes);
|
||||
auto data_stream = sst->data_stream(0, sst->ondisk_data_size(), permit, nullptr, nullptr, sstable::raw_stream::yes);
|
||||
|
||||
auto valid = true;
|
||||
std::exception_ptr ex;
|
||||
@@ -2938,11 +2930,10 @@ mutation_source sstable::as_mutation_source() {
|
||||
reader_permit permit,
|
||||
const dht::partition_range& range,
|
||||
const query::partition_slice& slice,
|
||||
const io_priority_class& pc,
|
||||
tracing::trace_state_ptr trace_state,
|
||||
streamed_mutation::forwarding fwd,
|
||||
mutation_reader::forwarding fwd_mr) mutable {
|
||||
return sst->make_reader(std::move(s), std::move(permit), range, slice, pc, std::move(trace_state), fwd, fwd_mr);
|
||||
return sst->make_reader(std::move(s), std::move(permit), range, slice, std::move(trace_state), fwd, fwd_mr);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -196,13 +196,13 @@ public:
|
||||
// load all components from disk
|
||||
// this variant will be useful for testing purposes and also when loading
|
||||
// a new sstable from scratch for sharing its components.
|
||||
future<> load(const io_priority_class& pc = default_priority_class(), sstable_open_config cfg = {}) noexcept;
|
||||
future<> load(sstable_open_config cfg = {}) noexcept;
|
||||
future<> open_data(sstable_open_config cfg = {}) noexcept;
|
||||
future<> update_info_for_opened_data(sstable_open_config cfg = {});
|
||||
|
||||
// Load set of shards that own the SSTable, while reading the minimum
|
||||
// from disk to achieve that.
|
||||
future<> load_owner_shards(const io_priority_class& pc = default_priority_class());
|
||||
future<> load_owner_shards();
|
||||
|
||||
// Call as the last method before the object is destroyed.
|
||||
// No other uses of the object can happen at this point.
|
||||
@@ -232,7 +232,6 @@ public:
|
||||
reader_permit permit,
|
||||
const dht::partition_range& range,
|
||||
const query::partition_slice& slice,
|
||||
const io_priority_class& pc = default_priority_class(),
|
||||
tracing::trace_state_ptr trace_state = {},
|
||||
streamed_mutation::forwarding fwd = streamed_mutation::forwarding::no,
|
||||
mutation_reader::forwarding fwd_mr = mutation_reader::forwarding::yes,
|
||||
@@ -243,7 +242,6 @@ public:
|
||||
flat_mutation_reader_v2 make_crawling_reader(
|
||||
schema_ptr schema,
|
||||
reader_permit permit,
|
||||
const io_priority_class& pc = default_priority_class(),
|
||||
tracing::trace_state_ptr trace_state = {},
|
||||
read_monitor& monitor = default_read_monitor());
|
||||
|
||||
@@ -255,14 +253,12 @@ public:
|
||||
uint64_t estimated_partitions,
|
||||
schema_ptr schema,
|
||||
const sstable_writer_config&,
|
||||
encoding_stats stats,
|
||||
const io_priority_class& pc = default_priority_class());
|
||||
encoding_stats stats);
|
||||
|
||||
sstable_writer get_writer(const schema& s,
|
||||
uint64_t estimated_partitions,
|
||||
const sstable_writer_config&,
|
||||
encoding_stats enc_stats,
|
||||
const io_priority_class& pc = default_priority_class(),
|
||||
shard_id shard = this_shard_id());
|
||||
|
||||
// Validates the content of the sstable.
|
||||
@@ -272,7 +268,7 @@ public:
|
||||
// If aborted, either via the abort-source or via unrecoverable errors
|
||||
// (e.g. parse error), it will return with validation error count seen up to
|
||||
// the abort. In the latter case it will call the error-handler before doing so.
|
||||
future<uint64_t> validate(reader_permit permit, const io_priority_class& pc, abort_source& abort,
|
||||
future<uint64_t> validate(reader_permit permit, abort_source& abort,
|
||||
std::function<void(sstring)> error_handler);
|
||||
|
||||
encoding_stats get_encoding_stats_for_compaction() const;
|
||||
@@ -553,7 +549,7 @@ private:
|
||||
future<file> open_file(component_type, open_flags, file_open_options = {}) noexcept;
|
||||
|
||||
template <component_type Type, typename T>
|
||||
future<> read_simple(T& comp, const io_priority_class& pc);
|
||||
future<> read_simple(T& comp);
|
||||
future<> do_read_simple(component_type type,
|
||||
noncopyable_function<future<> (version_types, file&&, uint64_t sz)> read_component);
|
||||
// this variant closes the file on parse completion
|
||||
@@ -561,10 +557,10 @@ private:
|
||||
noncopyable_function<future<> (version_types, file)> read_component);
|
||||
|
||||
template <component_type Type, typename T>
|
||||
void write_simple(const T& comp, const io_priority_class& pc);
|
||||
void write_simple(const T& comp);
|
||||
void do_write_simple(file_writer&& writer,
|
||||
noncopyable_function<void (version_types, file_writer&)> write_component);
|
||||
void do_write_simple(component_type type, const io_priority_class& pc,
|
||||
void do_write_simple(component_type type,
|
||||
noncopyable_function<void (version_types version, file_writer& writer)> write_component,
|
||||
unsigned buffer_size);
|
||||
|
||||
@@ -578,31 +574,31 @@ private:
|
||||
open_flags oflags = open_flags::wo | open_flags::create | open_flags::exclusive) noexcept;
|
||||
|
||||
void generate_toc();
|
||||
void open_sstable(const io_priority_class& pc);
|
||||
void open_sstable();
|
||||
|
||||
future<> read_compression(const io_priority_class& pc);
|
||||
void write_compression(const io_priority_class& pc);
|
||||
future<> read_compression();
|
||||
void write_compression();
|
||||
|
||||
future<> read_scylla_metadata(const io_priority_class& pc) noexcept;
|
||||
void write_scylla_metadata(const io_priority_class& pc, shard_id shard, sstable_enabled_features features, run_identifier identifier,
|
||||
future<> read_scylla_metadata() noexcept;
|
||||
void write_scylla_metadata(shard_id shard, sstable_enabled_features features, run_identifier identifier,
|
||||
std::optional<scylla_metadata::large_data_stats> ld_stats, sstring origin);
|
||||
|
||||
future<> read_filter(const io_priority_class& pc, sstable_open_config cfg = {});
|
||||
future<> read_filter(sstable_open_config cfg = {});
|
||||
|
||||
void write_filter(const io_priority_class& pc);
|
||||
void write_filter();
|
||||
|
||||
future<> read_summary(const io_priority_class& pc) noexcept;
|
||||
future<> read_summary() noexcept;
|
||||
|
||||
void write_summary(const io_priority_class& pc) {
|
||||
write_simple<component_type::Summary>(_components->summary, pc);
|
||||
void write_summary() {
|
||||
write_simple<component_type::Summary>(_components->summary);
|
||||
}
|
||||
|
||||
// To be called when we try to load an SSTable that lacks a Summary. Could
|
||||
// happen if old tools are being used.
|
||||
future<> generate_summary(const io_priority_class& pc);
|
||||
future<> generate_summary();
|
||||
|
||||
future<> read_statistics(const io_priority_class& pc);
|
||||
void write_statistics(const io_priority_class& pc);
|
||||
future<> read_statistics();
|
||||
void write_statistics();
|
||||
// Rewrite statistics component by creating a temporary Statistics and
|
||||
// renaming it into place of existing one.
|
||||
void rewrite_statistics();
|
||||
@@ -635,8 +631,7 @@ public:
|
||||
// If reversed is false, then the first position is actually the first row (can be the static one).
|
||||
// If reversed is true, then the first position is the last row (can be static if partition has a single static row).
|
||||
future<std::optional<position_in_partition>>
|
||||
find_first_position_in_partition(reader_permit permit, const dht::decorated_key& key, bool reversed,
|
||||
const io_priority_class& pc = default_priority_class());
|
||||
find_first_position_in_partition(reader_permit permit, const dht::decorated_key& key, bool reversed);
|
||||
|
||||
// Return an input_stream which reads exactly the specified byte range
|
||||
// from the data file (after uncompression, if the file is compressed).
|
||||
@@ -650,7 +645,7 @@ public:
|
||||
// When created with `raw_stream::yes`, the sstable data file will be
|
||||
// streamed as-is, without decompressing (if compressed).
|
||||
using raw_stream = bool_class<class raw_stream_tag>;
|
||||
input_stream<char> data_stream(uint64_t pos, size_t len, const io_priority_class& pc,
|
||||
input_stream<char> data_stream(uint64_t pos, size_t len,
|
||||
reader_permit permit, tracing::trace_state_ptr trace_state, lw_shared_ptr<file_input_stream_history> history, raw_stream raw = raw_stream::no);
|
||||
|
||||
// Read exactly the specific byte range from the data file (after
|
||||
@@ -659,7 +654,7 @@ public:
|
||||
// determined using the index file).
|
||||
// This function is intended (and optimized for) random access, not
|
||||
// for iteration through all the rows.
|
||||
future<temporary_buffer<char>> data_read(uint64_t pos, size_t len, const io_priority_class& pc, reader_permit permit);
|
||||
future<temporary_buffer<char>> data_read(uint64_t pos, size_t len, reader_permit permit);
|
||||
|
||||
private:
|
||||
future<summary_entry&> read_summary_entry(size_t i);
|
||||
|
||||
@@ -60,10 +60,10 @@ public:
|
||||
virtual future<> snapshot(const sstable& sst, sstring dir, absolute_path abs) const override;
|
||||
virtual future<> change_state(const sstable& sst, sstring to, generation_type generation, delayed_commit_changes* delay) override;
|
||||
// runs in async context
|
||||
virtual void open(sstable& sst, const io_priority_class& pc) override;
|
||||
virtual void open(sstable& sst) override;
|
||||
virtual future<> wipe(const sstable& sst) noexcept override;
|
||||
virtual future<file> open_component(const sstable& sst, component_type type, open_flags flags, file_open_options options, bool check_integrity) override;
|
||||
virtual future<data_sink> make_data_or_index_sink(sstable& sst, component_type type, io_priority_class pc) override;
|
||||
virtual future<data_sink> make_data_or_index_sink(sstable& sst, component_type type) override;
|
||||
virtual future<data_sink> make_component_sink(sstable& sst, component_type type, open_flags oflags, file_output_stream_options options) override;
|
||||
virtual future<> destroy(const sstable& sst) override { return make_ready_future<>(); }
|
||||
virtual noncopyable_function<future<>(std::vector<shared_sstable>)> atomic_deleter() const override {
|
||||
@@ -73,9 +73,8 @@ public:
|
||||
virtual sstring prefix() const override { return dir; }
|
||||
};
|
||||
|
||||
future<data_sink> filesystem_storage::make_data_or_index_sink(sstable& sst, component_type type, io_priority_class pc) {
|
||||
future<data_sink> filesystem_storage::make_data_or_index_sink(sstable& sst, component_type type) {
|
||||
file_output_stream_options options;
|
||||
options.io_priority_class = pc;
|
||||
options.buffer_size = sst.sstable_buffer_size;
|
||||
options.write_behind = 10;
|
||||
|
||||
@@ -116,7 +115,7 @@ future<file> filesystem_storage::open_component(const sstable& sst, component_ty
|
||||
return f;
|
||||
}
|
||||
|
||||
void filesystem_storage::open(sstable& sst, const io_priority_class& pc) {
|
||||
void filesystem_storage::open(sstable& sst) {
|
||||
touch_temp_dir(sst).get0();
|
||||
auto file_path = sst.filename(component_type::TemporaryTOC);
|
||||
|
||||
@@ -126,7 +125,6 @@ void filesystem_storage::open(sstable& sst, const io_priority_class& pc) {
|
||||
// sstable being created in parallel with the same generation.
|
||||
file_output_stream_options options;
|
||||
options.buffer_size = 4096;
|
||||
options.io_priority_class = pc;
|
||||
auto w = sst.make_component_file_writer(component_type::TemporaryTOC, std::move(options)).get0();
|
||||
|
||||
bool toc_exists = file_exists(sst.filename(component_type::TOC)).get0();
|
||||
@@ -439,10 +437,10 @@ public:
|
||||
virtual future<> snapshot(const sstable& sst, sstring dir, absolute_path abs) const override;
|
||||
virtual future<> change_state(const sstable& sst, sstring to, generation_type generation, delayed_commit_changes* delay) override;
|
||||
// runs in async context
|
||||
virtual void open(sstable& sst, const io_priority_class& pc) override;
|
||||
virtual void open(sstable& sst) override;
|
||||
virtual future<> wipe(const sstable& sst) noexcept override;
|
||||
virtual future<file> open_component(const sstable& sst, component_type type, open_flags flags, file_open_options options, bool check_integrity) override;
|
||||
virtual future<data_sink> make_data_or_index_sink(sstable& sst, component_type type, io_priority_class pc) override;
|
||||
virtual future<data_sink> make_data_or_index_sink(sstable& sst, component_type type) override;
|
||||
virtual future<data_sink> make_component_sink(sstable& sst, component_type type, open_flags oflags, file_output_stream_options options) override;
|
||||
virtual future<> destroy(const sstable& sst) override {
|
||||
return make_ready_future<>();
|
||||
@@ -465,7 +463,7 @@ future<> s3_storage::ensure_remote_prefix(const sstable& sst) {
|
||||
}
|
||||
}
|
||||
|
||||
void s3_storage::open(sstable& sst, const io_priority_class& pc) {
|
||||
void s3_storage::open(sstable& sst) {
|
||||
auto uuid = utils::UUID_gen::get_time_UUID();
|
||||
entry_descriptor desc("", "", "", sst._generation, sst._version, sst._format, component_type::TOC);
|
||||
sst.manager().system_keyspace().sstables_registry_create_entry(_location, uuid, status_creating, std::move(desc)).get();
|
||||
@@ -489,7 +487,7 @@ future<file> s3_storage::open_component(const sstable& sst, component_type type,
|
||||
co_return _client->make_readable_file(make_s3_object_name(sst, type));
|
||||
}
|
||||
|
||||
future<data_sink> s3_storage::make_data_or_index_sink(sstable& sst, component_type type, io_priority_class pc) {
|
||||
future<data_sink> s3_storage::make_data_or_index_sink(sstable& sst, component_type type) {
|
||||
assert(type == component_type::Data || type == component_type::Index);
|
||||
co_await ensure_remote_prefix(sst);
|
||||
// FIXME: if we have file size upper bound upfront, it's better to use make_upload_sink() instead
|
||||
|
||||
@@ -53,10 +53,10 @@ public:
|
||||
virtual future<> snapshot(const sstable& sst, sstring dir, absolute_path abs) const = 0;
|
||||
virtual future<> change_state(const sstable& sst, sstring to, generation_type generation, delayed_commit_changes* delay) = 0;
|
||||
// runs in async context
|
||||
virtual void open(sstable& sst, const io_priority_class& pc) = 0;
|
||||
virtual void open(sstable& sst) = 0;
|
||||
virtual future<> wipe(const sstable& sst) noexcept = 0;
|
||||
virtual future<file> open_component(const sstable& sst, component_type type, open_flags flags, file_open_options options, bool check_integrity) = 0;
|
||||
virtual future<data_sink> make_data_or_index_sink(sstable& sst, component_type type, io_priority_class pc) = 0;
|
||||
virtual future<data_sink> make_data_or_index_sink(sstable& sst, component_type type) = 0;
|
||||
virtual future<data_sink> make_component_sink(sstable& sst, component_type type, open_flags oflags, file_output_stream_options options) = 0;
|
||||
virtual future<> destroy(const sstable& sst) = 0;
|
||||
virtual noncopyable_function<future<>(std::vector<shared_sstable>)> atomic_deleter() const = 0;
|
||||
|
||||
@@ -14,11 +14,11 @@
|
||||
namespace sstables {
|
||||
|
||||
sstable_writer::sstable_writer(sstable& sst, const schema& s, uint64_t estimated_partitions,
|
||||
const sstable_writer_config& cfg, encoding_stats enc_stats, const io_priority_class& pc, shard_id shard) {
|
||||
const sstable_writer_config& cfg, encoding_stats enc_stats, shard_id shard) {
|
||||
if (sst.get_version() < oldest_writable_sstable_format) {
|
||||
on_internal_error(sstlog, format("writing sstables with too old format: {}", static_cast<int>(sst.get_version())));
|
||||
}
|
||||
_impl = mc::make_writer(sst, s, estimated_partitions, cfg, enc_stats, pc, shard);
|
||||
_impl = mc::make_writer(sst, s, estimated_partitions, cfg, enc_stats, shard);
|
||||
if (cfg.replay_position) {
|
||||
_impl->_collector.set_replay_position(cfg.replay_position.value());
|
||||
}
|
||||
|
||||
@@ -20,7 +20,6 @@ namespace sstables {
|
||||
struct sstable_writer::writer_impl {
|
||||
sstable& _sst;
|
||||
const schema& _schema;
|
||||
const io_priority_class& _pc;
|
||||
const sstable_writer_config _cfg;
|
||||
// NOTE: _collector and _c_stats are used to generation of statistics file
|
||||
// when writing a new sstable.
|
||||
@@ -28,10 +27,9 @@ struct sstable_writer::writer_impl {
|
||||
column_stats _c_stats;
|
||||
mutation_fragment_stream_validating_filter _validator;
|
||||
|
||||
writer_impl(sstable& sst, const schema& schema, const io_priority_class& pc, const sstable_writer_config& cfg)
|
||||
writer_impl(sstable& sst, const schema& schema, const sstable_writer_config& cfg)
|
||||
: _sst(sst)
|
||||
, _schema(schema)
|
||||
, _pc(pc)
|
||||
, _cfg(cfg)
|
||||
, _collector(_schema, sst.get_filename(), sst.manager().get_local_host_id())
|
||||
, _validator(format("sstable writer {}", _sst.get_filename()), _schema, _cfg.validation_level)
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
#include "consumer.hh"
|
||||
#include "replica/database.hh"
|
||||
#include "mutation/mutation_source_metadata.hh"
|
||||
#include "service/priority_manager.hh"
|
||||
#include "db/view/view_update_generator.hh"
|
||||
#include "db/view/view_update_checks.hh"
|
||||
#include "sstables/sstables.hh"
|
||||
@@ -54,11 +53,10 @@ std::function<future<> (flat_mutation_reader_v2)> make_streaming_consumer(sstrin
|
||||
});
|
||||
}
|
||||
schema_ptr s = reader.schema();
|
||||
auto& pc = service::get_local_streaming_priority();
|
||||
|
||||
return sst->write_components(std::move(reader), adjusted_estimated_partitions, s,
|
||||
cf->get_sstables_manager().configure_writer(origin),
|
||||
encoding_stats{}, pc).then([sst] {
|
||||
encoding_stats{}).then([sst] {
|
||||
return sst->open_data();
|
||||
}).then([cf, sst, offstrategy, origin] {
|
||||
if (offstrategy && sstables::repair_origin == origin) {
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
*/
|
||||
|
||||
#include <seastar/core/distributed.hh>
|
||||
#include "service/priority_manager.hh"
|
||||
#include "gms/gossiper.hh"
|
||||
#include "streaming/stream_manager.hh"
|
||||
#include "streaming/stream_result_future.hh"
|
||||
@@ -95,7 +94,7 @@ future<> stream_manager::stop() {
|
||||
|
||||
future<> stream_manager::update_io_throughput(uint32_t value_mbs) {
|
||||
uint64_t bps = ((uint64_t)(value_mbs != 0 ? value_mbs : std::numeric_limits<uint32_t>::max())) << 20;
|
||||
return service::get_local_streaming_priority().update_bandwidth(bps).then_wrapped([value_mbs] (auto f) {
|
||||
return _streaming_group.update_io_bandwidth(bps).then_wrapped([value_mbs] (auto f) {
|
||||
if (f.failed()) {
|
||||
sslog.warn("Couldn't update streaming bandwidth: {}", f.get_exception());
|
||||
} else if (value_mbs != 0) {
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
#include "streaming/stream_state.hh"
|
||||
#include "streaming/stream_session_state.hh"
|
||||
#include "streaming/stream_exception.hh"
|
||||
#include "service/priority_manager.hh"
|
||||
#include "service/migration_manager.hh"
|
||||
#include "query-request.hh"
|
||||
#include "schema/schema_registry.hh"
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
#include "range.hh"
|
||||
#include "dht/i_partitioner.hh"
|
||||
#include "dht/sharder.hh"
|
||||
#include "service/priority_manager.hh"
|
||||
#include <boost/range/irange.hpp>
|
||||
#include <boost/icl/interval.hpp>
|
||||
#include <boost/icl/interval_set.hpp>
|
||||
|
||||
@@ -54,13 +54,13 @@ static sstring read_to_string(file& f, size_t start, size_t len) {
|
||||
}
|
||||
|
||||
static sstring read_to_string(cached_file& cf, size_t off, size_t limit = std::numeric_limits<size_t>::max()) {
|
||||
auto s = cf.read(off, default_priority_class(), std::nullopt);
|
||||
auto s = cf.read(off, std::nullopt);
|
||||
return read_to_string(s, limit);
|
||||
}
|
||||
|
||||
[[gnu::unused]]
|
||||
static void read_to_void(cached_file& cf, size_t off, size_t limit = std::numeric_limits<size_t>::max()) {
|
||||
auto s = cf.read(off, default_priority_class(), std::nullopt);
|
||||
auto s = cf.read(off, std::nullopt);
|
||||
read_to_void(s, limit);
|
||||
}
|
||||
|
||||
@@ -270,8 +270,8 @@ private:
|
||||
}
|
||||
public:
|
||||
// unsupported
|
||||
virtual future<size_t> write_dma(uint64_t pos, const void* buffer, size_t len, const io_priority_class& pc) override { unsupported(); }
|
||||
virtual future<size_t> write_dma(uint64_t pos, std::vector<iovec> iov, const io_priority_class& pc) override { unsupported(); }
|
||||
virtual future<size_t> write_dma(uint64_t pos, const void* buffer, size_t len, io_intent*) override { unsupported(); }
|
||||
virtual future<size_t> write_dma(uint64_t pos, std::vector<iovec> iov, io_intent*) override { unsupported(); }
|
||||
virtual future<> flush(void) override { unsupported(); }
|
||||
virtual future<> truncate(uint64_t length) override { unsupported(); }
|
||||
virtual future<> discard(uint64_t offset, uint64_t length) override { unsupported(); }
|
||||
@@ -283,15 +283,15 @@ public:
|
||||
|
||||
virtual future<> close() override { return make_ready_future<>(); }
|
||||
|
||||
virtual future<temporary_buffer<uint8_t>> dma_read_bulk(uint64_t offset, size_t size, const io_priority_class& pc) override {
|
||||
virtual future<temporary_buffer<uint8_t>> dma_read_bulk(uint64_t offset, size_t size, io_intent*) override {
|
||||
return make_ready_future<temporary_buffer<uint8_t>>(temporary_buffer<uint8_t>(size));
|
||||
}
|
||||
|
||||
virtual future<size_t> read_dma(uint64_t pos, void* buffer, size_t len, const io_priority_class& pc) override {
|
||||
virtual future<size_t> read_dma(uint64_t pos, void* buffer, size_t len, io_intent*) override {
|
||||
unsupported(); // FIXME
|
||||
}
|
||||
|
||||
virtual future<size_t> read_dma(uint64_t pos, std::vector<iovec> iov, const io_priority_class& pc) override {
|
||||
virtual future<size_t> read_dma(uint64_t pos, std::vector<iovec> iov, io_intent*) override {
|
||||
unsupported(); // FIXME
|
||||
}
|
||||
};
|
||||
|
||||
@@ -36,7 +36,6 @@
|
||||
#include "db/extensions.hh"
|
||||
#include "readers/combined.hh"
|
||||
#include "log.hh"
|
||||
#include "service/priority_manager.hh"
|
||||
#include "test/lib/exception_utils.hh"
|
||||
#include "test/lib/cql_test_env.hh"
|
||||
#include "test/lib/data_model.hh"
|
||||
@@ -355,7 +354,7 @@ SEASTAR_TEST_CASE(test_commitlog_delete_when_over_disk_limit) {
|
||||
SEASTAR_TEST_CASE(test_commitlog_reader){
|
||||
static auto count_mutations_in_segment = [] (sstring path) -> future<size_t> {
|
||||
auto count = make_lw_shared<size_t>(0);
|
||||
return db::commitlog::read_log_file(path, db::commitlog::descriptor::FILENAME_PREFIX, service::get_local_commitlog_priority(), [count](db::commitlog::buffer_and_replay_position buf_rp) {
|
||||
return db::commitlog::read_log_file(path, db::commitlog::descriptor::FILENAME_PREFIX, [count](db::commitlog::buffer_and_replay_position buf_rp) {
|
||||
auto&& [buf, rp] = buf_rp;
|
||||
auto linearization_buffer = bytes_ostream();
|
||||
auto in = buf.get_istream();
|
||||
@@ -456,7 +455,7 @@ SEASTAR_TEST_CASE(test_commitlog_entry_corruption){
|
||||
BOOST_REQUIRE(!segments.empty());
|
||||
auto seg = segments[0];
|
||||
return corrupt_segment(seg, rps->at(1).pos + 4, 0x451234ab).then([seg, rps] {
|
||||
return db::commitlog::read_log_file(seg, db::commitlog::descriptor::FILENAME_PREFIX, service::get_local_commitlog_priority(), [rps](db::commitlog::buffer_and_replay_position buf_rp) {
|
||||
return db::commitlog::read_log_file(seg, db::commitlog::descriptor::FILENAME_PREFIX, [rps](db::commitlog::buffer_and_replay_position buf_rp) {
|
||||
auto&& [buf, rp] = buf_rp;
|
||||
BOOST_CHECK_EQUAL(rp, rps->at(0));
|
||||
return make_ready_future<>();
|
||||
@@ -496,7 +495,7 @@ SEASTAR_TEST_CASE(test_commitlog_chunk_corruption){
|
||||
BOOST_REQUIRE(!segments.empty());
|
||||
auto seg = segments[0];
|
||||
return corrupt_segment(seg, rps->at(0).pos - 4, 0x451234ab).then([seg, rps] {
|
||||
return db::commitlog::read_log_file(seg, db::commitlog::descriptor::FILENAME_PREFIX, service::get_local_commitlog_priority(), [rps](db::commitlog::buffer_and_replay_position buf_rp) {
|
||||
return db::commitlog::read_log_file(seg, db::commitlog::descriptor::FILENAME_PREFIX, [rps](db::commitlog::buffer_and_replay_position buf_rp) {
|
||||
BOOST_FAIL("Should not reach");
|
||||
return make_ready_future<>();
|
||||
}).then_wrapped([](auto&& f) {
|
||||
@@ -534,7 +533,7 @@ SEASTAR_TEST_CASE(test_commitlog_reader_produce_exception){
|
||||
auto segments = log.get_active_segment_names();
|
||||
BOOST_REQUIRE(!segments.empty());
|
||||
auto seg = segments[0];
|
||||
return db::commitlog::read_log_file(seg, db::commitlog::descriptor::FILENAME_PREFIX, service::get_local_commitlog_priority(), [](db::commitlog::buffer_and_replay_position buf_rp) {
|
||||
return db::commitlog::read_log_file(seg, db::commitlog::descriptor::FILENAME_PREFIX, [](db::commitlog::buffer_and_replay_position buf_rp) {
|
||||
return make_exception_future(std::runtime_error("I am in a throwing mode"));
|
||||
}).then_wrapped([](auto&& f) {
|
||||
try {
|
||||
@@ -698,7 +697,7 @@ SEASTAR_TEST_CASE(test_commitlog_add_entries) {
|
||||
std::unordered_set<replay_position> result;
|
||||
|
||||
for (auto& seg : segments) {
|
||||
db::commitlog::read_log_file(seg, db::commitlog::descriptor::FILENAME_PREFIX, service::get_local_commitlog_priority(), [&](db::commitlog::buffer_and_replay_position buf_rp) {
|
||||
db::commitlog::read_log_file(seg, db::commitlog::descriptor::FILENAME_PREFIX, [&](db::commitlog::buffer_and_replay_position buf_rp) {
|
||||
commitlog_entry_reader r(buf_rp.buffer);
|
||||
auto& rp = buf_rp.position;
|
||||
auto i = std::find(rps.begin(), rps.end(), rp);
|
||||
|
||||
@@ -275,11 +275,10 @@ static void test_database(void (*run_tests)(populate_fn_ex, bool)) {
|
||||
reader_permit permit,
|
||||
const dht::partition_range& range,
|
||||
const query::partition_slice& slice,
|
||||
const io_priority_class& pc,
|
||||
tracing::trace_state_ptr trace_state,
|
||||
streamed_mutation::forwarding fwd,
|
||||
mutation_reader::forwarding fwd_mr) {
|
||||
return cf.make_reader_v2(s, std::move(permit), range, slice, pc, std::move(trace_state), fwd, fwd_mr);
|
||||
return cf.make_reader_v2(s, std::move(permit), range, slice, std::move(trace_state), fwd, fwd_mr);
|
||||
});
|
||||
}, true);
|
||||
}).get();
|
||||
@@ -1278,7 +1277,6 @@ SEASTAR_TEST_CASE(database_drop_column_family_clears_querier_cache) {
|
||||
database_test(db).get_user_read_concurrency_semaphore().make_tracking_only_permit(s.get(), "test", db::no_timeout, {}),
|
||||
query::full_partition_range,
|
||||
s->full_slice(),
|
||||
default_priority_class(),
|
||||
nullptr);
|
||||
|
||||
auto f = replica::database::drop_table_on_all_shards(e.db(), "ks", "cf");
|
||||
|
||||
@@ -895,7 +895,6 @@ SEASTAR_THREAD_TEST_CASE(test_make_nonforwardable_from_mutations_as_mutation_sou
|
||||
reader_permit permit,
|
||||
const dht::partition_range& range,
|
||||
const query::partition_slice& slice,
|
||||
const io_priority_class&,
|
||||
tracing::trace_state_ptr,
|
||||
streamed_mutation::forwarding fwd_sm,
|
||||
mutation_reader::forwarding) mutable {
|
||||
@@ -935,7 +934,6 @@ SEASTAR_THREAD_TEST_CASE(test_mutation_reader_from_mutations_as_mutation_source)
|
||||
reader_permit permit,
|
||||
const dht::partition_range& range,
|
||||
const query::partition_slice& slice,
|
||||
const io_priority_class&,
|
||||
tracing::trace_state_ptr,
|
||||
streamed_mutation::forwarding fwd_sm,
|
||||
mutation_reader::forwarding) mutable {
|
||||
@@ -952,7 +950,6 @@ SEASTAR_THREAD_TEST_CASE(test_mutation_reader_from_mutations_v2_as_mutation_sour
|
||||
reader_permit permit,
|
||||
const dht::partition_range& range,
|
||||
const query::partition_slice& slice,
|
||||
const io_priority_class&,
|
||||
tracing::trace_state_ptr,
|
||||
streamed_mutation::forwarding fwd_sm,
|
||||
mutation_reader::forwarding) mutable {
|
||||
@@ -970,7 +967,6 @@ SEASTAR_THREAD_TEST_CASE(test_mutation_reader_from_fragments_v2_as_mutation_sour
|
||||
reader_permit permit,
|
||||
const dht::partition_range& range,
|
||||
const query::partition_slice& slice,
|
||||
const io_priority_class&,
|
||||
tracing::trace_state_ptr,
|
||||
streamed_mutation::forwarding fwd_sm,
|
||||
mutation_reader::forwarding) mutable {
|
||||
@@ -1131,7 +1127,6 @@ SEASTAR_THREAD_TEST_CASE(test_reverse_reader_v2_is_mutation_source) {
|
||||
reader_permit permit,
|
||||
const dht::partition_range& range,
|
||||
const query::partition_slice& slice,
|
||||
const io_priority_class& pc,
|
||||
tracing::trace_state_ptr trace_ptr,
|
||||
streamed_mutation::forwarding fwd_sm,
|
||||
mutation_reader::forwarding fwd_mr) mutable {
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
*/
|
||||
|
||||
#include <boost/test/unit_test.hpp>
|
||||
#include "service/priority_manager.hh"
|
||||
#include "replica/database.hh"
|
||||
#include "db/config.hh"
|
||||
#include "utils/UUID_gen.hh"
|
||||
@@ -537,7 +536,7 @@ SEASTAR_THREAD_TEST_CASE(test_tombstone_compaction_during_flush) {
|
||||
mt->apply(m);
|
||||
}
|
||||
|
||||
auto rd1 = mt->make_flat_reader(ss.schema(), semaphore.make_permit(), pr, s->full_slice(), default_priority_class(),
|
||||
auto rd1 = mt->make_flat_reader(ss.schema(), semaphore.make_permit(), pr, s->full_slice(),
|
||||
nullptr, streamed_mutation::forwarding::no, mutation_reader::forwarding::no);
|
||||
auto close_rd1 = defer([&] { rd1.close().get(); });
|
||||
|
||||
@@ -547,7 +546,7 @@ SEASTAR_THREAD_TEST_CASE(test_tombstone_compaction_during_flush) {
|
||||
auto rt = ss.delete_range(rt_m, ss.make_ckey_range(0, n_rows));
|
||||
mt->apply(rt_m);
|
||||
|
||||
auto rd2 = mt->make_flat_reader(ss.schema(), semaphore.make_permit(), pr, s->full_slice(), default_priority_class(),
|
||||
auto rd2 = mt->make_flat_reader(ss.schema(), semaphore.make_permit(), pr, s->full_slice(),
|
||||
nullptr, streamed_mutation::forwarding::no, mutation_reader::forwarding::no);
|
||||
auto close_rd2 = defer([&] { rd2.close().get(); });
|
||||
|
||||
@@ -614,7 +613,7 @@ SEASTAR_THREAD_TEST_CASE(test_tombstone_merging_with_multiple_versions) {
|
||||
|
||||
mt->apply(m1);
|
||||
|
||||
auto rd1 = mt->make_flat_reader(s, semaphore.make_permit(), pr, s->full_slice(), default_priority_class(),
|
||||
auto rd1 = mt->make_flat_reader(s, semaphore.make_permit(), pr, s->full_slice(),
|
||||
nullptr, streamed_mutation::forwarding::no, mutation_reader::forwarding::no);
|
||||
auto close_rd1 = defer([&] { rd1.close().get(); });
|
||||
|
||||
@@ -623,7 +622,7 @@ SEASTAR_THREAD_TEST_CASE(test_tombstone_merging_with_multiple_versions) {
|
||||
|
||||
mt->apply(m2);
|
||||
|
||||
auto rd2 = mt->make_flat_reader(s, semaphore.make_permit(), pr, s->full_slice(), default_priority_class(),
|
||||
auto rd2 = mt->make_flat_reader(s, semaphore.make_permit(), pr, s->full_slice(),
|
||||
nullptr, streamed_mutation::forwarding::no, mutation_reader::forwarding::no);
|
||||
auto close_r2 = defer([&] { rd2.close().get(); });
|
||||
|
||||
@@ -662,7 +661,7 @@ SEASTAR_THREAD_TEST_CASE(test_tombstone_merging_with_mvcc_and_preemption) {
|
||||
mt->apply(m0);
|
||||
|
||||
std::optional<flat_mutation_reader_v2> rd0 = mt->make_flat_reader(
|
||||
s, semaphore.make_permit(), pr, s->full_slice(), default_priority_class(),
|
||||
s, semaphore.make_permit(), pr, s->full_slice(),
|
||||
nullptr, streamed_mutation::forwarding::no, mutation_reader::forwarding::no);
|
||||
auto close_rd0 = defer([&] { rd0->close().get(); });
|
||||
rd0->fill_buffer().get();
|
||||
@@ -676,7 +675,7 @@ SEASTAR_THREAD_TEST_CASE(test_tombstone_merging_with_mvcc_and_preemption) {
|
||||
mt->apply(m1);
|
||||
|
||||
std::optional<flat_mutation_reader_v2> rd1 = mt->make_flat_reader(
|
||||
s, semaphore.make_permit(), pr, s->full_slice(), default_priority_class(),
|
||||
s, semaphore.make_permit(), pr, s->full_slice(),
|
||||
nullptr, streamed_mutation::forwarding::no, mutation_reader::forwarding::no);
|
||||
auto close_rd1 = defer([&] { rd1->close().get(); });
|
||||
rd1->fill_buffer().get();
|
||||
|
||||
@@ -25,7 +25,6 @@
|
||||
|
||||
#include "dht/sharder.hh"
|
||||
#include "schema/schema_registry.hh"
|
||||
#include "service/priority_manager.hh"
|
||||
#include "readers/forwardable_v2.hh"
|
||||
|
||||
// It has to be a container that does not invalidate pointers
|
||||
@@ -66,7 +65,6 @@ static auto make_populate(bool evict_paused_readers, bool single_fragment_buffer
|
||||
reader_permit permit,
|
||||
const dht::partition_range& range,
|
||||
const query::partition_slice& slice,
|
||||
const io_priority_class& pc,
|
||||
tracing::trace_state_ptr trace_state,
|
||||
streamed_mutation::forwarding fwd_sm,
|
||||
mutation_reader::forwarding fwd_mr) mutable {
|
||||
@@ -75,10 +73,9 @@ static auto make_populate(bool evict_paused_readers, bool single_fragment_buffer
|
||||
reader_permit permit,
|
||||
const dht::partition_range& range,
|
||||
const query::partition_slice& slice,
|
||||
const io_priority_class& pc,
|
||||
tracing::trace_state_ptr trace_state,
|
||||
mutation_reader::forwarding fwd_mr) {
|
||||
auto reader = remote_memtables->at(this_shard_id())->make_flat_reader(s, std::move(permit), range, slice, pc, std::move(trace_state),
|
||||
auto reader = remote_memtables->at(this_shard_id())->make_flat_reader(s, std::move(permit), range, slice, std::move(trace_state),
|
||||
streamed_mutation::forwarding::no, fwd_mr);
|
||||
if (single_fragment_buffer) {
|
||||
reader.set_max_buffer_size(1);
|
||||
@@ -88,7 +85,7 @@ static auto make_populate(bool evict_paused_readers, bool single_fragment_buffer
|
||||
|
||||
auto lifecycle_policy = seastar::make_shared<test_reader_lifecycle_policy>(std::move(factory), evict_paused_readers);
|
||||
auto mr = make_multishard_combining_reader_v2_for_tests(keep_alive_sharder.back(), std::move(lifecycle_policy), s,
|
||||
std::move(permit), range, slice, pc, trace_state, fwd_mr);
|
||||
std::move(permit), range, slice, trace_state, fwd_mr);
|
||||
if (fwd_sm == streamed_mutation::forwarding::yes) {
|
||||
return make_forwardable(std::move(mr));
|
||||
}
|
||||
|
||||
@@ -59,14 +59,13 @@ SEASTAR_TEST_CASE(test_mutation_merger_conforms_to_mutation_source) {
|
||||
reader_permit permit,
|
||||
const dht::partition_range& range,
|
||||
const query::partition_slice& slice,
|
||||
const io_priority_class& pc,
|
||||
tracing::trace_state_ptr trace_state,
|
||||
streamed_mutation::forwarding fwd,
|
||||
mutation_reader::forwarding fwd_mr)
|
||||
{
|
||||
std::vector<flat_mutation_reader_v2> readers;
|
||||
for (int i = 0; i < n; ++i) {
|
||||
readers.push_back(memtables[i]->make_flat_reader(s, permit, range, slice, pc, trace_state, fwd, fwd_mr));
|
||||
readers.push_back(memtables[i]->make_flat_reader(s, permit, range, slice, trace_state, fwd, fwd_mr));
|
||||
}
|
||||
return make_combined_reader(s, std::move(permit), std::move(readers), fwd, fwd_mr);
|
||||
});
|
||||
|
||||
@@ -31,7 +31,6 @@
|
||||
#include "readers/from_mutations_v2.hh"
|
||||
#include "mutation/mutation_rebuilder.hh"
|
||||
#include "readers/mutation_source.hh"
|
||||
#include "service/priority_manager.hh"
|
||||
|
||||
using namespace std::literals::chrono_literals;
|
||||
|
||||
@@ -54,7 +53,7 @@ struct mutation_less_cmp {
|
||||
};
|
||||
static mutation_source make_source(std::vector<mutation> mutations) {
|
||||
return mutation_source([mutations = std::move(mutations)] (schema_ptr s, reader_permit permit, const dht::partition_range& range, const query::partition_slice& slice,
|
||||
const io_priority_class& pc, tracing::trace_state_ptr, streamed_mutation::forwarding fwd, mutation_reader::forwarding fwd_mr) {
|
||||
tracing::trace_state_ptr, streamed_mutation::forwarding fwd, mutation_reader::forwarding fwd_mr) {
|
||||
assert(range.is_full()); // slicing not implemented yet
|
||||
for (auto&& m : mutations) {
|
||||
if (slice.options.contains(query::partition_slice::option::reversed)) {
|
||||
@@ -85,7 +84,7 @@ query::result_set to_result_set(const reconcilable_result& r, schema_ptr s, cons
|
||||
static reconcilable_result mutation_query(schema_ptr s, reader_permit permit, const mutation_source& source, const dht::partition_range& range,
|
||||
const query::partition_slice& slice, uint64_t row_limit, uint32_t partition_limit, gc_clock::time_point query_time) {
|
||||
|
||||
auto querier = query::querier(source, s, std::move(permit), range, slice, service::get_local_sstable_query_read_priority(), {});
|
||||
auto querier = query::querier(source, s, std::move(permit), range, slice, {});
|
||||
auto close_querier = deferred_close(querier);
|
||||
auto table_schema = slice.options.contains(query::partition_slice::option::reversed) ? s->make_reversed() : s;
|
||||
auto rrb = reconcilable_result_builder(*table_schema, slice, make_accounter());
|
||||
@@ -539,7 +538,7 @@ SEASTAR_TEST_CASE(test_partition_limit) {
|
||||
|
||||
static void data_query(schema_ptr s, reader_permit permit, const mutation_source& source, const dht::partition_range& range,
|
||||
const query::partition_slice& slice, query::result::builder& builder) {
|
||||
auto querier = query::querier(source, s, std::move(permit), range, slice, service::get_local_sstable_query_read_priority(), {});
|
||||
auto querier = query::querier(source, s, std::move(permit), range, slice, {});
|
||||
auto close_querier = deferred_close(querier);
|
||||
auto qrb = query_result_builder(*s, builder);
|
||||
querier.consume_page(std::move(qrb), std::numeric_limits<uint32_t>::max(), std::numeric_limits<uint32_t>::max(), gc_clock::now()).get();
|
||||
|
||||
@@ -43,7 +43,6 @@
|
||||
#include "replica/database.hh"
|
||||
#include "partition_slice_builder.hh"
|
||||
#include "schema/schema_registry.hh"
|
||||
#include "service/priority_manager.hh"
|
||||
#include "utils/ranges.hh"
|
||||
#include "mutation/mutation_rebuilder.hh"
|
||||
|
||||
@@ -739,7 +738,6 @@ SEASTAR_TEST_CASE(combined_mutation_reader_test) {
|
||||
list_permit,
|
||||
query::full_partition_range,
|
||||
s.schema()->full_slice(),
|
||||
seastar::default_priority_class(),
|
||||
nullptr,
|
||||
streamed_mutation::forwarding::no,
|
||||
mutation_reader::forwarding::no));
|
||||
@@ -753,7 +751,6 @@ SEASTAR_TEST_CASE(combined_mutation_reader_test) {
|
||||
env.make_reader_permit(),
|
||||
query::full_partition_range,
|
||||
s.schema()->full_slice(),
|
||||
seastar::default_priority_class(),
|
||||
nullptr,
|
||||
streamed_mutation::forwarding::no,
|
||||
mutation_reader::forwarding::no);
|
||||
@@ -1021,7 +1018,7 @@ SEASTAR_TEST_CASE(test_fast_forwarding_combined_reader_is_consistent_with_slicin
|
||||
readers.push_back(ds.make_reader_v2(s,
|
||||
permit,
|
||||
reader_ranges.back(),
|
||||
s->full_slice(), default_priority_class(), nullptr,
|
||||
s->full_slice(), nullptr,
|
||||
streamed_mutation::forwarding::yes,
|
||||
mutation_reader::forwarding::yes));
|
||||
}
|
||||
@@ -1119,9 +1116,9 @@ SEASTAR_TEST_CASE(test_combined_reader_slicing_with_overlapping_range_tombstones
|
||||
// Check fast_forward_to()
|
||||
{
|
||||
auto permit = env.make_reader_permit();
|
||||
readers.push_back(ds1.make_reader_v2(s, permit, query::full_partition_range, s->full_slice(), default_priority_class(),
|
||||
readers.push_back(ds1.make_reader_v2(s, permit, query::full_partition_range, s->full_slice(),
|
||||
nullptr, streamed_mutation::forwarding::yes));
|
||||
readers.push_back(ds2.make_reader_v2(s, permit, query::full_partition_range, s->full_slice(), default_priority_class(),
|
||||
readers.push_back(ds2.make_reader_v2(s, permit, query::full_partition_range, s->full_slice(),
|
||||
nullptr, streamed_mutation::forwarding::yes));
|
||||
|
||||
auto rd = mutation_fragment_v1_stream(make_combined_reader(s, permit, std::move(readers),
|
||||
@@ -1221,7 +1218,6 @@ SEASTAR_THREAD_TEST_CASE(test_foreign_reader_as_mutation_source) {
|
||||
reader_permit permit,
|
||||
const dht::partition_range& range,
|
||||
const query::partition_slice& slice,
|
||||
const io_priority_class& pc,
|
||||
tracing::trace_state_ptr trace_state,
|
||||
streamed_mutation::forwarding fwd_sm,
|
||||
mutation_reader::forwarding fwd_mr) {
|
||||
@@ -1231,7 +1227,6 @@ SEASTAR_THREAD_TEST_CASE(test_foreign_reader_as_mutation_source) {
|
||||
make_reader_permit(env),
|
||||
range,
|
||||
slice,
|
||||
pc,
|
||||
trace_state.get(),
|
||||
fwd_sm,
|
||||
fwd_mr)));
|
||||
@@ -1245,11 +1240,10 @@ SEASTAR_THREAD_TEST_CASE(test_foreign_reader_as_mutation_source) {
|
||||
reader_permit permit,
|
||||
const dht::partition_range& range,
|
||||
const query::partition_slice& slice,
|
||||
const io_priority_class& pc,
|
||||
tracing::trace_state_ptr trace_state,
|
||||
streamed_mutation::forwarding fwd_sm,
|
||||
mutation_reader::forwarding fwd_mr) {
|
||||
return (*reader_factory_ptr)(std::move(s), std::move(permit), range, slice, pc, std::move(trace_state), fwd_sm, fwd_mr);
|
||||
return (*reader_factory_ptr)(std::move(s), std::move(permit), range, slice, std::move(trace_state), fwd_sm, fwd_mr);
|
||||
});
|
||||
};
|
||||
|
||||
@@ -1606,7 +1600,6 @@ SEASTAR_THREAD_TEST_CASE(test_multishard_combining_reader_reading_empty_table) {
|
||||
reader_permit permit,
|
||||
const dht::partition_range& range,
|
||||
const query::partition_slice& slice,
|
||||
const io_priority_class& pc,
|
||||
tracing::trace_state_ptr trace_state,
|
||||
mutation_reader::forwarding fwd_mr) {
|
||||
shards_touched[this_shard_id()] = true;
|
||||
@@ -1618,8 +1611,7 @@ SEASTAR_THREAD_TEST_CASE(test_multishard_combining_reader_reading_empty_table) {
|
||||
s.schema(),
|
||||
make_reader_permit(env),
|
||||
query::full_partition_range,
|
||||
s.schema()->full_slice(),
|
||||
service::get_local_sstable_query_read_priority()))
|
||||
s.schema()->full_slice()))
|
||||
.produces_end_of_stream();
|
||||
|
||||
for (unsigned i = 0; i < smp::count; ++i) {
|
||||
@@ -1867,7 +1859,6 @@ multishard_reader_for_read_ahead prepare_multishard_reader_for_read_ahead_test(s
|
||||
reader_permit permit,
|
||||
const dht::partition_range& range,
|
||||
const query::partition_slice& slice,
|
||||
const io_priority_class& pc,
|
||||
tracing::trace_state_ptr trace_state,
|
||||
mutation_reader::forwarding) mutable {
|
||||
const auto shard = this_shard_id();
|
||||
@@ -1888,7 +1879,7 @@ multishard_reader_for_read_ahead prepare_multishard_reader_for_read_ahead_test(s
|
||||
|
||||
auto sharder = std::make_unique<dummy_sharder>(s.schema()->get_sharder(), std::move(pkeys_by_tokens));
|
||||
auto reader = make_multishard_combining_reader_v2_for_tests(*sharder, seastar::make_shared<test_reader_lifecycle_policy>(std::move(factory)),
|
||||
s.schema(), permit, *pr, s.schema()->full_slice(), service::get_local_sstable_query_read_priority());
|
||||
s.schema(), permit, *pr, s.schema()->full_slice());
|
||||
|
||||
return {std::move(reader), std::move(sharder), std::move(remote_controls), std::move(pr)};
|
||||
}
|
||||
@@ -1911,7 +1902,6 @@ SEASTAR_THREAD_TEST_CASE(test_multishard_combining_reader_custom_shard_number) {
|
||||
reader_permit permit,
|
||||
const dht::partition_range& range,
|
||||
const query::partition_slice& slice,
|
||||
const io_priority_class& pc,
|
||||
tracing::trace_state_ptr trace_state,
|
||||
mutation_reader::forwarding fwd_mr) {
|
||||
shards_touched[this_shard_id()] = true;
|
||||
@@ -1924,8 +1914,7 @@ SEASTAR_THREAD_TEST_CASE(test_multishard_combining_reader_custom_shard_number) {
|
||||
s.schema(),
|
||||
make_reader_permit(env),
|
||||
query::full_partition_range,
|
||||
s.schema()->full_slice(),
|
||||
service::get_local_sstable_query_read_priority()))
|
||||
s.schema()->full_slice()))
|
||||
.produces_end_of_stream();
|
||||
|
||||
for (unsigned i = 0; i < no_shards; ++i) {
|
||||
@@ -1952,7 +1941,6 @@ SEASTAR_THREAD_TEST_CASE(test_multishard_combining_reader_only_reads_from_needed
|
||||
reader_permit permit,
|
||||
const dht::partition_range& range,
|
||||
const query::partition_slice& slice,
|
||||
const io_priority_class& pc,
|
||||
tracing::trace_state_ptr trace_state,
|
||||
mutation_reader::forwarding fwd_mr) {
|
||||
shards_touched[this_shard_id()] = true;
|
||||
@@ -1991,8 +1979,7 @@ SEASTAR_THREAD_TEST_CASE(test_multishard_combining_reader_only_reads_from_needed
|
||||
s.schema(),
|
||||
make_reader_permit(env),
|
||||
pr,
|
||||
s.schema()->full_slice(),
|
||||
service::get_local_sstable_query_read_priority()))
|
||||
s.schema()->full_slice()))
|
||||
.produces_end_of_stream();
|
||||
|
||||
for (unsigned i = 0; i < smp::count; ++i) {
|
||||
@@ -2196,7 +2183,6 @@ SEASTAR_THREAD_TEST_CASE(test_multishard_combining_reader_next_partition) {
|
||||
reader_permit permit,
|
||||
const dht::partition_range& range,
|
||||
const query::partition_slice& slice,
|
||||
const io_priority_class& pc,
|
||||
tracing::trace_state_ptr trace_state,
|
||||
mutation_reader::forwarding fwd_mr) {
|
||||
auto& table = db->local().find_column_family(schema);
|
||||
@@ -2205,7 +2191,6 @@ SEASTAR_THREAD_TEST_CASE(test_multishard_combining_reader_next_partition) {
|
||||
std::move(permit),
|
||||
range,
|
||||
slice,
|
||||
service::get_local_sstable_query_read_priority(),
|
||||
std::move(trace_state),
|
||||
streamed_mutation::forwarding::no,
|
||||
fwd_mr);
|
||||
@@ -2217,8 +2202,7 @@ SEASTAR_THREAD_TEST_CASE(test_multishard_combining_reader_next_partition) {
|
||||
schema,
|
||||
make_reader_permit(env),
|
||||
query::full_partition_range,
|
||||
schema->full_slice(),
|
||||
service::get_local_sstable_query_read_priority());
|
||||
schema->full_slice());
|
||||
|
||||
reader.set_max_buffer_size(max_buffer_size);
|
||||
|
||||
@@ -2284,16 +2268,15 @@ SEASTAR_THREAD_TEST_CASE(test_multishard_streaming_reader) {
|
||||
reader_permit permit,
|
||||
const dht::partition_range& range,
|
||||
const query::partition_slice& slice,
|
||||
const io_priority_class& pc,
|
||||
tracing::trace_state_ptr trace_state,
|
||||
mutation_reader::forwarding fwd_mr) mutable {
|
||||
auto& table = db->local().find_column_family(s);
|
||||
return table.as_mutation_source().make_reader_v2(std::move(s), std::move(permit), range, slice, pc, std::move(trace_state),
|
||||
return table.as_mutation_source().make_reader_v2(std::move(s), std::move(permit), range, slice, std::move(trace_state),
|
||||
streamed_mutation::forwarding::no, fwd_mr);
|
||||
};
|
||||
auto reference_reader = make_filtering_reader(
|
||||
make_multishard_combining_reader_v2(seastar::make_shared<test_reader_lifecycle_policy>(std::move(reader_factory)),
|
||||
schema, make_reader_permit(env), partition_range, schema->full_slice(), service::get_local_sstable_query_read_priority()),
|
||||
schema, make_reader_permit(env), partition_range, schema->full_slice()),
|
||||
[&remote_partitioner] (const dht::decorated_key& pkey) {
|
||||
return remote_partitioner.shard_of(pkey.token()) == 0;
|
||||
});
|
||||
@@ -2531,11 +2514,10 @@ SEASTAR_THREAD_TEST_CASE(test_compacting_reader_as_mutation_source) {
|
||||
reader_permit permit,
|
||||
const dht::partition_range& range,
|
||||
const query::partition_slice& slice,
|
||||
const io_priority_class& pc,
|
||||
tracing::trace_state_ptr trace_state,
|
||||
streamed_mutation::forwarding fwd_sm,
|
||||
mutation_reader::forwarding fwd_mr) mutable {
|
||||
auto source = mt->make_flat_reader(s, std::move(permit), range, slice, pc, std::move(trace_state), streamed_mutation::forwarding::no, fwd_mr);
|
||||
auto source = mt->make_flat_reader(s, std::move(permit), range, slice, std::move(trace_state), streamed_mutation::forwarding::no, fwd_mr);
|
||||
if (fwd_sm == streamed_mutation::forwarding::yes) {
|
||||
source = make_forwardable(std::move(source));
|
||||
}
|
||||
@@ -2659,11 +2641,10 @@ SEASTAR_THREAD_TEST_CASE(test_auto_paused_evictable_reader_is_mutation_source) {
|
||||
reader_permit permit,
|
||||
const dht::partition_range& range,
|
||||
const query::partition_slice& slice,
|
||||
const io_priority_class& pc,
|
||||
tracing::trace_state_ptr trace_state,
|
||||
streamed_mutation::forwarding fwd_sm,
|
||||
mutation_reader::forwarding fwd_mr) mutable {
|
||||
auto mr = make_auto_paused_evictable_reader_v2(mt->as_data_source(), std::move(s), permit, range, slice, pc, std::move(trace_state), fwd_mr);
|
||||
auto mr = make_auto_paused_evictable_reader_v2(mt->as_data_source(), std::move(s), permit, range, slice, std::move(trace_state), fwd_mr);
|
||||
if (fwd_sm == streamed_mutation::forwarding::yes) {
|
||||
return make_forwardable(std::move(mr));
|
||||
}
|
||||
@@ -2693,11 +2674,10 @@ SEASTAR_THREAD_TEST_CASE(test_manual_paused_evictable_reader_is_mutation_source)
|
||||
reader_permit permit,
|
||||
const dht::partition_range& pr,
|
||||
const query::partition_slice& ps,
|
||||
const io_priority_class& pc,
|
||||
tracing::trace_state_ptr trace_state,
|
||||
mutation_reader::forwarding fwd_mr)
|
||||
: impl(std::move(query_schema), std::move(permit)), _reader(nullptr) {
|
||||
std::tie(_reader, _handle) = make_manually_paused_evictable_reader_v2(mt.as_data_source(), _schema, _permit, pr, ps, pc,
|
||||
std::tie(_reader, _handle) = make_manually_paused_evictable_reader_v2(mt.as_data_source(), _schema, _permit, pr, ps,
|
||||
std::move(trace_state), fwd_mr);
|
||||
}
|
||||
virtual future<> fill_buffer() override {
|
||||
@@ -2741,11 +2721,10 @@ SEASTAR_THREAD_TEST_CASE(test_manual_paused_evictable_reader_is_mutation_source)
|
||||
reader_permit permit,
|
||||
const dht::partition_range& range,
|
||||
const query::partition_slice& slice,
|
||||
const io_priority_class& pc,
|
||||
tracing::trace_state_ptr trace_state,
|
||||
streamed_mutation::forwarding fwd_sm,
|
||||
mutation_reader::forwarding fwd_mr) mutable {
|
||||
auto mr = make_flat_mutation_reader_v2<maybe_pausing_reader>(*mt, s, std::move(permit), range, slice, pc, std::move(trace_state), fwd_mr);
|
||||
auto mr = make_flat_mutation_reader_v2<maybe_pausing_reader>(*mt, s, std::move(permit), range, slice, std::move(trace_state), fwd_mr);
|
||||
if (fwd_sm == streamed_mutation::forwarding::yes) {
|
||||
return make_forwardable(std::move(mr));
|
||||
}
|
||||
@@ -2803,7 +2782,6 @@ flat_mutation_reader_v2 create_evictable_reader_and_evict_after_first_buffer(
|
||||
reader_permit permit,
|
||||
const dht::partition_range& range,
|
||||
const query::partition_slice& slice,
|
||||
const io_priority_class& pc,
|
||||
tracing::trace_state_ptr trace_state,
|
||||
streamed_mutation::forwarding fwd_sm,
|
||||
mutation_reader::forwarding fwd_mr) {
|
||||
@@ -2826,7 +2804,6 @@ flat_mutation_reader_v2 create_evictable_reader_and_evict_after_first_buffer(
|
||||
permit,
|
||||
prange,
|
||||
slice,
|
||||
seastar::default_priority_class(),
|
||||
nullptr,
|
||||
mutation_reader::forwarding::yes);
|
||||
|
||||
@@ -3208,7 +3185,6 @@ SEASTAR_THREAD_TEST_CASE(test_evictable_reader_recreate_before_fast_forward_to)
|
||||
reader_permit permit,
|
||||
const dht::partition_range& range,
|
||||
const query::partition_slice& slice,
|
||||
const io_priority_class& pc,
|
||||
tracing::trace_state_ptr tr,
|
||||
streamed_mutation::forwarding fwd,
|
||||
mutation_reader::forwarding fwd_mr) {
|
||||
@@ -3229,7 +3205,7 @@ SEASTAR_THREAD_TEST_CASE(test_evictable_reader_recreate_before_fast_forward_to)
|
||||
|
||||
auto pr0 = dht::partition_range::make({pkeys[0], true}, {pkeys[3], true});
|
||||
auto [reader, handle] = make_manually_paused_evictable_reader_v2(std::move(ms), s.schema(), permit, pr0, s.schema()->full_slice(),
|
||||
seastar::default_priority_class(), {}, mutation_reader::forwarding::yes);
|
||||
{}, mutation_reader::forwarding::yes);
|
||||
|
||||
auto reader_assert = assert_that(std::move(reader));
|
||||
reader_assert.produces(pkeys[0]);
|
||||
@@ -3513,7 +3489,6 @@ SEASTAR_THREAD_TEST_CASE(test_evictable_reader_non_monotonic_positions) {
|
||||
reader_permit permit,
|
||||
const dht::partition_range& range,
|
||||
const query::partition_slice& slice,
|
||||
const io_priority_class& pc,
|
||||
tracing::trace_state_ptr trace_state,
|
||||
streamed_mutation::forwarding fwd_sm,
|
||||
mutation_reader::forwarding fwd_mr) {
|
||||
@@ -3521,7 +3496,7 @@ SEASTAR_THREAD_TEST_CASE(test_evictable_reader_non_monotonic_positions) {
|
||||
reader.set_max_buffer_size(1);
|
||||
return reader;
|
||||
});
|
||||
auto reader = make_auto_paused_evictable_reader_v2(std::move(ms), schema, permit, prange, schema->full_slice(), seastar::default_priority_class(),
|
||||
auto reader = make_auto_paused_evictable_reader_v2(std::move(ms), schema, permit, prange, schema->full_slice(),
|
||||
nullptr, mutation_reader::forwarding::no);
|
||||
auto close_reader = deferred_close(reader);
|
||||
|
||||
@@ -3591,7 +3566,6 @@ SEASTAR_THREAD_TEST_CASE(test_evictable_reader_clear_tombstone_in_discontinued_p
|
||||
reader_permit permit,
|
||||
const dht::partition_range& range,
|
||||
const query::partition_slice& slice,
|
||||
const io_priority_class& pc,
|
||||
tracing::trace_state_ptr trace_state,
|
||||
streamed_mutation::forwarding fwd_sm,
|
||||
mutation_reader::forwarding fwd_mr) mutable {
|
||||
@@ -3602,7 +3576,7 @@ SEASTAR_THREAD_TEST_CASE(test_evictable_reader_clear_tombstone_in_discontinued_p
|
||||
return reader;
|
||||
});
|
||||
auto reader = make_auto_paused_evictable_reader_v2(std::move(ms), schema, permit, prange, schema->full_slice(),
|
||||
seastar::default_priority_class(), nullptr, mutation_reader::forwarding::no);
|
||||
nullptr, mutation_reader::forwarding::no);
|
||||
auto close_reader = deferred_close(reader);
|
||||
|
||||
reader.fill_buffer().get();
|
||||
@@ -3661,7 +3635,7 @@ SEASTAR_THREAD_TEST_CASE(test_evictable_reader_next_pos_is_partition_start) {
|
||||
return rd;
|
||||
});
|
||||
|
||||
auto [rd, handle] = make_manually_paused_evictable_reader_v2(ms, schema, permit, prange, schema->full_slice(), default_priority_class(), {},
|
||||
auto [rd, handle] = make_manually_paused_evictable_reader_v2(ms, schema, permit, prange, schema->full_slice(), {},
|
||||
mutation_reader::forwarding::no);
|
||||
auto stop_rd = deferred_close(rd);
|
||||
rd.set_max_buffer_size(max_buf_size);
|
||||
@@ -3871,7 +3845,7 @@ static future<> do_test_clustering_order_merger_sstable_set(bool reversed) {
|
||||
auto q = sst_set.make_position_reader_queue(
|
||||
[query_schema, &pr, &query_slice, fwd, permit] (sstable& sst) {
|
||||
return sst.make_reader(query_schema, permit, pr,
|
||||
query_slice, seastar::default_priority_class(), nullptr, fwd);
|
||||
query_slice, nullptr, fwd);
|
||||
},
|
||||
[included_gens] (const sstable& sst) { return included_gens.contains(sst.generation()); },
|
||||
pk.key(), query_schema, permit, fwd, reversed);
|
||||
@@ -4133,7 +4107,6 @@ SEASTAR_THREAD_TEST_CASE(clustering_combined_reader_mutation_source_test) {
|
||||
reader_permit permit,
|
||||
const dht::partition_range& range,
|
||||
const query::partition_slice& slice,
|
||||
const io_priority_class& pc,
|
||||
tracing::trace_state_ptr trace_state,
|
||||
streamed_mutation::forwarding fwd_sm,
|
||||
mutation_reader::forwarding fwd_mr) {
|
||||
@@ -4213,7 +4186,6 @@ SEASTAR_THREAD_TEST_CASE(test_generating_reader_v1) {
|
||||
reader_permit permit,
|
||||
const dht::partition_range& range,
|
||||
const query::partition_slice& slice,
|
||||
const io_priority_class& pc,
|
||||
tracing::trace_state_ptr trace_state,
|
||||
streamed_mutation::forwarding fwd_sm,
|
||||
mutation_reader::forwarding fwd_mr) {
|
||||
@@ -4236,7 +4208,6 @@ SEASTAR_THREAD_TEST_CASE(test_generating_reader_v2) {
|
||||
reader_permit permit,
|
||||
const dht::partition_range& range,
|
||||
const query::partition_slice& slice,
|
||||
const io_priority_class& pc,
|
||||
tracing::trace_state_ptr trace_state,
|
||||
streamed_mutation::forwarding fwd_sm,
|
||||
mutation_reader::forwarding fwd_mr) {
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user