The PRUNE MATERALIZED VIEW statement is performed as follows: 1. Perform a range scan of the view table from the view replicas based on the ranges specified in the statement. 2. While reading the paged scan above, for each view row perform a read from all base replicas at the corresponding primary key. If a discrepancy is detected, delete the row in the view table. When reading multiple rows, this is very slow because for each view row we need to performe a single row query on multiple replicas. In this patch we add an option to speed this up by performing many of the single base row reads concurrently, at the concurrency specified in the USING CONCURRENCY clause. Fixes https://github.com/scylladb/scylladb/issues/27070
56 lines
1.7 KiB
C++
56 lines
1.7 KiB
C++
/*
|
|
* Copyright (C) 2015-present ScyllaDB
|
|
*
|
|
* Modified by ScyllaDB
|
|
*/
|
|
|
|
/*
|
|
* SPDX-License-Identifier: (LicenseRef-ScyllaDB-Source-Available-1.0 and Apache-2.0)
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <seastar/core/shared_ptr.hh>
|
|
|
|
#include "schema/schema_fwd.hh"
|
|
#include "query/query-request.hh"
|
|
#include "service/query_state.hh"
|
|
#include "cql3/selection/selection.hh"
|
|
#include "cql3/query_options.hh"
|
|
#include "query_pager.hh"
|
|
#include "service/cas_shard.hh"
|
|
|
|
namespace service {
|
|
|
|
class storage_proxy;
|
|
|
|
namespace pager {
|
|
|
|
class query_pagers {
|
|
public:
|
|
static bool may_need_paging(const schema& s, uint32_t page_size, const query::read_command&,
|
|
const dht::partition_range_vector&);
|
|
static std::unique_ptr<query_pager> pager(service::storage_proxy& p, schema_ptr,
|
|
shared_ptr<const cql3::selection::selection>,
|
|
service::query_state&,
|
|
const cql3::query_options&,
|
|
lw_shared_ptr<query::read_command>,
|
|
dht::partition_range_vector,
|
|
::shared_ptr<const cql3::restrictions::statement_restrictions> filtering_restrictions = nullptr,
|
|
std::optional<service::cas_shard> cas_shard = {},
|
|
query_function query_function_override = {});
|
|
static ::shared_ptr<query_pager> ghost_row_deleting_pager(schema_ptr,
|
|
shared_ptr<const cql3::selection::selection>,
|
|
service::query_state&,
|
|
const cql3::query_options&,
|
|
lw_shared_ptr<query::read_command>,
|
|
dht::partition_range_vector,
|
|
cql3::cql_stats& stats,
|
|
storage_proxy& proxy,
|
|
db::timeout_clock::duration timeout_duration,
|
|
size_t concurrency);
|
|
};
|
|
|
|
}
|
|
}
|