mirror of
https://github.com/scylladb/scylladb.git
synced 2026-04-25 19:10:42 +00:00
This abstraction is used to merge the output of multiple readers, each opened for a single partition query, into a non-decreasing stream of mutation_fragments. It is similar to `mutation_reader_merger`, but an important difference is that the new merger may select new readers in the middle of a partition after it already returned some fragments from that partition. It uses the new `position_reader_queue` abstraction to select new readers. It doesn't support multi-partition (ring range) queries. The new merger will be later used when reading from sstable sets created by TimeWindowCompactionStrategy. This strategy creates many sstables that are mostly disjoint w.r.t the contained clustering keys, so we can delay opening sstable readers when querying a partition until after we have processed all mutation fragments with positions before the keys contained by these sstables. A microbenchmark was added that compares the existing combining reader (which uses `mutation_reader_merger` underneath) with a new combining reader built using the new `clustering_order_reader_merger` and a simple queue of readers that returns readers from some supplied set. The used set of readers is built from the following ranges of keys (each range corresponds to a single reader): `[0, 31]`, `[30, 61]`, `[60, 91]`, `[90, 121]`, `[120, 151]`. The microbenchmark runs the reader and divides the result by the number of mutation fragments. The results on my laptop were: ``` $ build/release/test/perf/perf_mutation_readers -t clustering_combined.* -r 10 single run iterations: 0 single run duration: 1.000s number of runs: 10 test iterations median mad min max clustering_combined.ranges_generic 2911678 117.598ns 0.685ns 116.175ns 119.482ns clustering_combined.ranges_specialized 3005618 111.015ns 0.349ns 110.063ns 111.840ns ``` `ranges_generic` denotes the existing combining reader, `ranges_specialized` denotes the new reader. Split from https://github.com/scylladb/scylla/pull/7437. Closes #7688 * github.com:scylladb/scylla: tests: mutation_source_test for clustering_order_reader_merger perf: microbenchmark for clustering_order_reader_merger mutation_reader_test: test clustering_order_reader_merger in memory test: generalize `random_subset` and move to header mutation_reader: introduce clustering_order_reader_merger