Description:
Isolation level: READ UNCOMMITTED
If the following four transactions are executed concurrently, some data is not successfully rolled back.
How to repeat:
/* init */ CREATE TABLE t (c1 TINYTEXT);
/* init */ INSERT INTO t VALUES ('aa');
/* init */ INSERT INTO t VALUES ('bb');
/* init */ INSERT INTO t VALUES ('cc');
/* init */ INSERT INTO t VALUES ('aa');
/* init */ INSERT INTO t VALUES ('bb');
/* init */ INSERT INTO t VALUES ('cc');
There are two sessions session1 and session2 executing concurrently.
Session1 executes transactions t1 and t3 successively.
/* t1 */
BEGIN;
UPDATE IGNORE t SET c1 = 'dd';
ROLLBACK;
/* t3 */
START TRANSACTION;
UPDATE LOW_PRIORITY IGNORE t SET c1 = 'ee';
INSERT INTO t VALUES ('ff');
INSERT LOW_PRIORITY IGNORE INTO t VALUES ('gg');
ROLLBACK;
Session2 executes transactions t2 and t4 successively.
/* t2 */
BEGIN;
SELECT ta1.c1 AS ca1 FROM t JOIN t AS ta1;
DELETE FROM t;
ROLLBACK;
/* t4 */
BEGIN;
REPLACE INTO t VALUES ('hh');
SELECT c1 FROM t;
SELECT c1 FROM t; -- [('ee'), ('ee'), ('cc'), ('aa'), ('bb'), ('cc'), ('hh')]
COMMIT;
In the query results of the 4th statement in transaction t4, rows 3-6 are the values after transaction t3 is rolled back (i.e., the values in the initial database), and rows 1-2 are the values before transaction t3 is rolled back (i.e., the values updated by the 2nd statement in t3).
Description: Isolation level: READ UNCOMMITTED If the following four transactions are executed concurrently, some data is not successfully rolled back. How to repeat: /* init */ CREATE TABLE t (c1 TINYTEXT); /* init */ INSERT INTO t VALUES ('aa'); /* init */ INSERT INTO t VALUES ('bb'); /* init */ INSERT INTO t VALUES ('cc'); /* init */ INSERT INTO t VALUES ('aa'); /* init */ INSERT INTO t VALUES ('bb'); /* init */ INSERT INTO t VALUES ('cc'); There are two sessions session1 and session2 executing concurrently. Session1 executes transactions t1 and t3 successively. /* t1 */ BEGIN; UPDATE IGNORE t SET c1 = 'dd'; ROLLBACK; /* t3 */ START TRANSACTION; UPDATE LOW_PRIORITY IGNORE t SET c1 = 'ee'; INSERT INTO t VALUES ('ff'); INSERT LOW_PRIORITY IGNORE INTO t VALUES ('gg'); ROLLBACK; Session2 executes transactions t2 and t4 successively. /* t2 */ BEGIN; SELECT ta1.c1 AS ca1 FROM t JOIN t AS ta1; DELETE FROM t; ROLLBACK; /* t4 */ BEGIN; REPLACE INTO t VALUES ('hh'); SELECT c1 FROM t; SELECT c1 FROM t; -- [('ee'), ('ee'), ('cc'), ('aa'), ('bb'), ('cc'), ('hh')] COMMIT; In the query results of the 4th statement in transaction t4, rows 3-6 are the values after transaction t3 is rolled back (i.e., the values in the initial database), and rows 1-2 are the values before transaction t3 is rolled back (i.e., the values updated by the 2nd statement in t3).