mirror of
https://github.com/scylladb/scylladb.git
synced 2026-05-12 19:02:12 +00:00
mutation_reader: reader_lifecycle_policy: remove convenience methods
These convenience methods are not used as much anymore and they are not even really necessary as the register/unregister inactive read API got streamlined a lot to the point where all of these "convenience methods" are just one-liners, which we can just inline into their few callers without loosing readability.
This commit is contained in:
@@ -309,7 +309,7 @@ flat_mutation_reader read_context::create_reader(
|
||||
|
||||
// The reader is either in inexistent or successful lookup state.
|
||||
if (rm.state == reader_state::successful_lookup) {
|
||||
if (auto reader_opt = try_resume(std::move(*rm.rparts->handle))) {
|
||||
if (auto reader_opt = semaphore().unregister_inactive_read(std::move(*rm.rparts->handle))) {
|
||||
rm.state = reader_state::used;
|
||||
return std::move(*reader_opt);
|
||||
}
|
||||
@@ -545,7 +545,7 @@ future<> read_context::lookup_readers() {
|
||||
reinterpret_cast<uintptr_t>(&semaphore)));
|
||||
}
|
||||
|
||||
auto handle = pause(semaphore, std::move(q).reader());
|
||||
auto handle = semaphore.register_inactive_read(std::move(q).reader());
|
||||
return reader_meta(
|
||||
reader_state::successful_lookup,
|
||||
reader_meta::remote_parts(q.permit(), std::move(q).reader_range(), std::move(q).reader_slice(), table.read_in_progress(),
|
||||
|
||||
@@ -1967,21 +1967,6 @@ future<> multishard_combining_reader::close() noexcept {
|
||||
});
|
||||
}
|
||||
|
||||
reader_concurrency_semaphore::inactive_read_handle
|
||||
reader_lifecycle_policy::pause(reader_concurrency_semaphore& sem, flat_mutation_reader reader) {
|
||||
return sem.register_inactive_read(std::move(reader));
|
||||
}
|
||||
|
||||
reader_concurrency_semaphore::inactive_read_handle
|
||||
reader_lifecycle_policy::pause(flat_mutation_reader reader) {
|
||||
return pause(semaphore(), std::move(reader));
|
||||
}
|
||||
|
||||
flat_mutation_reader_opt
|
||||
reader_lifecycle_policy::try_resume(reader_concurrency_semaphore::inactive_read_handle irh) {
|
||||
return semaphore().unregister_inactive_read(std::move(irh));
|
||||
}
|
||||
|
||||
flat_mutation_reader make_multishard_combining_reader(
|
||||
shared_ptr<reader_lifecycle_policy> lifecycle_policy,
|
||||
schema_ptr schema,
|
||||
|
||||
@@ -442,11 +442,6 @@ public:
|
||||
flat_mutation_reader::tracked_buffer unconsumed_fragments;
|
||||
};
|
||||
|
||||
protected:
|
||||
// Helpers for implementations, who might wish to provide the semaphore in
|
||||
// other ways than through the official `semaphore()` override.
|
||||
static reader_concurrency_semaphore::inactive_read_handle pause(reader_concurrency_semaphore& sem, flat_mutation_reader reader);
|
||||
|
||||
public:
|
||||
/// Create an appropriate reader on the shard it is called on.
|
||||
///
|
||||
@@ -486,26 +481,6 @@ public:
|
||||
///
|
||||
/// This method will be called on the shard where the relevant reader lives.
|
||||
virtual reader_concurrency_semaphore& semaphore() = 0;
|
||||
|
||||
/// Pause the reader.
|
||||
///
|
||||
/// The purpose of pausing a reader is making it evictable while it is
|
||||
/// otherwise inactive. This allows freeing up resources that are in-demand
|
||||
/// by evicting these paused readers. Most notably, this allows freeing up
|
||||
/// reader permits when the node is overloaded with reads.
|
||||
/// This is just a helper method, it uses the semaphore returned by
|
||||
/// `semaphore()` for the actual pausing.
|
||||
/// \see semaphore()
|
||||
reader_concurrency_semaphore::inactive_read_handle pause(flat_mutation_reader reader);
|
||||
|
||||
/// Try to resume the reader.
|
||||
///
|
||||
/// The optional returned will be disengaged when resuming fails. This can
|
||||
/// happen if the reader was evicted while paused.
|
||||
/// This is just a helper method, it uses the semaphore returned by
|
||||
/// `semaphore()` for the actual pausing.
|
||||
/// \see semaphore()
|
||||
flat_mutation_reader_opt try_resume(reader_concurrency_semaphore::inactive_read_handle irh);
|
||||
};
|
||||
|
||||
/// Make a multishard_combining_reader.
|
||||
|
||||
Reference in New Issue
Block a user