summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHorst.Hunger <horst.hunger@sun.com>2010-06-03 10:31:26 +0200
committerHorst.Hunger <horst.hunger@sun.com>2010-06-03 10:31:26 +0200
commit5c6a9a5f6fb1c57ad99ac3a14a56ade38684d631 (patch)
treeff20520bff51f1745ee6283bc0cb6a605f21ea75
parent20fc48fc38f18b3ad246e171224f23562f59a355 (diff)
downloadmariadb-git-5c6a9a5f6fb1c57ad99ac3a14a56ade38684d631.tar.gz
Patch for bug#52913 including all review results and changes of date format.
-rw-r--r--mysql-test/collections/default.experimental2
-rw-r--r--mysql-test/include/mysqlhotcopy.inc116
-rw-r--r--mysql-test/lib/mtr_misc.pl22
-rwxr-xr-xmysql-test/mysql-test-run.pl9
-rw-r--r--mysql-test/r/mysqlhotcopy_archive.result118
-rw-r--r--mysql-test/r/mysqlhotcopy_myisam.result164
-rw-r--r--mysql-test/t/mysqlhotcopy_archive.test8
-rw-r--r--mysql-test/t/mysqlhotcopy_myisam.test7
8 files changed, 446 insertions, 0 deletions
diff --git a/mysql-test/collections/default.experimental b/mysql-test/collections/default.experimental
index 11c6613a9f7..f84337660ea 100644
--- a/mysql-test/collections/default.experimental
+++ b/mysql-test/collections/default.experimental
@@ -42,3 +42,5 @@ parts.partition_mgm_lc1_ndb # joro : NDB tests marked as experiment
parts.partition_mgm_lc2_ndb # joro : NDB tests marked as experimental as agreed with bochklin
parts.partition_syntax_ndb # joro : NDB tests marked as experimental as agreed with bochklin
parts.partition_value_ndb # joro : NDB tests marked as experimental as agreed with bochklin
+main.mysqlhotcopy_myisam # horst: due to bug#54129
+main.mysqlhotcopy_archive # horst: due to bug#54129
diff --git a/mysql-test/include/mysqlhotcopy.inc b/mysql-test/include/mysqlhotcopy.inc
new file mode 100644
index 00000000000..585f8c13e74
--- /dev/null
+++ b/mysql-test/include/mysqlhotcopy.inc
@@ -0,0 +1,116 @@
+# Test of mysqlhotcopy (perl script)
+# Author: Horst Hunger
+# Created: 2010-05-10
+
+--source include/not_windows.inc
+--source include/not_embedded.inc
+
+let $MYSQLD_DATADIR= `SELECT @@datadir`;
+--disable_warnings
+DROP DATABASE IF EXISTS hotcopy_test;
+--enable_warnings
+CREATE DATABASE hotcopy_test;
+USE hotcopy_test;
+eval CREATE TABLE t1 (c1 int, c2 varchar(20)) ENGINE=$engine;
+eval CREATE TABLE t2 (c1 int, c2 varchar(20)) ENGINE=$engine;
+eval CREATE TABLE t3 (c1 int, c2 varchar(20)) ENGINE=$engine;
+
+INSERT INTO t1 VALUES (1,'aaaaaaaaaaaaaaaaaaaa'),(2, 'bbbbbbbbbbbbbbbbbbbbbbb');
+INSERT INTO t2 VALUES (1,'aaaaaaaaaaaaaaaaaaaa'),(2, 'bbbbbbbbbbbbbbbbbbbbbbb');
+INSERT INTO t3 VALUES (1,'aaaaaaaaaaaaaaaaaaaa'),(2, 'bbbbbbbbbbbbbbbbbbbbbbb');
+
+--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
+--list_files $MYSQLD_DATADIR/hotcopy_test
+
+# backup into another database in the same directory
+--replace_result $MASTER_MYSOCK MASTER_MYSOCK
+--exec $MYSQLHOTCOPY --quiet -S $MASTER_MYSOCK -u root hotcopy_test hotcopy_save
+
+--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
+--list_files $MYSQLD_DATADIR/hotcopy_save
+
+USE hotcopy_save;
+SELECT * FROM t1;
+SELECT * FROM t2;
+SELECT * FROM t3;
+
+# restore data into the original database with mysqlhotcopy
+if(`SELECT engine= 'MyISAM' FROM information_schema.tables WHERE table_name='t1'`)
+{
+USE hotcopy_test;
+DELETE FROM t1;
+SELECT * FROM t1;
+
+--replace_result $MASTER_MYSOCK MASTER_MYSOCK
+--exec $MYSQLHOTCOPY --quiet --addtodest -S $MASTER_MYSOCK -u root hotcopy_save hotcopy_test
+
+USE hotcopy_save;
+SELECT * FROM t1;
+SELECT * FROM t2;
+SELECT * FROM t3;
+}
+
+USE hotcopy_test;
+DROP TABLE t2;
+--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
+--list_files $MYSQLD_DATADIR/hotcopy_test
+
+--replace_result $MASTER_MYSOCK MASTER_MYSOCK
+--exec $MYSQLHOTCOPY --quiet --addtodest -S $MASTER_MYSOCK -u root hotcopy_save hotcopy_test
+
+FLUSH TABLES;
+SELECT * FROM t1;
+SELECT * FROM t2;
+SELECT * FROM t3;
+
+# backup of db into a directory
+USE hotcopy_test;
+--replace_result $MASTER_MYSOCK MASTER_MYSOCK $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+--exec $MYSQLHOTCOPY --quiet -S $MASTER_MYSOCK -u root hotcopy_test $MYSQLTEST_VARDIR/tmp
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+--list_files $MYSQLTEST_VARDIR/tmp/hotcopy_test
+#--exec rm -rf $MYSQLTEST_VARDIR/tmp/hotcopy_test
+--remove_files_wildcard $MYSQLTEST_VARDIR/tmp/hotcopy_test *
+--rmdir $MYSQLTEST_VARDIR/tmp/hotcopy_test
+
+# backup without full index files
+# reproduction of bug#53556, "--list_files" shows MYI files, which is wrong.
+DROP DATABASE hotcopy_save;
+--replace_result $MASTER_MYSOCK MASTER_MYSOCK
+--exec $MYSQLHOTCOPY --quiet --noindices -S $MASTER_MYSOCK -u root hotcopy_test hotcopy_save
+--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
+--list_files $MYSQLD_DATADIR/hotcopy_save
+
+# test of option "allowold"
+DROP DATABASE hotcopy_save;
+--replace_result $MASTER_MYSOCK MASTER_MYSOCK
+--exec $MYSQLHOTCOPY --quiet -S $MASTER_MYSOCK -u root hotcopy_test hotcopy_save
+--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
+--list_files $MYSQLD_DATADIR/hotcopy_save
+--replace_result $MASTER_MYSOCK MASTER_MYSOCK
+--error 9,2304
+--exec $MYSQLHOTCOPY --quiet -S $MASTER_MYSOCK -u root hotcopy_test hotcopy_save
+--replace_result $MASTER_MYSOCK MASTER_MYSOCK
+--exec $MYSQLHOTCOPY --quiet --allowold -S $MASTER_MYSOCK -u root hotcopy_test hotcopy_save
+--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
+--list_files $MYSQLD_DATADIR/hotcopy_save
+
+# test of option "keepold"
+--replace_result $MASTER_MYSOCK MASTER_MYSOCK
+--exec $MYSQLHOTCOPY --quiet --keepold -S $MASTER_MYSOCK -u root hotcopy_test hotcopy_save
+--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
+--list_files $MYSQLD_DATADIR/hotcopy_save_old
+--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
+--list_files $MYSQLD_DATADIR/hotcopy_save
+
+# test of option "suffix"
+--replace_result $MASTER_MYSOCK MASTER_MYSOCK
+--exec $MYSQLHOTCOPY --quiet --suffix=_cpy -S $MASTER_MYSOCK -u root hotcopy_test
+--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
+--list_files $MYSQLD_DATADIR/hotcopy_test_cpy
+DROP DATABASE hotcopy_test_cpy;
+
+DROP DATABASE hotcopy_test;
+DROP DATABASE hotcopy_save;
+DROP DATABASE hotcopy_save_old;
+
diff --git a/mysql-test/lib/mtr_misc.pl b/mysql-test/lib/mtr_misc.pl
index 97eb693b52e..32960d866ce 100644
--- a/mysql-test/lib/mtr_misc.pl
+++ b/mysql-test/lib/mtr_misc.pl
@@ -149,6 +149,28 @@ sub mtr_exe_maybe_exists (@) {
#
# NOTE! More specific paths should be given before less specific.
+#
+sub mtr_pl_maybe_exists (@) {
+ my @path= @_;
+
+ map {$_.= ".pl"} @path if IS_WINDOWS;
+ foreach my $path ( @path )
+ {
+ if(IS_WINDOWS)
+ {
+ return $path if -f $path;
+ }
+ else
+ {
+ return $path if -x $path;
+ }
+ }
+ return "";
+}
+
+
+#
+# NOTE! More specific paths should be given before less specific.
# For example /client/debug should be listed before /client
#
sub mtr_exe_exists (@) {
diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl
index a35741bebda..820650b120e 100755
--- a/mysql-test/mysql-test-run.pl
+++ b/mysql-test/mysql-test-run.pl
@@ -2040,6 +2040,15 @@ sub environment_setup {
"$basedir/myisam/myisampack"));
# ----------------------------------------------------
+ # mysqlhotcopy
+ # ----------------------------------------------------
+ my $mysqlhotcopy=
+ mtr_pl_maybe_exists("$basedir/scripts/mysqlhotcopy");
+ # Since mysqltest interprets the real path as "false" in an if,
+ # use 1 ("true") to indicate "not exists" so it can be tested for
+ $ENV{'MYSQLHOTCOPY'}= $mysqlhotcopy || 1;
+
+ # ----------------------------------------------------
# perror
# ----------------------------------------------------
my $exe_perror= mtr_exe_exists(vs_config_dirs('extra', 'perror'),
diff --git a/mysql-test/r/mysqlhotcopy_archive.result b/mysql-test/r/mysqlhotcopy_archive.result
new file mode 100644
index 00000000000..bea78597336
--- /dev/null
+++ b/mysql-test/r/mysqlhotcopy_archive.result
@@ -0,0 +1,118 @@
+DROP DATABASE IF EXISTS hotcopy_test;
+CREATE DATABASE hotcopy_test;
+USE hotcopy_test;
+CREATE TABLE t1 (c1 int, c2 varchar(20)) ENGINE=archive;
+CREATE TABLE t2 (c1 int, c2 varchar(20)) ENGINE=archive;
+CREATE TABLE t3 (c1 int, c2 varchar(20)) ENGINE=archive;
+INSERT INTO t1 VALUES (1,'aaaaaaaaaaaaaaaaaaaa'),(2, 'bbbbbbbbbbbbbbbbbbbbbbb');
+Warnings:
+Warning 1265 Data truncated for column 'c2' at row 2
+INSERT INTO t2 VALUES (1,'aaaaaaaaaaaaaaaaaaaa'),(2, 'bbbbbbbbbbbbbbbbbbbbbbb');
+Warnings:
+Warning 1265 Data truncated for column 'c2' at row 2
+INSERT INTO t3 VALUES (1,'aaaaaaaaaaaaaaaaaaaa'),(2, 'bbbbbbbbbbbbbbbbbbbbbbb');
+Warnings:
+Warning 1265 Data truncated for column 'c2' at row 2
+db.opt
+t1.ARZ
+t1.frm
+t2.ARZ
+t2.frm
+t3.ARZ
+t3.frm
+db.opt
+t1.ARZ
+t1.frm
+t2.ARZ
+t2.frm
+t3.ARZ
+t3.frm
+USE hotcopy_save;
+SELECT * FROM t1;
+c1 c2
+1 aaaaaaaaaaaaaaaaaaaa
+2 bbbbbbbbbbbbbbbbbbbb
+SELECT * FROM t2;
+c1 c2
+1 aaaaaaaaaaaaaaaaaaaa
+2 bbbbbbbbbbbbbbbbbbbb
+SELECT * FROM t3;
+c1 c2
+1 aaaaaaaaaaaaaaaaaaaa
+2 bbbbbbbbbbbbbbbbbbbb
+USE hotcopy_test;
+DROP TABLE t2;
+db.opt
+t1.ARZ
+t1.frm
+t3.ARZ
+t3.frm
+FLUSH TABLES;
+SELECT * FROM t1;
+c1 c2
+1 aaaaaaaaaaaaaaaaaaaa
+2 bbbbbbbbbbbbbbbbbbbb
+SELECT * FROM t2;
+c1 c2
+1 aaaaaaaaaaaaaaaaaaaa
+2 bbbbbbbbbbbbbbbbbbbb
+SELECT * FROM t3;
+c1 c2
+1 aaaaaaaaaaaaaaaaaaaa
+2 bbbbbbbbbbbbbbbbbbbb
+USE hotcopy_test;
+db.opt
+t1.ARZ
+t1.frm
+t2.ARZ
+t2.frm
+t3.ARZ
+t3.frm
+DROP DATABASE hotcopy_save;
+db.opt
+t1.ARZ
+t1.frm
+t2.ARZ
+t2.frm
+t3.ARZ
+t3.frm
+DROP DATABASE hotcopy_save;
+db.opt
+t1.ARZ
+t1.frm
+t2.ARZ
+t2.frm
+t3.ARZ
+t3.frm
+db.opt
+t1.ARZ
+t1.frm
+t2.ARZ
+t2.frm
+t3.ARZ
+t3.frm
+db.opt
+t1.ARZ
+t1.frm
+t2.ARZ
+t2.frm
+t3.ARZ
+t3.frm
+db.opt
+t1.ARZ
+t1.frm
+t2.ARZ
+t2.frm
+t3.ARZ
+t3.frm
+db.opt
+t1.ARZ
+t1.frm
+t2.ARZ
+t2.frm
+t3.ARZ
+t3.frm
+DROP DATABASE hotcopy_test_cpy;
+DROP DATABASE hotcopy_test;
+DROP DATABASE hotcopy_save;
+DROP DATABASE hotcopy_save_old;
diff --git a/mysql-test/r/mysqlhotcopy_myisam.result b/mysql-test/r/mysqlhotcopy_myisam.result
new file mode 100644
index 00000000000..52aeffce5cf
--- /dev/null
+++ b/mysql-test/r/mysqlhotcopy_myisam.result
@@ -0,0 +1,164 @@
+DROP DATABASE IF EXISTS hotcopy_test;
+CREATE DATABASE hotcopy_test;
+USE hotcopy_test;
+CREATE TABLE t1 (c1 int, c2 varchar(20)) ENGINE=MyISAM;
+CREATE TABLE t2 (c1 int, c2 varchar(20)) ENGINE=MyISAM;
+CREATE TABLE t3 (c1 int, c2 varchar(20)) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (1,'aaaaaaaaaaaaaaaaaaaa'),(2, 'bbbbbbbbbbbbbbbbbbbbbbb');
+Warnings:
+Warning 1265 Data truncated for column 'c2' at row 2
+INSERT INTO t2 VALUES (1,'aaaaaaaaaaaaaaaaaaaa'),(2, 'bbbbbbbbbbbbbbbbbbbbbbb');
+Warnings:
+Warning 1265 Data truncated for column 'c2' at row 2
+INSERT INTO t3 VALUES (1,'aaaaaaaaaaaaaaaaaaaa'),(2, 'bbbbbbbbbbbbbbbbbbbbbbb');
+Warnings:
+Warning 1265 Data truncated for column 'c2' at row 2
+db.opt
+t1.MYD
+t1.MYI
+t1.frm
+t2.MYD
+t2.MYI
+t2.frm
+t3.MYD
+t3.MYI
+t3.frm
+db.opt
+t1.MYD
+t1.MYI
+t1.frm
+t2.MYD
+t2.MYI
+t2.frm
+t3.MYD
+t3.MYI
+t3.frm
+USE hotcopy_save;
+SELECT * FROM t1;
+c1 c2
+1 aaaaaaaaaaaaaaaaaaaa
+2 bbbbbbbbbbbbbbbbbbbb
+SELECT * FROM t2;
+c1 c2
+1 aaaaaaaaaaaaaaaaaaaa
+2 bbbbbbbbbbbbbbbbbbbb
+SELECT * FROM t3;
+c1 c2
+1 aaaaaaaaaaaaaaaaaaaa
+2 bbbbbbbbbbbbbbbbbbbb
+USE hotcopy_test;
+DELETE FROM t1;
+SELECT * FROM t1;
+c1 c2
+USE hotcopy_save;
+SELECT * FROM t1;
+c1 c2
+1 aaaaaaaaaaaaaaaaaaaa
+2 bbbbbbbbbbbbbbbbbbbb
+SELECT * FROM t2;
+c1 c2
+1 aaaaaaaaaaaaaaaaaaaa
+2 bbbbbbbbbbbbbbbbbbbb
+SELECT * FROM t3;
+c1 c2
+1 aaaaaaaaaaaaaaaaaaaa
+2 bbbbbbbbbbbbbbbbbbbb
+USE hotcopy_test;
+DROP TABLE t2;
+db.opt
+t1.MYD
+t1.MYI
+t1.frm
+t3.MYD
+t3.MYI
+t3.frm
+FLUSH TABLES;
+SELECT * FROM t1;
+c1 c2
+1 aaaaaaaaaaaaaaaaaaaa
+2 bbbbbbbbbbbbbbbbbbbb
+SELECT * FROM t2;
+c1 c2
+1 aaaaaaaaaaaaaaaaaaaa
+2 bbbbbbbbbbbbbbbbbbbb
+SELECT * FROM t3;
+c1 c2
+1 aaaaaaaaaaaaaaaaaaaa
+2 bbbbbbbbbbbbbbbbbbbb
+USE hotcopy_test;
+db.opt
+t1.MYD
+t1.MYI
+t1.frm
+t2.MYD
+t2.MYI
+t2.frm
+t3.MYD
+t3.MYI
+t3.frm
+DROP DATABASE hotcopy_save;
+db.opt
+t1.MYD
+t1.MYI
+t1.frm
+t2.MYD
+t2.MYI
+t2.frm
+t3.MYD
+t3.MYI
+t3.frm
+DROP DATABASE hotcopy_save;
+db.opt
+t1.MYD
+t1.MYI
+t1.frm
+t2.MYD
+t2.MYI
+t2.frm
+t3.MYD
+t3.MYI
+t3.frm
+db.opt
+t1.MYD
+t1.MYI
+t1.frm
+t2.MYD
+t2.MYI
+t2.frm
+t3.MYD
+t3.MYI
+t3.frm
+db.opt
+t1.MYD
+t1.MYI
+t1.frm
+t2.MYD
+t2.MYI
+t2.frm
+t3.MYD
+t3.MYI
+t3.frm
+db.opt
+t1.MYD
+t1.MYI
+t1.frm
+t2.MYD
+t2.MYI
+t2.frm
+t3.MYD
+t3.MYI
+t3.frm
+db.opt
+t1.MYD
+t1.MYI
+t1.frm
+t2.MYD
+t2.MYI
+t2.frm
+t3.MYD
+t3.MYI
+t3.frm
+DROP DATABASE hotcopy_test_cpy;
+DROP DATABASE hotcopy_test;
+DROP DATABASE hotcopy_save;
+DROP DATABASE hotcopy_save_old;
diff --git a/mysql-test/t/mysqlhotcopy_archive.test b/mysql-test/t/mysqlhotcopy_archive.test
new file mode 100644
index 00000000000..4bfad3ce138
--- /dev/null
+++ b/mysql-test/t/mysqlhotcopy_archive.test
@@ -0,0 +1,8 @@
+# Test of mysqlhotcopy (perl script)
+# Author: Horst Hunger
+# Created: 2010-05-10
+
+--source include/have_archive.inc
+let $engine= archive;
+--source include/mysqlhotcopy.inc
+--exit
diff --git a/mysql-test/t/mysqlhotcopy_myisam.test b/mysql-test/t/mysqlhotcopy_myisam.test
new file mode 100644
index 00000000000..adf26e42245
--- /dev/null
+++ b/mysql-test/t/mysqlhotcopy_myisam.test
@@ -0,0 +1,7 @@
+# Test of mysqlhotcopy (perl script)
+# Author: Horst Hunger
+# Created: 2010-05-10
+
+let $engine= MyISAM;
+--source include/mysqlhotcopy.inc
+--exit