File: innodb-wl5980-windows.test

package info (click to toggle)
percona-xtrabackup 2.2.3-2.1
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 293,260 kB
  • ctags: 146,881
  • sloc: cpp: 1,051,960; ansic: 570,217; java: 54,595; perl: 53,495; pascal: 44,194; sh: 27,826; yacc: 15,314; python: 12,142; xml: 7,848; sql: 4,125; makefile: 1,459; awk: 785; lex: 758
file content (237 lines) | stat: -rwxr-xr-x 9,045 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
#
# This testcase is related to WL5980, to test the portability feature.
# Create a DB & tables with all kinds Non-Partition & partition on
# Linux platform. Zip the entire DB and tablespaces on Windows.
# Bring the zip file to Windows. Unzip the DB and modify the *.isl files
# with the proper path of the *.ibd files. Restart the DB & check the
# DB with a few DML operations. Test and validate the Linux DB on
# Windows platform.
# Prerequisite : portability_wl5980_windows.zip
# should exist in "suite/innodb/t"

# Windows-specific tests
--source include/windows.inc
--source include/have_innodb_16k.inc
--source include/not_embedded.inc

--echo #Check whether unzip is installed on the system
--echo #Store the command output into a temp file.
perl;
 my $dir = $ENV{'MYSQLTEST_VARDIR'};
 my $cmd = system('unzip --help > NUL 2>&1');
 open ( OUTPUT, ">$dir/tmp/tar.inc") ;
 print OUTPUT "let \$stat = $cmd;\n";
 close (OUTPUT);
EOF

--echo #Get the value of the $stat variable from perl, to MTR
--source  $MYSQLTEST_VARDIR/tmp/tar.inc

--echo #Check the status is non-zero
if ($stat != 0)
{
 --skip Test requires Unzip on Windows
}

--echo #Remove the temp file tar.inc
--remove_file $MYSQLTEST_VARDIR/tmp/tar.inc

--echo # Set the environmental variables
let $MYSQL_BASEDIR= `select @@basedir`;

--echo # Stop server
-- exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
-- shutdown_server 30
-- source include/wait_until_disconnected.inc

--echo # Copy the remote tablespace & DB zip files from suite location to working location.
--copy_file $MYSQL_BASEDIR/mysql-test/suite/innodb/t/portability_wl5980_windows.zip $MYSQL_TMP_DIR/portability_wl5980_windows.zip

--echo # Check that the file exists in the working folder.
--file_exists $MYSQL_TMP_DIR/portability_wl5980_windows.zip

--echo # Unzip the zip file.
--exec unzip -q $MYSQL_TMP_DIR/portability_wl5980_windows.zip -d $MYSQL_TMP_DIR

--echo # Remove the DOS based *.isl files from the MySql Data directory.
--remove_file $MYSQL_TMP_DIR/mysqld.5980/data/test/emp2#p#p1.isl
--remove_file $MYSQL_TMP_DIR/mysqld.5980/data/test/emp2#p#p2.isl

--remove_file $MYSQL_TMP_DIR/mysqld.5980/data/test/emp3.isl

--remove_file $MYSQL_TMP_DIR/mysqld.5980/data/test/emp4#p#p1.isl
--remove_file $MYSQL_TMP_DIR/mysqld.5980/data/test/emp4#p#p2.isl

--remove_file $MYSQL_TMP_DIR/mysqld.5980/data/test/purchase#p#p0#sp#s0.isl
--remove_file $MYSQL_TMP_DIR/mysqld.5980/data/test/purchase#p#p0#sp#s1.isl
--remove_file $MYSQL_TMP_DIR/mysqld.5980/data/test/purchase#p#p1#sp#s2.isl
--remove_file $MYSQL_TMP_DIR/mysqld.5980/data/test/purchase#p#p1#sp#s3.isl

--echo # Check that the *.ibd files are in the required location.
--file_exists $MYSQL_TMP_DIR/mysqld.5980/tab1/test/emp2#p#p1.ibd
--file_exists $MYSQL_TMP_DIR/mysqld.5980/tab2/test/emp2#p#p2.ibd

--file_exists $MYSQL_TMP_DIR/mysqld.5980/tab3/test/emp3.ibd

