mirror of
https://github.com/scylladb/scylladb.git
synced 2026-05-01 13:45:53 +00:00
`time_series_sstable_set` uses `clustering_combined_reader` to implement efficient single-partition reads. It provides a `position_reader_queue` to the reader. This queue returns readers to the sstables from the set in order of the sstables' lower bounds, and with each reader it provides an upper bound for the positions-in-partition returned by the reader. Until now we would assume non-reversed queries only. Reversed queries were implemented by performing forward query in the lower layers and reversing the results at the upper-most layer of the reader stack. Before pushing the reversing down to the sources (in particular, to sstable readers), we need to support the reverse mode in `time_series_sstable_set` and the queue it provides to `clustering_combined_reader`. This requires using different lower and upper bounds in the queue. For non-reversed reads we used `sstable::min_position()` as the lower bound and `sstable::max_position()` as the upper bound. For reversed reads all comparisons performed by `clustering_combined_reader` will be reversed, as it will use a reversed schema. We can then use `sstable::max_position().reversed()` for the lower bound and `sstable::min_position().reversed()` for the upper bound.