-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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] Conform transactions and row locks to vanilla Postgres #2706
Comments
The following results are from a build after intermediate work on issue #2523 (I use (mod-read) INSERT, SELECT FOR SHARE
(mod-read) DELETE, SELECT FOR SHARE
For Yugabyte, the error looks like
For vanilla Postgres, the error looks like
|
The following results are from after commit (I use (post-2523) INSERT, SELECT FOR SHARE
For Yugabyte, the error looks like
|
Jira Link: DB-1577
EDIT: remove "Row locking does not have any affect" from "Should fix".
There are some differences in the way Yugabyte and vanilla Postgres work with
transactions and row locks. I highlight several of them below.
Should fix:
A deletion is detected in the middle of a transaction when it shouldn't be
visible (see issue Data becomes visible before it should when using FOR KEY SHARE in default isolation mode #2523):
Need not be fixed:
No wait on conflicting deletion:
(I use
SELECT 123
statements because of issue #2702.)DELETE, INSERT
CREATE TABLE a (i int PRIMARY KEY);
CREATE TABLE b (i int REFERENCES a(i));
INSERT INTO a VALUES (1);
BEGIN ISOLATION LEVEL REPEATABLE READ;
SELECT 123;
DELETE FROM a WHERE i = 1;
INSERT INTO b VALUES (1);
COMMIT;
For Yugabyte, the last
INSERT
causesFor vanilla Postgres, the last
INSERT
causesDELETE, SELECT FOR SHARE
CREATE TABLE d (i int);
INSERT INTO d VALUES (1);
BEGIN ISOLATION LEVEL REPEATABLE READ;
SELECT 123;
DELETE FROM d WHERE i = 1;
SELECT * FROM d FOR SHARE
COMMIT;
For Yugabyte, the last
SELECT
returns 0 rows.For vanilla Postgres, the last
SELECT
causesIt doesn't matter whether
i
is a primary key.DELETE, SELECT FOR KEY SHARE
CREATE TABLE d (i int);
INSERT INTO d VALUES (1);
BEGIN ISOLATION LEVEL REPEATABLE READ;
SELECT 123;
DELETE FROM d WHERE i = 1;
SELECT * FROM d FOR KEY SHARE
COMMIT;
For Yugabyte, the last
SELECT
returns 0 rows.For vanilla Postgres, the last
SELECT
causesIt doesn't matter whether
i
is a primary key.INSERT, DELETE
CREATE TABLE a (i int PRIMARY KEY);
CREATE TABLE b (i int REFERENCES a(i));
INSERT INTO a VALUES (1);
BEGIN ISOLATION LEVEL REPEATABLE READ;
INSERT INTO b VALUES (1);
DELETE FROM a WHERE i = 1;
COMMIT;
For Yugabyte, there is a transaction error that takes one of two forms:
The
DELETE
causesThe
COMMIT
causesFor vanilla Postgres, it blocks on the
DELETE
until theCOMMIT
.SELECT FOR SHARE, DELETE
CREATE TABLE d (i int);
INSERT INTO d VALUES (1);
BEGIN ISOLATION LEVEL REPEATABLE READ;
SELECT * FROM d FOR SHARE;
DELETE FROM d WHERE i = 1;
COMMIT;
For Yugabyte, there is a transaction error that takes one of two forms:
The
DELETE
causesThe
COMMIT
causesFor vanilla Postgres, it blocks on the
DELETE
until theCOMMIT
.It doesn't matter whether
i
is a primary key.SELECT FOR KEY SHARE, DELETE
CREATE TABLE d (i int);
INSERT INTO d VALUES (1);
BEGIN ISOLATION LEVEL REPEATABLE READ;
SELECT * FROM d FOR KEY SHARE;
DELETE FROM d WHERE i = 1;
COMMIT;
For Yugabyte, there is a transaction error that takes one of two forms:
The
DELETE
causesThe
COMMIT
causesFor vanilla Postgres, it blocks on the
DELETE
until theCOMMIT
.It doesn't matter whether
i
is a primary key.The text was updated successfully, but these errors were encountered: