sstables: Disengage integrity_check from sstable class

The `integrity_check` flag was first introduced as a parameter in
`sstable::data_stream()` to support creating input streams with
integrity checking. As such, it was defined in the sstable class.

However, we also use this flag in the kl/mx full-scan readers, and, in
a later patch, we will use it in `class sstable_set` as well.

Move the definition into `types_fwd.hh` since it is no longer bound to
the sstable class.

Signed-off-by: Nikos Dragazis <nikolaos.dragazis@scylladb.com>
This commit is contained in:
Nikos Dragazis
2024-10-09 19:13:53 +03:00
parent 2cc82f64e8
commit 5b896cdbb7
7 changed files with 18 additions and 16 deletions

View File

@@ -1349,7 +1349,7 @@ private:
sstable::disk_read_range drr{begin, *end};
auto last_end = _fwd_mr ? _sst->data_size() : drr.end;
_read_enabled = bool(drr);
_context = data_consume_rows<DataConsumeRowsContext>(*_schema, _sst, _consumer, std::move(drr), last_end, sstable::integrity_check::no);
_context = data_consume_rows<DataConsumeRowsContext>(*_schema, _sst, _consumer, std::move(drr), last_end, integrity_check::no);
}
_monitor.on_read_started(_context->reader_position());
@@ -1551,7 +1551,7 @@ public:
reader_permit permit,
tracing::trace_state_ptr trace_state,
read_monitor& mon,
sstable::integrity_check integrity)
integrity_check integrity)
: mp_row_consumer_reader_k_l(std::move(schema), permit, std::move(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, integrity))
@@ -1598,7 +1598,7 @@ mutation_reader make_full_scan_reader(
reader_permit permit,
tracing::trace_state_ptr trace_state,
read_monitor& monitor,
sstable::integrity_check integrity) {
integrity_check integrity) {
return make_mutation_reader<sstable_full_scan_reader>(std::move(sstable), std::move(schema), std::move(permit),
std::move(trace_state), monitor, integrity);
}

View File

@@ -11,7 +11,7 @@
#include "readers/mutation_reader_fwd.hh"
#include "readers/mutation_reader.hh"
#include "sstables/progress_monitor.hh"
#include "sstables/sstables.hh"
#include "sstables/types_fwd.hh"
namespace sstables {
namespace kl {
@@ -47,7 +47,7 @@ mutation_reader make_full_scan_reader(
reader_permit permit,
tracing::trace_state_ptr trace_state,
read_monitor& monitor,
sstable::integrity_check integrity);
integrity_check integrity);
} // namespace kl
} // namespace sstables

View File

@@ -1557,7 +1557,7 @@ private:
sstable::disk_read_range drr{begin, *end};
auto last_end = _fwd_mr ? _sst->data_size() : drr.end;
_read_enabled = bool(drr);
_context = data_consume_rows<DataConsumeRowsContext>(*_schema, _sst, _consumer, std::move(drr), last_end, sstable::integrity_check::no);
_context = data_consume_rows<DataConsumeRowsContext>(*_schema, _sst, _consumer, std::move(drr), last_end, integrity_check::no);
}
_monitor.on_read_started(_context->reader_position());
@@ -1773,7 +1773,7 @@ public:
reader_permit permit,
tracing::trace_state_ptr trace_state,
read_monitor& mon,
sstable::integrity_check integrity)
integrity_check integrity)
: mp_row_consumer_reader_mx(std::move(schema), permit, std::move(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, integrity))
@@ -1818,7 +1818,7 @@ mutation_reader make_full_scan_reader(
reader_permit permit,
tracing::trace_state_ptr trace_state,
read_monitor& monitor,
sstable::integrity_check integrity) {
integrity_check integrity) {
return make_mutation_reader<mx_sstable_full_scan_reader>(std::move(sstable), std::move(schema), std::move(permit),
std::move(trace_state), monitor, integrity);
}
@@ -2066,7 +2066,7 @@ future<uint64_t> validate(
sstables::read_monitor& monitor) {
auto schema = sstable->get_schema();
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, sstable::integrity_check::yes);
auto context = data_consume_rows<data_consume_rows_context_m<validating_consumer>>(*schema, sstable, consumer, integrity_check::yes);
std::optional<sstables::index_reader> idx_reader;
idx_reader.emplace(sstable, permit, tracing::trace_state_ptr{}, sstables::use_caching::no, false);

