Open jacobg opened 4 days ago
Actually, maybe the backend is returning no cursor and 0 skipped results before it got through all the results it needs to offset.
It seems to repro when querying on multiple properties, with at least one of them being a list property. It seems to work correctly, if not querying any list property, or if only querying on one list property and nothing else.
Could that mean a backend bug, possibly when querying a list with an offset using zig-zag merge?
Sorry I don't have a good repro for you because I'm only repro-ing it on my data, but here is a code that seems to clearly demonstrate a bug:
In addition, I added two print statements in google/cloud/datastore/query.py's _next_page while loop:
This is the output running the script:
It seems what happens is that if the
while
loop that skips results based on offset reaches the end of the actual resultset, then the response returns empty cursor. In that case, what the code should do is realize there are no results and immediately return. However, what the code does instead is move on to run the full query again for one more iteration, then exit the while loop, and fetch and return all the remaining results.Am I understanding that correctly?