Commit 25323de2 authored by Marko Mäkelä's avatar Marko Mäkelä

Bug#20816223 InnoDB crash on shutdown

if XA PREPARE transactions hold explicit locks.

innobase_shutdown_for_mysql(): Call trx_sys_close() before lock_sys_close()
(and dict_close()) so that trx_free_prepared() will see all locks intact.

RB: 8561
Reviewed-by: default avatarVasil Dimov <vasil.dimov@oracle.com>
parent 7285b4c4
CREATE TABLE t1 (a INT) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1);
XA START 'x';
UPDATE t1 set a=2;
XA END 'x';
XA PREPARE 'x';
call mtr.add_suppression("Found 1 prepared XA transactions");
SELECT * FROM t1 LOCK IN SHARE MODE;
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
SELECT * FROM t1;
a
2
XA ROLLBACK 'x';
SELECT * FROM t1;
a
1
DROP TABLE t1;
--source include/have_innodb.inc
CREATE TABLE t1 (a INT) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1);
connect (con1,localhost,root);
XA START 'x'; UPDATE t1 set a=2; XA END 'x'; XA PREPARE 'x';
connection default;
call mtr.add_suppression("Found 1 prepared XA transactions");
# Kill and restart the server.
-- exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
-- shutdown_server 0
-- source include/wait_until_disconnected.inc
-- exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
-- enable_reconnect
-- source include/wait_until_connected_again.inc
-- disable_reconnect
disconnect con1;
connect (con1,localhost,root);
--send SELECT * FROM t1 LOCK IN SHARE MODE
connection default;
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = 'Sending data' and
info = 'SELECT * FROM t1 LOCK IN SHARE MODE';
--source include/wait_condition.inc
--source include/restart_mysqld.inc
disconnect con1;
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
SELECT * FROM t1;
XA ROLLBACK 'x';
SELECT * FROM t1;
DROP TABLE t1;
/*****************************************************************************
Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
Copyright (c) 1996, 2015, Oracle and/or its affiliates. All rights reserved.
Copyright (c) 2008, Google Inc.
Copyright (c) 2009, Percona Inc.
......@@ -2230,9 +2230,9 @@ innobase_shutdown_for_mysql(void)
ibuf_close();
log_shutdown();
lock_sys_close();
trx_sys_file_format_close();
trx_sys_close();
lock_sys_close();
mutex_free(&srv_monitor_file_mutex);
mutex_free(&srv_dict_tmpfile_mutex);
......
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