Details
-
Bug
-
Status: Closed (View Workflow)
-
Critical
-
Resolution: Incomplete
-
10.11.2, 12.0.2
-
OS: Ubuntu-22.04
Description
Under the READ UNCOMMITTED isolation level, if the following four transactions are executed concurrently, some data is not successfully rolled back.
/* init */ CREATE TABLE t1 (c1 TINYTEXT); |
/* init */ INSERT INTO t1 VALUES ('aa'); |
/* init */ INSERT INTO t1 VALUES ('bb'); |
/* init */ INSERT INTO t1 VALUES ('cc'); |
/* init */ INSERT INTO t1 VALUES ('aa'); |
/* init */ INSERT INTO t1 VALUES ('bb'); |
/* init */ INSERT INTO t1 VALUES ('cc'); |
|
There are two sessions session1 and session2 executing concurrently. |
|
Session1 executes transactions t1 and t3 successively. |
/* t1 */
|
BEGIN; |
UPDATE IGNORE t1 SET c1 = 'dd'; |
ROLLBACK; |
|
/* t3 */
|
START TRANSACTION; |
UPDATE LOW_PRIORITY IGNORE t1 SET c1 = 'ee'; |
INSERT INTO t1 VALUES ('ff'); |
INSERT LOW_PRIORITY IGNORE INTO t1 VALUES ('gg'); |
ROLLBACK; |
|
Session2 executes transactions t2 and t4 successively. |
/* t2 */
|
BEGIN; |
SELECT ta1.c1 AS ca1 FROM t1 JOIN t1 AS ta1; |
DELETE FROM t1; |
ROLLBACK; |
|
/* t4 */
|
BEGIN; |
REPLACE INTO t1 VALUES ('hh'); |
SELECT c1 FROM t1; |
SELECT c1 FROM t1; -- [('ee'), ('bb'), ('cc'), ('aa'), ('bb'), ('cc'), ('hh')] |
COMMIT; |
In the query result of the 4th statement in transaction t4, rows 2-6 are the values after transaction t3 is rolled back (i.e., the values in the initial database), and the first row is the value before transaction t3 is rolled back (i.e., the value updated by the 2nd statement in t3).
Due to the nondeterminism of concurrent transaction execution, the triggering of this issue is undeterministic. It is necessary to run these concurrent transactions multiple times to trigger this issue.