Open pkj415 opened 2 years ago
@pkj415 create-trigger
seems to require table-level locking as well. see this case:
starting permutation: s1a s1b s2a s2b s2c s1c s2d
step s1a: BEGIN;
step s1b: CREATE TRIGGER t AFTER UPDATE ON a EXECUTE PROCEDURE f();
step s2a: BEGIN;
step s2b: SELECT * FROM a WHERE i = 1 FOR UPDATE;
i
1
step s2c: UPDATE a SET i = 4 WHERE i = 3; <waiting ...>
step s1c: COMMIT;
step s2c: <... completed>
step s2d: COMMIT;
@pkj415 note that with wait-based locking we still get some discrepancies on insert-conflict-do-nothing-2
*** /Users/rob/code/branches/repo5/src/postgres/src/test/isolation/expected/insert-conflict-do-nothing-2.out 2021-07-05 11:51:18.000000000 -0700
--- /Users/rob/code/branches/repo5/./pgregress_output/yb_pg_isolation_schedule/results/insert-conflict-do-nothing-2.out 2022-12-12 10:59:25.000000000 -0700
***************
*** 31,37 ****
step donothing2: INSERT INTO ints(key, val) VALUES(1, 'donothing2'), (1, 'donothing3') ON CONFLICT DO NOTHING; <waiting ...>
step c1: COMMIT;
step donothing2: <... completed>
- error in steps c1 donothing2: ERROR: could not serialize access due to concurrent update
step c2: COMMIT;
step show: SELECT * FROM ints;
key val
--- 31,36 ----
***************
*** 45,51 ****
step donothing1: INSERT INTO ints(key, val) VALUES(1, 'donothing1') ON CONFLICT DO NOTHING; <waiting ...>
step c2: COMMIT;
step donothing1: <... completed>
- error in steps c2 donothing1: ERROR: could not serialize access due to concurrent update
step c1: COMMIT;
step show: SELECT * FROM ints;
key val
--- 44,49 ----
***************
*** 80,103 ****
step begins1: BEGIN ISOLATION LEVEL SERIALIZABLE;
step begins2: BEGIN ISOLATION LEVEL SERIALIZABLE;
step donothing1: INSERT INTO ints(key, val) VALUES(1, 'donothing1') ON CONFLICT DO NOTHING;
! step donothing2: INSERT INTO ints(key, val) VALUES(1, 'donothing2'), (1, 'donothing3') ON CONFLICT DO NOTHING; <waiting ...>
step c1: COMMIT;
! step donothing2: <... completed>
! error in steps c1 donothing2: ERROR: could not serialize access due to concurrent update
step c2: COMMIT;
step show: SELECT * FROM ints;
key val
! 1 donothing1
starting permutation: begins1 begins2 donothing2 donothing1 c2 c1 show
step begins1: BEGIN ISOLATION LEVEL SERIALIZABLE;
step begins2: BEGIN ISOLATION LEVEL SERIALIZABLE;
step donothing2: INSERT INTO ints(key, val) VALUES(1, 'donothing2'), (1, 'donothing3') ON CONFLICT DO NOTHING;
! step donothing1: INSERT INTO ints(key, val) VALUES(1, 'donothing1') ON CONFLICT DO NOTHING; <waiting ...>
step c2: COMMIT;
- step donothing1: <... completed>
- error in steps c2 donothing1: ERROR: could not serialize access due to concurrent update
step c1: COMMIT;
step show: SELECT * FROM ints;
key val
--- 78,99 ----
step begins1: BEGIN ISOLATION LEVEL SERIALIZABLE;
step begins2: BEGIN ISOLATION LEVEL SERIALIZABLE;
step donothing1: INSERT INTO ints(key, val) VALUES(1, 'donothing1') ON CONFLICT DO NOTHING;
! step donothing2: INSERT INTO ints(key, val) VALUES(1, 'donothing2'), (1, 'donothing3') ON CONFLICT DO NOTHING;
step c1: COMMIT;
! ERROR: Operation expired: Transaction [71, 53, 155, 234, 145, 145, 76, 33, 138, 37, 223, 226, 191, 114, 207, 107] expired or aborted by a conflict: 40001
step c2: COMMIT;
step show: SELECT * FROM ints;
key val
! 1 donothing2
starting permutation: begins1 begins2 donothing2 donothing1 c2 c1 show
step begins1: BEGIN ISOLATION LEVEL SERIALIZABLE;
step begins2: BEGIN ISOLATION LEVEL SERIALIZABLE;
step donothing2: INSERT INTO ints(key, val) VALUES(1, 'donothing2'), (1, 'donothing3') ON CONFLICT DO NOTHING;
! step donothing1: INSERT INTO ints(key, val) VALUES(1, 'donothing1') ON CONFLICT DO NOTHING;
! ERROR: All transparent retries exhausted. Operation failed. Try again: 7d2d2b05-e4ea-4a45-83a9-ed77786cbeb0 Conflicts with higher priority transaction: dc883489-c41a-48b0-b717-6cd09c271e21
step c2: COMMIT;
step c1: COMMIT;
step show: SELECT * FROM ints;
key val
======================================================================
Jira Link: DB-519
Description
We aim to ensure that YSQL passes all tests in PostgreSQL's isolation regress test suite.
This issue tracks the progress of this goal. The following tests haven't yet been enabled due to the reason mentioned along with each test -