summaryrefslogtreecommitdiff
path: root/mysql-test/r/ps_ddl.result
diff options
context:
space:
mode:
authorJon Olav Hauglid <jon.hauglid@sun.com>2009-12-10 11:53:20 +0100
committerJon Olav Hauglid <jon.hauglid@sun.com>2009-12-10 11:53:20 +0100
commit5e1dfa4c066ec0e48a725b4976bdb5aa09c79685 (patch)
treeb0bd9c2a627f690af8d8e861fec45dd6d817ff61 /mysql-test/r/ps_ddl.result
parentf3bc2406b0258d128b4f8f0ae21640e80a518f18 (diff)
downloadmariadb-git-5e1dfa4c066ec0e48a725b4976bdb5aa09c79685.tar.gz
Backport of revno: 2617.71.1
Bug#42546 Backup: RESTORE fails, thinking it finds an existing table The problem occured when a MDL locking conflict happened for a non-existent table between a CREATE and a INSERT statement. The code for CREATE interpreted this lock conflict to mean that the table existed, which meant that the statement failed when it should not have. The problem could occur for CREATE TABLE, CREATE TABLE LIKE and ALTER TABLE RENAME. This patch fixes the problem for CREATE TABLE and CREATE TABLE LIKE. It is based on code backported from the mysql-6.1-fk tree written by Dmitry Lenev. CREATE now uses normal open_and_lock_tables() code to acquire exclusive locks. This means that for the test case in the bug description, CREATE will wait until INSERT completes so that it can get the exclusive lock. This resolves the reported bug. The patch also prohibits CREATE TABLE and CREATE TABLE LIKE under LOCK TABLES. Note that this is an incompatible change and must be reflected in the documentation. Affected test cases have been updated. mdl_sync.test contains tests for CREATE TABLE and CREATE TABLE LIKE. Fixing the issue for ALTER TABLE RENAME is beyond the scope of this patch. ALTER TABLE cannot be prohibited from working under LOCK TABLES as this could seriously impact customers and a proper fix would require a significant rewrite.
Diffstat (limited to 'mysql-test/r/ps_ddl.result')
-rw-r--r--mysql-test/r/ps_ddl.result17
1 files changed, 10 insertions, 7 deletions
diff --git a/mysql-test/r/ps_ddl.result b/mysql-test/r/ps_ddl.result
index f411328ed7c..3d57c8f7332 100644
--- a/mysql-test/r/ps_ddl.result
+++ b/mysql-test/r/ps_ddl.result
@@ -1755,21 +1755,21 @@ SUCCESS
drop table t1;
deallocate prepare stmt;
-# XXX: no validation of the first table in case of
-# CREATE TEMPORARY TABLE. This is a shortcoming of the current code,
-# but since validation is not strictly necessary, nothing is done
-# about it.
-# Will be fixed as part of work on Bug#21431 "Incomplete support of
-# temporary tables"
create table t1 (a int);
insert into t1 (a) values (1);
prepare stmt from "create temporary table if not exists t2 as select * from t1";
execute stmt;
drop table t2;
execute stmt;
+call p_verify_reprepare_count(0);
+SUCCESS
+
execute stmt;
Warnings:
Note 1050 Table 't2' already exists
+call p_verify_reprepare_count(1);
+SUCCESS
+
select * from t2;
a
1
@@ -1777,6 +1777,9 @@ a
execute stmt;
Warnings:
Note 1050 Table 't2' already exists
+call p_verify_reprepare_count(0);
+SUCCESS
+
select * from t2;
a
1
@@ -1790,7 +1793,7 @@ Note 1050 Table 't2' already exists
select * from t2;
a
1
-call p_verify_reprepare_count(0);
+call p_verify_reprepare_count(1);
SUCCESS
drop table t1;