Skip to content
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

Merged
merged 9 commits into from Mar 24, 2020

Conversation

larkee
Copy link
Contributor

@larkee larkee commented Feb 18, 2020

…errors after a previous error

Fixes #11

@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Feb 18, 2020
Copy link
Contributor

@tseaver tseaver left a 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.

google/cloud/spanner_v1/transaction.py Outdated Show resolved Hide resolved
@@ -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
Copy link
Contributor

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

@googlebot
Copy link

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.
In order to pass this check, please resolve this problem and then comment @googlebot I fixed it.. If the bot doesn't comment, it means it doesn't think anything has changed.

ℹ️ Googlers: Go here for more info.

@googlebot googlebot added cla: no This human has *not* signed the Contributor License Agreement. and removed cla: yes This human has signed the Contributor License Agreement. labels Feb 20, 2020
@larkee larkee requested a review from tseaver February 21, 2020 04:53
@tseaver
Copy link
Contributor

tseaver commented Feb 25, 2020

@larkee I don't know what the CLA bot is on about: tseaver@palladion.com is my normal github email, and the one associated with my long-ago-signed CLA (I've been committing to these repos using it for 5+ years now!).

@tseaver
Copy link
Contributor

tseaver commented Feb 25, 2020

Also, the PR still needs the added unit tests I outlined above.

@googlebot
Copy link

CLAs look good, thanks!

ℹ️ Googlers: Go here for more info.

@googlebot googlebot added cla: yes This human has signed the Contributor License Agreement. and removed cla: no This human has *not* signed the Contributor License Agreement. labels Feb 26, 2020
@larkee
Copy link
Contributor Author

larkee commented Feb 27, 2020

@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.

@odeke-em
Copy link

odeke-em commented Mar 3, 2020

Kindly pinging you @tseaver @skuruppu to take a look here as we need this change. Thank you.

@larkee larkee requested a review from skuruppu March 23, 2020 06:09
@larkee larkee dismissed tseaver’s stale review March 24, 2020 04:25

I have made these changes.

@larkee larkee merged commit adeacee into googleapis:master Mar 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
5 participants