From 8411a720c80d8921137c6d9d794e7b378f78256e Mon Sep 17 00:00:00 2001 From: "karen.langford@sun.com" <> Date: Tue, 6 Jul 2010 16:01:02 +0200 Subject: [PATCH 1/2] Raise version number after cloning 5.1.49 --- configure.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.in b/configure.in index 74e575fad8c..a475185d880 100644 --- a/configure.in +++ b/configure.in @@ -12,7 +12,7 @@ dnl dnl When changing the major version number please also check the switch dnl statement in mysqlbinlog::check_master_version(). You may also need dnl to update version.c in ndb. -AC_INIT([MySQL Server], [5.1.49], [], [mysql]) +AC_INIT([MySQL Server], [5.1.50], [], [mysql]) AC_CONFIG_SRCDIR([sql/mysqld.cc]) AC_CANONICAL_SYSTEM From 60edcf9475eadf0a76fde74e20aebeff474a5f0e Mon Sep 17 00:00:00 2001 From: Jon Olav Hauglid Date: Wed, 7 Jul 2010 13:55:09 +0200 Subject: [PATCH 2/2] Bug #54117 crash in thr_multi_unlock, temporary table This crash occured after ALTER TABLE was used on a temporary transactional table locked by LOCK TABLES. Any later attempts to execute LOCK/UNLOCK TABLES, caused the server to crash. The reason for the crash was the list of locked tables would end up having a pointer to a free'd table instance. This happened because ALTER TABLE deleted the table without also removing the table reference from the locked tables list. This patch fixes the problem by making sure ALTER TABLE also removes the table from the locked tables list. Test case added to innodb_mysql.test. --- mysql-test/suite/innodb/r/innodb_mysql.result | 8 ++++++++ mysql-test/suite/innodb/t/innodb_mysql.test | 14 ++++++++++++++ sql/sql_table.cc | 5 +++++ 3 files changed, 27 insertions(+) diff --git a/mysql-test/suite/innodb/r/innodb_mysql.result b/mysql-test/suite/innodb/r/innodb_mysql.result index ba37a46b62a..8765f58b120 100644 --- a/mysql-test/suite/innodb/r/innodb_mysql.result +++ b/mysql-test/suite/innodb/r/innodb_mysql.result @@ -2499,4 +2499,12 @@ ORDER BY f1 DESC LIMIT 5; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 range f2,f4 f4 1 NULL 11 Using where DROP TABLE t1; +# +# Bug#54117 crash in thr_multi_unlock, temporary table +# +CREATE TEMPORARY TABLE t1(a INT) ENGINE = InnoDB; +LOCK TABLES t1 READ; +ALTER TABLE t1 COMMENT 'test'; +UNLOCK TABLES; +DROP TABLE t1; End of 5.1 tests diff --git a/mysql-test/suite/innodb/t/innodb_mysql.test b/mysql-test/suite/innodb/t/innodb_mysql.test index d802b04487e..80f14d32eb8 100644 --- a/mysql-test/suite/innodb/t/innodb_mysql.test +++ b/mysql-test/suite/innodb/t/innodb_mysql.test @@ -737,4 +737,18 @@ ORDER BY f1 DESC LIMIT 5; DROP TABLE t1; + +--echo # +--echo # Bug#54117 crash in thr_multi_unlock, temporary table +--echo # + +CREATE TEMPORARY TABLE t1(a INT) ENGINE = InnoDB; + +LOCK TABLES t1 READ; +ALTER TABLE t1 COMMENT 'test'; +UNLOCK TABLES; + +DROP TABLE t1; + + --echo End of 5.1 tests diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 50045ec6d90..6de461574d8 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -7387,6 +7387,11 @@ view_err: mysql_unlock_tables(thd, thd->lock); thd->lock=0; } + /* + If LOCK TABLES list is not empty and contains this table, + unlock the table and remove the table from this list. + */ + mysql_lock_remove(thd, thd->locked_tables, table, FALSE); /* Remove link to old table and rename the new one */ close_temporary_table(thd, table, 1, 1); /* Should pass the 'new_name' as we store table name in the cache */