Class ScanAllRangesCommandIterator

All Implemented Interfaces:
com.google.common.collect.PeekingIterator<RowIterator>, AutoCloseable, Iterator<RowIterator>, BasePartitionIterator<RowIterator>, PartitionIterator, CloseableIterator<RowIterator>

public class ScanAllRangesCommandIterator extends RangeCommandIterator
A custom RangeCommandIterator that queries all replicas required by consistency level at once with data range specify in PartitionRangeReadCommand.

This is to speed up Index.QueryPlan.isTopK() queries that needs to find global top-k rows in the cluster, because existing RangeCommandIterator has to execute a top-k search per vnode range which is wasting resources.

The implementation combines the replica plans for each data range into a single shared replica plan. This results in queries using reconciliation where it may not be expected. This is handled in the DataResolver for top-K queries so any usage for queries other that top-K should bear this in mind.

It is important to note that this implementation can only be used with ConsistencyLevel.ONE and ConsistencyLevel.LOCAL_ONE