View File

@@ -11,7 +11,7 @@
#include "readers/mutation_reader_fwd.hh"
#include "readers/mutation_reader.hh"
#include "sstables/progress_monitor.hh"
#include "sstables/sstables.hh"
#include "sstables/types_fwd.hh"
namespace sstables {
namespace mx {
@@ -50,7 +50,7 @@ mutation_reader make_full_scan_reader(
reader_permit permit,
tracing::trace_state_ptr trace_state,
read_monitor& monitor,
sstable::integrity_check integrity);
integrity_check integrity);
// Validate the content of the sstable with the mutation_fragment_stream_valdiator,
// additionally cross checking that the content is laid out as expected by the

View File

@@ -110,7 +110,7 @@ position_in_partition_view get_slice_lower_bound(const schema& s, const query::p
// heuristics which learn from the usefulness of previous read aheads.
template <typename DataConsumeRowsContext>
inline std::unique_ptr<DataConsumeRowsContext> data_consume_rows(const schema& s, shared_sstable sst, typename DataConsumeRowsContext::consumer& consumer,
sstable::disk_read_range toread, uint64_t last_end, sstable::integrity_check integrity) {
sstable::disk_read_range toread, uint64_t last_end, integrity_check integrity) {
// Although we were only asked to read until toread.end, we'll not limit
// the underlying file input stream to this end, but rather to last_end.
// This potentially enables read-ahead beyond end, until last_end, which
@@ -158,7 +158,7 @@ inline std::unique_ptr<DataConsumeRowsContext> data_consume_single_partition(con
// Like data_consume_rows() with bounds, but iterates over whole range
template <typename DataConsumeRowsContext>
inline std::unique_ptr<DataConsumeRowsContext> data_consume_rows(const schema& s, shared_sstable sst, typename DataConsumeRowsContext::consumer& consumer,
sstable::integrity_check integrity) {
integrity_check integrity) {
auto data_size = sst->data_size();
return data_consume_rows<DataConsumeRowsContext>(s, std::move(sst), consumer, {0, data_size}, data_size, integrity);
}

View File

@@ -186,7 +186,6 @@ public:
using format_types = sstable_format_types;
using manager_list_link_type = bi::list_member_hook<bi::link_mode<bi::auto_unlink>>;
using manager_set_link_type = bi::set_member_hook<bi::link_mode<bi::auto_unlink>>;
using integrity_check = bool_class<class integrity_check_tag>;
public:
sstable(schema_ptr schema,
const data_dictionary::storage_options& storage,
@@ -1011,13 +1010,13 @@ public:
friend class sstables_manager;
template <typename DataConsumeRowsContext>
friend std::unique_ptr<DataConsumeRowsContext>
data_consume_rows(const schema&, shared_sstable, typename DataConsumeRowsContext::consumer&, disk_read_range, uint64_t, sstable::integrity_check);
data_consume_rows(const schema&, shared_sstable, typename DataConsumeRowsContext::consumer&, disk_read_range, uint64_t, integrity_check);
template <typename DataConsumeRowsContext>
friend std::unique_ptr<DataConsumeRowsContext>
data_consume_single_partition(const schema&, shared_sstable, typename DataConsumeRowsContext::consumer&, disk_read_range);
template <typename DataConsumeRowsContext>
friend std::unique_ptr<DataConsumeRowsContext>
data_consume_rows(const schema&, shared_sstable, typename DataConsumeRowsContext::consumer&, sstable::integrity_check);
data_consume_rows(const schema&, shared_sstable, typename DataConsumeRowsContext::consumer&, integrity_check);
friend void lw_shared_ptr_deleter<sstables::sstable>::dispose(sstable* s);
gc_clock::time_point get_gc_before_for_drop_estimation(const gc_clock::time_point& compaction_time, const tombstone_gc_state& gc_state, const schema_ptr& s) const;
gc_clock::time_point get_gc_before_for_fully_expire(const gc_clock::time_point& compaction_time, const tombstone_gc_state& gc_state, const schema_ptr& s) const;

View File

@@ -8,10 +8,13 @@
#pragma once
#include <seastar/util/bool_class.hh>
#include "utils/UUID.hh"
namespace sstables {
using run_id = utils::tagged_uuid<struct run_id_tag>;
using integrity_check = bool_class<class integrity_check_tag>;
} // namespace sstables