summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergei Golubchik <sergii@pisem.net>2014-07-29 09:09:52 +0200
committerSergei Golubchik <sergii@pisem.net>2014-07-29 09:09:52 +0200
commit6ef139780d7a6ae6ea001523b4505de6b5c3a7bc (patch)
tree2f906094eb0529614434ae6c7bbf27a182479ccb
parent0aa40c35ca50f06a4baa9c8bfb6ba9e402bd773b (diff)
downloadmariadb-git-6ef139780d7a6ae6ea001523b4505de6b5c3a7bc.tar.gz
MDEV-6497 InnoDB deadlocks on UNINSTALL PLUGIN
Free the trx of the current thd (if any) in innobase_end()
-rw-r--r--mysql-test/r/innodb_load_xa.result13
-rw-r--r--mysql-test/t/innodb_load_xa.test7
-rw-r--r--storage/innobase/handler/ha_innodb.cc8
-rw-r--r--storage/xtradb/handler/ha_innodb.cc8
4 files changed, 36 insertions, 0 deletions
diff --git a/mysql-test/r/innodb_load_xa.result b/mysql-test/r/innodb_load_xa.result
index 7ce2fb6c48f..e738ca6e3af 100644
--- a/mysql-test/r/innodb_load_xa.result
+++ b/mysql-test/r/innodb_load_xa.result
@@ -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';
engine support transactions xa
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;
diff --git a/mysql-test/t/innodb_load_xa.test b/mysql-test/t/innodb_load_xa.test
index ab2204133a2..52862151b22 100644
--- a/mysql-test/t/innodb_load_xa.test
+++ b/mysql-test/t/innodb_load_xa.test
@@ -8,4 +8,11 @@ if (!$HA_INNODB_SO) {
}
install plugin innodb soname 'ha_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;
diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
index 2e837e80fcd..2c2e2dcd6d6 100644
--- a/storage/innobase/handler/ha_innodb.cc
+++ b/storage/innobase/handler/ha_innodb.cc
@@ -2658,6 +2658,14 @@ innobase_end(
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;
innodb_inited = 0;
hash_table_free(innobase_open_tables);
diff --git a/storage/xtradb/handler/ha_innodb.cc b/storage/xtradb/handler/ha_innodb.cc
index 539e0ca8d7e..510292fefc5 100644
--- a/storage/xtradb/handler/ha_innodb.cc
+++ b/storage/xtradb/handler/ha_innodb.cc
@@ -3276,6 +3276,14 @@ innobase_end(
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;
innodb_inited = 0;
hash_table_free(innobase_open_tables);