Skip to content

sql: add row lock modes; make FOR UPDATE a no-op #40206

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

Merged
merged 1 commit into from
Aug 27, 2019

Conversation

jordanlewis
Copy link
Member

This commit adds parsing for the row locking modes: FOR UPDATE, FOR NO
KEY UPDATE, FOR SHARE, FOR KEY UPDATE.

All return unimplemented errors, except for FOR UPDATE, which behaves as
a no-op.

Closes #6583.
Added #40205 to track the remaining kinds of row locking.

Release note (sql change): support parsing the FOR UPDATE modifier on
SELECT clauses, treating it as a no-op, since CockroachDB's transactions
only operate in SERIALIZABLE mode.

@jordanlewis jordanlewis requested a review from a team as a code owner August 26, 2019 03:42
@cockroach-teamcity
Copy link
Member

This change is Reviewable

Copy link
Contributor

@bdarnell bdarnell left a comment

Choose a reason for hiding this comment

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

LGTM, but should we go ahead and make all of these no-ops instead of just FOR UPDATE? I think the same logic applies to all of these (except for the fact that FOR UPDATE appears to be far more commonly used than the others).

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @andy-kimball, @bdarnell, and @rytaft)

@jordanlewis
Copy link
Member Author

We can do that - I hadn't thought about the semantics of all of the other ones, which also seem subtle - but I think you're right that none of them are observably different when all transactions are serializable.

This commit adds parsing for the row locking modes: FOR UPDATE, FOR NO
KEY UPDATE, FOR SHARE, FOR KEY UPDATE.

All return unimplemented errors, except for FOR UPDATE, which behaves as
a no-op.

Release note (sql change): support parsing the FOR UPDATE modifier on
SELECT clauses, treating it as a no-op, since CockroachDB's transactions
only operate in SERIALIZABLE mode.
Copy link
Collaborator

@rytaft rytaft left a comment

Choose a reason for hiding this comment

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

:LGTM:

Reviewed 9 of 9 files at r1, 4 of 4 files at r2.
Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @andy-kimball)

@jordanlewis
Copy link
Member Author

bors r+

craig bot pushed a commit that referenced this pull request Aug 27, 2019
40206: sql: add row lock modes; make FOR UPDATE a no-op r=jordanlewis a=jordanlewis

This commit adds parsing for the row locking modes: FOR UPDATE, FOR NO
KEY UPDATE, FOR SHARE, FOR KEY UPDATE.

All return unimplemented errors, except for FOR UPDATE, which behaves as
a no-op.

Closes #6583.
Added #40205 to track the remaining kinds of row locking.

Release note (sql change): support parsing the FOR UPDATE modifier on
SELECT clauses, treating it as a no-op, since CockroachDB's transactions
only operate in SERIALIZABLE mode.

Co-authored-by: Jordan Lewis <[email protected]>
@craig
Copy link
Contributor

craig bot commented Aug 27, 2019

Build succeeded

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

sql: explicit lock syntax (SELECT FOR {SHARE,UPDATE} {skip locked,nowait})
4 participants