mirror of
https://github.com/scylladb/scylladb.git
synced 2026-04-25 11:00:35 +00:00
We introduce a new single-key sstable reader for sstables created by `TimeWindowCompactionStrategy`. The reader uses the fact that sstables created by TWCS are mostly disjoint with respect to the contained `position_in_partition`s in order to avoid having multiple sstable readers opened at the same time unnecessarily. In case there are overlapping ranges (for example, in the current time-window), it performs the necessary merging (it uses `clustering_order_reader_merger`, introduced recently). The reader uses min/max clustering key metadata present in `md` sstables in order to decide when to open or close a sstable reader. The following experiment was performed: 1. create a TWCS table with 1 minute windows 2. fill the table with 8 equal windows of data (each window flushed to a separate sstable) 3. perform `select * from ks.t where pk = 0 limit 1` query with and without the change The expectation is that with the commit, only one sstable will be opened to fetch that one row; without the commit all 8 sstables would be opened at once. The difference in the value of `scylla_reactor_aio_bytes_read` was measured (value after the query minus value before the query), both with and without the commit. With the commit, the difference was 67584. Without the commit, the difference was 528384. 528384 / 67584 ~= 7.8. Fixes #6418. Closes #7437 * github.com:scylladb/scylla: sstables: gather clustering key filtering statistics in TWCS single key reader sstables: use time_series_sstable_set in time_window_compaction_strategy sstable_set: new reader for TWCS single partition queries mutation_reader_test: test clustering_order_reader_merger with time_series_sstable_set sstable_set: introduce min_position_reader_queue sstable_set: introduce time_series_sstable_set sstables: add min_position and max_position accessors sstable_set: make create_single_key_sstable_reader a virtual method clustering_order_reader_merger: fix the 0 readers case