Partitions.db uses a piece of the murmur hash of the partition key internally. The same hash is used to query the bloom filter. So to avoid computing the hash twice (which involves converting the key into a hashable linearized form) it would make sense to use the same `hashed_key` for both purposes. This is what we do in this patch. We extract the computation of the `hashed_key` from `make_pk_filter` up to its parent `sstable_set_impl::create_single_key_sstable_reader`, and we pass this hash down both to `make_pk_filter` and to the sstable reader. (And we add a pointer to the `hashed_key` as a parameter to all functions along the way, to propagate it). The number of parameters to `mx::make_reader` is getting uncomfortable. Maybe they should be packed into some structs.
76 lines
2.4 KiB
C++
76 lines
2.4 KiB
C++
/*
|
|
* Copyright (C) 2021-present ScyllaDB
|
|
*/
|
|
|
|
/*
|
|
* SPDX-License-Identifier: LicenseRef-ScyllaDB-Source-Available-1.0
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include "readers/mutation_reader_fwd.hh"
|
|
#include "readers/mutation_reader.hh"
|
|
#include "sstables/progress_monitor.hh"
|
|
#include "sstables/types_fwd.hh"
|
|
#include "sstables/index_reader.hh"
|
|
|
|
namespace sstables {
|
|
namespace mx {
|
|
|
|
// Precondition: if the slice is reversed, the schema must be reversed as well
|
|
// and the range must be singular (`range.is_singular()`).
|
|
// Fast-forwarding is not supported in reversed queries (FIXME).
|
|
mutation_reader make_reader(
|
|
shared_sstable sstable,
|
|
schema_ptr schema,
|
|
reader_permit permit,
|
|
const dht::partition_range& range,
|
|
const query::partition_slice& slice,
|
|
tracing::trace_state_ptr trace_state,
|
|
streamed_mutation::forwarding fwd,
|
|
mutation_reader::forwarding fwd_mr,
|
|
read_monitor& monitor,
|
|
integrity_check integrity,
|
|
std::unique_ptr<abstract_index_reader>,
|
|
const utils::hashed_key* single_partition_read_murmur_hash
|
|
);
|
|
|
|
// Same as above but the slice is moved and stored inside the reader.
|
|
mutation_reader make_reader(
|
|
shared_sstable sstable,
|
|
schema_ptr schema,
|
|
reader_permit permit,
|
|
const dht::partition_range& range,
|
|
query::partition_slice&& slice,
|
|
tracing::trace_state_ptr trace_state,
|
|
streamed_mutation::forwarding fwd,
|
|
mutation_reader::forwarding fwd_mr,
|
|
read_monitor& monitor,
|
|
integrity_check integrity,
|
|
std::unique_ptr<abstract_index_reader>,
|
|
const utils::hashed_key* single_partition_read_murmur_hash
|
|
);
|
|
|
|
// A reader which doesn't use the index at all. It reads everything from the
|
|
// sstable and it doesn't support skipping.
|
|
mutation_reader make_full_scan_reader(
|
|
shared_sstable sstable,
|
|
schema_ptr schema,
|
|
reader_permit permit,
|
|
tracing::trace_state_ptr trace_state,
|
|
read_monitor& monitor,
|
|
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
|
|
// index and promoted index respectively.
|
|
future<uint64_t> validate(
|
|
shared_sstable sstable,
|
|
reader_permit permit,
|
|
abort_source& abort,
|
|
std::function<void(sstring)> error_handler,
|
|
sstables::read_monitor& monitor);
|
|
|
|
} // namespace mx
|
|
} // namespace sstables
|