Merge lp:~akopytov/percona-xtrabackup/replication-support-in-test-suite-1.6 into lp:percona-xtrabackup/1.6
- replication-support-in-test-suite-1.6
- Merge into release-1.6
Status: | Merged |
---|---|
Approved by: | Stewart Smith |
Approved revision: | no longer in the source branch. |
Merged at revision: | 343 |
Proposed branch: | lp:~akopytov/percona-xtrabackup/replication-support-in-test-suite-1.6 |
Merge into: | lp:percona-xtrabackup/1.6 |
Diff against target: |
1912 lines (+513/-371) 41 files modified
innobackupex (+9/-23) test/disabled/ib_include.sh (+4/-6) test/experimental/xb_race_drop.sh (+26/-2) test/inc/common.sh (+262/-132) test/run.sh (+32/-39) test/t/bug1002688.sh (+3/-4) test/t/bug514068.sh (+2/-3) test/t/bug722638.sh (+6/-7) test/t/bug723097.sh (+4/-7) test/t/bug729843.sh (+1/-2) test/t/bug733651.sh (+1/-3) test/t/bug759225.sh (+3/-4) test/t/bug759701.sh (+3/-4) test/t/bug766607.sh (+5/-6) test/t/bug810269.sh (+3/-5) test/t/bug817132.sh (+3/-4) test/t/bug884737.sh (+1/-2) test/t/bug891496.sh (+4/-7) test/t/bug977101.sh (+31/-0) test/t/bug983685.sh (+1/-3) test/t/ib_binlog_info.sh (+1/-2) test/t/ib_csm_csv.sh (+3/-4) test/t/ib_empty_dir.sh (+2/-3) test/t/ib_incremental.sh (+3/-4) test/t/ib_rsync.sh (+3/-4) test/t/ib_slave_info.sh (+20/-8) test/t/ib_specialchar.sh (+4/-4) test/t/tar4ibd_o_direct.sh (+4/-4) test/t/tar4ibd_symlink.sh (+19/-17) test/t/xb_basic.sh (+5/-5) test/t/xb_export.sh (+14/-17) test/t/xb_incremental.sh (+4/-4) test/t/xb_incremental_compressed.sh (+4/-6) test/t/xb_parallel.sh (+4/-4) test/t/xb_parallel_incremental.sh (+4/-4) test/t/xb_part_range.sh (+3/-4) test/t/xb_partial.sh (+4/-4) test/t/xb_perm_basic.sh (+1/-2) test/t/xb_perm_stream.sh (+1/-2) test/t/xb_stats.sh (+2/-2) test/t/xb_stream.sh (+4/-4) |
To merge this branch: | bzr merge lp:~akopytov/percona-xtrabackup/replication-support-in-test-suite-1.6 |
Related bugs: | |
Related blueprints: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Stewart Smith (community) | Approve | ||
Review via email: mp+108670@code.launchpad.net |
Commit message
Description of the change
Alexey Kopytov (akopytov) wrote : | # |
Stewart Smith (stewart) wrote : | # |
The method of trying to find a free TCP port is a concern to me... it looks racey - and in a impossible to determine way.
If we must have TCP, we'll have to do a mechanism similar to MTR and ensure we're the only user of it.
Stewart Smith (stewart) wrote : | # |
basically, the racey bit is two test suite runs executing lock step, each will think the same port is free and try to run mysqld on it, causing one of them to fail.
Alexey Kopytov (akopytov) wrote : | # |
Yes, I was looking at MTR when implementing get_free_port(). It uses absolutely the same probing method, so it has the same race. The only difference is that MTR tries to get a unique ID for "build thread" with the file locking primitives, which are unavailable in shell. So the XB test suite uses random numbers instead.
But anyway, MTR also "pings" the port and then tries starting the server on that port. I think he problem is not that serious in reality, with only a few possible concurrent runs, and only a few seconds between checking a port and using it.
Stewart Smith (stewart) wrote : | # |
On Tue, 12 Jun 2012 07:42:22 -0000, Alexey Kopytov <email address hidden> wrote:
> Yes, I was looking at MTR when implementing get_free_port(). It uses absolutely the same probing method, so it has the same race. The only difference is that MTR tries to get a unique ID for "build thread" with the file locking primitives, which are unavailable in shell. So the XB test suite uses random numbers instead.
>
> But anyway, MTR also "pings" the port and then tries starting the
> server on that port. I think he problem is not that serious in
> reality, with only a few possible concurrent runs, and only a few
> seconds between checking a port and using it.
The lock in MTR should prevent the race though, as only one process is
ever going to get the lock.
We could do the next best thing by putting pid in a file, and if pid
exists, it is in use (for if we fail to cleanup file).
thoughts?
--
Stewart Smith
Alexey Kopytov (akopytov) wrote : | # |
Actually, on a closer look, MTR picks unique IDs only for multiple threads within the same MTR run, i.e. for --parallel. It doesn't warrant any uniqueness with multiple concurrent MTR runs. Which means it is absolutely identical to what XB test suite does: just check if a port is open and hope nothing grabs it before we start the server on it.
Alexey Kopytov (akopytov) wrote : | # |
Implemented "port locking" in free port selection code. It's still
racey, but it's the best thing you can do in bash.
Alexey Kopytov (akopytov) wrote : | # |
Stewart Smith (stewart) wrote : | # |
I think this is about as good as we're going to get.
Preview Diff
1 | === modified file 'innobackupex' |
2 | --- innobackupex 2012-05-22 14:52:54 +0000 |
3 | +++ innobackupex 2012-06-12 10:33:17 +0000 |
4 | @@ -1202,28 +1202,21 @@ |
5 | # |
6 | sub write_binlog_info { |
7 | my @lines; |
8 | - my @info_lines = (); |
9 | my $position = ''; |
10 | my $filename = ''; |
11 | |
12 | # get binlog position |
13 | - mysql_send "SHOW MASTER STATUS;"; |
14 | + mysql_send 'SHOW MASTER STATUS\G'; |
15 | |
16 | - # get "show master status" output lines (2) from mysql output |
17 | + # get the name of the last binlog file and position in it |
18 | + # from the SHOW MASTER STATUS output |
19 | file_to_array($mysql_stdout, \@lines); |
20 | - foreach my $line (@lines) { |
21 | - if ($line =~ m/xtrabackup ping/) { |
22 | - # this is a hello message, ignore it |
23 | - } else { |
24 | - # this is output line from "show master status" |
25 | - push(@info_lines, $line); |
26 | - } |
27 | + foreach (@lines) { |
28 | + $filename = $1 if /^\s+File:\s(\S+)\s*$/; |
29 | + $position = $1 if /^\s+Position:\s(\d+)\s*$/; |
30 | } |
31 | |
32 | # write binlog info file |
33 | - if (!defined $info_lines[1]) { |
34 | - $info_lines[1] = ""; |
35 | - } |
36 | if (!$option_remote_host) { |
37 | open(FILE, ">$binlog_info") || |
38 | Die "Failed to open file '$binlog_info': $!"; |
39 | @@ -1231,7 +1224,7 @@ |
40 | open(FILE, "| ssh $option_ssh_opt $option_remote_host 'cat > $binlog_info'") || |
41 | Die "Failed to open file '$option_remote_host:$binlog_info': $!"; |
42 | } |
43 | - print FILE "$info_lines[1]\n"; |
44 | + print FILE "$filename\t$position\t\t\n"; |
45 | close(FILE); |
46 | |
47 | if ($option_stream eq 'tar') { |
48 | @@ -1240,14 +1233,7 @@ |
49 | unlink $binlog_info || Die "Failed to delete '$binlog_info': $!"; |
50 | } |
51 | |
52 | - # get the name of the last binlog file and position in it |
53 | - ($filename, $position) = $info_lines[1] =~ /^\s*([^\s]+)\s+(.*)$/; |
54 | - |
55 | - if (defined $filename && defined $position) { |
56 | - $mysql_binlog_position = "filename '$filename', position $position"; |
57 | - } else { |
58 | - $mysql_binlog_position = "filename '', position "; |
59 | - } |
60 | + $mysql_binlog_position = "filename '$filename', position $position"; |
61 | } |
62 | |
63 | |
64 | @@ -1265,7 +1251,7 @@ |
65 | |
66 | # get slave status. Use single quotes here, otherwise |
67 | # \G is evaluated as a control character. |
68 | - mysql_send 'SHOW SLAVE STATUS\G;'; |
69 | + mysql_send 'SHOW SLAVE STATUS\G'; |
70 | |
71 | # get output of the "show slave status" command from mysql output |
72 | # and extract binlog position of the master server |
73 | |
74 | === modified file 'test/disabled/ib_include.sh' |
75 | --- test/disabled/ib_include.sh 2011-03-16 19:41:17 +0000 |
76 | +++ test/disabled/ib_include.sh 2012-06-12 10:33:17 +0000 |
77 | @@ -1,7 +1,7 @@ |
78 | . inc/common.sh |
79 | |
80 | -init |
81 | -run_mysqld |
82 | +start_server |
83 | + |
84 | run_cmd ${MYSQL} ${MYSQL_ARGS} -e "create database include;" |
85 | run_cmd ${MYSQL} ${MYSQL_ARGS} -e "create table t1 (a int) ENGINE=MyISAM;" include |
86 | run_cmd ${MYSQL} ${MYSQL_ARGS} -e "create table t2 (a int) ENGINE=InnoDB;" include |
87 | @@ -15,7 +15,7 @@ |
88 | vlog "checksum_t2 is $checksum_t2" |
89 | run_cmd ${IB_BIN} --user=root --socket=$mysql_socket --include="^include[.]t" $topdir/backup > $OUTFILE 2>&1 |
90 | backup_dir=`grep "innobackupex: Backup created in directory" $OUTFILE | awk -F\' '{ print $2}'` |
91 | -stop_mysqld |
92 | +stop_server |
93 | # Remove datadir |
94 | rm -r $mysql_datadir |
95 | # Restore data |
96 | @@ -30,7 +30,7 @@ |
97 | echo "# RESTORE #" >> $OUTFILE |
98 | echo "###########" >> $OUTFILE |
99 | run_cmd ${IB_BIN} --copy-back $backup_dir >> $OUTFILE 2>&1 |
100 | -run_mysqld |
101 | +start_server |
102 | checksum_tt1=`${MYSQL} ${MYSQL_ARGS} -Ns -e "checksum table t1" include | awk '{print $2}'` |
103 | checksum_tt2=`${MYSQL} ${MYSQL_ARGS} -Ns -e "checksum table t2" include | awk '{print $2}'` |
104 | vlog "checksum_tt1 is $checksum_tt1" |
105 | @@ -42,5 +42,3 @@ |
106 | vlog "Checksums are not equal" |
107 | exit -1 |
108 | fi |
109 | -stop_mysqld |
110 | -clean |
111 | |
112 | === modified file 'test/experimental/xb_race_drop.sh' |
113 | --- test/experimental/xb_race_drop.sh 2011-06-10 06:11:56 +0000 |
114 | +++ test/experimental/xb_race_drop.sh 2012-06-12 10:33:17 +0000 |
115 | @@ -1,7 +1,31 @@ |
116 | . inc/common.sh |
117 | |
118 | -init |
119 | -run_mysqld --innodb_file_per_table |
120 | +function race_create_drop() |
121 | +{ |
122 | + vlog "Started create/drop table cycle" |
123 | + race_cycle_num=$1 |
124 | + if [ -z $race_cycle_num ] |
125 | + then |
126 | + race_cycle_num=1000 |
127 | + fi |
128 | + run_cmd ${MYSQL} ${MYSQL_ARGS} -e "create database race;" |
129 | + race_cycle_cnt=0; |
130 | + while [ "$race_cycle_num" -gt "$race_cycle_cnt"] |
131 | + do |
132 | + t1=tr$RANDOM |
133 | + t2=tr$RANDOM |
134 | + t3=tr$RANDOM |
135 | + ${MYSQL} ${MYSQL_ARGS} -e "create table $t1 (a int) ENGINE=InnoDB;" race |
136 | + ${MYSQL} ${MYSQL_ARGS} -e "create table $t2 (a int) ENGINE=InnoDB;" race |
137 | + ${MYSQL} ${MYSQL_ARGS} -e "create table $t3 (a int) ENGINE=InnoDB;" race |
138 | + ${MYSQL} ${MYSQL_ARGS} -e "drop table $t1;" race |
139 | + ${MYSQL} ${MYSQL_ARGS} -e "drop table $t2;" race |
140 | + ${MYSQL} ${MYSQL_ARGS} -e "drop table $t3;" race |
141 | + let "race_cycle_cnt=race_cycle_cnt+1" |
142 | + done |
143 | +} |
144 | + |
145 | +start_server --innodb_file_per_table |
146 | |
147 | run_cmd race_create_drop & |
148 | |
149 | |
150 | === modified file 'test/inc/common.sh' |
151 | --- test/inc/common.sh 2011-12-21 16:40:27 +0000 |
152 | +++ test/inc/common.sh 2012-06-12 10:33:17 +0000 |
153 | @@ -17,25 +17,10 @@ |
154 | echo "`date +"%F %T"`: `basename "$0"`: $@" >&2 |
155 | } |
156 | |
157 | -function clean_datadir() |
158 | -{ |
159 | - vlog "Removing MySQL data directory: $mysql_datadir" |
160 | - rm -rf "$mysql_datadir" |
161 | - vlog "Creating MySQL data directory: $mysql_datadir" |
162 | - mkdir -p "$mysql_datadir" |
163 | - init_mysql_dir |
164 | -} |
165 | |
166 | function clean() |
167 | { |
168 | - vlog "Removing temporary $topdir" |
169 | - rm -rf "$topdir" |
170 | -} |
171 | -function clean_on_error() |
172 | -{ |
173 | -vlog "Exit on error" |
174 | -clean |
175 | -exit -1 |
176 | + rm -rf ${TEST_BASEDIR}/var[0-9] |
177 | } |
178 | |
179 | function die() |
180 | @@ -44,86 +29,46 @@ |
181 | exit 1 |
182 | } |
183 | |
184 | -function initdir() |
185 | -{ |
186 | - if test -d "$topdir" |
187 | - then |
188 | - vlog "Directory $topdir exists. Removing it..." |
189 | - rm -r "$topdir" |
190 | - fi |
191 | - vlog "Creating temporary directory: $topdir" |
192 | - mkdir -p "$topdir/tmp" |
193 | - vlog "Creating MySQL data directory: $mysql_datadir" |
194 | - mkdir -p "$mysql_datadir" |
195 | -} |
196 | - |
197 | function init_mysql_dir() |
198 | { |
199 | - vlog "Creating MySQL database" |
200 | - $MYSQL_INSTALL_DB --no-defaults --basedir=$MYSQL_BASEDIR --datadir="$mysql_datadir" --tmpdir="$mysql_tmpdir" |
201 | -} |
202 | -function set_mysl_port() |
203 | -{ |
204 | - i=$mysql_port |
205 | - while [ $i -lt 65536 ] |
206 | - do |
207 | - # check if port $i is used |
208 | - vlog "Checking port $i" |
209 | - port_status=`netstat -an | grep LISTEN | grep tcp | grep ":$i " || true` |
210 | - if test -z "$port_status" |
211 | - then |
212 | - # port is not used |
213 | - vlog "Port $i is free" |
214 | - mysql_port=$i |
215 | - break |
216 | - else |
217 | - vlog "Port $i is used" |
218 | - let i=$i+1 |
219 | - fi |
220 | - done |
221 | + if [ ! -d "$MYSQLD_VARDIR" ] |
222 | + then |
223 | + vlog "Creating server root directory: $MYSQLD_VARDIR" |
224 | + mkdir "$MYSQLD_VARDIR" |
225 | + fi |
226 | + if [ ! -d "$MYSQLD_TMPDIR" ] |
227 | + then |
228 | + vlog "Creating server temporary directory: $MYSQLD_TMPDIR" |
229 | + mkdir "$MYSQLD_TMPDIR" |
230 | + fi |
231 | + if [ ! -d "$MYSQLD_DATADIR" ] |
232 | + then |
233 | + vlog "Creating server data directory: $MYSQLD_DATADIR" |
234 | + mkdir -p "$MYSQLD_DATADIR" |
235 | + vlog "Calling mysql_install_db" |
236 | + $MYSQL_INSTALL_DB --no-defaults --basedir=$MYSQL_BASEDIR --datadir="$MYSQLD_DATADIR" --tmpdir="$MYSQLD_TMPDIR" |
237 | + fi |
238 | } |
239 | |
240 | +######################################################################## |
241 | # Checks whether MySQL is alive |
242 | +######################################################################## |
243 | function mysql_ping() |
244 | { |
245 | - local result="0" |
246 | - if test -S ${mysql_socket} |
247 | - then |
248 | - result=`${MYSQL} ${MYSQL_ARGS} -e "SELECT IF(COUNT(*)>=0, 1, 1) FROM user;" -s --skip-column-names mysql 2>/dev/null` || result="0" |
249 | - else |
250 | - result="0" |
251 | - fi |
252 | - echo $result |
253 | + $MYSQLADMIN $MYSQL_ARGS --wait=100 ping >/dev/null 2>&1 || return 1 |
254 | } |
255 | |
256 | function kill_leftovers() |
257 | { |
258 | - while test -f "$PWD/mysqld.pid" |
259 | - do |
260 | - vlog "Found a leftover mysqld processes with PID `cat $PWD/mysqld.pid`, stopping it" |
261 | - stop_mysqld 2> /dev/null |
262 | - done |
263 | -} |
264 | - |
265 | -function run_mysqld() |
266 | -{ |
267 | - local c=0 |
268 | - kill_leftovers |
269 | - ${MYSQLD} ${MYSQLD_ARGS} $* --pid-file="$PWD/mysqld.pid" & |
270 | - while [ "`mysql_ping`" != "1" ] |
271 | - do |
272 | - if [ ${c} -eq 100 ] |
273 | - then |
274 | - vlog "Can't run MySQL!" |
275 | - clean_on_error |
276 | - fi |
277 | - let c=${c}+1 |
278 | - sleep 1 |
279 | - done |
280 | - if [ -n "$MYSQL_VERSION" -a -n "$INNODB_VERSION" ] |
281 | - then |
282 | - vlog "MySQL $MYSQL_VERSION (InnoDB $INNODB_VERSION) started successfully" |
283 | - fi |
284 | + local file |
285 | + for file in ${TEST_BASEDIR}/mysqld*.pid |
286 | + do |
287 | + if [ -f $file ] |
288 | + then |
289 | + vlog "Found a leftover mysqld processes with PID `cat $file`, stopping it" |
290 | + kill -9 `cat $file` 2>/dev/null || true |
291 | + fi |
292 | + done |
293 | } |
294 | |
295 | function run_cmd() |
296 | @@ -152,21 +97,6 @@ |
297 | fi |
298 | } |
299 | |
300 | -function stop_mysqld() |
301 | -{ |
302 | - if [ -f "$PWD/mysqld.pid" ] |
303 | - then |
304 | - ${MYSQLADMIN} ${MYSQL_ARGS} shutdown |
305 | - vlog "Database server has been stopped" |
306 | - if [ -f "$PWD/mysqld.pid" ] |
307 | - then |
308 | - sleep 1; |
309 | - kill -9 `cat $PWD/mysqld.pid` |
310 | - rm -f $PWD/mysqld.pid |
311 | - fi |
312 | - fi |
313 | -} |
314 | - |
315 | function load_sakila() |
316 | { |
317 | vlog "Loading sakila" |
318 | @@ -196,39 +126,236 @@ |
319 | run_cmd ${MYSQL} ${MYSQL_ARGS} -e "DROP DATABASE $1" |
320 | } |
321 | |
322 | -function init() |
323 | -{ |
324 | -initdir |
325 | -init_mysql_dir |
326 | -echo " |
327 | +######################################################################## |
328 | +# Choose a free port for a MySQL server instance |
329 | +######################################################################## |
330 | +function get_free_port() |
331 | +{ |
332 | + local id=$1 |
333 | + local port |
334 | + local lockfile |
335 | + |
336 | + for (( port=PORT_BASE+id; port < 65535; port++)) |
337 | + do |
338 | + lockfile="/tmp/xtrabackup_port_lock.$port" |
339 | + # Try to atomically lock the current port number |
340 | + if ! set -C > $lockfile |
341 | + then |
342 | + set +C |
343 | + # check if the process still exists |
344 | + if kill -0 "`cat $lockfile`" |
345 | + then |
346 | + continue; |
347 | + fi |
348 | + # stale file, overwrite it with the current PID |
349 | + fi |
350 | + set +C |
351 | + echo $$ > $lockfile |
352 | + if ! nc -z -w1 localhost $port >/dev/null 2>&1 |
353 | + then |
354 | + echo $port |
355 | + return 0 |
356 | + fi |
357 | + rm -f $lockfile |
358 | + done |
359 | + |
360 | + die "Could not find a free port for server id $id!" |
361 | +} |
362 | + |
363 | +######################################################################## |
364 | +# Initialize server variables such as datadir, tmpdir, etc. and store |
365 | +# them with the specified index in SRV_MYSQLD_* arrays to be used by |
366 | +# switch_server() later |
367 | +######################################################################## |
368 | +function init_server_variables() |
369 | +{ |
370 | + local id=$1 |
371 | + |
372 | + if [ -n ${SRV_MYSQLD_IDS[$id]:-""} ] |
373 | + then |
374 | + die "Server with id $id has already been started" |
375 | + fi |
376 | + |
377 | + SRV_MYSQLD_IDS[$id]="$id" |
378 | + local vardir="${TEST_BASEDIR}/var${id}" |
379 | + SRV_MYSQLD_VARDIR[$id]="$vardir" |
380 | + SRV_MYSQLD_DATADIR[$id]="$vardir/data" |
381 | + SRV_MYSQLD_TMPDIR[$id]="$vardir/tmp" |
382 | + SRV_MYSQLD_PIDFILE[$id]="${TEST_BASEDIR}/mysqld${id}.pid" |
383 | + SRV_MYSQLD_PORT[$id]=`get_free_port $id` |
384 | + SRV_MYSQLD_SOCKET[$id]=`mktemp -t xtrabackup.mysql.sock.XXXXXX` |
385 | +} |
386 | + |
387 | +######################################################################## |
388 | +# Reset server variables |
389 | +######################################################################## |
390 | +function reset_server_variables() |
391 | +{ |
392 | + local id=$1 |
393 | + |
394 | + if [ -z ${SRV_MYSQLD_VARDIR[$id]:-""} ] |
395 | + then |
396 | + # Variables have already been reset |
397 | + return 0; |
398 | + fi |
399 | + |
400 | + SRV_MYSQLD_IDS[$id]= |
401 | + SRV_MYSQLD_VARDIR[$id]= |
402 | + SRV_MYSQLD_DATADIR[$id]= |
403 | + SRV_MYSQLD_TMPDIR[$id]= |
404 | + SRV_MYSQLD_PIDFILE[$id]= |
405 | + SRV_MYSQLD_PORT[$id]= |
406 | + SRV_MYSQLD_SOCKET[$id]= |
407 | +} |
408 | + |
409 | +########################################################################## |
410 | +# Change the environment to make all utilities access the server with an |
411 | +# id specified in the argument. |
412 | +########################################################################## |
413 | +function switch_server() |
414 | +{ |
415 | + local id=$1 |
416 | + |
417 | + MYSQLD_VARDIR="${SRV_MYSQLD_VARDIR[$id]}" |
418 | + MYSQLD_DATADIR="${SRV_MYSQLD_DATADIR[$id]}" |
419 | + MYSQLD_TMPDIR="${SRV_MYSQLD_TMPDIR[$id]}" |
420 | + MYSQLD_PIDFILE="${SRV_MYSQLD_PIDFILE[$id]}" |
421 | + MYSQLD_PORT="${SRV_MYSQLD_PORT[$id]}" |
422 | + MYSQLD_SOCKET="${SRV_MYSQLD_SOCKET[$id]}" |
423 | + |
424 | + MYSQL_ARGS="--no-defaults --socket=${MYSQLD_SOCKET} --user=root" |
425 | + MYSQLD_ARGS="--no-defaults --basedir=${MYSQL_BASEDIR} \ |
426 | +--socket=${MYSQLD_SOCKET} --port=${MYSQLD_PORT} --server-id=$id \ |
427 | +--datadir=${MYSQLD_DATADIR} --tmpdir=${MYSQLD_TMPDIR} --log-bin=mysql-bin \ |
428 | +--relay-log=mysql-relay-bin --pid-file=${MYSQLD_PIDFILE} ${MYSQLD_EXTRA_ARGS}" |
429 | + if [ "`whoami`" = "root" ] |
430 | + then |
431 | + MYSQLD_ARGS="$MYSQLD_ARGS --user=root" |
432 | + fi |
433 | + |
434 | + IB_ARGS="--defaults-file=${MYSQLD_VARDIR}/my.cnf --user=root \ |
435 | +--socket=${MYSQLD_SOCKET} --ibbackup=$XB_BIN" |
436 | + XB_ARGS="--no-defaults" |
437 | + |
438 | + # Some aliases for compatibility, as tests use the following names |
439 | + topdir="$MYSQLD_VARDIR" |
440 | + mysql_datadir="$MYSQLD_DATADIR" |
441 | + mysql_tmpdir="$MYSQLD_TMPDIR" |
442 | + mysql_socket="$MYSQLD_SOCKET" |
443 | +} |
444 | + |
445 | +######################################################################## |
446 | +# Start server with the id specified as the first argument |
447 | +######################################################################## |
448 | +function start_server_with_id() |
449 | +{ |
450 | + local id=$1 |
451 | + shift |
452 | + |
453 | + vlog "Starting server with id=$id..." |
454 | + |
455 | + init_server_variables $id |
456 | + switch_server $id |
457 | + |
458 | + init_mysql_dir |
459 | + cat > ${MYSQLD_VARDIR}/my.cnf <<EOF |
460 | [mysqld] |
461 | -datadir=$mysql_datadir |
462 | -tmpdir=$mysql_tmpdir" > $topdir/my.cnf |
463 | -} |
464 | - |
465 | -function race_create_drop() |
466 | -{ |
467 | - vlog "Started create/drop table cycle" |
468 | - race_cycle_num=$1 |
469 | - if [ -z $race_cycle_num ] |
470 | - then |
471 | - race_cycle_num=1000 |
472 | - fi |
473 | - run_cmd ${MYSQL} ${MYSQL_ARGS} -e "create database race;" |
474 | - race_cycle_cnt=0; |
475 | - while [ "$race_cycle_num" -gt "$race_cycle_cnt"] |
476 | - do |
477 | - t1=tr$RANDOM |
478 | - t2=tr$RANDOM |
479 | - t3=tr$RANDOM |
480 | - ${MYSQL} ${MYSQL_ARGS} -e "create table $t1 (a int) ENGINE=InnoDB;" race |
481 | - ${MYSQL} ${MYSQL_ARGS} -e "create table $t2 (a int) ENGINE=InnoDB;" race |
482 | - ${MYSQL} ${MYSQL_ARGS} -e "create table $t3 (a int) ENGINE=InnoDB;" race |
483 | - ${MYSQL} ${MYSQL_ARGS} -e "drop table $t1;" race |
484 | - ${MYSQL} ${MYSQL_ARGS} -e "drop table $t2;" race |
485 | - ${MYSQL} ${MYSQL_ARGS} -e "drop table $t3;" race |
486 | - let "race_cycle_cnt=race_cycle_cnt+1" |
487 | - done |
488 | +datadir=${MYSQLD_DATADIR} |
489 | +tmpdir=${MYSQLD_TMPDIR} |
490 | +EOF |
491 | + |
492 | + # Start the server |
493 | + ${MYSQLD} ${MYSQLD_ARGS} $* & |
494 | + if ! mysql_ping |
495 | + then |
496 | + die "Can't start the server!" |
497 | + fi |
498 | + vlog "Server with id=$id has been started on port $MYSQLD_PORT, \ |
499 | +socket $MYSQLD_SOCKET" |
500 | +} |
501 | + |
502 | +######################################################################## |
503 | +# Stop server with the id specified as the first argument and additional |
504 | +# command line arguments (if specified) |
505 | +######################################################################## |
506 | +function stop_server_with_id() |
507 | +{ |
508 | + local id=$1 |
509 | + switch_server $id |
510 | + |
511 | + vlog "Stopping server with id=$id..." |
512 | + |
513 | + if [ -f "${MYSQLD_PIDFILE}" ] |
514 | + then |
515 | + ${MYSQLADMIN} ${MYSQL_ARGS} --shutdown-timeout=60 shutdown |
516 | + if [ -f "${MYSQLD_PIDFILE}" ] |
517 | + then |
518 | + vlog "Could not stop the server with id=$id, using kill -9" |
519 | + kill -9 `cat ${MYSQLD_PIDFILE}` |
520 | + rm -f ${MYSQLD_PIDFILE} |
521 | + fi |
522 | + vlog "Server with id=$id has been stopped" |
523 | + else |
524 | + vlog "Server pid file '${MYSQLD_PIDFILE}' doesn't exist!" |
525 | + fi |
526 | + |
527 | + # unlock the port number |
528 | + rm -f /tmp/xtrabackup_port_lock.$MYSQLD_PORT |
529 | + |
530 | + reset_server_variables $id |
531 | +} |
532 | + |
533 | +######################################################################## |
534 | +# Start server with id=1 and additional command line arguments |
535 | +# (if specified) |
536 | +######################################################################## |
537 | +function start_server() |
538 | +{ |
539 | + start_server_with_id 1 $* |
540 | +} |
541 | + |
542 | +######################################################################## |
543 | +# Stop server with id=1 |
544 | +######################################################################## |
545 | +function stop_server() |
546 | +{ |
547 | + stop_server_with_id 1 |
548 | +} |
549 | + |
550 | +######################################################################## |
551 | +# Stop all running servers |
552 | +######################################################################## |
553 | +function stop_all_servers() |
554 | +{ |
555 | + local id |
556 | + for id in ${SRV_MYSQLD_IDS[*]} |
557 | + do |
558 | + stop_server_with_id ${SRV_MYSQLD_IDS[$id]} |
559 | + done |
560 | +} |
561 | + |
562 | +######################################################################## |
563 | +# Configure a specified server as a slave |
564 | +# Synopsis: |
565 | +# setup_slave <slave_id> <master_id> |
566 | +######################################################################### |
567 | +function setup_slave() |
568 | +{ |
569 | + local slave_id=$1 |
570 | + local master_id=$2 |
571 | + |
572 | + vlog "Setting up server #$slave_id as a slave of server #$master_id" |
573 | + |
574 | + switch_server $slave_id |
575 | + |
576 | + run_cmd $MYSQL $MYSQL_ARGS <<EOF |
577 | +CHANGE MASTER TO |
578 | + MASTER_HOST='localhost', |
579 | + MASTER_USER='root', |
580 | + MASTER_PORT=${SRV_MYSQLD_PORT[$master_id]}; |
581 | + |
582 | +START SLAVE |
583 | +EOF |
584 | } |
585 | |
586 | ######################################################################## |
587 | @@ -239,3 +366,6 @@ |
588 | { |
589 | $MYSQL $MYSQL_ARGS -Ns -e "CHECKSUM TABLE $2" $1 | awk {'print $2'} |
590 | } |
591 | + |
592 | +# To avoid unbound variable error when no server have been started |
593 | +SRV_MYSQLD_IDS= |
594 | |
595 | === modified file 'test/run.sh' |
596 | --- test/run.sh 2011-07-05 03:02:01 +0000 |
597 | +++ test/run.sh 2012-06-12 10:33:17 +0000 |
598 | @@ -1,5 +1,7 @@ |
599 | #!/bin/bash |
600 | |
601 | +export DEBUG= |
602 | + |
603 | . inc/common.sh |
604 | |
605 | set +e |
606 | @@ -14,7 +16,7 @@ |
607 | Usage: $0 [-f] [-g] [-h] [-s suite] [-t test_name] [-d mysql_basedir] [-c build_conf] |
608 | -f Continue running tests after failures |
609 | -d path Server installation directory. Default is './server'. |
610 | --g Output debug information to results/*.out |
611 | +-g Debug mode |
612 | -t path Run only a single named test |
613 | -h Print this help message |
614 | -s suite Select a test suite to run. Possible values: experimental, t. |
615 | @@ -52,13 +54,9 @@ |
616 | |
617 | function set_vars() |
618 | { |
619 | - topdir="`pwd`/var" |
620 | - mysql_datadir="$topdir/mysql" |
621 | - mysql_tmpdir="$topdir/tmp" |
622 | - mysql_port="3306" |
623 | - mysql_socket=`mktemp -t xtrabackup.mysql.sock.XXXXXX` |
624 | - IB_ARGS="--defaults-file=$topdir/my.cnf --user=root --socket=$mysql_socket" |
625 | - XB_ARGS="--no-defaults" |
626 | + TEST_BASEDIR="$PWD" |
627 | + MYSQL_BASEDIR=${MYSQL_BASEDIR:-"$PWD/server"} |
628 | + PORT_BASE=$((3306 + $RANDOM)) |
629 | |
630 | if gnutar --version > /dev/null 2>&1 |
631 | then |
632 | @@ -67,16 +65,6 @@ |
633 | TAR=tar |
634 | fi |
635 | |
636 | - MYSQL_BASEDIR=${MYSQL_BASEDIR:-"$PWD/server"} |
637 | - |
638 | - MYSQL_ARGS="--no-defaults --socket=${mysql_socket} --user=root" |
639 | - |
640 | - MYSQLD_ARGS="--no-defaults --basedir=${MYSQL_BASEDIR} --socket=${mysql_socket} --datadir=$mysql_datadir --tmpdir=$mysql_tmpdir --skip-networking" |
641 | - if [ "`whoami`" = "root" ] |
642 | - then |
643 | - MYSQLD_ARGS="$MYSQLD_ARGS --user=root" |
644 | - fi |
645 | - |
646 | find_program MYSQL_INSTALL_DB mysql_install_db $MYSQL_BASEDIR/bin \ |
647 | $MYSQL_BASEDIR/scripts |
648 | find_program MYSQLD mysqld $MYSQL_BASEDIR/bin/ $MYSQL_BASEDIR/libexec |
649 | @@ -92,22 +80,26 @@ |
650 | |
651 | PATH="${MYSQL_BASEDIR}/bin:$PATH" |
652 | |
653 | - export topdir mysql_datadir mysql_tmpdir mysql_port mysql_socket OUTFILE \ |
654 | - IB_ARGS XB_ARGS TAR MYSQL_BASEDIR MYSQL MYSQLADMIN \ |
655 | - MYSQL_ARGS MYSQLD_ARGS MYSQL_INSTALL_DB MYSQLD PATH |
656 | + export TEST_BASEDIR PORT_BASE TAR MYSQL_BASEDIR MYSQL MYSQLD MYSQLADMIN \ |
657 | +MYSQL_INSTALL_DB PATH |
658 | } |
659 | |
660 | function get_version_info() |
661 | { |
662 | + MYSQLD_EXTRA_ARGS= |
663 | + |
664 | + XB_BIN="" |
665 | + IB_ARGS="--user=root --ibbackup=$XB_BIN" |
666 | + XB_ARGS="--no-defaults" |
667 | + |
668 | if [ "$XB_BUILD" != "autodetect" ] |
669 | then |
670 | - XB_BIN="" |
671 | case "$XB_BUILD" in |
672 | "innodb51_builtin" ) |
673 | XB_BIN="xtrabackup_51";; |
674 | "innodb51" ) |
675 | XB_BIN="xtrabackup_plugin" |
676 | - MYSQLD_ARGS="$MYSQLD_ARGS --ignore-builtin-innodb --plugin-load=innodb=ha_innodb_plugin.so";; |
677 | + MYSQLD_EXTRA_ARGS="--ignore-builtin-innodb --plugin-load=innodb=ha_innodb_plugin.so";; |
678 | "innodb55" ) |
679 | XB_BIN="xtrabackup_innodb55";; |
680 | "xtradb51" ) |
681 | @@ -122,11 +114,11 @@ |
682 | fi |
683 | fi |
684 | |
685 | - init |
686 | - |
687 | MYSQL_VERSION="" |
688 | INNODB_VERSION="" |
689 | - run_mysqld |
690 | + |
691 | + start_server |
692 | + |
693 | # Get MySQL and InnoDB versions |
694 | MYSQL_VERSION=`$MYSQL ${MYSQL_ARGS} -Nsf -e "SHOW VARIABLES LIKE 'version'"` |
695 | MYSQL_VERSION=${MYSQL_VERSION#"version "} |
696 | @@ -176,17 +168,17 @@ |
697 | vlog "Cannot find 'innobackupex' in PATH" |
698 | return 1 |
699 | fi |
700 | - IB_ARGS="$IB_ARGS --ibbackup=$XB_BIN" |
701 | |
702 | vlog "Using '$XB_BIN' as xtrabackup binary" |
703 | |
704 | + stop_server |
705 | + |
706 | export MYSQL_VERSION MYSQL_VERSION_COMMENT INNODB_VERSION XTRADB_VERSION \ |
707 | - XB_BIN IB_BIN IB_ARGS |
708 | + XB_BIN IB_BIN IB_ARGS XB_ARGS MYSQLD_EXTRA_ARGS |
709 | } |
710 | |
711 | export SKIPPED_EXIT_CODE=200 |
712 | |
713 | - |
714 | tname="" |
715 | XTRACE_OPTION="" |
716 | XB_BUILD="autodetect" |
717 | @@ -195,7 +187,7 @@ |
718 | case $options in |
719 | f ) force="yes";; |
720 | t ) tname="$OPTARG";; |
721 | - g ) XTRACE_OPTION="-x";; |
722 | + g ) XTRACE_OPTION="-x"; DEBUG=on;; |
723 | h ) usage; exit;; |
724 | s ) tname="$OPTARG/*.sh";; |
725 | d ) export MYSQL_BASEDIR="$OPTARG";; |
726 | @@ -219,6 +211,9 @@ |
727 | total_count=0 |
728 | |
729 | export OUTFILE="$PWD/results/setup" |
730 | + |
731 | +clean >>$OUTFILE 2>&1 |
732 | + |
733 | if ! get_version_info |
734 | then |
735 | echo "get_version_info failed. See $OUTFILE for details." |
736 | @@ -253,6 +248,12 @@ |
737 | bash $XTRACE_OPTION $t > $OUTFILE 2>&1 |
738 | rc=$? |
739 | |
740 | + if [[ -z "$DEBUG" || -n "$force" ]] |
741 | + then |
742 | + kill_leftovers >>$OUTFILE 2>&1 |
743 | + clean >>$OUTFILE 2>&1 |
744 | + fi |
745 | + |
746 | if [ $rc -eq 0 ] |
747 | then |
748 | echo "[passed]" |
749 | @@ -279,17 +280,9 @@ |
750 | then |
751 | break; |
752 | fi |
753 | - fi |
754 | - |
755 | - stop_mysqld >/dev/null 2>&1 |
756 | - clean >/dev/null 2>&1 |
757 | + fi |
758 | done |
759 | |
760 | -if [ -z "$force" -o $failed_count -eq 0 ] |
761 | -then |
762 | - kill_leftovers |
763 | -fi |
764 | - |
765 | if [ $result -eq 1 ] |
766 | then |
767 | echo |
768 | |
769 | === modified file 'test/t/bug1002688.sh' |
770 | --- test/t/bug1002688.sh 2012-05-22 14:52:54 +0000 |
771 | +++ test/t/bug1002688.sh 2012-06-12 10:33:17 +0000 |
772 | @@ -3,8 +3,7 @@ |
773 | ############################################################################ |
774 | . inc/common.sh |
775 | |
776 | -init |
777 | -run_mysqld --innodb_file_per_table |
778 | +start_server --innodb_file_per_table |
779 | load_sakila |
780 | |
781 | # Full backup |
782 | @@ -44,7 +43,7 @@ |
783 | vlog "Data prepared for restore" |
784 | |
785 | # Destroying mysql data |
786 | -stop_mysqld |
787 | +stop_server |
788 | rm -rf $mysql_datadir/* |
789 | vlog "Data destroyed" |
790 | |
791 | @@ -53,7 +52,7 @@ |
792 | innobackupex --copy-back $full_backup_dir |
793 | vlog "Data restored" |
794 | |
795 | -run_mysqld --innodb_file_per_table |
796 | +start_server --innodb_file_per_table |
797 | |
798 | vlog "Checking checksums" |
799 | checksum_b=`checksum_table newdb actor_copy` |
800 | |
801 | === modified file 'test/t/bug514068.sh' |
802 | --- test/t/bug514068.sh 2011-12-05 12:35:43 +0000 |
803 | +++ test/t/bug514068.sh 2012-06-12 10:33:17 +0000 |
804 | @@ -5,12 +5,11 @@ |
805 | |
806 | . inc/common.sh |
807 | |
808 | -init |
809 | -run_mysqld |
810 | +start_server |
811 | |
812 | innobackupex --no-timestamp $topdir/backup >$topdir/stdout 2>$topdir/stderr |
813 | |
814 | -stop_mysqld |
815 | +stop_server |
816 | # Remove datadir |
817 | rm -r $mysql_datadir |
818 | |
819 | |
820 | === modified file 'test/t/bug722638.sh' |
821 | --- test/t/bug722638.sh 2011-09-14 15:32:21 +0000 |
822 | +++ test/t/bug722638.sh 2012-06-12 10:33:17 +0000 |
823 | @@ -3,15 +3,14 @@ |
824 | # created breaks backup |
825 | ######################################################################## |
826 | |
827 | -if ! `$XB_BIN --help | grep debug-sync > /dev/null`; then |
828 | +. inc/common.sh |
829 | + |
830 | +if ! $XB_BIN --help 2>&1 | grep -q debug-sync; then |
831 | echo "Requires --debug-sync support" > $SKIPPED_REASON |
832 | exit $SKIPPED_EXIT_CODE |
833 | fi |
834 | |
835 | -. inc/common.sh |
836 | - |
837 | -init |
838 | -run_mysqld --innodb_file_per_table |
839 | +start_server --innodb_file_per_table |
840 | |
841 | run_cmd $MYSQL $MYSQL_ARGS test <<EOF |
842 | |
843 | @@ -88,14 +87,14 @@ |
844 | # Prepare |
845 | xtrabackup --datadir=$mysql_datadir --prepare --target-dir=$topdir/backup |
846 | |
847 | -stop_mysqld |
848 | +stop_server |
849 | |
850 | # Restore |
851 | rm -rf $mysql_datadir/ibdata1 $mysql_datadir/ib_logfile* \ |
852 | $mysql_datadir/test/*.ibd |
853 | cp -r $topdir/backup/* $mysql_datadir |
854 | |
855 | -run_mysqld --innodb_file_per_table |
856 | +start_server --innodb_file_per_table |
857 | |
858 | # Verify checksums |
859 | checksum_t1_new=`checksum_table test t1` |
860 | |
861 | === modified file 'test/t/bug723097.sh' |
862 | --- test/t/bug723097.sh 2011-12-21 16:40:27 +0000 |
863 | +++ test/t/bug723097.sh 2012-06-12 10:33:17 +0000 |
864 | @@ -1,7 +1,6 @@ |
865 | . inc/common.sh |
866 | |
867 | -init |
868 | -run_mysqld --innodb_file_per_table |
869 | +start_server --innodb_file_per_table |
870 | |
871 | vlog "Loading data from sql file" |
872 | run_cmd ${MYSQL} ${MYSQL_ARGS} test < t/bug723097.sql |
873 | @@ -17,15 +16,15 @@ |
874 | vlog "Backup is done" |
875 | xtrabackup --datadir=$mysql_datadir --prepare --target-dir=$topdir/data/full |
876 | vlog "Data prepared fo restore" |
877 | -stop_mysqld |
878 | +stop_server |
879 | |
880 | cd $topdir/data/full |
881 | cp -r * $mysql_datadir |
882 | cd - |
883 | -run_mysqld --innodb_file_per_table |
884 | +start_server --innodb_file_per_table |
885 | checksum_b=`checksum_table test messages` |
886 | vlog "Checksum after is $checksum_b" |
887 | -stop_mysqld |
888 | +stop_server |
889 | |
890 | if [ "$checksum_a" -eq "$checksum_b" ] |
891 | then |
892 | @@ -34,5 +33,3 @@ |
893 | vlog "Checksums are not equal" |
894 | exit -1 |
895 | fi |
896 | - |
897 | -clean |
898 | |
899 | === modified file 'test/t/bug729843.sh' |
900 | --- test/t/bug729843.sh 2011-11-25 18:50:56 +0000 |
901 | +++ test/t/bug729843.sh 2012-06-12 10:33:17 +0000 |
902 | @@ -4,8 +4,7 @@ |
903 | |
904 | . inc/common.sh |
905 | |
906 | -init |
907 | -run_mysqld |
908 | +start_server |
909 | |
910 | mkdir $topdir/backup |
911 | logfile=$topdir/backup/innobackupex_log |
912 | |
913 | === modified file 'test/t/bug733651.sh' |
914 | --- test/t/bug733651.sh 2012-01-31 11:15:25 +0000 |
915 | +++ test/t/bug733651.sh 2012-06-12 10:33:17 +0000 |
916 | @@ -5,14 +5,12 @@ |
917 | |
918 | . inc/common.sh |
919 | |
920 | -init |
921 | - |
922 | options="innodb_log_files_in_group innodb_log_file_size" |
923 | if [ ! -z "$XTRADB_VERSION" ]; then |
924 | options="$options innodb_page_size innodb_fast_checksum innodb_log_block_size" |
925 | fi |
926 | |
927 | -run_mysqld |
928 | +start_server |
929 | |
930 | mkdir -p $topdir/backup |
931 | innobackupex $topdir/backup |
932 | |
933 | === modified file 'test/t/bug759225.sh' |
934 | --- test/t/bug759225.sh 2011-09-21 09:00:00 +0000 |
935 | +++ test/t/bug759225.sh 2012-06-12 10:33:17 +0000 |
936 | @@ -16,15 +16,14 @@ |
937 | exit $SKIPPED_EXIT_CODE |
938 | fi |
939 | |
940 | -init |
941 | -run_mysqld |
942 | +start_server |
943 | load_sakila |
944 | |
945 | # Take backup |
946 | echo "innodb_flush_method=ALL_O_DIRECT" >> $topdir/my.cnf |
947 | mkdir -p $topdir/backup |
948 | innobackupex --stream=tar $topdir/backup > $topdir/backup/out.tar |
949 | -stop_mysqld |
950 | +stop_server |
951 | |
952 | # See if tar4ibd was using O_DIRECT |
953 | if ! grep "tar4ibd: using O_DIRECT for the input file" $OUTFILE ; |
954 | @@ -46,6 +45,6 @@ |
955 | mkdir -p $mysql_datadir |
956 | innobackupex --copy-back --defaults-file=$topdir/my.cnf $backup_dir |
957 | |
958 | -run_mysqld |
959 | +start_server |
960 | # Check sakila |
961 | ${MYSQL} ${MYSQL_ARGS} -e "SELECT count(*) from actor" sakila |
962 | |
963 | === modified file 'test/t/bug759701.sh' |
964 | --- test/t/bug759701.sh 2011-12-21 16:40:27 +0000 |
965 | +++ test/t/bug759701.sh 2012-06-12 10:33:17 +0000 |
966 | @@ -4,8 +4,7 @@ |
967 | ########################################################################## |
968 | . inc/common.sh |
969 | |
970 | -init |
971 | -run_mysqld --innodb_file_per_table |
972 | +start_server --innodb_file_per_table |
973 | load_sakila |
974 | |
975 | # Full backup |
976 | @@ -45,7 +44,7 @@ |
977 | vlog "Data prepared for restore" |
978 | |
979 | # Destroying mysql data |
980 | -stop_mysqld |
981 | +stop_server |
982 | rm -rf $mysql_datadir/* |
983 | vlog "Data destroyed" |
984 | |
985 | @@ -54,7 +53,7 @@ |
986 | innobackupex --copy-back $full_backup_dir |
987 | vlog "Data restored" |
988 | |
989 | -run_mysqld --innodb_file_per_table |
990 | +start_server --innodb_file_per_table |
991 | |
992 | vlog "Checking checksums" |
993 | checksum_b=`checksum_table newdb actor_copy` |
994 | |
995 | === modified file 'test/t/bug766607.sh' |
996 | --- test/t/bug766607.sh 2011-07-05 03:02:01 +0000 |
997 | +++ test/t/bug766607.sh 2012-06-12 10:33:17 +0000 |
998 | @@ -1,7 +1,6 @@ |
999 | . inc/common.sh |
1000 | |
1001 | -init |
1002 | -run_mysqld --innodb_file_per_table |
1003 | +start_server --innodb_file_per_table |
1004 | load_dbase_schema incremental_sample |
1005 | |
1006 | # Full backup dir |
1007 | @@ -18,8 +17,8 @@ |
1008 | FLUSH LOGS; |
1009 | EOF |
1010 | |
1011 | -stop_mysqld |
1012 | -run_mysqld --innodb_file_per_table |
1013 | +stop_server |
1014 | +start_server --innodb_file_per_table |
1015 | |
1016 | vlog "Making incremental backup" |
1017 | xtrabackup --datadir=$mysql_datadir --backup --target-dir=$topdir/data/delta --incremental-basedir=$topdir/data/full |
1018 | @@ -37,7 +36,7 @@ |
1019 | xtrabackup --datadir=$mysql_datadir --prepare --target-dir=$topdir/data/full |
1020 | vlog "Data prepared for restore" |
1021 | |
1022 | -stop_mysqld |
1023 | +stop_server |
1024 | |
1025 | vlog "Copying files" |
1026 | |
1027 | @@ -46,6 +45,6 @@ |
1028 | cd $topdir |
1029 | |
1030 | vlog "Data restored" |
1031 | -run_mysqld --innodb_file_per_table |
1032 | +start_server --innodb_file_per_table |
1033 | |
1034 | run_cmd $MYSQL $MYSQL_ARGS -e "SELECT * FROM t" test |
1035 | |
1036 | === modified file 'test/t/bug810269.sh' |
1037 | --- test/t/bug810269.sh 2011-09-14 12:48:27 +0000 |
1038 | +++ test/t/bug810269.sh 2012-06-12 10:33:17 +0000 |
1039 | @@ -5,14 +5,12 @@ |
1040 | |
1041 | . inc/common.sh |
1042 | |
1043 | -init |
1044 | - |
1045 | if [ -z "$INNODB_VERSION" ]; then |
1046 | echo "Requires InnoDB plugin or XtraDB" >$SKIPPED_REASON |
1047 | exit $SKIPPED_EXIT_CODE |
1048 | fi |
1049 | |
1050 | -run_mysqld "--innodb_strict_mode --innodb_file_per_table \ |
1051 | +start_server "--innodb_strict_mode --innodb_file_per_table \ |
1052 | --innodb_file_format=Barracuda" |
1053 | |
1054 | load_dbase_schema incremental_sample |
1055 | @@ -54,7 +52,7 @@ |
1056 | |
1057 | innobackupex --stream=tar $topdir/backup > $topdir/backup/out.tar |
1058 | |
1059 | -stop_mysqld |
1060 | +stop_server |
1061 | rm -rf $mysql_datadir |
1062 | |
1063 | vlog "Applying log" |
1064 | @@ -68,7 +66,7 @@ |
1065 | mkdir -p $mysql_datadir |
1066 | innobackupex --copy-back $topdir/backup |
1067 | |
1068 | -run_mysqld |
1069 | +start_server |
1070 | |
1071 | checksum_b=`checksum_table incremental_sample test` |
1072 | |
1073 | |
1074 | === modified file 'test/t/bug817132.sh' |
1075 | --- test/t/bug817132.sh 2011-12-07 13:28:47 +0000 |
1076 | +++ test/t/bug817132.sh 2012-06-12 10:33:17 +0000 |
1077 | @@ -12,8 +12,7 @@ |
1078 | exit $SKIPPED_EXIT_CODE |
1079 | fi |
1080 | |
1081 | -init |
1082 | -run_mysqld |
1083 | +start_server |
1084 | load_dbase_schema sakila |
1085 | load_dbase_data sakila |
1086 | |
1087 | @@ -22,7 +21,7 @@ |
1088 | backup_dir=`grep "innobackupex: Backup created in directory" $OUTFILE | awk -F\' '{ print $2}'` |
1089 | vlog "Backup created in directory $backup_dir" |
1090 | |
1091 | -stop_mysqld |
1092 | +stop_server |
1093 | # Remove datadir |
1094 | rm -r $mysql_datadir |
1095 | |
1096 | @@ -37,6 +36,6 @@ |
1097 | # --ibbackup explicitly (see $IB_ARGS). |
1098 | run_cmd $IB_BIN --defaults-file=$topdir/my.cnf --user=root --socket=$mysql_socket --copy-back $backup_dir |
1099 | |
1100 | -run_mysqld |
1101 | +start_server |
1102 | # Check sakila |
1103 | run_cmd ${MYSQL} ${MYSQL_ARGS} -e "SELECT count(*) from actor" sakila |
1104 | |
1105 | === modified file 'test/t/bug884737.sh' |
1106 | --- test/t/bug884737.sh 2011-11-01 16:17:02 +0000 |
1107 | +++ test/t/bug884737.sh 2012-06-12 10:33:17 +0000 |
1108 | @@ -5,8 +5,7 @@ |
1109 | |
1110 | . inc/common.sh |
1111 | |
1112 | -init |
1113 | -run_mysqld |
1114 | +start_server |
1115 | |
1116 | # Check that --parallel=<negative value> doesn't blow up |
1117 | vlog "Creating the backup directory: $topdir/backup" |
1118 | |
1119 | === modified file 'test/t/bug891496.sh' |
1120 | --- test/t/bug891496.sh 2012-01-16 11:49:20 +0000 |
1121 | +++ test/t/bug891496.sh 2012-06-12 10:33:17 +0000 |
1122 | @@ -4,17 +4,14 @@ |
1123 | |
1124 | . inc/common.sh |
1125 | |
1126 | -init |
1127 | - |
1128 | innodb_data_file_path="ibdata1:3M;ibdata2:10M:autoextend" |
1129 | |
1130 | +start_server --innodb_data_file_path=$innodb_data_file_path |
1131 | + |
1132 | cat >> $topdir/my.cnf <<EOF |
1133 | innodb_data_file_path=$innodb_data_file_path |
1134 | EOF |
1135 | |
1136 | -MYSQLD_ARGS="$MYSQLD_ARGS --innodb_data_file_path=$innodb_data_file_path" |
1137 | - |
1138 | -run_mysqld |
1139 | load_dbase_schema sakila |
1140 | load_dbase_data sakila |
1141 | |
1142 | @@ -22,7 +19,7 @@ |
1143 | mkdir -p $topdir/backup |
1144 | innobackupex --stream=tar $topdir/backup > $topdir/backup/out.tar |
1145 | |
1146 | -stop_mysqld |
1147 | +stop_server |
1148 | # Remove datadir |
1149 | rm -r $mysql_datadir |
1150 | # Restore sakila |
1151 | @@ -42,6 +39,6 @@ |
1152 | vlog "###########" |
1153 | innobackupex --copy-back $backup_dir |
1154 | |
1155 | -run_mysqld |
1156 | +start_server --innodb_data_file_path=$innodb_data_file_path |
1157 | # Check sakila |
1158 | run_cmd ${MYSQL} ${MYSQL_ARGS} -e "SELECT count(*) from actor" sakila |
1159 | |
1160 | === added file 'test/t/bug977101.sh' |
1161 | --- test/t/bug977101.sh 1970-01-01 00:00:00 +0000 |
1162 | +++ test/t/bug977101.sh 2012-06-12 10:33:17 +0000 |
1163 | @@ -0,0 +1,31 @@ |
1164 | +######################################################################## |
1165 | +# Bug #977101: --safe-slave-backup results in incorrect binlog info |
1166 | +######################################################################## |
1167 | + |
1168 | +. inc/common.sh |
1169 | + |
1170 | +master_id=1 |
1171 | +slave_id=2 |
1172 | + |
1173 | +start_server_with_id $master_id |
1174 | +start_server_with_id $slave_id |
1175 | + |
1176 | +setup_slave $slave_id $master_id |
1177 | + |
1178 | +# Full backup of the slave server |
1179 | +switch_server $slave_id |
1180 | + |
1181 | +# Check that binlog info is correct with --safe-slave-backup |
1182 | +innobackupex --no-timestamp --safe-slave-backup $topdir/backup |
1183 | +egrep -q '^mysql-bin.000001[[:space:]]+[0-9]+[[:space:]]+$' \ |
1184 | + $topdir/backup/xtrabackup_binlog_info |
1185 | + |
1186 | +# Check that both binlog info and slave info are correct with |
1187 | +# --safe-slave-backup |
1188 | +rm -rf $topdir/backup |
1189 | +innobackupex --no-timestamp --slave-info --safe-slave-backup $topdir/backup |
1190 | +egrep -q '^mysql-bin.000001[[:space:]]+[0-9]+[[:space:]]+$' \ |
1191 | + $topdir/backup/xtrabackup_binlog_info |
1192 | +egrep -q '^CHANGE MASTER TO MASTER_LOG_FILE='\''mysql-bin.000001'\'', MASTER_LOG_POS=[0-9]+$' \ |
1193 | + $topdir/backup/xtrabackup_slave_info |
1194 | + |
1195 | |
1196 | === modified file 'test/t/bug983685.sh' |
1197 | --- test/t/bug983685.sh 2012-04-17 12:44:49 +0000 |
1198 | +++ test/t/bug983685.sh 2012-06-12 10:33:17 +0000 |
1199 | @@ -4,12 +4,10 @@ |
1200 | |
1201 | . inc/common.sh |
1202 | |
1203 | -init |
1204 | +start_server |
1205 | |
1206 | options="innodb_data_file_path innodb_log_group_home_dir" |
1207 | |
1208 | -run_mysqld |
1209 | - |
1210 | mkdir -p $topdir/backup |
1211 | innobackupex $topdir/backup |
1212 | backup_dir=`grep "innobackupex: Backup created in directory" $OUTFILE | awk -F\' '{ print $2}'` |
1213 | |
1214 | === modified file 'test/t/ib_binlog_info.sh' |
1215 | --- test/t/ib_binlog_info.sh 2011-12-21 05:54:55 +0000 |
1216 | +++ test/t/ib_binlog_info.sh 2012-06-12 10:33:17 +0000 |
1217 | @@ -4,8 +4,7 @@ |
1218 | |
1219 | . inc/common.sh |
1220 | |
1221 | -init |
1222 | -run_mysqld |
1223 | +start_server |
1224 | load_sakila |
1225 | |
1226 | innobackupex --no-timestamp $topdir/backup |
1227 | |
1228 | === modified file 'test/t/ib_csm_csv.sh' |
1229 | --- test/t/ib_csm_csv.sh 2011-12-07 13:28:47 +0000 |
1230 | +++ test/t/ib_csm_csv.sh 2012-06-12 10:33:17 +0000 |
1231 | @@ -1,7 +1,6 @@ |
1232 | . inc/common.sh |
1233 | |
1234 | -init |
1235 | -run_mysqld --innodb_file_per_table |
1236 | +start_server --innodb_file_per_table |
1237 | run_cmd ${MYSQL} ${MYSQL_ARGS} -e "create database csv" |
1238 | run_cmd ${MYSQL} ${MYSQL_ARGS} -e "create table csm (a int NOT NULL ) ENGINE=CSV" csv |
1239 | # Adding initial rows |
1240 | @@ -37,7 +36,7 @@ |
1241 | vlog "Data prepared for restore" |
1242 | |
1243 | # Destroying mysql data |
1244 | -stop_mysqld |
1245 | +stop_server |
1246 | rm -rf $mysql_datadir/* |
1247 | vlog "Data destroyed" |
1248 | |
1249 | @@ -49,7 +48,7 @@ |
1250 | innobackupex --copy-back $full_backup_dir |
1251 | vlog "Data restored" |
1252 | |
1253 | -run_mysqld --innodb_file_per_table |
1254 | +start_server --innodb_file_per_table |
1255 | checksum_b=`checksum_table csv csm` |
1256 | vlog "Checking checksums: $checksum_a/$checksum_b" |
1257 | |
1258 | |
1259 | === modified file 'test/t/ib_empty_dir.sh' |
1260 | --- test/t/ib_empty_dir.sh 2011-11-28 09:26:22 +0000 |
1261 | +++ test/t/ib_empty_dir.sh 2012-06-12 10:33:17 +0000 |
1262 | @@ -1,14 +1,13 @@ |
1263 | # Test for bug https://bugs.launchpad.net/percona-xtrabackup/+bug/737569 |
1264 | . inc/common.sh |
1265 | |
1266 | -init |
1267 | -run_mysqld |
1268 | +start_server |
1269 | |
1270 | innobackupex --no-timestamp $topdir/backup |
1271 | backup_dir=$topdir/backup |
1272 | vlog "Backup created in directory $backup_dir" |
1273 | |
1274 | -stop_mysqld |
1275 | +stop_server |
1276 | # Remove datadir |
1277 | rm -r $mysql_datadir |
1278 | # Restore backup |
1279 | |
1280 | === modified file 'test/t/ib_incremental.sh' |
1281 | --- test/t/ib_incremental.sh 2011-12-21 16:40:27 +0000 |
1282 | +++ test/t/ib_incremental.sh 2012-06-12 10:33:17 +0000 |
1283 | @@ -1,7 +1,6 @@ |
1284 | . inc/common.sh |
1285 | |
1286 | -init |
1287 | -run_mysqld --innodb_file_per_table |
1288 | +start_server --innodb_file_per_table |
1289 | load_dbase_schema incremental_sample |
1290 | |
1291 | # Adding initial rows |
1292 | @@ -72,7 +71,7 @@ |
1293 | vlog "Data prepared for restore" |
1294 | |
1295 | # Destroying mysql data |
1296 | -stop_mysqld |
1297 | +stop_server |
1298 | rm -rf $mysql_datadir/* |
1299 | vlog "Data destroyed" |
1300 | |
1301 | @@ -84,7 +83,7 @@ |
1302 | innobackupex --copy-back $full_backup_dir |
1303 | vlog "Data restored" |
1304 | |
1305 | -run_mysqld --innodb_file_per_table |
1306 | +start_server --innodb_file_per_table |
1307 | |
1308 | vlog "Checking checksums" |
1309 | checksum_b=`checksum_table incremental_sample test` |
1310 | |
1311 | === modified file 'test/t/ib_rsync.sh' |
1312 | --- test/t/ib_rsync.sh 2011-11-15 13:01:05 +0000 |
1313 | +++ test/t/ib_rsync.sh 2012-06-12 10:33:17 +0000 |
1314 | @@ -6,13 +6,12 @@ |
1315 | exit $SKIPPED_EXIT_CODE |
1316 | fi |
1317 | |
1318 | -init |
1319 | -run_mysqld --innodb_file_per_table |
1320 | +start_server --innodb_file_per_table |
1321 | load_sakila |
1322 | |
1323 | innobackupex --rsync --no-timestamp $topdir/backup |
1324 | |
1325 | -stop_mysqld |
1326 | +stop_server |
1327 | |
1328 | run_cmd rm -r $mysql_datadir |
1329 | |
1330 | @@ -22,5 +21,5 @@ |
1331 | |
1332 | innobackupex --copy-back $topdir/backup |
1333 | |
1334 | -run_mysqld |
1335 | +start_server |
1336 | run_cmd ${MYSQL} ${MYSQL_ARGS} -e "SELECT COUNT(*) FROM actor" sakila |
1337 | |
1338 | === modified file 'test/t/ib_slave_info.sh' |
1339 | --- test/t/ib_slave_info.sh 2011-08-29 19:44:10 +0000 |
1340 | +++ test/t/ib_slave_info.sh 2012-06-12 10:33:17 +0000 |
1341 | @@ -1,7 +1,14 @@ |
1342 | . inc/common.sh |
1343 | |
1344 | -init |
1345 | -run_mysqld --innodb_file_per_table |
1346 | +master_id=1 |
1347 | +slave_id=2 |
1348 | + |
1349 | +start_server_with_id $master_id |
1350 | +start_server_with_id $slave_id |
1351 | + |
1352 | +setup_slave $slave_id $master_id |
1353 | + |
1354 | +switch_server $master_id |
1355 | load_dbase_schema incremental_sample |
1356 | |
1357 | # Adding initial rows |
1358 | @@ -15,14 +22,19 @@ |
1359 | done |
1360 | vlog "Initial rows added" |
1361 | |
1362 | -# Full backup |
1363 | -# backup root directory |
1364 | -mkdir -p $topdir/backup |
1365 | +# Full backup of the slave server |
1366 | +switch_server $slave_id |
1367 | |
1368 | vlog "Check that --slave-info with --no-lock and no --safe-slave-backup fails" |
1369 | -run_cmd_expect_failure $IB_BIN $IB_ARGS --slave-info --no-lock $topdir/backup |
1370 | +run_cmd_expect_failure $IB_BIN $IB_ARGS --no-timestamp --slave-info --no-lock \ |
1371 | + $topdir/backup |
1372 | |
1373 | vlog "Check that --slave-info with --incremental and no --safe-slave-backup fails" |
1374 | -run_cmd_expect_failure $IB_BIN $IB_ARGS --slave-info --incremental --incremental-basedir=$topdir/backup $topdir/backup |
1375 | +run_cmd_expect_failure $IB_BIN $IB_ARGS --no-timestamp --slave-info \ |
1376 | + --incremental --incremental-basedir=$topdir/backup $topdir/backup |
1377 | |
1378 | -# TODO: add positive tests when the test suite is able to setup replication |
1379 | +innobackupex --no-timestamp --slave-info $topdir/backup |
1380 | +egrep -q '^mysql-bin.000001[[:space:]]+[0-9]+[[:space:]]+$' \ |
1381 | + $topdir/backup/xtrabackup_binlog_info |
1382 | +egrep -q '^CHANGE MASTER TO MASTER_LOG_FILE='\''mysql-bin.000001'\'', MASTER_LOG_POS=[0-9]+$' \ |
1383 | + $topdir/backup/xtrabackup_slave_info |
1384 | |
1385 | === modified file 'test/t/ib_specialchar.sh' |
1386 | --- test/t/ib_specialchar.sh 2011-12-07 13:28:47 +0000 |
1387 | +++ test/t/ib_specialchar.sh 2012-06-12 10:33:17 +0000 |
1388 | @@ -1,7 +1,7 @@ |
1389 | . inc/common.sh |
1390 | |
1391 | -init |
1392 | -run_mysqld |
1393 | +start_server |
1394 | + |
1395 | load_dbase_schema sakila |
1396 | load_dbase_data sakila |
1397 | |
1398 | @@ -20,7 +20,7 @@ |
1399 | run_cmd ${MYSQLADMIN} ${MYSQL_ARGS} -p'$PASSWD' password '' |
1400 | |
1401 | vlog "Stopping database server" |
1402 | -stop_mysqld |
1403 | +stop_server |
1404 | # Remove datadir |
1405 | vlog "Removing data folder" |
1406 | rm -r $mysql_datadir |
1407 | @@ -40,7 +40,7 @@ |
1408 | |
1409 | vlog "Starting database server" |
1410 | # using --skip-grant-tables to override root password restored from backup |
1411 | -run_mysqld --skip-grant-tables |
1412 | +start_server --skip-grant-tables |
1413 | vlog "Database server started" |
1414 | # Check sakila |
1415 | run_cmd ${MYSQL} ${MYSQL_ARGS} -e "SELECT count(*) from actor" sakila |
1416 | |
1417 | === modified file 'test/t/tar4ibd_o_direct.sh' |
1418 | --- test/t/tar4ibd_o_direct.sh 2012-02-02 13:29:22 +0000 |
1419 | +++ test/t/tar4ibd_o_direct.sh 2012-06-12 10:33:17 +0000 |
1420 | @@ -11,15 +11,15 @@ |
1421 | exit $SKIPPED_EXIT_CODE |
1422 | fi |
1423 | |
1424 | -init |
1425 | -run_mysqld --innodb_file_per_table |
1426 | +start_server --innodb_file_per_table |
1427 | + |
1428 | load_sakila |
1429 | |
1430 | # Take backup |
1431 | echo "innodb_flush_method=O_DIRECT" >> $topdir/my.cnf |
1432 | mkdir -p $topdir/backup |
1433 | innobackupex --stream=tar $topdir/backup > $topdir/backup/out.tar |
1434 | -stop_mysqld |
1435 | +stop_server |
1436 | |
1437 | # See if tar4ibd was using O_DIRECT for all InnoDB files |
1438 | cnt=`grep "tar4ibd: using O_DIRECT for the input file" $OUTFILE | wc -l` |
1439 | @@ -42,6 +42,6 @@ |
1440 | mkdir -p $mysql_datadir |
1441 | innobackupex --copy-back --defaults-file=$topdir/my.cnf $backup_dir |
1442 | |
1443 | -run_mysqld |
1444 | +start_server |
1445 | # Check sakila |
1446 | ${MYSQL} ${MYSQL_ARGS} -e "SELECT count(*) from actor" sakila |
1447 | |
1448 | === modified file 'test/t/tar4ibd_symlink.sh' |
1449 | --- test/t/tar4ibd_symlink.sh 2011-06-14 13:33:54 +0000 |
1450 | +++ test/t/tar4ibd_symlink.sh 2012-06-12 10:33:17 +0000 |
1451 | @@ -4,37 +4,41 @@ |
1452 | |
1453 | . inc/common.sh |
1454 | |
1455 | -init |
1456 | -run_mysqld --innodb_file_per_table |
1457 | +start_server --innodb_file_per_table |
1458 | + |
1459 | load_dbase_schema sakila |
1460 | load_dbase_data sakila |
1461 | |
1462 | +# Force a checkpoint |
1463 | +stop_server |
1464 | +start_server |
1465 | + |
1466 | # Copy some .ibd files to a temporary location and replace them with symlinks |
1467 | |
1468 | -mv $topdir/mysql/sakila/actor.ibd $topdir |
1469 | -ln -s $topdir/actor.ibd $topdir/mysql/sakila |
1470 | +mv $MYSQLD_DATADIR/sakila/actor.ibd $MYSQLD_VARDIR/ |
1471 | +ln -s $MYSQLD_VARDIR/actor.ibd $MYSQLD_DATADIR/sakila/actor.ibd |
1472 | |
1473 | -mv $topdir/mysql/sakila/customer.ibd $topdir |
1474 | -ln -s $topdir/customer.ibd $topdir/customer_link.ibd |
1475 | -ln -s $topdir/customer_link.ibd $topdir/mysql/sakila/customer.ibd |
1476 | +mv $MYSQLD_DATADIR/sakila/customer.ibd $MYSQLD_VARDIR/customer.ibd |
1477 | +ln -s $MYSQLD_VARDIR/customer.ibd $MYSQLD_VARDIR/customer_link.ibd |
1478 | +ln -s $MYSQLD_VARDIR/customer_link.ibd $MYSQLD_DATADIR/sakila/customer.ibd |
1479 | |
1480 | # Take backup |
1481 | -mkdir -p $topdir/backup |
1482 | -innobackupex --stream=tar $topdir/backup > $topdir/backup/out.tar |
1483 | +mkdir -p $MYSQLD_VARDIR/backup |
1484 | +innobackupex --stream=tar $MYSQLD_VARDIR/backup > $MYSQLD_VARDIR/backup/out.tar |
1485 | |
1486 | -stop_mysqld |
1487 | +stop_server |
1488 | |
1489 | # Remove datadir |
1490 | rm -r $mysql_datadir |
1491 | |
1492 | # Remove the temporary files referenced by symlinks |
1493 | -rm -f $topdir/actor.ibd |
1494 | -rm -f $topdir/customer.ibd |
1495 | -rm -f $topdir/customer_link.ibd |
1496 | +rm -f $MYSQLD_VARDIR/actor.ibd |
1497 | +rm -f $MYSQLD_VARDIR/customer.ibd |
1498 | +rm -f $MYSQLD_VARDIR/customer_link.ibd |
1499 | |
1500 | # Restore sakila |
1501 | vlog "Applying log" |
1502 | -backup_dir=$topdir/backup |
1503 | +backup_dir=$MYSQLD_VARDIR/backup |
1504 | cd $backup_dir |
1505 | $TAR -ixvf out.tar |
1506 | cd - >/dev/null 2>&1 |
1507 | @@ -46,10 +50,8 @@ |
1508 | |
1509 | innobackupex --copy-back $backup_dir |
1510 | |
1511 | -run_mysqld |
1512 | +start_server |
1513 | |
1514 | # Check sakila |
1515 | run_cmd ${MYSQL} ${MYSQL_ARGS} -e "SELECT COUNT(*) FROM actor" sakila |
1516 | run_cmd ${MYSQL} ${MYSQL_ARGS} -e "SELECT COUNT(*) FROM customer" sakila |
1517 | -stop_mysqld |
1518 | -clean |
1519 | |
1520 | === modified file 'test/t/xb_basic.sh' |
1521 | --- test/t/xb_basic.sh 2011-12-07 13:28:47 +0000 |
1522 | +++ test/t/xb_basic.sh 2012-06-12 10:33:17 +0000 |
1523 | @@ -1,16 +1,16 @@ |
1524 | . inc/common.sh |
1525 | |
1526 | -init |
1527 | -run_mysqld |
1528 | +start_server |
1529 | + |
1530 | load_dbase_schema sakila |
1531 | load_dbase_data sakila |
1532 | |
1533 | mkdir -p $topdir/backup |
1534 | -innobackupex $topdir/backup |
1535 | +innobackupex $topdir/backup |
1536 | backup_dir=`grep "innobackupex: Backup created in directory" $OUTFILE | awk -F\' '{ print $2}'` |
1537 | vlog "Backup created in directory $backup_dir" |
1538 | |
1539 | -stop_mysqld |
1540 | +stop_server |
1541 | # Remove datadir |
1542 | rm -r $mysql_datadir |
1543 | #init_mysql_dir |
1544 | @@ -27,6 +27,6 @@ |
1545 | vlog "###########" |
1546 | innobackupex --copy-back $backup_dir |
1547 | |
1548 | -run_mysqld |
1549 | +start_server |
1550 | # Check sakila |
1551 | run_cmd ${MYSQL} ${MYSQL_ARGS} -e "SELECT count(*) from actor" sakila |
1552 | |
1553 | === modified file 'test/t/xb_export.sh' |
1554 | --- test/t/xb_export.sh 2011-12-21 16:40:27 +0000 |
1555 | +++ test/t/xb_export.sh 2012-06-12 10:33:17 +0000 |
1556 | @@ -1,11 +1,5 @@ |
1557 | . inc/common.sh |
1558 | |
1559 | -init |
1560 | - |
1561 | -backup_dir=$topdir/xb_export_backup |
1562 | -rm -rf $backup_dir |
1563 | -mkdir $backup_dir |
1564 | - |
1565 | if [ -z "$XTRADB_VERSION" ]; then |
1566 | echo "Requires XtraDB" > $SKIPPED_REASON |
1567 | exit $SKIPPED_EXIT_CODE |
1568 | @@ -18,11 +12,15 @@ |
1569 | import_option="--innodb_expand_import=1" |
1570 | fi |
1571 | |
1572 | -MYSQLD_ARGS="$MYSQLD_ARGS --innodb_file_per_table $import_option \ |
1573 | +mysql_extra_args="--innodb_file_per_table $import_option \ |
1574 | --innodb_file_format=Barracuda" |
1575 | |
1576 | # Starting database server |
1577 | -run_mysqld |
1578 | +start_server $mysql_extra_args |
1579 | + |
1580 | +backup_dir=$topdir/xb_export_backup |
1581 | +rm -rf $backup_dir |
1582 | +mkdir $backup_dir |
1583 | |
1584 | # Loading table schema |
1585 | load_dbase_schema incremental_sample |
1586 | @@ -48,10 +46,9 @@ |
1587 | vlog "Table was backed up" |
1588 | |
1589 | vlog "Re-initializing database server" |
1590 | -stop_mysqld |
1591 | -# Can't use clean/init because that will remove $backup_dir as well |
1592 | -clean_datadir |
1593 | -run_mysqld |
1594 | +stop_server |
1595 | +rm -rf ${MYSQLD_DATADIR} |
1596 | +start_server $mysql_extra_args |
1597 | load_dbase_schema incremental_sample |
1598 | vlog "Database was re-initialized" |
1599 | |
1600 | @@ -91,8 +88,8 @@ |
1601 | # consistent backup results. Otherwise we risk ending up with no test.ibd |
1602 | # in the backup in case importing has not finished before taking backup |
1603 | |
1604 | -stop_mysqld |
1605 | -run_mysqld |
1606 | +stop_server |
1607 | +start_server $mysql_extra_args |
1608 | |
1609 | # Some testing queries |
1610 | run_cmd ${MYSQL} ${MYSQL_ARGS} -e "select count(*) from test;" incremental_sample |
1611 | @@ -111,13 +108,13 @@ |
1612 | |
1613 | run_cmd ${MYSQL} ${MYSQL_ARGS} -e "delete from test;" incremental_sample |
1614 | |
1615 | -stop_mysqld |
1616 | +stop_server |
1617 | |
1618 | cd $topdir/backup/full |
1619 | cp -r * $mysql_datadir |
1620 | cd - |
1621 | |
1622 | -run_mysqld |
1623 | +start_server $mysql_extra_args |
1624 | |
1625 | vlog "Cheking checksums" |
1626 | checksum_3=`checksum_table incremental_sample test` |
1627 | @@ -131,6 +128,6 @@ |
1628 | |
1629 | vlog "Checksums are OK" |
1630 | |
1631 | -stop_mysqld |
1632 | +stop_server |
1633 | |
1634 | rm -rf $backup_dir |
1635 | |
1636 | === modified file 'test/t/xb_incremental.sh' |
1637 | --- test/t/xb_incremental.sh 2011-12-21 16:40:27 +0000 |
1638 | +++ test/t/xb_incremental.sh 2012-06-12 10:33:17 +0000 |
1639 | @@ -1,7 +1,7 @@ |
1640 | . inc/common.sh |
1641 | |
1642 | -init |
1643 | -run_mysqld --innodb_file_per_table |
1644 | +start_server --innodb_file_per_table |
1645 | + |
1646 | load_dbase_schema incremental_sample |
1647 | |
1648 | # Adding 10k rows |
1649 | @@ -73,14 +73,14 @@ |
1650 | run_cmd ${MYSQL} ${MYSQL_ARGS} -e "delete from test;" incremental_sample |
1651 | |
1652 | # Restore backup |
1653 | -stop_mysqld |
1654 | +stop_server |
1655 | vlog "Copying files" |
1656 | cd $topdir/data/full/ |
1657 | cp -r * $mysql_datadir |
1658 | cd $topdir |
1659 | |
1660 | vlog "Data restored" |
1661 | -run_mysqld --innodb_file_per_table |
1662 | +start_server --innodb_file_per_table |
1663 | |
1664 | vlog "Checking checksums" |
1665 | checksum_b=`checksum_table incremental_sample test` |
1666 | |
1667 | === modified file 'test/t/xb_incremental_compressed.sh' |
1668 | --- test/t/xb_incremental_compressed.sh 2011-12-21 16:40:27 +0000 |
1669 | +++ test/t/xb_incremental_compressed.sh 2012-06-12 10:33:17 +0000 |
1670 | @@ -4,8 +4,6 @@ |
1671 | |
1672 | . inc/common.sh |
1673 | |
1674 | -init |
1675 | - |
1676 | if [ -z "$INNODB_VERSION" ]; then |
1677 | echo "Requires InnoDB plugin or XtraDB" >$SKIPPED_REASON |
1678 | exit $SKIPPED_EXIT_CODE |
1679 | @@ -27,7 +25,7 @@ |
1680 | mysqld_additional_args="--innodb_strict_mode --innodb_file_per_table \ |
1681 | --innodb_file_format=Barracuda" |
1682 | |
1683 | - run_mysqld ${mysqld_additional_args} |
1684 | + start_server ${mysqld_additional_args} |
1685 | |
1686 | load_dbase_schema incremental_sample |
1687 | |
1688 | @@ -134,7 +132,7 @@ |
1689 | |
1690 | # Restore backup |
1691 | |
1692 | - stop_mysqld |
1693 | + stop_server |
1694 | |
1695 | vlog "Copying files" |
1696 | |
1697 | @@ -144,7 +142,7 @@ |
1698 | |
1699 | vlog "Data restored" |
1700 | |
1701 | - run_mysqld ${mysqld_additional_args} |
1702 | + start_server ${mysqld_additional_args} |
1703 | |
1704 | vlog "Cheking checksums" |
1705 | checksum_b=`checksum_table incremental_sample test` |
1706 | @@ -158,7 +156,7 @@ |
1707 | vlog "Checksums are OK" |
1708 | |
1709 | drop_dbase incremental_sample |
1710 | - stop_mysqld |
1711 | + stop_server |
1712 | } |
1713 | |
1714 | for page_size in 1 2 4 8 16; do |
1715 | |
1716 | === modified file 'test/t/xb_parallel.sh' |
1717 | --- test/t/xb_parallel.sh 2011-12-28 12:52:39 +0000 |
1718 | +++ test/t/xb_parallel.sh 2012-06-12 10:33:17 +0000 |
1719 | @@ -1,7 +1,7 @@ |
1720 | . inc/common.sh |
1721 | |
1722 | -init |
1723 | -run_mysqld --innodb_file_per_table |
1724 | +start_server --innodb_file_per_table |
1725 | + |
1726 | load_dbase_schema sakila |
1727 | load_dbase_data sakila |
1728 | |
1729 | @@ -13,7 +13,7 @@ |
1730 | |
1731 | #echo "Backup dir in $backup_dir" |
1732 | |
1733 | -stop_mysqld |
1734 | +stop_server |
1735 | # Remove datadir |
1736 | rm -r $mysql_datadir |
1737 | # Restore sakila |
1738 | @@ -29,6 +29,6 @@ |
1739 | vlog "###########" |
1740 | innobackupex --copy-back $backup_dir |
1741 | |
1742 | -run_mysqld |
1743 | +start_server |
1744 | # Check sakila |
1745 | run_cmd ${MYSQL} ${MYSQL_ARGS} -e "SELECT count(*) from actor" sakila |
1746 | |
1747 | === modified file 'test/t/xb_parallel_incremental.sh' |
1748 | --- test/t/xb_parallel_incremental.sh 2011-12-28 13:14:34 +0000 |
1749 | +++ test/t/xb_parallel_incremental.sh 2012-06-12 10:33:17 +0000 |
1750 | @@ -4,8 +4,8 @@ |
1751 | |
1752 | . inc/common.sh |
1753 | |
1754 | -init |
1755 | -run_mysqld --innodb_file_per_table |
1756 | +start_server --innodb_file_per_table |
1757 | + |
1758 | load_dbase_schema sakila |
1759 | load_dbase_data sakila |
1760 | |
1761 | @@ -38,7 +38,7 @@ |
1762 | innobackupex --incremental --no-timestamp --parallel=8 \ |
1763 | --incremental-basedir=$topdir/full_backup $topdir/inc_backup |
1764 | |
1765 | -stop_mysqld |
1766 | +stop_server |
1767 | # Remove datadir |
1768 | rm -r $mysql_datadir |
1769 | |
1770 | @@ -52,7 +52,7 @@ |
1771 | mkdir -p $mysql_datadir |
1772 | innobackupex --copy-back $topdir/full_backup |
1773 | |
1774 | -run_mysqld |
1775 | +start_server |
1776 | |
1777 | # Check sakila |
1778 | run_cmd ${MYSQL} ${MYSQL_ARGS} -e "SELECT count(*) from actor" sakila |
1779 | |
1780 | === modified file 'test/t/xb_part_range.sh' |
1781 | --- test/t/xb_part_range.sh 2011-12-21 16:40:27 +0000 |
1782 | +++ test/t/xb_part_range.sh 2012-06-12 10:33:17 +0000 |
1783 | @@ -1,7 +1,6 @@ |
1784 | . inc/common.sh |
1785 | |
1786 | -init |
1787 | -run_mysqld |
1788 | +start_server |
1789 | |
1790 | run_cmd $MYSQL $MYSQL_ARGS test <<EOF |
1791 | CREATE TABLE test ( |
1792 | @@ -89,7 +88,7 @@ |
1793 | |
1794 | # Restore backup |
1795 | |
1796 | -stop_mysqld |
1797 | +stop_server |
1798 | |
1799 | vlog "Copying files" |
1800 | |
1801 | @@ -99,7 +98,7 @@ |
1802 | |
1803 | vlog "Data restored" |
1804 | |
1805 | -run_mysqld |
1806 | +start_server |
1807 | |
1808 | vlog "Cheking checksums" |
1809 | checksum_b=`checksum_table test test` |
1810 | |
1811 | === modified file 'test/t/xb_partial.sh' |
1812 | --- test/t/xb_partial.sh 2011-12-21 16:40:27 +0000 |
1813 | +++ test/t/xb_partial.sh 2012-06-12 10:33:17 +0000 |
1814 | @@ -1,7 +1,7 @@ |
1815 | . inc/common.sh |
1816 | |
1817 | -init |
1818 | -run_mysqld --innodb_file_per_table |
1819 | +start_server --innodb_file_per_table |
1820 | + |
1821 | load_dbase_schema incremental_sample |
1822 | |
1823 | # Adding 10k rows |
1824 | @@ -34,13 +34,13 @@ |
1825 | vlog "Table cleared" |
1826 | |
1827 | # Restore backup |
1828 | -stop_mysqld |
1829 | +stop_server |
1830 | vlog "Copying files" |
1831 | cd $topdir/data/parted/ |
1832 | cp -r * $mysql_datadir |
1833 | cd $topdir |
1834 | vlog "Data restored" |
1835 | -run_mysqld --innodb_file_per_table |
1836 | +start_server --innodb_file_per_table |
1837 | vlog "Checking checksums" |
1838 | checksum_b=`checksum_table incremental_sample test` |
1839 | |
1840 | |
1841 | === modified file 'test/t/xb_perm_basic.sh' |
1842 | --- test/t/xb_perm_basic.sh 2012-01-27 11:21:39 +0000 |
1843 | +++ test/t/xb_perm_basic.sh 2012-06-12 10:33:17 +0000 |
1844 | @@ -1,8 +1,7 @@ |
1845 | # Test for fix of https://bugs.launchpad.net/percona-xtrabackup/+bug/691090 |
1846 | . inc/common.sh |
1847 | |
1848 | -init |
1849 | -run_mysqld |
1850 | +start_server |
1851 | |
1852 | chmod -R 500 $mysql_datadir |
1853 | trap "vlog restoring permissions on datadir $mysql_datadir ; \ |
1854 | |
1855 | === modified file 'test/t/xb_perm_stream.sh' |
1856 | --- test/t/xb_perm_stream.sh 2012-01-27 11:21:39 +0000 |
1857 | +++ test/t/xb_perm_stream.sh 2012-06-12 10:33:17 +0000 |
1858 | @@ -1,8 +1,7 @@ |
1859 | # Test for fix of https://bugs.launchpad.net/percona-xtrabackup/+bug/691090 |
1860 | . inc/common.sh |
1861 | |
1862 | -init |
1863 | -run_mysqld |
1864 | +start_server |
1865 | |
1866 | # Take backup |
1867 | chmod -R 500 $mysql_datadir |
1868 | |
1869 | === modified file 'test/t/xb_stats.sh' |
1870 | --- test/t/xb_stats.sh 2011-12-07 13:28:47 +0000 |
1871 | +++ test/t/xb_stats.sh 2012-06-12 10:33:17 +0000 |
1872 | @@ -1,7 +1,7 @@ |
1873 | . inc/common.sh |
1874 | |
1875 | -init |
1876 | -run_mysqld |
1877 | +start_server |
1878 | + |
1879 | load_dbase_schema sakila |
1880 | load_dbase_data sakila |
1881 | |
1882 | |
1883 | === modified file 'test/t/xb_stream.sh' |
1884 | --- test/t/xb_stream.sh 2011-12-07 13:28:47 +0000 |
1885 | +++ test/t/xb_stream.sh 2012-06-12 10:33:17 +0000 |
1886 | @@ -1,7 +1,7 @@ |
1887 | . inc/common.sh |
1888 | |
1889 | -init |
1890 | -run_mysqld |
1891 | +start_server |
1892 | + |
1893 | load_dbase_schema sakila |
1894 | load_dbase_data sakila |
1895 | |
1896 | @@ -9,7 +9,7 @@ |
1897 | mkdir -p $topdir/backup |
1898 | innobackupex --stream=tar $topdir/backup > $topdir/backup/out.tar |
1899 | |
1900 | -stop_mysqld |
1901 | +stop_server |
1902 | # Remove datadir |
1903 | rm -r $mysql_datadir |
1904 | # Restore sakila |
1905 | @@ -29,6 +29,6 @@ |
1906 | vlog "###########" |
1907 | innobackupex --copy-back $backup_dir |
1908 | |
1909 | -run_mysqld |
1910 | +start_server |
1911 | # Check sakila |
1912 | run_cmd ${MYSQL} ${MYSQL_ARGS} -e "SELECT count(*) from actor" sakila |
http:// jenkins. percona. com/view/ XtraBackup/ job/percona- xtrabackup- 1.6-param/ 136/