-
Notifications
You must be signed in to change notification settings - Fork 44
tests: add coverage for skip < offset case #165
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@@ -593,8 +593,12 @@ def _next_page(self): | |||
# skipped all of the results yet. Don't return any results. | |||
# Instead, rerun query, adjusting offsets. Datastore doesn't process | |||
# more than 1000 skipped results in a query. | |||
old_query_pb = query_pb | |||
query_pb = query_pb2.Query() | |||
query_pb._pb.CopyFrom(old_query_pb._pb) # copy for testability |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@craiglabenz is this going to hit the bad path for perf and protoplus?
I have hesitation about making a product change to make it possible to test. Can you shed more light on this change @tseaver
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For perf:
- We are dealing with the raw protos here -- no protoplus attributes are touched, and
CopyFrom
is super-fast (implemented in C). - The copy will only be made once per page, in the edge case where we are skipping over more than a page of results.
For correctness:
- Scribbling on the original
query_pb
is a puzzlement, and might actually defeat some forms of debugging (maybe even a full-retry of the query, if needed somehow?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Closes #158