summaryrefslogtreecommitdiff
path: root/mysql-test/t/create.test
diff options
context:
space:
mode:
authorJon Olav Hauglid <jon.hauglid@sun.com>2009-12-09 13:15:35 +0100
committerJon Olav Hauglid <jon.hauglid@sun.com>2009-12-09 13:15:35 +0100
commit05a126eda1d0fc34440323d707921d4c836c3628 (patch)
tree7685bc95a39aad57e3c54febb2da9b32f6d83a3e /mysql-test/t/create.test
parentd40ef57d80639815fb5c64ef07a37d826b943cb8 (diff)
downloadmariadb-git-05a126eda1d0fc34440323d707921d4c836c3628.tar.gz
Backport of revno: 2617.76.2
Bug #47107 assert in notify_shared_lock on incorrect CREATE TABLE , HANDLER Attempts to create a table (using CREATE TABLE, CREATE TABLE LIKE or CREATE TABLE SELECT statements) which already existed and was opened by the same connection through HANDLER statement, led to a stalled connection (for production builds of the server) or to the server being aborted due to an assertion failure (for debug builds of the server). This problem was introduced by the new implementation of a metadata locking subsystem and didn't affect earlier versions of the server. The cause of the problem was that the HANDLER was not closed by CREATE TABLE before CREATE tried to open and lock the table. Acquiring an exclusive MDL lock on the table to be created would therefore fail since HANDLER already had a shared MDL lock. This triggered an assert as the HANDLER and CREATE statements came from the same thread (self-deadlock). This patch resolves the issue by closing any open HANDLERs on tables to be created by CREATE TABLE, similar to what is already done for DROP and ALTER TABLE. Test case added to create.test.
Diffstat (limited to 'mysql-test/t/create.test')
-rw-r--r--mysql-test/t/create.test30
1 files changed, 30 insertions, 0 deletions
diff --git a/mysql-test/t/create.test b/mysql-test/t/create.test
index c07014bfc19..21778e00ab9 100644
--- a/mysql-test/t/create.test
+++ b/mysql-test/t/create.test
@@ -1639,3 +1639,33 @@ END ;|
DROP TABLE t1;
DROP TABLE B;
+
+
+--echo #
+--echo # Bug #47107 assert in notify_shared_lock on incorrect
+--echo # CREATE TABLE , HANDLER
+--echo #
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+CREATE TABLE t1(f1 integer);
+
+--echo # The following CREATE TABLEs before gave an assert.
+
+HANDLER t1 OPEN AS A;
+--error ER_TABLE_EXISTS_ERROR
+CREATE TABLE t1 SELECT 1 AS f2;
+
+HANDLER t1 OPEN AS A;
+--error ER_TABLE_EXISTS_ERROR
+CREATE TABLE t1(f1 integer);
+
+CREATE TABLE t2(f1 integer);
+HANDLER t1 OPEN AS A;
+--error ER_TABLE_EXISTS_ERROR
+CREATE TABLE t1 LIKE t2;
+
+DROP TABLE t2;
+DROP TABLE t1;