paging_state: switch from shared_ptr to lw_shared_ptr
Change the way `service::pager::paging_state` is passed around from `shared_ptr` to `lw_shared_ptr`. It's safe since `paging_state` is final. Tests: unit(dev, debug) Signed-off-by: Pavel Solodovnikov <pa.solodovnikov@scylladb.com>
This commit is contained in:
@@ -2706,7 +2706,7 @@ static future<executor::request_return_type> do_query(schema_ptr schema,
|
||||
service::client_state& client_state,
|
||||
cql3::cql_stats& cql_stats,
|
||||
tracing::trace_state_ptr trace_state) {
|
||||
::shared_ptr<service::pager::paging_state> paging_state = nullptr;
|
||||
lw_shared_ptr<service::pager::paging_state> paging_state = nullptr;
|
||||
|
||||
tracing::trace(trace_state, "Performing a database query");
|
||||
|
||||
@@ -2716,7 +2716,7 @@ static future<executor::request_return_type> do_query(schema_ptr schema,
|
||||
if (schema->clustering_key_size() > 0) {
|
||||
ck = ck_from_json(*exclusive_start_key, schema);
|
||||
}
|
||||
paging_state = ::make_shared<service::pager::paging_state>(pk, ck, query::max_partitions, utils::UUID(), service::pager::paging_state::replicas_per_token_range{}, std::nullopt, 0);
|
||||
paging_state = make_lw_shared<service::pager::paging_state>(pk, ck, query::max_partitions, utils::UUID(), service::pager::paging_state::replicas_per_token_range{}, std::nullopt, 0);
|
||||
}
|
||||
|
||||
auto regular_columns = boost::copy_range<query::column_id_vector>(
|
||||
|
||||
@@ -130,7 +130,7 @@ query_options::query_options(db::consistency_level cl, const ::timeout_config& t
|
||||
{
|
||||
}
|
||||
|
||||
query_options::query_options(std::unique_ptr<query_options> qo, ::shared_ptr<service::pager::paging_state> paging_state)
|
||||
query_options::query_options(std::unique_ptr<query_options> qo, lw_shared_ptr<service::pager::paging_state> paging_state)
|
||||
: query_options(qo->_cql_config,
|
||||
qo->_consistency,
|
||||
qo->get_timeout_config(),
|
||||
@@ -143,7 +143,7 @@ query_options::query_options(std::unique_ptr<query_options> qo, ::shared_ptr<ser
|
||||
|
||||
}
|
||||
|
||||
query_options::query_options(std::unique_ptr<query_options> qo, ::shared_ptr<service::pager::paging_state> paging_state, int32_t page_size)
|
||||
query_options::query_options(std::unique_ptr<query_options> qo, lw_shared_ptr<service::pager::paging_state> paging_state, int32_t page_size)
|
||||
: query_options(qo->_cql_config,
|
||||
qo->_consistency,
|
||||
qo->get_timeout_config(),
|
||||
|
||||
@@ -68,7 +68,7 @@ public:
|
||||
static thread_local const specific_options DEFAULT;
|
||||
|
||||
const int32_t page_size;
|
||||
const ::shared_ptr<service::pager::paging_state> state;
|
||||
const lw_shared_ptr<service::pager::paging_state> state;
|
||||
const std::optional<db::consistency_level> serial_consistency;
|
||||
const api::timestamp_type timestamp;
|
||||
};
|
||||
@@ -161,8 +161,8 @@ public:
|
||||
explicit query_options(std::vector<cql3::raw_value> values);
|
||||
explicit query_options(db::consistency_level, const timeout_config& timeouts,
|
||||
std::vector<cql3::raw_value> values, specific_options options = specific_options::DEFAULT);
|
||||
explicit query_options(std::unique_ptr<query_options>, ::shared_ptr<service::pager::paging_state> paging_state);
|
||||
explicit query_options(std::unique_ptr<query_options>, ::shared_ptr<service::pager::paging_state> paging_state, int32_t page_size);
|
||||
explicit query_options(std::unique_ptr<query_options>, lw_shared_ptr<service::pager::paging_state> paging_state);
|
||||
explicit query_options(std::unique_ptr<query_options>, lw_shared_ptr<service::pager::paging_state> paging_state, int32_t page_size);
|
||||
|
||||
const timeout_config& get_timeout_config() const { return _timeout_config; }
|
||||
|
||||
@@ -190,7 +190,7 @@ public:
|
||||
}
|
||||
|
||||
/** The paging state for this query, or null if not relevant. */
|
||||
::shared_ptr<service::pager::paging_state> get_paging_state() const {
|
||||
lw_shared_ptr<service::pager::paging_state> get_paging_state() const {
|
||||
return get_specific_options().state;
|
||||
}
|
||||
|
||||
|
||||
@@ -661,7 +661,7 @@ query_options query_processor::make_internal_options(
|
||||
}
|
||||
}
|
||||
if (page_size > 0) {
|
||||
::shared_ptr<service::pager::paging_state> paging_state;
|
||||
lw_shared_ptr<service::pager::paging_state> paging_state;
|
||||
db::consistency_level serial_consistency = db::consistency_level::SERIAL;
|
||||
api::timestamp_type ts = api::missing_timestamp;
|
||||
return query_options(
|
||||
@@ -790,7 +790,7 @@ query_processor::execute_paged_internal(::shared_ptr<internal_query_state> state
|
||||
_state->more_results = false;
|
||||
} else {
|
||||
const service::pager::paging_state& st = *rs.get_metadata().paging_state();
|
||||
shared_ptr<service::pager::paging_state> shrd = ::make_shared<service::pager::paging_state>(st);
|
||||
lw_shared_ptr<service::pager::paging_state> shrd = make_lw_shared<service::pager::paging_state>(st);
|
||||
_state->opts = std::make_unique<query_options>(std::move(_state->opts), shrd);
|
||||
_state->p = _qp.prepare_internal(_state->query_string);
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ metadata::metadata(std::vector<::shared_ptr<column_specification>> names_)
|
||||
{ }
|
||||
|
||||
metadata::metadata(flag_enum_set flags, std::vector<::shared_ptr<column_specification>> names_, uint32_t column_count,
|
||||
::shared_ptr<const service::pager::paging_state> paging_state)
|
||||
lw_shared_ptr<const service::pager::paging_state> paging_state)
|
||||
: _flags(flags)
|
||||
, _column_info(make_lw_shared<column_info>(std::move(names_), column_count))
|
||||
, _paging_state(std::move(paging_state))
|
||||
@@ -74,12 +74,12 @@ bool metadata::all_in_same_cf() const {
|
||||
return column_specification::all_in_same_table(_column_info->_names);
|
||||
}
|
||||
|
||||
void metadata::set_paging_state(::shared_ptr<const service::pager::paging_state> paging_state) {
|
||||
void metadata::set_paging_state(lw_shared_ptr<const service::pager::paging_state> paging_state) {
|
||||
_flags.set<flag::HAS_MORE_PAGES>();
|
||||
_paging_state = std::move(paging_state);
|
||||
}
|
||||
|
||||
void metadata::maybe_set_paging_state(::shared_ptr<const service::pager::paging_state> paging_state) {
|
||||
void metadata::maybe_set_paging_state(lw_shared_ptr<const service::pager::paging_state> paging_state) {
|
||||
assert(paging_state);
|
||||
if (paging_state->get_remaining() > 0) {
|
||||
set_paging_state(std::move(paging_state));
|
||||
@@ -97,7 +97,7 @@ metadata::flag_enum_set metadata::flags() const {
|
||||
return _flags;
|
||||
}
|
||||
|
||||
::shared_ptr<const service::pager::paging_state> metadata::paging_state() const {
|
||||
lw_shared_ptr<const service::pager::paging_state> metadata::paging_state() const {
|
||||
return _paging_state;
|
||||
}
|
||||
|
||||
|
||||
@@ -93,13 +93,13 @@ private:
|
||||
|
||||
private:
|
||||
lw_shared_ptr<column_info> _column_info;
|
||||
::shared_ptr<const service::pager::paging_state> _paging_state;
|
||||
lw_shared_ptr<const service::pager::paging_state> _paging_state;
|
||||
|
||||
public:
|
||||
metadata(std::vector<::shared_ptr<column_specification>> names_);
|
||||
|
||||
metadata(flag_enum_set flags, std::vector<::shared_ptr<column_specification>> names_, uint32_t column_count,
|
||||
::shared_ptr<const service::pager::paging_state> paging_state);
|
||||
lw_shared_ptr<const service::pager::paging_state> paging_state);
|
||||
|
||||
// The maximum number of values that the ResultSet can hold. This can be bigger than columnCount due to CASSANDRA-4911
|
||||
uint32_t value_count() const;
|
||||
@@ -110,8 +110,8 @@ private:
|
||||
bool all_in_same_cf() const;
|
||||
|
||||
public:
|
||||
void set_paging_state(::shared_ptr<const service::pager::paging_state> paging_state);
|
||||
void maybe_set_paging_state(::shared_ptr<const service::pager::paging_state> paging_state);
|
||||
void set_paging_state(lw_shared_ptr<const service::pager::paging_state> paging_state);
|
||||
void maybe_set_paging_state(lw_shared_ptr<const service::pager::paging_state> paging_state);
|
||||
|
||||
void set_skip_metadata();
|
||||
|
||||
@@ -119,7 +119,7 @@ public:
|
||||
|
||||
uint32_t column_count() const { return _column_info->_column_count; }
|
||||
|
||||
::shared_ptr<const service::pager::paging_state> paging_state() const;
|
||||
lw_shared_ptr<const service::pager::paging_state> paging_state() const;
|
||||
|
||||
const std::vector<::shared_ptr<column_specification>>& get_names() const {
|
||||
return _column_info->_names;
|
||||
|
||||
@@ -474,7 +474,7 @@ indexed_table_select_statement::do_execute_base_query(
|
||||
service::query_state& state,
|
||||
const query_options& options,
|
||||
gc_clock::time_point now,
|
||||
::shared_ptr<const service::pager::paging_state> paging_state) const {
|
||||
lw_shared_ptr<const service::pager::paging_state> paging_state) const {
|
||||
auto cmd = prepare_command_for_base_query(options, state, now, bool(paging_state));
|
||||
auto timeout = db::timeout_clock::now() + options.get_timeout_config().*get_timeout_config_selector();
|
||||
uint32_t queried_ranges_count = partition_ranges.size();
|
||||
@@ -531,7 +531,7 @@ indexed_table_select_statement::execute_base_query(
|
||||
service::query_state& state,
|
||||
const query_options& options,
|
||||
gc_clock::time_point now,
|
||||
::shared_ptr<const service::pager::paging_state> paging_state) const {
|
||||
lw_shared_ptr<const service::pager::paging_state> paging_state) const {
|
||||
return do_execute_base_query(proxy, std::move(partition_ranges), state, options, now, paging_state).then(
|
||||
[this, &proxy, &state, &options, now, paging_state = std::move(paging_state)] (foreign_ptr<lw_shared_ptr<query::result>> result, lw_shared_ptr<query::read_command> cmd) {
|
||||
return process_base_query_results(std::move(result), std::move(cmd), proxy, state, options, now, std::move(paging_state));
|
||||
@@ -545,7 +545,7 @@ indexed_table_select_statement::do_execute_base_query(
|
||||
service::query_state& state,
|
||||
const query_options& options,
|
||||
gc_clock::time_point now,
|
||||
::shared_ptr<const service::pager::paging_state> paging_state) const {
|
||||
lw_shared_ptr<const service::pager::paging_state> paging_state) const {
|
||||
auto cmd = prepare_command_for_base_query(options, state, now, bool(paging_state));
|
||||
auto timeout = db::timeout_clock::now() + options.get_timeout_config().*get_timeout_config_selector();
|
||||
|
||||
@@ -607,7 +607,7 @@ indexed_table_select_statement::execute_base_query(
|
||||
service::query_state& state,
|
||||
const query_options& options,
|
||||
gc_clock::time_point now,
|
||||
::shared_ptr<const service::pager::paging_state> paging_state) const {
|
||||
lw_shared_ptr<const service::pager::paging_state> paging_state) const {
|
||||
return do_execute_base_query(proxy, std::move(primary_keys), state, options, now, paging_state).then(
|
||||
[this, &proxy, &state, &options, now, paging_state = std::move(paging_state)] (foreign_ptr<lw_shared_ptr<query::result>> result, lw_shared_ptr<query::read_command> cmd) {
|
||||
return process_base_query_results(std::move(result), std::move(cmd), proxy, state, options, now, std::move(paging_state));
|
||||
@@ -661,7 +661,7 @@ indexed_table_select_statement::process_base_query_results(
|
||||
service::query_state& state,
|
||||
const query_options& options,
|
||||
gc_clock::time_point now,
|
||||
::shared_ptr<const service::pager::paging_state> paging_state) const
|
||||
lw_shared_ptr<const service::pager::paging_state> paging_state) const
|
||||
{
|
||||
if (paging_state) {
|
||||
paging_state = generate_view_paging_state_from_base_query_results(paging_state, results, proxy, state, options);
|
||||
@@ -831,7 +831,7 @@ static void append_base_key_to_index_ck(std::vector<bytes_view>& exploded_index_
|
||||
std::move(begin, key_view.end(), std::back_inserter(exploded_index_ck));
|
||||
}
|
||||
|
||||
::shared_ptr<const service::pager::paging_state> indexed_table_select_statement::generate_view_paging_state_from_base_query_results(::shared_ptr<const service::pager::paging_state> paging_state,
|
||||
lw_shared_ptr<const service::pager::paging_state> indexed_table_select_statement::generate_view_paging_state_from_base_query_results(lw_shared_ptr<const service::pager::paging_state> paging_state,
|
||||
const foreign_ptr<lw_shared_ptr<query::result>>& results, service::storage_proxy& proxy, service::query_state& state, const query_options& options) const {
|
||||
const column_definition* cdef = _schema->get_column_definition(to_bytes(_index.target_column()));
|
||||
if (!cdef) {
|
||||
@@ -876,7 +876,7 @@ static void append_base_key_to_index_ck(std::vector<bytes_view>& exploded_index_
|
||||
return std::move(paging_state);
|
||||
}
|
||||
|
||||
auto paging_state_copy = ::make_shared<service::pager::paging_state>(service::pager::paging_state(*paging_state));
|
||||
auto paging_state_copy = make_lw_shared<service::pager::paging_state>(service::pager::paging_state(*paging_state));
|
||||
paging_state_copy->set_partition_key(std::move(index_pk));
|
||||
paging_state_copy->set_clustering_key(std::move(index_ck));
|
||||
return std::move(paging_state_copy);
|
||||
@@ -965,18 +965,18 @@ indexed_table_select_statement::do_execute(service::storage_proxy& proxy,
|
||||
|
||||
if (whole_partitions || partition_slices) {
|
||||
return find_index_partition_ranges(proxy, state, *internal_options).then(
|
||||
[this, now, &state, &internal_options, &proxy, consume_results = std::move(consume_results)] (dht::partition_range_vector partition_ranges, ::shared_ptr<const service::pager::paging_state> paging_state) {
|
||||
[this, now, &state, &internal_options, &proxy, consume_results = std::move(consume_results)] (dht::partition_range_vector partition_ranges, lw_shared_ptr<const service::pager::paging_state> paging_state) {
|
||||
bool has_more_pages = paging_state && paging_state->get_remaining() > 0;
|
||||
internal_options.reset(new cql3::query_options(std::move(internal_options), paging_state ? ::make_shared<service::pager::paging_state>(*paging_state) : nullptr));
|
||||
internal_options.reset(new cql3::query_options(std::move(internal_options), paging_state ? make_lw_shared<service::pager::paging_state>(*paging_state) : nullptr));
|
||||
return do_execute_base_query(proxy, std::move(partition_ranges), state, *internal_options, now, std::move(paging_state)).then(consume_results).then([has_more_pages] {
|
||||
return stop_iteration(!has_more_pages);
|
||||
});
|
||||
});
|
||||
} else {
|
||||
return find_index_clustering_rows(proxy, state, *internal_options).then(
|
||||
[this, now, &state, &internal_options, &proxy, consume_results = std::move(consume_results)] (std::vector<primary_key> primary_keys, ::shared_ptr<const service::pager::paging_state> paging_state) {
|
||||
[this, now, &state, &internal_options, &proxy, consume_results = std::move(consume_results)] (std::vector<primary_key> primary_keys, lw_shared_ptr<const service::pager::paging_state> paging_state) {
|
||||
bool has_more_pages = paging_state && paging_state->get_remaining() > 0;
|
||||
internal_options.reset(new cql3::query_options(std::move(internal_options), paging_state ? ::make_shared<service::pager::paging_state>(*paging_state) : nullptr));
|
||||
internal_options.reset(new cql3::query_options(std::move(internal_options), paging_state ? make_lw_shared<service::pager::paging_state>(*paging_state) : nullptr));
|
||||
return this->do_execute_base_query(proxy, std::move(primary_keys), state, *internal_options, now, std::move(paging_state)).then(consume_results).then([has_more_pages] {
|
||||
return stop_iteration(!has_more_pages);
|
||||
});
|
||||
@@ -995,13 +995,13 @@ indexed_table_select_statement::do_execute(service::storage_proxy& proxy,
|
||||
if (whole_partitions || partition_slices) {
|
||||
// In this case, can use our normal query machinery, which retrieves
|
||||
// entire partitions or the same slice for many partitions.
|
||||
return find_index_partition_ranges(proxy, state, options).then([now, &state, &options, &proxy, this] (dht::partition_range_vector partition_ranges, ::shared_ptr<const service::pager::paging_state> paging_state) {
|
||||
return find_index_partition_ranges(proxy, state, options).then([now, &state, &options, &proxy, this] (dht::partition_range_vector partition_ranges, lw_shared_ptr<const service::pager::paging_state> paging_state) {
|
||||
return this->execute_base_query(proxy, std::move(partition_ranges), state, options, now, std::move(paging_state));
|
||||
});
|
||||
} else {
|
||||
// In this case, we need to retrieve a list of rows (not entire
|
||||
// partitions) and then retrieve those specific rows.
|
||||
return find_index_clustering_rows(proxy, state, options).then([now, &state, &options, &proxy, this] (std::vector<primary_key> primary_keys, ::shared_ptr<const service::pager::paging_state> paging_state) {
|
||||
return find_index_clustering_rows(proxy, state, options).then([now, &state, &options, &proxy, this] (std::vector<primary_key> primary_keys, lw_shared_ptr<const service::pager::paging_state> paging_state) {
|
||||
return this->execute_base_query(proxy, std::move(primary_keys), state, options, now, std::move(paging_state));
|
||||
});
|
||||
}
|
||||
@@ -1153,7 +1153,7 @@ indexed_table_select_statement::read_posting_list(service::storage_proxy& proxy,
|
||||
|
||||
// Note: the partitions keys returned by this function are sorted
|
||||
// in token order. See issue #3423.
|
||||
future<dht::partition_range_vector, ::shared_ptr<const service::pager::paging_state>>
|
||||
future<dht::partition_range_vector, lw_shared_ptr<const service::pager::paging_state>>
|
||||
indexed_table_select_statement::find_index_partition_ranges(service::storage_proxy& proxy,
|
||||
service::query_state& state,
|
||||
const query_options& options) const
|
||||
@@ -1189,13 +1189,13 @@ indexed_table_select_statement::find_index_partition_ranges(service::storage_pro
|
||||
partition_ranges.emplace_back(range);
|
||||
}
|
||||
auto paging_state = rows->rs().get_metadata().paging_state();
|
||||
return make_ready_future<dht::partition_range_vector, ::shared_ptr<const service::pager::paging_state>>(std::move(partition_ranges), std::move(paging_state));
|
||||
return make_ready_future<dht::partition_range_vector, lw_shared_ptr<const service::pager::paging_state>>(std::move(partition_ranges), std::move(paging_state));
|
||||
});
|
||||
}
|
||||
|
||||
// Note: the partitions keys returned by this function are sorted
|
||||
// in token order. See issue #3423.
|
||||
future<std::vector<indexed_table_select_statement::primary_key>, ::shared_ptr<const service::pager::paging_state>>
|
||||
future<std::vector<indexed_table_select_statement::primary_key>, lw_shared_ptr<const service::pager::paging_state>>
|
||||
indexed_table_select_statement::find_index_clustering_rows(service::storage_proxy& proxy, service::query_state& state, const query_options& options) const
|
||||
{
|
||||
auto now = gc_clock::now();
|
||||
@@ -1220,7 +1220,7 @@ indexed_table_select_statement::find_index_clustering_rows(service::storage_prox
|
||||
primary_keys.emplace_back(primary_key{std::move(dk), std::move(ck)});
|
||||
}
|
||||
auto paging_state = rows->rs().get_metadata().paging_state();
|
||||
return make_ready_future<std::vector<indexed_table_select_statement::primary_key>, ::shared_ptr<const service::pager::paging_state>>(std::move(primary_keys), std::move(paging_state));
|
||||
return make_ready_future<std::vector<indexed_table_select_statement::primary_key>, lw_shared_ptr<const service::pager::paging_state>>(std::move(primary_keys), std::move(paging_state));
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -216,14 +216,14 @@ private:
|
||||
virtual future<::shared_ptr<cql_transport::messages::result_message>> do_execute(service::storage_proxy& proxy,
|
||||
service::query_state& state, const query_options& options) const override;
|
||||
|
||||
::shared_ptr<const service::pager::paging_state> generate_view_paging_state_from_base_query_results(::shared_ptr<const service::pager::paging_state> paging_state,
|
||||
lw_shared_ptr<const service::pager::paging_state> generate_view_paging_state_from_base_query_results(lw_shared_ptr<const service::pager::paging_state> paging_state,
|
||||
const foreign_ptr<lw_shared_ptr<query::result>>& results, service::storage_proxy& proxy, service::query_state& state, const query_options& options) const;
|
||||
|
||||
future<dht::partition_range_vector, ::shared_ptr<const service::pager::paging_state>> find_index_partition_ranges(service::storage_proxy& proxy,
|
||||
future<dht::partition_range_vector, lw_shared_ptr<const service::pager::paging_state>> find_index_partition_ranges(service::storage_proxy& proxy,
|
||||
service::query_state& state,
|
||||
const query_options& options) const;
|
||||
|
||||
future<std::vector<primary_key>, ::shared_ptr<const service::pager::paging_state>> find_index_clustering_rows(service::storage_proxy& proxy,
|
||||
future<std::vector<primary_key>, lw_shared_ptr<const service::pager::paging_state>> find_index_clustering_rows(service::storage_proxy& proxy,
|
||||
service::query_state& state,
|
||||
const query_options& options) const;
|
||||
|
||||
@@ -235,7 +235,7 @@ private:
|
||||
service::query_state& state,
|
||||
const query_options& options,
|
||||
gc_clock::time_point now,
|
||||
::shared_ptr<const service::pager::paging_state> paging_state) const;
|
||||
lw_shared_ptr<const service::pager::paging_state> paging_state) const;
|
||||
|
||||
lw_shared_ptr<query::read_command>
|
||||
prepare_command_for_base_query(const query_options& options, service::query_state& state, gc_clock::time_point now, bool use_paging) const;
|
||||
@@ -247,7 +247,7 @@ private:
|
||||
service::query_state& state,
|
||||
const query_options& options,
|
||||
gc_clock::time_point now,
|
||||
::shared_ptr<const service::pager::paging_state> paging_state) const;
|
||||
lw_shared_ptr<const service::pager::paging_state> paging_state) const;
|
||||
future<shared_ptr<cql_transport::messages::result_message>>
|
||||
execute_base_query(
|
||||
service::storage_proxy& proxy,
|
||||
@@ -255,7 +255,7 @@ private:
|
||||
service::query_state& state,
|
||||
const query_options& options,
|
||||
gc_clock::time_point now,
|
||||
::shared_ptr<const service::pager::paging_state> paging_state) const;
|
||||
lw_shared_ptr<const service::pager::paging_state> paging_state) const;
|
||||
|
||||
// Function for fetching the selected columns from a list of clustering rows.
|
||||
// It is currently used only in our Secondary Index implementation - ordinary
|
||||
@@ -273,7 +273,7 @@ private:
|
||||
service::query_state& state,
|
||||
const query_options& options,
|
||||
gc_clock::time_point now,
|
||||
::shared_ptr<const service::pager::paging_state> paging_state) const;
|
||||
lw_shared_ptr<const service::pager::paging_state> paging_state) const;
|
||||
future<shared_ptr<cql_transport::messages::result_message>>
|
||||
execute_base_query(
|
||||
service::storage_proxy& proxy,
|
||||
@@ -281,7 +281,7 @@ private:
|
||||
service::query_state& state,
|
||||
const query_options& options,
|
||||
gc_clock::time_point now,
|
||||
::shared_ptr<const service::pager::paging_state> paging_state) const;
|
||||
lw_shared_ptr<const service::pager::paging_state> paging_state) const;
|
||||
|
||||
virtual void update_stats_rows_read(int64_t rows_read) const override {
|
||||
_stats.rows_read += rows_read;
|
||||
|
||||
@@ -72,7 +72,7 @@ service::pager::paging_state::paging_state(partition_key pk,
|
||||
, _rows_fetched_for_last_partition(rows_fetched_for_last_partition) {
|
||||
}
|
||||
|
||||
::shared_ptr<service::pager::paging_state> service::pager::paging_state::deserialize(
|
||||
lw_shared_ptr<service::pager::paging_state> service::pager::paging_state::deserialize(
|
||||
bytes_opt data) {
|
||||
if (!data) {
|
||||
return nullptr;
|
||||
@@ -87,7 +87,7 @@ service::pager::paging_state::paging_state(partition_key pk,
|
||||
seastar::simple_input_stream in(reinterpret_cast<char*>(data.value().begin() + sizeof(uint32_t)), data.value().size() - sizeof(uint32_t));
|
||||
|
||||
try {
|
||||
return ::make_shared<paging_state>(ser::deserialize(in, boost::type<paging_state>()));
|
||||
return make_lw_shared<paging_state>(ser::deserialize(in, boost::type<paging_state>()));
|
||||
} catch (...) {
|
||||
std::throw_with_nested(
|
||||
exceptions::protocol_exception(
|
||||
|
||||
@@ -156,7 +156,7 @@ public:
|
||||
return _query_read_repair_decision;
|
||||
}
|
||||
|
||||
static ::shared_ptr<paging_state> deserialize(bytes_opt bytes);
|
||||
static lw_shared_ptr<paging_state> deserialize(bytes_opt bytes);
|
||||
bytes_opt serialize() const;
|
||||
};
|
||||
|
||||
|
||||
@@ -139,7 +139,7 @@ public:
|
||||
* @return the current paging state. If the pager is exhausted, the result is a valid pointer
|
||||
* to a paging_state instance which will return 0 on calling get_remaining() on it.
|
||||
*/
|
||||
::shared_ptr<const paging_state> state() const;
|
||||
lw_shared_ptr<const paging_state> state() const;
|
||||
|
||||
protected:
|
||||
template<typename Base>
|
||||
|
||||
@@ -369,8 +369,8 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
::shared_ptr<const paging_state> query_pager::state() const {
|
||||
return ::make_shared<paging_state>(_last_pkey.value_or(partition_key::make_empty()), _last_ckey, _exhausted ? 0 : _max, _cmd->query_uuid, _last_replicas, _query_read_repair_decision, _rows_fetched_for_last_partition);
|
||||
lw_shared_ptr<const paging_state> query_pager::state() const {
|
||||
return make_lw_shared<paging_state>(_last_pkey.value_or(partition_key::make_empty()), _last_ckey, _exhausted ? 0 : _max, _cmd->query_uuid, _last_replicas, _query_read_repair_decision, _rows_fetched_for_last_partition);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -801,13 +801,13 @@ SEASTAR_TEST_CASE(test_allow_filtering_with_secondary_index) {
|
||||
});
|
||||
}
|
||||
|
||||
static ::shared_ptr<service::pager::paging_state> extract_paging_state(::shared_ptr<cql_transport::messages::result_message> res) {
|
||||
static lw_shared_ptr<service::pager::paging_state> extract_paging_state(::shared_ptr<cql_transport::messages::result_message> res) {
|
||||
auto rows = dynamic_pointer_cast<cql_transport::messages::result_message::rows>(res);
|
||||
auto paging_state = rows->rs().get_metadata().paging_state();
|
||||
if (!paging_state) {
|
||||
return nullptr;
|
||||
}
|
||||
return ::make_shared<service::pager::paging_state>(*paging_state);
|
||||
return make_lw_shared<service::pager::paging_state>(*paging_state);
|
||||
};
|
||||
|
||||
static size_t count_rows_fetched(::shared_ptr<cql_transport::messages::result_message> res) {
|
||||
@@ -992,7 +992,7 @@ SEASTAR_TEST_CASE(test_allow_filtering_per_partition_limit) {
|
||||
{ int32_type->decompose(1), boolean_type->decompose(false)},
|
||||
});
|
||||
|
||||
::shared_ptr<service::pager::paging_state> paging_state = nullptr;
|
||||
lw_shared_ptr<service::pager::paging_state> paging_state = nullptr;
|
||||
// Some pages might be empty and in such case we should continue querying
|
||||
size_t rows_fetched = 0;
|
||||
while (rows_fetched == 0) {
|
||||
|
||||
@@ -483,7 +483,7 @@ SEASTAR_TEST_CASE(test_simple_index_paging) {
|
||||
auto rows = dynamic_pointer_cast<cql_transport::messages::result_message::rows>(res);
|
||||
auto paging_state = rows->rs().get_metadata().paging_state();
|
||||
assert(paging_state);
|
||||
return ::make_shared<service::pager::paging_state>(*paging_state);
|
||||
return make_lw_shared<service::pager::paging_state>(*paging_state);
|
||||
};
|
||||
|
||||
auto expect_more_pages = [] (::shared_ptr<cql_transport::messages::result_message> res, bool more_pages_expected) {
|
||||
@@ -785,7 +785,7 @@ SEASTAR_TEST_CASE(test_local_index_paging) {
|
||||
auto rows = dynamic_pointer_cast<cql_transport::messages::result_message::rows>(res);
|
||||
auto paging_state = rows->rs().get_metadata().paging_state();
|
||||
assert(paging_state);
|
||||
return ::make_shared<service::pager::paging_state>(*paging_state);
|
||||
return make_lw_shared<service::pager::paging_state>(*paging_state);
|
||||
};
|
||||
|
||||
eventually([&] {
|
||||
|
||||
@@ -246,7 +246,7 @@ public:
|
||||
|
||||
std::unique_ptr<cql3::query_options> options;
|
||||
if (flags) {
|
||||
::shared_ptr<service::pager::paging_state> paging_state;
|
||||
lw_shared_ptr<service::pager::paging_state> paging_state;
|
||||
int32_t page_size = flags.contains<options_flag::PAGE_SIZE>() ? read_int() : -1;
|
||||
if (flags.contains<options_flag::PAGING_STATE>()) {
|
||||
paging_state = service::pager::paging_state::deserialize(read_bytes());
|
||||
|
||||
Reference in New Issue
Block a user