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
fix: increment seqno before execute calls to prevent InvalidArgument … #19
Conversation
…errors after a previous error
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.
In addition to the atomicity changes I suggested, the PR really needs to add a unit test for each modified method, provoking the bug (e.g., by raising an exception from inside the api.execute_streaming_sql
/ api.execute_sql
/ api.batch_execute_dml
methods). The new testcases should then assert that the instance's _execute_sql_count
had been incremented.
@@ -243,15 +244,16 @@ def batch_update(self, statements): | |||
transaction = self._make_txn_selector() | |||
api = database.spanner_api | |||
|
|||
seqno = self._execute_sql_count | |||
self._execute_sql_count += 1 |
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.
Likewise here:
seqno, self._execute_sql_count = self._execute_sql_count, self._execute_sql_count + 1
We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google. ℹ️ Googlers: Go here for more info. |
@larkee I don't know what the CLA bot is on about: |
Also, the PR still needs the added unit tests I outlined above. |
e4039a9
to
c67c8ba
Compare
CLAs look good, thanks! ℹ️ Googlers: Go here for more info. |
@tseaver I've fixed the CLA problem by just redoing the commits. I added the test and noticed that the change to snapshot.py doesn't actually make any difference, possibly because the call is wrapped in functools.partial? Because of this, I've reverted it. |
…errors after a previous error
Fixes #11