flat_mutation_reader_v2 was introduced in a pair of commits in 2021:e3309322c3"Clone flat_mutation_reader related classes into v2 variants"08b5773c12"Adapt flat_mutation_reader_v2 to the new version of the API" as a replacement for flat_mutation_reader, using range_tombstone_change instead of range_tombstone to represent represent range tombstones. See those commits for more information. The transition was incremental; the last use of the original flat_mutation_reader was removed in 2022 in commit026f8cc1e7"db: Use mutation_partition_v2 in mvcc" In turn, flat_mutation_reader was introduced in 2017 in commit748205ca75"Introduce flat_mutation_reader" To transition from a mutation_reader that nested rows within a partition in a separate stream, to a flat reader that streamed partitions and rows in the same stream. Here, we reclaim the original name and rename the awkward flat_mutation_reader_v2 to mutation_reader. Note that mutation_fragment_v2 remains since we still use the original for compatibilty, sometimes. Some notes about the transition: - files were also renamed. In one case (flat_mutation_reader_test.cc), the rename target already existed, so we rename to mutation_reader_another_test.cc. - a namespace 'mutation_reader' with two definitions existed (in mutation_reader_fwd.hh). Its contents was folded into the mutation_reader class. As a result, a few #includes had to be adjusted. Closes scylladb/scylladb#19356
83 lines
2.8 KiB
C++
83 lines
2.8 KiB
C++
/*
|
|
* Copyright (C) 2022-present ScyllaDB
|
|
*/
|
|
|
|
/*
|
|
* SPDX-License-Identifier: AGPL-3.0-or-later
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include "dht/i_partitioner_fwd.hh"
|
|
#include "readers/mutation_reader_fwd.hh"
|
|
#include "readers/mutation_reader.hh"
|
|
#include "schema/schema_fwd.hh"
|
|
#include "seastarx.hh"
|
|
|
|
class reader_permit;
|
|
class mutation_source;
|
|
|
|
namespace tracing {
|
|
class trace_state_ptr;
|
|
}
|
|
|
|
namespace query {
|
|
class partition_slice;
|
|
}
|
|
|
|
/// Make an auto-paused evictable reader.
|
|
///
|
|
/// The reader is paused after each use, that is after each call to any of its
|
|
/// members that cause actual reading to be done (`fill_buffer()` and
|
|
/// `fast_forward_to()`). When paused, the reader is made evictable, that it is
|
|
/// it is registered with reader concurrency semaphore as an inactive read.
|
|
/// The reader is resumed automatically on the next use. If it was evicted, it
|
|
/// will be recreated at the position it left off reading. This is all
|
|
/// transparent to its user.
|
|
/// Parameters passed by reference have to be kept alive while the reader is
|
|
/// alive.
|
|
mutation_reader make_auto_paused_evictable_reader_v2(
|
|
mutation_source ms,
|
|
schema_ptr schema,
|
|
reader_permit permit,
|
|
const dht::partition_range& pr,
|
|
const query::partition_slice& ps,
|
|
tracing::trace_state_ptr trace_state,
|
|
mutation_reader::forwarding fwd_mr);
|
|
|
|
class evictable_reader_v2;
|
|
|
|
class evictable_reader_handle_v2 {
|
|
friend std::pair<mutation_reader, evictable_reader_handle_v2> make_manually_paused_evictable_reader_v2(mutation_source, schema_ptr, reader_permit,
|
|
const dht::partition_range&, const query::partition_slice&, tracing::trace_state_ptr, mutation_reader::forwarding);
|
|
|
|
private:
|
|
evictable_reader_v2* _r;
|
|
|
|
private:
|
|
explicit evictable_reader_handle_v2(evictable_reader_v2& r);
|
|
|
|
public:
|
|
void pause();
|
|
};
|
|
|
|
/// Make a manually-paused evictable reader.
|
|
///
|
|
/// The reader can be paused via the evictable reader handle when desired. The
|
|
/// intended usage is subsequent reads done in bursts, after which the reader is
|
|
/// not used for some time. When paused, the reader is made evictable, that is,
|
|
/// it is registered with reader concurrency semaphore as an inactive read.
|
|
/// The reader is resumed automatically on the next use. If it was evicted, it
|
|
/// will be recreated at the position it left off reading. This is all
|
|
/// transparent to its user.
|
|
/// Parameters passed by reference have to be kept alive while the reader is
|
|
/// alive.
|
|
std::pair<mutation_reader, evictable_reader_handle_v2> make_manually_paused_evictable_reader_v2(
|
|
mutation_source ms,
|
|
schema_ptr schema,
|
|
reader_permit permit,
|
|
const dht::partition_range& pr,
|
|
const query::partition_slice& ps,
|
|
tracing::trace_state_ptr trace_state,
|
|
mutation_reader::forwarding fwd_mr);
|