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

[YSQL] Support SELECT ... NOWAIT in REPEATABLE READ and SERIALIZABLE isolation level #12166

Open
pkj415 opened this issue Apr 14, 2022 · 1 comment
Labels
area/ysql Yugabyte SQL (YSQL) kind/enhancement This is an enhancement of an existing feature pg-compatibility Label for issues that result in differences b/w YSQL and Pg semantics priority/medium Medium priority issue

Comments

@pkj415
Copy link
Contributor

pkj415 commented Apr 14, 2022

Jira Link: DB-503

Description

Currently, NOWAIT is supported in READ COMMITTED isolation level only.

@pkj415 pkj415 added area/ysql Yugabyte SQL (YSQL) status/awaiting-triage Issue awaiting triage labels Apr 14, 2022
@pkj415 pkj415 added the pg-compatibility Label for issues that result in differences b/w YSQL and Pg semantics label May 24, 2022
@yugabyte-ci yugabyte-ci added kind/bug This issue is a bug priority/medium Medium priority issue labels May 24, 2022
@yugabyte-ci yugabyte-ci added kind/new-feature This is a request for a completely new feature and removed kind/bug This issue is a bug status/awaiting-triage Issue awaiting triage labels Jul 27, 2022
@yugabyte-ci yugabyte-ci added kind/enhancement This is an enhancement of an existing feature and removed kind/new-feature This is a request for a completely new feature labels Aug 18, 2022
@FranckPachot
Copy link
Contributor

@pkj415 What is the status of this issue?

I see the expected behavior: not waiting but an error if it cannot lock the row:

yugabyte=# create table kv ( key int primary key, value int);
CREATE TABLE

yugabyte=# begin transaction isolation level repeatable read;
BEGIN

yugabyte=*# SELECT Key, Value FROM KV WHERE Key=1 FOR UPDATE NOWAIT;
WARNING:  Setting wait policy to NOWAIT which is not allowed in REPEATABLE READ isolation (GH issue #12166)

 key | value
-----+-------
   1 |   100
(1 row)

yugabyte=*# \! psql -c " begin transaction isolation level repeatable read; SELECT Key, Value FROM KV WHERE Key=1 FOR UPDATE NOWAIT; commit;"

WARNING:  Setting wait policy to NOWAIT which is not allowed in REPEATABLE READ isolation (GH issue #12166)
BEGIN
ERROR:  could not obtain lock on row in relation "kv"

On other tries (probably depending on transaction priority) it succeeds, and the other transaction fails on Unknown transaction, could be recently aborted. But in all case it's a NOWAIT behavior.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/ysql Yugabyte SQL (YSQL) kind/enhancement This is an enhancement of an existing feature pg-compatibility Label for issues that result in differences b/w YSQL and Pg semantics priority/medium Medium priority issue
Projects
None yet
Development

No branches or pull requests

3 participants