Fix: Allow filtering empty page enumerable premature reduce exit #35
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.
Because of ALLOW FILTERING, it is possible for a Scylla query to return pages of rows which are often empty, followed by non empty pages. This causes CQEx's enumerable to fail to iterate past the empty page and therefore not stream all the results
I populate my table (partitioned by
id
) where 5% (by random chance) of the events match the WHERE clause and 95% do notAs you can see there are many empty pages by there are still several events
I now try this using CQEx and find no events
I now run this again but with redbug
what is suspicious to me is the last call:
% cqerl:has_more_pages/1 -> true
which returns true.This I guess indicates the Enumerable recursion exits before
cqerl:has_more_pages
can return false.This last line
% cqerl:next/1 -> empty_dataset
indicates that we prematurely exit.Now it works! 🥳
This affects scylla 3.x and 4.x. Have not tried Cassandra
This issue will also affect the
defp find
function as well