CNDB-12308: Remove index-based sorting at CQL level #1488
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
It was recently found that index-based sorting is done twice in the coordinator. The first sorting is done by
StorageAttachedIndexQueryPlan#postProcessor
, at the service level, which sorts aPartitionIterator
. Then a second sorting is done bySortedRowsBuilder
, at the CQL level, which sorts a simplerList<ByteBuffer>
.CNDB-11762 removed the entire
StorageAttachedIndexQueryPlan#postProcessor
method so sorting was not duplicated anymore. However, this was problematic for implementations ofQueryInfoTracker.ReadTracker
, which is applied after sorting with the postprocessor, but before sorting at the CQL level, here. Thus, that change was reverted to avoid breaking external trackers relying on the previous behaviour.I think what we should do instead is to get rid of index-based sorting at the CQL level, so all sorting is done by the postprocessor. The postprocessor works at a lower level so, with some adjustments, it should be able to do all the sorting on its own without needing CQL intervention. That should remove the duplicated sorting and simplify CQL a bit.
Checklist before you submit for review
NoSpamLogger
for log lines that may appear frequently in the logs