fix: Ensure Flux reads across all shards #20064
Merged
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.
Closes #20035
This PR ensures all elements of the
cursors.CursorIterator
slice (itrs
) are read when reading a multi-shard cursor. It is accompanied with a unit test to replicate the incorrect behaviour.The root cause is that it is possible a single shard has no data for a given query and this resulted in the read stopping short, as it returned a nil cursor.
Unlike the
createCursor
function, which finds the next non-nil result from theitrs
slice:influxdb/storage/reads/array_cursor.go
Lines 110 to 113 in b7ac9f0
the existing implementation of
nextArrayCursor
was only checking one element of theitrs
slice:influxdb/storage/reads/array_cursor.gen.go
Lines 316 to 317 in 632e8f1
If the call to
Next
returned a nilCursor
, that signalled the end of the read.This fix ensures
itrs
is read in a loop for the next non-nil cursor.