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

MDEV-35335 implicit commit at START TRANSACTION doesn't reset characteristics

This commit is contained in:
Sergei Golubchik
2024-11-13 20:35:03 +01:00
parent 990b010b09
commit 725b5e7794
3 changed files with 44 additions and 0 deletions

View File

@@ -579,3 +579,23 @@ a
# This statement should work, since last statement committed. # This statement should work, since last statement committed.
INSERT INTO t1 VALUES (1); INSERT INTO t1 VALUES (1);
DROP TABLE t1; DROP TABLE t1;
#
# MDEV-35335 implicit commit at START TRANSACTION doesn't reset characteristics
#
create table t1 (a int) engine=innodb;
insert t1 values (1);
start transaction;
set session transaction isolation level serializable;
start transaction;
select * from t1;
a
1
connect con1,localhost,root;
set session innodb_lock_wait_timeout=0;
update t1 set a=2;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
disconnect con1;
connection default;
rollback;
drop table t1;
# End of 10.6 tests

View File

@@ -677,3 +677,23 @@ SELECT * FROM t1;
INSERT INTO t1 VALUES (1); INSERT INTO t1 VALUES (1);
DROP TABLE t1; DROP TABLE t1;
--echo #
--echo # MDEV-35335 implicit commit at START TRANSACTION doesn't reset characteristics
--echo #
create table t1 (a int) engine=innodb;
insert t1 values (1);
start transaction;
set session transaction isolation level serializable;
start transaction;
select * from t1;
connect con1,localhost,root;
set session innodb_lock_wait_timeout=0;
--error ER_LOCK_WAIT_TIMEOUT
update t1 set a=2;
disconnect con1;
connection default;
rollback;
drop table t1;
--echo # End of 10.6 tests

View File

@@ -120,11 +120,15 @@ bool trans_begin(THD *thd, uint flags)
if (thd->in_multi_stmt_transaction_mode() || if (thd->in_multi_stmt_transaction_mode() ||
(thd->variables.option_bits & OPTION_TABLE_LOCK)) (thd->variables.option_bits & OPTION_TABLE_LOCK))
{ {
bool was_in_trans= thd->server_status &
(SERVER_STATUS_IN_TRANS | SERVER_STATUS_IN_TRANS_READONLY);
thd->variables.option_bits&= ~OPTION_TABLE_LOCK; thd->variables.option_bits&= ~OPTION_TABLE_LOCK;
thd->server_status&= thd->server_status&=
~(SERVER_STATUS_IN_TRANS | SERVER_STATUS_IN_TRANS_READONLY); ~(SERVER_STATUS_IN_TRANS | SERVER_STATUS_IN_TRANS_READONLY);
DBUG_PRINT("info", ("clearing SERVER_STATUS_IN_TRANS")); DBUG_PRINT("info", ("clearing SERVER_STATUS_IN_TRANS"));
res= MY_TEST(ha_commit_trans(thd, TRUE)); res= MY_TEST(ha_commit_trans(thd, TRUE));
if (was_in_trans)
trans_reset_one_shot_chistics(thd);
#ifdef WITH_WSREP #ifdef WITH_WSREP
if (wsrep_thd_is_local(thd)) if (wsrep_thd_is_local(thd))
{ {