summaryrefslogtreecommitdiff
path: root/mysql-test/t/merge.test
diff options
context:
space:
mode:
authorAlexander Nozdrin <alik@sun.com>2010-06-25 19:32:59 +0400
committerAlexander Nozdrin <alik@sun.com>2010-06-25 19:32:59 +0400
commit8f521b41baf084d7188c26034ecb03fa2e76b8b3 (patch)
tree546fd92283955f11ad27a77c1740a6fd7c17b89b /mysql-test/t/merge.test
parent47edc4cade1dc4eb37bbe11db40f2712469d01cb (diff)
downloadmariadb-git-8f521b41baf084d7188c26034ecb03fa2e76b8b3.tar.gz
Backport of revid:ingo.struewing@sun.com-20091223200354-r2uzbdkj2v6yv111
Bug#47633 - assert in ha_myisammrg::info during OPTIMIZE The server crashed on an attempt to optimize a MERGE table with non-existent child table. mysql_admin_table() relied on the table to be successfully open if a table object had been allocated. Changed code to check return value of the open function before calling a handler:: function on it. mysql-test/r/merge.result: Backport of revid:ingo.struewing@sun.com-20091223200354-r2uzbdkj2v6yv111 Bug#47633 - assert in ha_myisammrg::info during OPTIMIZE Updated result file. mysql-test/t/merge.test: Backport of revid:ingo.struewing@sun.com-20091223200354-r2uzbdkj2v6yv111 Bug#47633 - assert in ha_myisammrg::info during OPTIMIZE Changed tests to respect changed TEMPORARY MERGE locking (unrelated). Changed tests to respect changed CREATE TABLE ... LIKE (unrelated). Changed tests to respect that no new tables can be created under LOCK TABLE (unrelated). Added test for Bug#47633. Changed error numbers to symbolic names. Added test for child locking for ALTER under LOCK TABLE. Since Bug 36171 is not pushed yet, not the whole patch has been backported. mysys/my_delete.c: Backport of revid:ingo.struewing@sun.com-20091223200354-r2uzbdkj2v6yv111 Bug#47633 - assert in ha_myisammrg::info during OPTIMIZE Fixed error reporting. Fixed indentation. mysys/my_mmap.c: Backport of revid:ingo.struewing@sun.com-20091223200354-r2uzbdkj2v6yv111 Bug#47633 - assert in ha_myisammrg::info during OPTIMIZE Added DBUG. sql/item_func.cc: Backport of revid:ingo.struewing@sun.com-20091223200354-r2uzbdkj2v6yv111 Added Debug Sync point, required by merge_sync.test. sql/sql_table.cc: Backport of revid:ingo.struewing@sun.com-20091223200354-r2uzbdkj2v6yv111 Bug#47633 - assert in ha_myisammrg::info during OPTIMIZE Do not call handler:: functions if the table was not opened successfully. Added Debug Sync point, required by merge_sync.test. storage/myisam/mi_check.c: Backport of revid:ingo.struewing@sun.com-20091223200354-r2uzbdkj2v6yv111 Bug#47633 - assert in ha_myisammrg::info during OPTIMIZE Unmap memory before exchanging data files. Needed on Windows. storage/myisammrg/ha_myisammrg.cc: Backport of revid:ingo.struewing@sun.com-20091223200354-r2uzbdkj2v6yv111 Added Debug Sync point, required by merge_sync.test. merge_sync.test will be introduced by a patch for Bug 36171, which is not pushed yet.
Diffstat (limited to 'mysql-test/t/merge.test')
-rw-r--r--mysql-test/t/merge.test44
1 files changed, 34 insertions, 10 deletions
diff --git a/mysql-test/t/merge.test b/mysql-test/t/merge.test
index 29c0eae1df6..a06da03cbcd 100644
--- a/mysql-test/t/merge.test
+++ b/mysql-test/t/merge.test
@@ -457,7 +457,7 @@ CREATE TABLE t2(a INT) ENGINE=MERGE UNION=(t1);
SELECT * FROM t2;
DROP TABLE t1, t2;
CREATE TABLE t2(a INT) ENGINE=MERGE UNION=(t3);
---error 1168
+--error ER_WRONG_MRG_TABLE
SELECT * FROM t2;
DROP TABLE t2;
@@ -549,11 +549,11 @@ drop table t1;
# CREATE TABLE fails
#
CREATE TABLE tm1(a INT) ENGINE=MERGE UNION=(t1, t2);
---error 1168
+--error ER_WRONG_MRG_TABLE
SELECT * FROM tm1;
CHECK TABLE tm1;
CREATE TABLE t1(a INT);
---error 1168
+--error ER_WRONG_MRG_TABLE
SELECT * FROM tm1;
CHECK TABLE tm1;
CREATE TABLE t2(a BLOB);
@@ -887,6 +887,9 @@ CREATE TABLE t4 LIKE t3;
SHOW CREATE TABLE t4;
--error ER_TABLE_NOT_LOCKED
INSERT INTO t4 VALUES (4);
+--echo # Temporary tables can be created in spite of LOCK TABLES.
+--echo # If the temporary MERGE table uses the locked children only,
+--echo # it can even be used.
CREATE TEMPORARY TABLE t4 LIKE t3;
--error ER_WRONG_MRG_TABLE
SHOW CREATE TABLE t4;
@@ -913,7 +916,7 @@ DROP TABLE t4;
--echo # 2. Normal rename.
SELECT * FROM t3 ORDER BY c1;
RENAME TABLE t2 TO t5;
---error 1168
+--error ER_WRONG_MRG_TABLE
SELECT * FROM t3 ORDER BY c1;
RENAME TABLE t5 TO t2;
SELECT * FROM t3 ORDER BY c1;
@@ -931,7 +934,7 @@ UNLOCK TABLES;
--echo #
--echo # 4. Alter table rename.
ALTER TABLE t2 RENAME TO t5;
---error 1168
+--error ER_WRONG_MRG_TABLE
SELECT * FROM t3 ORDER BY c1;
ALTER TABLE t5 RENAME TO t2;
SELECT * FROM t3 ORDER BY c1;
@@ -1170,6 +1173,7 @@ SELECT @a;
SELECT * FROM t4 ORDER BY c1;
DELETE FROM t4 WHERE c1 = 33;
DROP TRIGGER t3_ai;
+UNLOCK TABLES;
--echo #
--echo # Trigger with table use on child
DELETE FROM t4 WHERE c1 = 4;
@@ -1273,11 +1277,12 @@ DROP TABLE t1, t2, t3;
#
# Bug#25038 - Waiting TRUNCATE
+# Truncate failed with error message when table was in use by MERGE.
#
# Show that truncate of child table after use of parent table works.
-CREATE TABLE t1 (c1 INT) ENGINE= MyISAM;
-CREATE TABLE t2 (c1 INT) ENGINE= MyISAM;
-CREATE TABLE t3 (c1 INT) ENGINE= MRG_MYISAM UNION= (t1, t2);
+CREATE TABLE t1 (c1 INT) ENGINE=MyISAM;
+CREATE TABLE t2 (c1 INT) ENGINE=MyISAM;
+CREATE TABLE t3 (c1 INT) ENGINE=MRG_MYISAM UNION=(t1,t2);
INSERT INTO t1 VALUES (1);
INSERT INTO t2 VALUES (2);
SELECT * FROM t3;
@@ -1429,7 +1434,6 @@ FLUSH TABLES m1, t1;
UNLOCK TABLES;
DROP TABLE t1, m1;
-
#
# Bug#35068 - Assertion fails when reading from i_s.tables
# and there is incorrect merge table
@@ -1816,7 +1820,7 @@ CREATE TABLE m1 (c1 INT) ENGINE=MRG_MYISAM UNION=(t1,mysql_test1.t2)
INSERT INTO t1 VALUES (1);
INSERT INTO mysql_test1.t2 VALUES (2);
SELECT * FROM m1;
-#--copy_file $MYSQLTEST_VARDIR/master-data/test/m1.MRG /tmp/mysql-test-m1.MRG
+#--copy_file $MYSQLTEST_DATADIR/test/m1.MRG /tmp/mysql-test-m1.MRG
DROP TABLE t1, mysql_test1.t2, m1;
DROP DATABASE mysql_test1;
#
@@ -2105,6 +2109,14 @@ DROP FUNCTION f1;
DROP TABLE tm1, t1, t2, t3, t4, t5;
--echo #
+--echo # Bug#47633 - assert in ha_myisammrg::info during OPTIMIZE
+--echo #
+CREATE TEMPORARY TABLE t1 (c1 INT);
+ALTER TABLE t1 ENGINE=MERGE UNION(t_not_exists,t1);
+OPTIMIZE TABLE t1;
+DROP TABLE t1;
+
+--echo #
--echo # Bug47098 assert in MDL_context::destroy on HANDLER
--echo # <damaged merge table> OPEN
--echo #
@@ -2186,6 +2198,18 @@ ALTER TABLE m1 ADD INDEX (c1);
UNLOCK TABLES;
DROP TABLE m1, t1;
+--echo #
+--echo # If children are to be altered, they need an explicit lock.
+--echo #
+CREATE TABLE t1 (c1 INT);
+CREATE TABLE m1 (c1 INT) ENGINE=MRG_MyISAM UNION=(t1);
+LOCK TABLE m1 WRITE;
+--error ER_TABLE_NOT_LOCKED_FOR_WRITE
+ALTER TABLE t1 ADD INDEX (c1);
+LOCK TABLE m1 WRITE, t1 WRITE;
+ALTER TABLE t1 ADD INDEX (c1);
+UNLOCK TABLES;
+DROP TABLE m1, t1;
--echo #
--echo # Test for bug #37371 "CREATE TABLE LIKE merge loses UNION parameter"