1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

MDEV-37215 SELECT FOR UPDATE crash in SERIALIZABLE

ha_innobase::store_lock(): Set also trx->will_lock when starting
a transaction at SERIALIZABLE isolation level. This fixes up
commit 7fbbbc983f (MDEV-36330).
This commit is contained in:
Marko Mäkelä
2025-07-14 10:31:56 +03:00
parent 499fa24d63
commit b7b2e009b3
3 changed files with 20 additions and 0 deletions

View File

@@ -283,4 +283,13 @@ COMMIT;
disconnect consistent; disconnect consistent;
connection default; connection default;
DROP TABLE t1,t2; DROP TABLE t1,t2;
#
# MDEV-37215 SELECT...FOR UPDATE crash under SERIALIZABLE
#
SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE;
CREATE TABLE t1(a INT PRIMARY KEY) ENGINE=InnoDB;
SELECT * FROM t1 FOR UPDATE;
a
DROP TABLE t1;
SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ;
# End of 10.6 tests # End of 10.6 tests

View File

@@ -295,5 +295,15 @@ COMMIT;
--connection default --connection default
DROP TABLE t1,t2; DROP TABLE t1,t2;
--echo #
--echo # MDEV-37215 SELECT...FOR UPDATE crash under SERIALIZABLE
--echo #
SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE;
CREATE TABLE t1(a INT PRIMARY KEY) ENGINE=InnoDB;
SELECT * FROM t1 FOR UPDATE;
DROP TABLE t1;
SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ;
--source include/wait_until_count_sessions.inc --source include/wait_until_count_sessions.inc
--echo # End of 10.6 tests --echo # End of 10.6 tests

View File

@@ -16510,6 +16510,7 @@ ha_innobase::store_lock(
case ISO_SERIALIZABLE: case ISO_SERIALIZABLE:
auto trx_state = trx->state; auto trx_state = trx->state;
if (trx_state == TRX_STATE_NOT_STARTED) { if (trx_state == TRX_STATE_NOT_STARTED) {
trx->will_lock = true;
trx_start_if_not_started(trx, false); trx_start_if_not_started(trx, false);
trx->read_view.open(trx); trx->read_view.open(trx);
} else { } else {