--file_exists $MYSQL_TMP_DIR/mysqld.5980/tab4/test/emp4#p#p1.ibd
--file_exists $MYSQL_TMP_DIR/mysqld.5980/tab5/test/emp4#p#p2.ibd

--file_exists $MYSQL_TMP_DIR/mysqld.5980/part0/test/purchase#p#p0#sp#s0.ibd
--file_exists $MYSQL_TMP_DIR/mysqld.5980/part1/test/purchase#p#p0#sp#s1.ibd
--file_exists $MYSQL_TMP_DIR/mysqld.5980/part2/test/purchase#p#p1#sp#s2.ibd
--file_exists $MYSQL_TMP_DIR/mysqld.5980/part3/test/purchase#p#p1#sp#s3.ibd


--echo # Create new *.isl files with the correct path to the *.ibd files,
--exec echo $MYSQL_TMP_DIR/mysqld.5980/tab1/test/emp2#p#p1.ibd > $MYSQL_TMP_DIR/mysqld.5980/data/test/emp2#p#p1.isl
--exec echo $MYSQL_TMP_DIR/mysqld.5980/tab2/test/emp2#p#p2.ibd > $MYSQL_TMP_DIR/mysqld.5980/data/test/emp2#p#p2.isl

--exec echo $MYSQL_TMP_DIR/mysqld.5980/tab3/test/emp3.ibd  > $MYSQL_TMP_DIR/mysqld.5980/data/test/emp3.isl

--exec echo $MYSQL_TMP_DIR/mysqld.5980/tab4/test/emp4#p#p1.ibd > $MYSQL_TMP_DIR/mysqld.5980/data/test/emp4#p#p1.isl
--exec echo $MYSQL_TMP_DIR/mysqld.5980/tab5/test/emp4#p#p2.ibd > $MYSQL_TMP_DIR/mysqld.5980/data/test/emp4#p#p2.isl

--exec echo $MYSQL_TMP_DIR/mysqld.5980/part0/test/purchase#p#p0#sp#s0.ibd > $MYSQL_TMP_DIR/mysqld.5980/data/test/purchase#p#p0#sp#s0.isl 
--exec echo $MYSQL_TMP_DIR/mysqld.5980/part1/test/purchase#p#p0#sp#s1.ibd > $MYSQL_TMP_DIR/mysqld.5980/data/test/purchase#p#p0#sp#s1.isl
--exec echo $MYSQL_TMP_DIR/mysqld.5980/part2/test/purchase#p#p1#sp#s2.ibd > $MYSQL_TMP_DIR/mysqld.5980/data/test/purchase#p#p1#sp#s2.isl
--exec echo $MYSQL_TMP_DIR/mysqld.5980/part3/test/purchase#p#p1#sp#s3.ibd > $MYSQL_TMP_DIR/mysqld.5980/data/test/purchase#p#p1#sp#s3.isl

--exec echo #change path separator Linux "/" format to windows "\" format by Perl script, 
--exec echo #in the *.ISL files , in the Mysql data directory
--perl  EOF
use File::Copy;
#use strict;
#use warnings;
my $dir= $ENV{'MYSQL_TMP_DIR'}."/mysqld.5980/data/test";
opendir(DIR, $dir) or die $!;
 while (my $file = readdir(DIR)) {
 # Read files only in the Directory
 next unless (-f "$dir/$file");
 # Use a regular expression to find files ending in .isl
    next unless ($file =~ m/\.isl$/);
	# open file in write mode
	open IN_FILE,"<", "$dir/$file" or die $!;
	open OUT_FILE, ">", "$dir/tmp" or die $!;
	while(<IN_FILE>) {
        #change the path separator "/" to "\" in the file
	 $_=~ s/"$//g;
         $_=~ s/\//\\/g;
	 print OUT_FILE $_;
	}

	close(IN_FILE);
	close(OUT_FILE);
	#move the new content from tmp file to the orginal file.
	move("$dir/tmp", "$dir/$file");
	print "$file\n";
   }
closedir(DIR);

exit 0;
EOF

--echo # Restarting the server with skip-grant-tables option and updating
--echo # mysql.user table. This is to deal with the restriction imposed on
--echo # plugin field for users in WL6982.

