Containing utility methods to query data from the local replica. Intended to be used to read system tables, completely bypassing storage proxy in the process. This duplicates some code already found in storage proxy, but that is a small price to pay, to be able to break some circular dependencies involving storage proxy, that have been plaguing us since time immemorial. One thing we lose with this, is the smp service level using in storage proxy. If this becomes a problem, we can create one in database and use it in these methods too. Another thing we lose is increasing `replica_cross_shard_ops` storage proxy stat. I think this is not a problem at all as these new functions are meant to be used by internal users, which will reduce the internal noise in this metric, which is meant to indicate users not using shard-aware clients.
41 lines
1.2 KiB
C++
41 lines
1.2 KiB
C++
/*
|
|
* Copyright (C) 2018-present ScyllaDB
|
|
*/
|
|
|
|
/*
|
|
* SPDX-License-Identifier: AGPL-3.0-or-later
|
|
*/
|
|
|
|
/*
|
|
* Utilities for executing queries on the local replica.
|
|
*
|
|
* Allows for bypassing storage proxy entirely when querying local (system) tables.
|
|
*/
|
|
|
|
#include "replica/database.hh"
|
|
|
|
namespace replica {
|
|
|
|
/// Reads the specified range and slice of the given table, from the local replica.
|
|
///
|
|
/// There is no paging or limits applied to the result, make sure the result is
|
|
/// sufficiently small.
|
|
future<foreign_ptr<lw_shared_ptr<reconcilable_result>>> query_mutations(
|
|
sharded<database>& db,
|
|
schema_ptr s,
|
|
const dht::partition_range& pr,
|
|
const query::partition_slice& ps,
|
|
db::timeout_clock::time_point timeout);
|
|
|
|
/// Reads the specified range and slice of the given table, from the local replica.
|
|
///
|
|
/// A variant of query_mutations() which returns query result, instead of mutations (only live data).
|
|
future<foreign_ptr<lw_shared_ptr<query::result>>> query_data(
|
|
sharded<database>& db,
|
|
schema_ptr s,
|
|
const dht::partition_range& pr,
|
|
const query::partition_slice& ps,
|
|
db::timeout_clock::time_point timeout);
|
|
|
|
} // namespace replica
|