diff options
author | Vasil Dimov <vasil.dimov@oracle.com> | 2012-02-06 12:44:59 +0200 |
---|---|---|
committer | Vasil Dimov <vasil.dimov@oracle.com> | 2012-02-06 12:44:59 +0200 |
commit | 1c4fd3bb546a501fc95ca52def2c728681d62b28 (patch) | |
tree | 2dd2108dbd24da9baa84f38b9ee994f607345569 /mysql-test | |
parent | cfcb5daba80df535527890b5bd37607057623e8f (diff) | |
download | mariadb-git-1c4fd3bb546a501fc95ca52def2c728681d62b28.tar.gz |
Fix Bug#11754376 45976: INNODB LOST FILES FOR TEMPORARY TABLES ON
GRACEFUL SHUTDOWN
During startup mysql picks up .frm files from the tmpdir directory and
tries to drop those tables in the storage engine.
The problem is that when tmpdir ends in / then ha_innobase::delete_table()
is passed a string like "/var/tmp//#sql123", then it wrongly normalizes it
to "/#sql123" and calls row_drop_table_for_mysql() which of course fails
to delete the table entry from the InnoDB dictionary cache.
ha_innobase::delete_table() returns an error but nevertheless mysql wipes
away the .frm file and the entry in the InnoDB dictionary cache remains
orphaned with no easy way to remove it.
The "no easy" way to remove it is to create a similar temporary table again,
copy its .frm file to tmpdir under "#sql123.frm" and restart mysqld with
tmpdir=/var/tmp (no trailing slash) - this way mysql will pick the .frm file
after restart and will try to issue drop table for "/var/tmp/#sql123"
(notice do double slash), ha_innobase::delete_table() will normalize it to
"tmp/#sql123" and row_drop_table_for_mysql() will successfully remove the
table entry from the dictionary cache.
The solution is to fix normalize_table_name_low() to normalize things like
"/var/tmp//table" correctly to "tmp/table".
This patch also adds a test function which invokes
normalize_table_name_low() with various inputs to make sure it works
correctly and a mtr test that calls this test function.
Reviewed by: Marko (http://bur03.no.oracle.com/rb/r/929/)
Diffstat (limited to 'mysql-test')
4 files changed, 40 insertions, 0 deletions
diff --git a/mysql-test/suite/innodb/r/innodb_bug11754376.result b/mysql-test/suite/innodb/r/innodb_bug11754376.result new file mode 100644 index 00000000000..26e92b9d3ea --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_bug11754376.result @@ -0,0 +1,4 @@ +CREATE TABLE bug11754376 (c INT) ENGINE=INNODB; +SET SESSION DEBUG='+d,test_normalize_table_name_low'; +DROP TABLE bug11754376; +SET SESSION DEBUG='-d,test_normalize_table_name_low'; diff --git a/mysql-test/suite/innodb/t/innodb_bug11754376.test b/mysql-test/suite/innodb/t/innodb_bug11754376.test new file mode 100644 index 00000000000..4ab695fe9c2 --- /dev/null +++ b/mysql-test/suite/innodb/t/innodb_bug11754376.test @@ -0,0 +1,16 @@ +# +# Bug#11754376 45976: INNODB LOST FILES FOR TEMPORARY TABLES ON GRACEFUL SHUTDOWN +# + +-- source include/have_debug.inc +-- source include/have_innodb.inc + +CREATE TABLE bug11754376 (c INT) ENGINE=INNODB; + +# This will invoke test_normalize_table_name_low() in debug builds + +SET SESSION DEBUG='+d,test_normalize_table_name_low'; + +DROP TABLE bug11754376; + +SET SESSION DEBUG='-d,test_normalize_table_name_low'; diff --git a/mysql-test/suite/innodb_plugin/r/innodb_bug11754376.result b/mysql-test/suite/innodb_plugin/r/innodb_bug11754376.result new file mode 100644 index 00000000000..26e92b9d3ea --- /dev/null +++ b/mysql-test/suite/innodb_plugin/r/innodb_bug11754376.result @@ -0,0 +1,4 @@ +CREATE TABLE bug11754376 (c INT) ENGINE=INNODB; +SET SESSION DEBUG='+d,test_normalize_table_name_low'; +DROP TABLE bug11754376; +SET SESSION DEBUG='-d,test_normalize_table_name_low'; diff --git a/mysql-test/suite/innodb_plugin/t/innodb_bug11754376.test b/mysql-test/suite/innodb_plugin/t/innodb_bug11754376.test new file mode 100644 index 00000000000..d4f221f187e --- /dev/null +++ b/mysql-test/suite/innodb_plugin/t/innodb_bug11754376.test @@ -0,0 +1,16 @@ +# +# Bug#11754376 45976: INNODB LOST FILES FOR TEMPORARY TABLES ON GRACEFUL SHUTDOWN +# + +-- source include/have_debug.inc +-- source include/have_innodb_plugin.inc + +CREATE TABLE bug11754376 (c INT) ENGINE=INNODB; + +# This will invoke test_normalize_table_name_low() in debug builds + +SET SESSION DEBUG='+d,test_normalize_table_name_low'; + +DROP TABLE bug11754376; + +SET SESSION DEBUG='-d,test_normalize_table_name_low'; |