Details
-
Bug
-
Status: Closed (View Workflow)
-
Critical
-
Resolution: Not a Bug
-
10.6
-
Ubuntu 20.04
Description
How to repeat:
/* init */ CREATE TABLE t(a INT PRIMARY KEY); |
/* t1 */ SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; |
/* t2 */ SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; |
 |
/* t1 */ BEGIN; |
/* t2 */ BEGIN; |
/* t1 */ INSERT INTO t(a) VALUES (2); |
/* t2 */ SELECT a FROM t FOR UPDATE; -- actual: [2], expected: [1, 2] |
/* t1 */ INSERT INTO t(a) VALUES (1); |
/* t1 */ COMMIT; |
/* t2 */ COMMIT; |
The SELECT FOR UPDATE statement of t2 was initially blocked by t1. It recovered after t1's COMMIT, but its query result only contained record (2), even though in innodb_snapshot_isolation=ON mode. Interestingly, swapping the order of the two INSERT statements for t1 eliminates this anomaly.