--echo # Restart the DB server from unzip location of MySQL Data Dir 
-- exec echo "restart: --datadir=$MYSQL_TMP_DIR/mysqld.5980/data/ --skip-grant-tables" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
-- enable_reconnect
-- source include/wait_until_connected_again.inc

-- exec $MYSQL -e "UPDATE mysql.user SET plugin = 'mysql_native_password'"

-- echo # Stop server
-- exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
-- shutdown_server 30
-- source include/wait_until_disconnected.inc

--echo # Restart the DB server from unzip location of MySQL Data Dir 
-- exec echo "restart: --datadir=$MYSQL_TMP_DIR/mysqld.5980/data/ " > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
-- enable_reconnect
-- source include/wait_until_connected_again.inc

--echo # Check the DB & tables with DML statements.
use test;
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
SHOW CREATE TABLE emp1;
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
SHOW CREATE TABLE emp2;
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
SHOW CREATE TABLE emp3;
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
SHOW CREATE TABLE emp4;
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
SHOW CREATE TABLE purchase;

SELECT COUNT(*) FROM emp1;
SELECT COUNT(*) FROM emp2;
SELECT COUNT(*) FROM emp3;
SELECT COUNT(*) FROM emp4;
SELECT COUNT(*) FROM purchase;

DELETE  FROM emp1;
DELETE  FROM emp2;
DELETE  FROM emp3;
DELETE  FROM emp4;
DELETE FROM purchase;

SELECT COUNT(*) FROM emp1;
SELECT COUNT(*) FROM emp2;
SELECT COUNT(*) FROM emp3;
SELECT COUNT(*) FROM emp4;
SELECT COUNT(*) FROM purchase;

--echo # Check the system tables have the proper entry of the tables.
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
SELECT path FROM information_schema.innodb_sys_datafiles
       WHERE path LIKE '%test%' ORDER BY space;
SELECT name,file_format,row_format 
       FROM information_schema.innodb_sys_tablespaces
       ORDER BY name;
SELECT name,n_cols,file_format,row_format 
       FROM information_schema.innodb_sys_tables 
       WHERE name LIKE '%emp%' ORDER BY name;
SELECT name,n_cols,file_format,row_format 
       FROM information_schema.innodb_sys_tables 
       WHERE name LIKE '%purchase%' ORDER BY name;

--echo #
--echo # Cleanup
--echo #

DROP TABLE emp1;
DROP TABLE emp2;
DROP TABLE emp3;
DROP TABLE emp4;
DROP TABLE purchase;

# The following lines of code just to dupe the MTR frame work nothing to do with WL,
# As MTR thinks that it was a failure, When the server logs contains error/warnings
# even though there are no result mismatch.It is an expected behavior of the server.

CREATE DATABASE mtr;
DELIMITER |;
CREATE PROCEDURE mtr.check_warnings(OUT result INT)
BEGIN
SELECT 0 INTO RESULT;
END|

--rmdir $MYSQL_TMP_DIR/mysqld.5980/tab1/test
--rmdir $MYSQL_TMP_DIR/mysqld.5980/tab2/test
--rmdir $MYSQL_TMP_DIR/mysqld.5980/tab3/test
--rmdir $MYSQL_TMP_DIR/mysqld.5980/tab4/test
--rmdir $MYSQL_TMP_DIR/mysqld.5980/tab5/test
--rmdir $MYSQL_TMP_DIR/mysqld.5980/part0/test
--rmdir $MYSQL_TMP_DIR/mysqld.5980/part1/test
--rmdir $MYSQL_TMP_DIR/mysqld.5980/part2/test
--rmdir $MYSQL_TMP_DIR/mysqld.5980/part3/test
--rmdir $MYSQL_TMP_DIR/mysqld.5980/tab1
--rmdir $MYSQL_TMP_DIR/mysqld.5980/tab2
--rmdir $MYSQL_TMP_DIR/mysqld.5980/tab3
--rmdir $MYSQL_TMP_DIR/mysqld.5980/tab4
--rmdir $MYSQL_TMP_DIR/mysqld.5980/tab5
--rmdir $MYSQL_TMP_DIR/mysqld.5980/part0
--rmdir $MYSQL_TMP_DIR/mysqld.5980/part1
--rmdir $MYSQL_TMP_DIR/mysqld.5980/part2
--rmdir $MYSQL_TMP_DIR/mysqld.5980/part3