Skip to content

Commit

Permalink
partition_snapshot_reader: do not accidentally copy schema
Browse files Browse the repository at this point in the history
Functions `upper_bound` and `lower_bound` had signatures:
```
template<typename T, typename... Args>
static rows_iter_type lower_bound(const T& t, Args... args);
```
This caused a dacay from `const schema&` to `schema` as one of the args,
which in turn copied the schema in a fair number of the queries. Fix
that by setting the parameter type to `Args&&`, which doesn't discard
the reference.

Fixes scylladb#9502
  • Loading branch information
enedil committed Oct 20, 2021
1 parent 7c35d47 commit 546cbc6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions partition_snapshot_reader.hh
Expand Up @@ -114,15 +114,15 @@ class partition_snapshot_flat_reader : public flat_mutation_reader::impl, public
// In reversing mode, upper and lower bounds still need to be executed against
// snapshot schema and ck_range, however we need them to search from "opposite" direction.
template<typename T, typename... Args>
static rows_iter_type lower_bound(const T& t, Args... args) {
static rows_iter_type lower_bound(const T& t, Args&&... args) {
if constexpr (Reversing) {
return make_iterator(t.upper_bound(std::forward<Args>(args)...));
} else {
return make_iterator(t.lower_bound(std::forward<Args>(args)...));
}
}
template<typename T, typename... Args>
static rows_iter_type upper_bound(const T& t, Args... args) {
static rows_iter_type upper_bound(const T& t, Args&&... args) {
if constexpr (Reversing) {
return make_iterator(t.lower_bound(std::forward<Args>(args)...));
} else {
Expand Down

0 comments on commit 546cbc6

Please sign in to comment.