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] Serializable isolation SELECT, DELETE, SELECT excessive failures #2698

Closed
jaki opened this issue Oct 23, 2019 · 5 comments
Closed

[YSQL] Serializable isolation SELECT, DELETE, SELECT excessive failures #2698

jaki opened this issue Oct 23, 2019 · 5 comments
Assignees
Labels
area/ysql Yugabyte SQL (YSQL)

Comments

@jaki
Copy link
Contributor

jaki commented Oct 23, 2019

Compared to vanilla PostgreSQL, Yugabyte seems to fail too often whenever a serializable isolation level transaction happens with an intermediate DELETE. Nothing is particularly wrong with the excessive failures. The most notable failure is on the second variant of <stmt> below, where disjoint SELECTs and DELETEs still cause failures.

Session A Session B
CREATE TABLE t (i int)
INSERT INTO t VALUES (1), (2), (3)
BEGIN ISOLATION LEVEL SERIALIZABLE
<stmt>
DELETE FROM t WHERE i = 2
<stmt>
COMMIT
<stmt> PostgreSQL 11 Yugabyte
SELECT * FROM t 3 rows; 3 rows fail
SELECT i FROM t WHERE i = 1 1 row; 1 row fail
SELECT i FROM t WHERE i = 2 1 row; 1 row fail
SELECT i FROM t WHERE i > 1 2 rows; 2 rows fail
SELECT i FROM t 3 rows; 3 rows fail

The "fail" above are all of the same kind. They non-deterministically fail on one of two statements:

  • The DELETE:

    ERROR:  Operation failed. Try again.: 42e6ddd2-30a7-4131-86a5-c4755b605092 Conflicts with higher priority transaction: de163721-31a8-4feb-92a7-7cbda4bdab53
    
  • The second <stmt>:

    ERROR:  Operation failed. Try again.: Transaction aborted: b8bde22d-b5e1-4ece-93f2-2ea312b24dd5
    

Related:

@jaki jaki added kind/bug This issue is a bug area/ysql Yugabyte SQL (YSQL) labels Oct 23, 2019
@jaki jaki self-assigned this Oct 23, 2019
@jaki
Copy link
Contributor Author

jaki commented Oct 23, 2019

Note that I have edited both this comment and the above comment to clean things up from a previous version of this issue that is no longer relevant.

@jaki jaki closed this as completed Oct 23, 2019
@jaki jaki removed their assignment Oct 24, 2019
@jaki jaki added kind/enhancement This is an enhancement of an existing feature priority/low Low priority and removed kind/bug This issue is a bug kind/enhancement This is an enhancement of an existing feature labels Nov 4, 2019
@jaki jaki self-assigned this Nov 4, 2019
@jaki jaki changed the title [YSQL] Transaction SELECT, DELETE, SELECT inconsistencies [YSQL] Serializable isolation SELECT, DELETE, SELECT excessive failures Nov 4, 2019
@jaki jaki reopened this Nov 4, 2019
@lhotari
Copy link

lhotari commented Nov 5, 2019

We are facing this issue with pretty basic use cases with YSQL and it's becoming a blocker. Do you need help in reproducing the issue?

@jaki
Copy link
Contributor Author

jaki commented Nov 5, 2019

Hi, @lhotari. Feel free to detail your use cases and issues. If the issues do not fall into any of the cases above, a repro would be particularly nice.

Note that this is not necessarily a bug because Yugabyte serializable isolation isn't the same as vanilla PostgreSQL serializable isolation. In Yugabyte, a serializable isolation transaction ensures that all of its statements could have appeared to happen on commit time. In that case, a lot of the failures become reasonable. However, the failure on the second variant of <stmt> (i.e. SELECT i FROM t WHERE i = 1) should, in theory, be avoidable.

@ndeodhar ndeodhar removed the priority/low Low priority label Nov 5, 2019
@ndeodhar
Copy link
Contributor

ndeodhar commented Nov 5, 2019

Bringing this to @spolitov 's attention for the issue where unrelated delete causes a conflict failure.

@spolitov
Copy link
Contributor

Fixed by 385d2c5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/ysql Yugabyte SQL (YSQL)
Projects
None yet
Development

No branches or pull requests

4 participants