Details
-
Bug
-
Status: Closed (View Workflow)
-
Critical
-
Resolution: Fixed
-
11.7.2
-
Ubuntu 22.04
-
Can result in unexpected behaviour
-
Q3/2025 Maintenance
Description
When I use the keyword AUTO_INCREMENT, I find a issue.
As in the following case, when reading via the Limit keyword, the result here is an exception that violates the serializable isolation level. This result is not consistent with any kind of serializable execution.
--- I see
|
DROP TABLE t1, t2; |
CREATE TABLE t1 (c0 INT); |
CREATE TABLE t2 (c0 INT PRIMARY KEY AUTO_INCREMENT, c1 INT); |
INSERT INTO t1(c0) VALUES (1),(2),(3); |
/* init */SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE; |
/* init */SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE; |
/* T1 */BEGIN; |
/* T2 */BEGIN; |
/* T1 */INSERT INTO t2(c1) VALUES(1); |
/* T2 */INSERT INTO t2(c1) VALUES(2), (3); |
/* T2 */COMMIT; |
/* T1 */UPDATE t1 SET c0 = 10 WHERE c0 in (SELECT c1 FROM (SELECT * FROM t2 ORDER BY c0 LIMIT 2) AS t); |
/* T1 */COMMIT; |
/* Finally database state */
|
mysql> SELECT * FROM t1; |
+------+ |
| c0 |
|
+------+ |
| 10 |
|
| 10 |
|
| 3 |
|
+------+ |
3 rows in set (0.00 sec) |
 |
--- Expected to See
|
/* Finally database state */
|
mysql> SELECT * FROM t1; |
+------+ |
| c0 |
|
+------+ |
| 10 |
|
| 2 |
|
| 3 |
|
+------+ |
3 rows in set (0.00 sec) |
OR
|
mysql> SELECT * FROM t1; |
+------+ |
| c0 |
|
+------+ |
| 1 |
|
| 10 |
|
| 10 |
|
+------+ |
3 rows in set (0.00 sec) |
Attachments
Issue Links
- causes
-
MDEV-37215 Server crashes upon SELECT .. FOR UPDATE under SERIALIZABLE
-
- Closed
-
- relates to
-
MDEV-15494 InnoDB: Assertion failure in file trx/trx0roll.cc line 326 in trx_rollback_last_sql_stat_for_mysql
-
- Confirmed
-
-
MDEV-37432 Assertion `!trx->is_started()' failed in int innobase_start_trx_and_assign_read_view(THD *)
-
- Confirmed
-
-
MDEV-35124 Set innodb_snapshot_isolation=ON by default
-
- Closed
-