Commit 6ef13978 authored by Sergei Golubchik's avatar Sergei Golubchik

MDEV-6497 InnoDB deadlocks on UNINSTALL PLUGIN

Free the trx of the current thd (if any) in innobase_end()
parent 0aa40c35
...@@ -4,4 +4,17 @@ Warning 1105 Cannot enable tc-log at run-time. XA features of InnoDB are disable ...@@ -4,4 +4,17 @@ Warning 1105 Cannot enable tc-log at run-time. XA features of InnoDB are disable
select engine,support,transactions,xa from information_schema.engines where engine='innodb'; select engine,support,transactions,xa from information_schema.engines where engine='innodb';
engine support transactions xa engine support transactions xa
InnoDB YES YES NO InnoDB YES YES NO
create table t1 (a int) engine=innodb;
start transaction;
insert t1 values (1);
insert t1 values (2);
commit;
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
mysqld-bin.000001 # Query # # use `test`; create table t1 (a int) engine=innodb
mysqld-bin.000001 # Query # # BEGIN
mysqld-bin.000001 # Query # # use `test`; insert t1 values (1)
mysqld-bin.000001 # Query # # use `test`; insert t1 values (2)
mysqld-bin.000001 # Query # # COMMIT
drop table t1;
uninstall plugin innodb; uninstall plugin innodb;
...@@ -8,4 +8,11 @@ if (!$HA_INNODB_SO) { ...@@ -8,4 +8,11 @@ if (!$HA_INNODB_SO) {
} }
install plugin innodb soname 'ha_innodb'; install plugin innodb soname 'ha_innodb';
select engine,support,transactions,xa from information_schema.engines where engine='innodb'; select engine,support,transactions,xa from information_schema.engines where engine='innodb';
create table t1 (a int) engine=innodb;
start transaction;
insert t1 values (1);
insert t1 values (2);
commit;
--source include/show_binlog_events.inc
drop table t1;
uninstall plugin innodb; uninstall plugin innodb;
...@@ -2658,6 +2658,14 @@ innobase_end( ...@@ -2658,6 +2658,14 @@ innobase_end(
if (innodb_inited) { if (innodb_inited) {
THD *thd= current_thd;
if (thd) { // may be UNINSTALL PLUGIN statement
trx_t* trx = thd_to_trx(thd);
if (trx) {
trx_free_for_mysql(trx);
}
}
srv_fast_shutdown = (ulint) innobase_fast_shutdown; srv_fast_shutdown = (ulint) innobase_fast_shutdown;
innodb_inited = 0; innodb_inited = 0;
hash_table_free(innobase_open_tables); hash_table_free(innobase_open_tables);
......
...@@ -3276,6 +3276,14 @@ innobase_end( ...@@ -3276,6 +3276,14 @@ innobase_end(
if (innodb_inited) { if (innodb_inited) {
THD *thd= current_thd;
if (thd) { // may be UNINSTALL PLUGIN statement
trx_t* trx = thd_to_trx(thd);
if (trx) {
trx_free_for_mysql(trx);
}
}
srv_fast_shutdown = (ulint) innobase_fast_shutdown; srv_fast_shutdown = (ulint) innobase_fast_shutdown;
innodb_inited = 0; innodb_inited = 0;
hash_table_free(innobase_open_tables); hash_table_free(innobase_open_tables);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment