mirror of
https://github.com/scylladb/scylladb.git
synced 2026-04-28 04:06:59 +00:00
The multishard combining reader currently assumes that all shards have data for the read range. This however is not always true and in extreme cases (like reading a single token) it can lead to huge read amplification. Avoid this by not pushing shards to `_shard_selection_min_heap` if the first token they are expected to produce falls outside of the read range. Also change the read ahead algorithm to select the shards from `_shard_selection_min_heap`, instead of walking them in shard order. This was wrong in two ways: * Shards may be ordered differently with respect to the first partition they will produce; reading ahead on the next shard in shard order might not bring in data on the next shard the read will continue on. Shard order is only correct when starting a new range and shards are iterated over in the order they own tokens according to the sharding algorithm. * Shards that may not have data relevant to the read range are also considered for read ahead. After this patch, the multishard reader will only read from shards that have data relevant to the read range, both in the case of normal reads and also for read-ahead. Fixes: #8161 Tests: unit(release) Signed-off-by: Botond Dénes <bdenes@scylladb.com> Message-Id: <20210226132536.85438-1-bdenes@scylladb.com>
110 KiB
110 KiB