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

Finish read-write transaction when SELECT statement was aborted #96

Merged
merged 2 commits into from
Dec 17, 2020

Conversation

apstndb
Copy link
Collaborator

@apstndb apstndb commented Dec 17, 2020

This PR fixed a bug that the read-write transaction doesn't finish when the execution of SELECT statement returns codes.Aborted.

Behavior

> BEGIN RW;
Query OK, 0 rows affected (0.01 sec)

(rw txn)> @{LOCK_SCANNED_RANGES=exclusive} SELECT * FROM tbl WHERE pk = 0;
Empty set (10.44 msecs)

(rw txn)> @{LOCK_SCANNED_RANGES=exclusive} SELECT * FROM tbl WHERE pk = 0;
ERROR: spanner: code = "Aborted", desc = "Transaction was aborted."
>  

This PR doesn't change the behavior of codes other than codes.Aborted so syntax error doesn't abort transaction. It seems user friendly.

(rw txn)> SELECT * FROM tbl WHERE pk = '';
ERROR: spanner: code = "InvalidArgument", desc = "No matching signature for operator = for argument types: INT64, STRING. Supported signature: ANY = ANY [at 1:25]\\nSELECT * FROM tbl WHERE pk = \\'\\'\\n                        ^"
(rw txn)> 

closes #95

@google-cla google-cla bot added the cla: yes CLA signed label Dec 17, 2020
@yfuruyama yfuruyama self-requested a review December 17, 2020 13:57
Copy link
Collaborator

@yfuruyama yfuruyama left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks!

@yfuruyama yfuruyama merged commit 051eb4b into cloudspannerecosystem:master Dec 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes CLA signed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Finish read-write transaction when aborted
2 participants