Bug #119649 SERIALIZABLE Isolation Violation with Consistent Snapshot in MySQL
Description:
MySQL's SERIALIZABLE isolation level fails to maintain transaction isolation when using START TRANSACTION WITH CONSISTENT SNAPSHOT. A transaction that starts with a consistent snapshot incorrectly sees modifications committed by other transactions that began after it, violating the serializable isolation guarantee.
How to repeat:
CREATE TABLE mtest(x INT DEFAULT 0,c0 VARCHAR(20));
INSERT INTO mtest(c0, x) VALUES ("<X?", 59);
INSERT IGNORE INTO mtest(c0) VALUES ("[]]");
-- Initial Table:
View{
1:[59, <X?]
2:[0, []]]
}
/* s1 */SET TRANSACTION ISOLATION LEVEL SERIALIZABLE;
/* s1 */START TRANSACTION WITH CONSISTENT SNAPSHOT;
/* s2 */SET TRANSACTION ISOLATION LEVEL SERIALIZABLE;
/* s2 */START TRANSACTION WITH CONSISTENT SNAPSHOT;
/* s2 */UPDATE mtest SET c0="p9#|" WHERE TRUE;
/* s2 */COMMIT;
/* s1 */SELECT * FROM mtest WHERE TRUE;
+------+------+
| x | c0 |
+------+------+
| 59 | p9#| |
| 0 | p9#| |
+------+------+
/* s1 *COMMIT;
Portions of this website are copyright © 2001, 2002 The PHP Group
Page generated in 0.047 sec. using MySQL 8.4.7-u6-cloud
Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the
respective copyright holders.
It is not reviewed in advance
by Oracle and does not necessarily represent the opinion of
Oracle or any other party.
Description: MySQL's SERIALIZABLE isolation level fails to maintain transaction isolation when using START TRANSACTION WITH CONSISTENT SNAPSHOT. A transaction that starts with a consistent snapshot incorrectly sees modifications committed by other transactions that began after it, violating the serializable isolation guarantee. How to repeat: CREATE TABLE mtest(x INT DEFAULT 0,c0 VARCHAR(20)); INSERT INTO mtest(c0, x) VALUES ("<X?", 59); INSERT IGNORE INTO mtest(c0) VALUES ("[]]"); -- Initial Table: View{ 1:[59, <X?] 2:[0, []]] } /* s1 */SET TRANSACTION ISOLATION LEVEL SERIALIZABLE; /* s1 */START TRANSACTION WITH CONSISTENT SNAPSHOT; /* s2 */SET TRANSACTION ISOLATION LEVEL SERIALIZABLE; /* s2 */START TRANSACTION WITH CONSISTENT SNAPSHOT; /* s2 */UPDATE mtest SET c0="p9#|" WHERE TRUE; /* s2 */COMMIT; /* s1 */SELECT * FROM mtest WHERE TRUE; +------+------+ | x | c0 | +------+------+ | 59 | p9#| | | 0 | p9#| | +------+------+ /* s1 *COMMIT;