summaryrefslogtreecommitdiff
path: root/mysql-test/suite/innodb/t/insert_into_empty.test
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2021-04-09 09:18:07 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2021-04-09 09:18:07 +0300
commitde119fa2b65aa8f9300c8a01a9f4e1328881ec0e (patch)
tree81c9fc8e489ce2566375531bef62caf7e463a047 /mysql-test/suite/innodb/t/insert_into_empty.test
parent7588049374c63b169ddd245c2dd5f3faac129b4e (diff)
downloadmariadb-git-de119fa2b65aa8f9300c8a01a9f4e1328881ec0e.tar.gz
MDEV-25297 Assertion: trx->roll_limit <= trx->undo_no in ROLLBACK TO SAVEPOINT
In commit 8ea923f55b7666a359ac2c54f6c10e8609d16846 (MDEV-24818) when we optimized multi-statement INSERT transactions into empty tables, we would roll back the entire transaction on any error. But, we would fail to invalidate any SAVEPOINT that had been requested in the past. trx_t::savepoints_discard(): Renamed from trx_roll_savepoints_free(). row_mysql_handle_errors(): If we were in bulk insert, invoke trx_t::savepoints_discard(). In this way, a future attempt of ROLLBACK TO SAVEPOINT will return an error.
Diffstat (limited to 'mysql-test/suite/innodb/t/insert_into_empty.test')
-rw-r--r--mysql-test/suite/innodb/t/insert_into_empty.test20
1 files changed, 20 insertions, 0 deletions
diff --git a/mysql-test/suite/innodb/t/insert_into_empty.test b/mysql-test/suite/innodb/t/insert_into_empty.test
index 81c4805c13c..17579ffe9ef 100644
--- a/mysql-test/suite/innodb/t/insert_into_empty.test
+++ b/mysql-test/suite/innodb/t/insert_into_empty.test
@@ -119,3 +119,23 @@ SHOW ENGINE InnoDB STATUS;
--enable_result_log
COMMIT;
DROP TABLE t1,t2;
+
+--echo #
+--echo # MDEV-25297 Assertion: trx->roll_limit <= trx->undo_no
+--echo # in ROLLBACK TO SAVEPOINT
+--echo #
+
+CREATE TABLE t1 (c INT PRIMARY KEY) ENGINE=InnoDB;
+CREATE TABLE t2 (c INT PRIMARY KEY) ENGINE=InnoDB;
+BEGIN;
+INSERT INTO t1 VALUES(0);
+SAVEPOINT x;
+INSERT INTO t2 VALUES(0);
+--error ER_DUP_ENTRY
+INSERT INTO t1 VALUES(0);
+--error ER_ERROR_DURING_ROLLBACK
+ROLLBACK TO SAVEPOINT x;
+COMMIT;
+SELECT * FROM t1;
+SELECT * FROM t2;
+DROP TABLE t1,t2;