diff options
Diffstat (limited to 'mysql-test/t/mysqldump.test')
-rw-r--r-- | mysql-test/t/mysqldump.test | 129 |
1 files changed, 123 insertions, 6 deletions
diff --git a/mysql-test/t/mysqldump.test b/mysql-test/t/mysqldump.test index ea85d7f4f55..d841312392d 100644 --- a/mysql-test/t/mysqldump.test +++ b/mysql-test/t/mysqldump.test @@ -11,7 +11,7 @@ drop view if exists v1, v2, v3; # XML output -CREATE TABLE t1(a int); +CREATE TABLE t1(a int, key (a)) key_block_size=1024; INSERT INTO t1 VALUES (1), (2); --exec $MYSQL_DUMP --skip-create --skip-comments -X test t1 DROP TABLE t1; @@ -794,9 +794,10 @@ drop table t1, t2; drop database db1; use test; -# -# dump of view -# +--echo # +--echo # dump of view +--echo # + create table t1(a int); create view v1 as select * from t1; --exec $MYSQL_DUMP --skip-comments test @@ -977,7 +978,7 @@ CREATE FUNCTION `bug9056_func1`(a INT, b INT) RETURNS int(11) RETURN a+b // CREATE PROCEDURE `bug9056_proc1`(IN a INT, IN b INT, OUT c INT) BEGIN SELECT a+b INTO c; end // -create function bug9056_func2(f1 char binary) returns char binary +create function bug9056_func2(f1 char binary) returns char begin set f1= concat( 'hello', f1 ); return f1; @@ -1080,7 +1081,6 @@ create view v2 as select * from v0; select * from v2; --exec $MYSQL_DUMP -x --skip-comments --databases test - drop view v2; drop view v0; drop view v1; @@ -1342,7 +1342,9 @@ grant RELOAD on *.* to mysqltest_1@localhost; grant REPLICATION CLIENT on *.* to mysqltest_1@localhost; # Execute mysqldump, should now succeed +--disable_result_log --exec $MYSQL_DUMP --compact --master-data -u mysqltest_1 test 2>&1 +--enable_result_log # Clean up drop table t1; @@ -1430,3 +1432,118 @@ DROP TABLE t1; --echo # --echo # End of 5.0 tests --echo # + +# Check new --replace option + +--disable_warnings +drop table if exists t1; +--enable_warnings + +CREATE TABLE t1(a int, b int); +INSERT INTO t1 VALUES (1,1); +INSERT INTO t1 VALUES (2,3); +INSERT INTO t1 VALUES (3,4), (4,5); +--exec $MYSQL_DUMP --replace --skip-comments test t1 +DROP TABLE t1; + +# +# Added for use-thread option +# +create table t1 (a text , b text); +create table t2 (a text , b text); +insert t1 values ("Duck, Duck", "goose"); +insert t1 values ("Duck, Duck", "pidgeon"); +insert t2 values ("We the people", "in order to perform"); +insert t2 values ("a more perfect", "union"); +select * from t1; +select * from t2; +--exec $MYSQL_DUMP --tab=$MYSQLTEST_VARDIR/tmp/ test +--exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/t1.sql +--exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/t2.sql +# The first load tests the pausing code +--exec $MYSQL_IMPORT --use-threads=1 test $MYSQLTEST_VARDIR/tmp/t1.txt $MYSQLTEST_VARDIR/tmp/t2.txt +# Now we test with multiple threads! +--exec $MYSQL_IMPORT --silent --use-threads=5 test $MYSQLTEST_VARDIR/tmp/t1.txt $MYSQLTEST_VARDIR/tmp/t2.txt +select * from t1; +select * from t2; +# Now we test with multiple threads, but less threads than files. +create table words(a varchar(255)); +create table words2(b varchar(255)); +--exec $MYSQL_IMPORT --silent --use-threads=2 test $MYSQLTEST_VARDIR/tmp/t1.txt $MYSQLTEST_VARDIR/tmp/t2.txt $MYSQLTEST_VARDIR/std_data_ln/words.dat $MYSQLTEST_VARDIR/std_data_ln/words2.dat +select * from t1; +select * from t2; +select * from words; +select * from words2; + +# Drop table "words" and run with threads, should fail +drop table words; +--replace_regex /.*mysqlimport(\.exe)*/mysql-import/ +--error 1 +--exec $MYSQL_IMPORT --silent --use-threads=2 test $MYSQLTEST_VARDIR/tmp/t1.txt $MYSQLTEST_VARDIR/tmp/t2.txt $MYSQLTEST_VARDIR/std_data_ln/words.dat $MYSQLTEST_VARDIR/std_data_ln/words2.dat 2>&1 + +drop table t1; +drop table t2; + +drop table words2; + +--echo # +--echo # BUG# 16853: mysqldump doesn't show events +--echo # + +create database first; +use first; +set time_zone = 'UTC'; + +## prove one works (with spaces and tabs on the end) +create event ee1 on schedule at '2035-12-31 20:01:23' do set @a=5; +show events; +show create event ee1; +--exec $MYSQL_DUMP --events first > $MYSQLTEST_VARDIR/tmp/bug16853-1.sql +drop database first; + +create database second; +use second; +--exec $MYSQL second < $MYSQLTEST_VARDIR/tmp/bug16853-1.sql +show events; +show create event ee1; + +## prove three works (with spaces and tabs on the end) +# start with one from the previous restore +create event ee2 on schedule at '2018-12-31 21:01:23' do set @a=5; +create event ee3 on schedule at '2030-12-31 22:01:23' do set @a=5; +show events; +--exec $MYSQL_DUMP --events second > $MYSQLTEST_VARDIR/tmp/bug16853-2.sql +drop database second; + +create database third; +use third; +--exec $MYSQL third < $MYSQLTEST_VARDIR/tmp/bug16853-2.sql +show events; +drop database third; + +# revert back to normal settings +set time_zone = 'SYSTEM'; +use test; + +--echo # +--echo # BUG#17201 Spurious 'DROP DATABASE' in output, +--echo # also confusion between tables and views. +--echo # Example code from Markus Popp +--echo # + +create database mysqldump_test_db; +use mysqldump_test_db; +create table t1 (id int); +create view v1 as select * from t1; +insert into t1 values (1232131); +insert into t1 values (4711); +insert into t1 values (3231); +insert into t1 values (0815); +--exec $MYSQL_DUMP --skip-comments --add-drop-database --databases mysqldump_test_db +drop view v1; +drop table t1; +drop database mysqldump_test_db; + +--echo # +--echo # End of 5.1 tests +--echo # |