diff --git a/dht/i_partitioner.cc b/dht/i_partitioner.cc index 3ed1a83ac5..93d253bf06 100644 --- a/dht/i_partitioner.cc +++ b/dht/i_partitioner.cc @@ -363,8 +363,8 @@ ring_position_exponential_sharder::next(const schema& s) { } -ring_position_exponential_vector_sharder::ring_position_exponential_vector_sharder(const std::vector>& ranges) - : _ranges(std::begin(ranges), std::end(ranges)) { +ring_position_exponential_vector_sharder::ring_position_exponential_vector_sharder(const std::vector>&& ranges) { + std::move(ranges.begin(), ranges.end(), std::back_inserter(_ranges)); if (!_ranges.empty()) { _current_sharder.emplace(_ranges.front()); _ranges.pop_front(); diff --git a/dht/i_partitioner.hh b/dht/i_partitioner.hh index 068314f018..34609305a5 100644 --- a/dht/i_partitioner.hh +++ b/dht/i_partitioner.hh @@ -641,7 +641,7 @@ class ring_position_exponential_vector_sharder { stdx::optional _current_sharder; unsigned _element = 0; public: - explicit ring_position_exponential_vector_sharder(const std::vector>& ranges); + explicit ring_position_exponential_vector_sharder(const std::vector>&& ranges); stdx::optional next(const schema& s); }; diff --git a/service/storage_proxy.cc b/service/storage_proxy.cc index fc7d026d7b..6ca0fcb192 100644 --- a/service/storage_proxy.cc +++ b/service/storage_proxy.cc @@ -4073,18 +4073,19 @@ struct partition_range_and_sort_key { }; future>, cache_temperature> -storage_proxy::query_nonsingular_mutations_locally(schema_ptr s, lw_shared_ptr cmd, const dht::partition_range_vector& prs, +storage_proxy::query_nonsingular_mutations_locally(schema_ptr s, lw_shared_ptr cmd, const dht::partition_range_vector&& prs, tracing::trace_state_ptr trace_state, uint64_t max_size) { // no one permitted us to modify *cmd, so make a copy auto shard_cmd = make_lw_shared(*cmd); + auto range_count = static_cast(prs.size()); return do_with(cmd, shard_cmd, 0u, false, - static_cast(prs.size()), + range_count, std::unordered_map{}, mutation_result_merger{s, cmd}, - dht::ring_position_exponential_vector_sharder{prs}, + dht::ring_position_exponential_vector_sharder{std::move(prs)}, global_schema_ptr(s), tracing::global_trace_state_ptr(std::move(trace_state)), cache_temperature(0.0f), diff --git a/service/storage_proxy.hh b/service/storage_proxy.hh index f0253e1420..0046cc3541 100644 --- a/service/storage_proxy.hh +++ b/service/storage_proxy.hh @@ -279,7 +279,7 @@ private: template future<> mutate_internal(Range mutations, db::consistency_level cl, bool counter_write, tracing::trace_state_ptr tr_state, stdx::optional timeout_opt = { }); future>, cache_temperature> query_nonsingular_mutations_locally( - schema_ptr s, lw_shared_ptr cmd, const dht::partition_range_vector& pr, tracing::trace_state_ptr trace_state, uint64_t max_size); + schema_ptr s, lw_shared_ptr cmd, const dht::partition_range_vector&& pr, tracing::trace_state_ptr trace_state, uint64_t max_size); struct frozen_mutation_and_schema { frozen_mutation fm;