Merge lp:~akopytov/percona-xtrabackup/replication-support-in-test-suite-2.0 into lp:percona-xtrabackup/2.0

Proposed by Alexey Kopytov
Status: Merged
Approved by: Stewart Smith
Approved revision: no longer in the source branch.
Merged at revision: 438
Proposed branch: lp:~akopytov/percona-xtrabackup/replication-support-in-test-suite-2.0
Merge into: lp:percona-xtrabackup/2.0
Diff against target: 2429 lines (+546/-600)
61 files modified
innobackupex (+9/-23)
test/disabled/ib_include.sh (+0/-46)
test/disabled/tar_compressed.sh (+0/-110)
test/disabled/xb_lru_dump.sh (+0/-20)
test/experimental/bug408803.sh (+3/-4)
test/experimental/xb_race_drop.sh (+26/-2)
test/inc/common.sh (+262/-132)
test/inc/ib_stream_common.sh (+4/-4)
test/run.sh (+31/-40)
test/t/bug1002688.sh (+3/-4)
test/t/bug483827.sh (+6/-9)
test/t/bug489290.sh (+1/-2)
test/t/bug514068.sh (+2/-3)
test/t/bug606981.sh (+4/-4)
test/t/bug722638.sh (+6/-7)
test/t/bug723097.sh (+3/-4)
test/t/bug723318.sh (+4/-3)
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/bug766033.sh (+8/-13)
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/bug972169.sh (+1/-3)
test/t/bug977101.sh (+31/-0)
test/t/bug983685.sh (+1/-3)
test/t/bug983720_galerainfo.sh (+1/-2)
test/t/bug983720_lrudump.sh (+1/-2)
test/t/bug989397.sh (+1/-2)
test/t/bug996493.sh (+2/-4)
test/t/bug999750.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_lru_dump_basic.sh (+1/-2)
test/t/ib_lru_dump_rsync.sh (+1/-2)
test/t/ib_lru_dump_stream.sh (+1/-2)
test/t/ib_rsync.sh (+3/-4)
test/t/ib_slave_info.sh (+18/-7)
test/t/ib_specialchar.sh (+4/-4)
test/t/ib_stream_incremental.sh (+3/-4)
test/t/tar4ibd_symlink.sh (+19/-15)
test/t/xb_basic.sh (+5/-5)
test/t/xb_defaults_file.sh (+1/-2)
test/t/xb_export.sh (+14/-17)
test/t/xb_galera_info.sh (+2/-3)
test/t/xb_incremental.sh (+4/-4)
test/t/xb_incremental_compressed.sh (+5/-6)
test/t/xb_log_overwrap.sh (+2/-2)
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)
To merge this branch: bzr merge lp:~akopytov/percona-xtrabackup/replication-support-in-test-suite-2.0
Reviewer Review Type Date Requested Status
Stewart Smith (community) Approve
Review via email: mp+108772@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Alexey Kopytov (akopytov) wrote :
Revision history for this message
Stewart Smith (stewart) wrote :

same as for 1.6 merge req - free port allocation is racy.

review: Needs Fixing
Revision history for this message
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.

Revision history for this message
Alexey Kopytov (akopytov) wrote :
Revision history for this message
Stewart Smith (stewart) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'innobackupex'
2--- innobackupex 2012-05-23 17:06:52 +0000
3+++ innobackupex 2012-06-12 10:40:23 +0000
4@@ -1207,28 +1207,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@@ -1236,7 +1229,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) {
48@@ -1245,14 +1238,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@@ -1314,7 +1300,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=== removed 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 1970-01-01 00:00:00 +0000
77@@ -1,46 +0,0 @@
78-. inc/common.sh
79-
80-init
81-run_mysqld
82-run_cmd ${MYSQL} ${MYSQL_ARGS} -e "create database include;"
83-run_cmd ${MYSQL} ${MYSQL_ARGS} -e "create table t1 (a int) ENGINE=MyISAM;" include
84-run_cmd ${MYSQL} ${MYSQL_ARGS} -e "create table t2 (a int) ENGINE=InnoDB;" include
85-run_cmd ${MYSQL} ${MYSQL_ARGS} -e "insert into t1 values (1),(2),(3);" include
86-run_cmd ${MYSQL} ${MYSQL_ARGS} -e "insert into t2 values (1),(2),(3);" include
87-# Take backup
88-mkdir -p $topdir/backup
89-checksum_t1=`${MYSQL} ${MYSQL_ARGS} -Ns -e "checksum table t1" include | awk '{print $2}'`
90-checksum_t2=`${MYSQL} ${MYSQL_ARGS} -Ns -e "checksum table t2" include | awk '{print $2}'`
91-vlog "checksum_t1 is $checksum_t1"
92-vlog "checksum_t2 is $checksum_t2"
93-run_cmd ${IB_BIN} --user=root --socket=$mysql_socket --include="^include[.]t" $topdir/backup > $OUTFILE 2>&1
94-backup_dir=`grep "innobackupex: Backup created in directory" $OUTFILE | awk -F\' '{ print $2}'`
95-stop_mysqld
96-# Remove datadir
97-rm -r $mysql_datadir
98-# Restore data
99-vlog "Applying log"
100-echo "###########" >> $OUTFILE
101-echo "# PREPARE #" >> $OUTFILE
102-echo "###########" >> $OUTFILE
103-run_cmd ${IB_BIN} --apply-log $backup_dir >> $OUTFILE 2>&1
104-vlog "Restoring MySQL datadir"
105-mkdir -p $mysql_datadir
106-echo "###########" >> $OUTFILE
107-echo "# RESTORE #" >> $OUTFILE
108-echo "###########" >> $OUTFILE
109-run_cmd ${IB_BIN} --copy-back $backup_dir >> $OUTFILE 2>&1
110-run_mysqld
111-checksum_tt1=`${MYSQL} ${MYSQL_ARGS} -Ns -e "checksum table t1" include | awk '{print $2}'`
112-checksum_tt2=`${MYSQL} ${MYSQL_ARGS} -Ns -e "checksum table t2" include | awk '{print $2}'`
113-vlog "checksum_tt1 is $checksum_tt1"
114-vlog "checksum_tt2 is $checksum_tt2"
115-if [ (( ($checksum_t2 -eq $checksum_tt2) || ($checksum_t1 -eq $checksum_tt1) )) ]
116-then
117- vlog "Checksums are OK"
118-else
119- vlog "Checksums are not equal"
120- exit -1
121-fi
122-stop_mysqld
123-clean
124
125=== removed file 'test/disabled/tar_compressed.sh'
126--- test/disabled/tar_compressed.sh 2011-04-22 02:41:31 +0000
127+++ test/disabled/tar_compressed.sh 1970-01-01 00:00:00 +0000
128@@ -1,110 +0,0 @@
129-################################################################################
130-# Test of streaming backups with InnoDB compression
131-################################################################################
132-
133-. inc/common.sh
134-
135-if [ "$MYSQL_VERSION" = "5.0" ]; then
136- exit $SKIPPED_EXIT_CODE
137-fi
138-
139-function test_incremental_compressed()
140-{
141- page_size=$1
142-
143- echo "************************************************************************"
144- echo "Testing streaming backup with compressed page size=${page_size}KB "
145- echo "************************************************************************"
146-
147- # Use innodb_strict_mode so that failure to use compression results in an
148- # error rather than a warning
149- if [ "$MYSQL_VERSION" = "5.1" ]; then
150- mysqld_additional_args="--ignore_builtin_innodb --innodb_strict_mode --plugin-load=innodb=ha_innodb_plugin.so --innodb_file_per_table --innodb_file_format=Barracuda"
151- else
152- mysqld_additional_args="--innodb_strict_mode --innodb_file_per_table --innodb_file_format=Barracuda"
153- fi
154-
155- run_mysqld ${mysqld_additional_args}
156- load_dbase_schema incremental_sample
157-
158- vlog "Compressing the table"
159-
160- run_cmd ${MYSQL} ${MYSQL_ARGS} -e \
161- "ALTER TABLE test ENGINE=InnoDB ROW_FORMAT=compressed KEY_BLOCK_SIZE=$page_size" incremental_sample
162-
163- # Adding 10k rows
164- vlog "Adding initial rows to database..."
165- numrow=10000
166- count=0
167- while [ "$numrow" -gt "$count" ]; do
168- sql="INSERT INTO test VALUES ($count, $numrow)"
169- let "count=count+1"
170- for ((i=0; $i<99; i++)); do
171- sql="${sql},($count, $numrow)"
172- let "count=count+1"
173- done
174- ${MYSQL} ${MYSQL_ARGS} -e "$sql" incremental_sample
175- done
176-
177- rows=`${MYSQL} ${MYSQL_ARGS} -Ns -e "SELECT COUNT(*) FROM test" incremental_sample`
178- if [ "$rows" != "10000" ]; then
179- vlog "Failed to add initial rows"
180- exit -1
181- fi
182- vlog "Initial rows added"
183-
184- # Create directory for backup files
185- rm -rf $topdir/data/full
186- mkdir -p $topdir/data/full
187-
188- # Start streaming backuop
189- vlog "Starting backup"
190- ${IB_BIN} --socket=$mysql_socket --stream=tar $topdir/data/full > $topdir/data/full/out.tar 2>$OUTFILE
191-
192- # Saving the checksum of original table
193- checksum_a=`${MYSQL} ${MYSQL_ARGS} -Ns -e "checksum table test;" incremental_sample | awk '{print $2}'`
194- vlog "Table checksum is $checksum_a"
195-
196-
197- # Prepare backup
198- vlog "Preparing backup"
199- cd $topdir/data/full
200- tar -ixf out.tar
201- cd - > /dev/null 2>&1
202- run_cmd ${IB_BIN} --apply-log $topdir/data/full >> $OUTFILE 2>&1
203- vlog "Data prepared for restore"
204-
205- # removing rows
206- vlog "Table cleared"
207- ${MYSQL} ${MYSQL_ARGS} -e "delete from test;" incremental_sample
208-
209- # Restore backup
210- stop_mysqld
211- vlog "Copying files"
212- run_cmd ${IB_BIN} --copy-back $topdir/data/full >> $OUTFILE 2>&1
213- vlog "Data restored"
214-
215- # Comparing checksums
216- run_mysqld ${mysqld_additional_args}
217- vlog "Cheking checksums"
218- checksum_b=`${MYSQL} ${MYSQL_ARGS} -Ns -e "checksum table test;" incremental_sample | awk '{print $2}'`
219-
220- if [ $checksum_a -ne $checksum_b ]
221- then
222- vlog "Checksums are not equal"
223- exit -1
224- fi
225-
226- vlog "Checksums are OK"
227-
228- drop_dbase incremental_sample
229- stop_mysqld
230-}
231-
232-init
233-
234-for page_size in 1 2 4 8 16; do
235- test_incremental_compressed ${page_size}
236-done
237-
238-clean
239
240=== removed file 'test/disabled/xb_lru_dump.sh'
241--- test/disabled/xb_lru_dump.sh 2011-03-30 10:30:35 +0000
242+++ test/disabled/xb_lru_dump.sh 1970-01-01 00:00:00 +0000
243@@ -1,20 +0,0 @@
244-. inc/common.sh
245-
246-init
247-run_mysqld
248-
249-run_cmd ${MYSQL} ${MYSQL_ARGS} -e "select * from information_schema.XTRADB_ADMIN_COMMAND /*!XTRA_LRU_DUMP*/;"
250-
251-mkdir -p $topdir/backup
252-run_cmd ${XB_BIN} --datadir=$mysql_datadir --backup --target-dir=$topdir/backup
253-
254-stop_mysqld
255-
256-if [ -f $topdir/backup/ib_lru_dump ]
257-then
258- vlog "LRU dump has been backuped"
259- clean
260-else
261- vlog "LRU dump was not backuped"
262- exit -1
263-fi
264
265=== modified file 'test/experimental/bug408803.sh'
266--- test/experimental/bug408803.sh 2011-06-09 18:34:00 +0000
267+++ test/experimental/bug408803.sh 2012-06-12 10:40:23 +0000
268@@ -1,7 +1,6 @@
269 . inc/common.sh
270
271-init
272-run_mysqld --interactive_timeout=1 --wait_timeout=1
273+start_server --interactive_timeout=1 --wait_timeout=1
274 load_dbase_schema sakila
275 load_dbase_data sakila
276
277@@ -11,7 +10,7 @@
278 backup_dir=`grep "innobackupex: Backup created in directory" $OUTFILE | awk -F\' '{ print $2}'`
279 vlog "Backup dir in $backup_dir"
280
281-stop_mysqld
282+stop_server
283 # Remove datadir
284 rm -r $mysql_datadir
285 # Restore sakila
286@@ -28,6 +27,6 @@
287 echo "###########" >> $OUTFILE
288 innobackupex --copy-back $full_backup_dir >> $OUTFILE 2>&1
289
290-run_mysqld
291+start_server
292 # Check sakila
293 ${MYSQL} ${MYSQL_ARGS} -e "SELECT count(*) from actor" sakila
294
295=== modified file 'test/experimental/xb_race_drop.sh'
296--- test/experimental/xb_race_drop.sh 2011-06-10 07:55:26 +0000
297+++ test/experimental/xb_race_drop.sh 2012-06-12 10:40:23 +0000
298@@ -1,7 +1,31 @@
299 . inc/common.sh
300
301-init
302-run_mysqld --innodb_file_per_table
303+function race_create_drop()
304+{
305+ vlog "Started create/drop table cycle"
306+ race_cycle_num=$1
307+ if [ -z $race_cycle_num ]
308+ then
309+ race_cycle_num=1000
310+ fi
311+ run_cmd ${MYSQL} ${MYSQL_ARGS} -e "create database race;"
312+ race_cycle_cnt=0;
313+ while [ "$race_cycle_num" -gt "$race_cycle_cnt"]
314+ do
315+ t1=tr$RANDOM
316+ t2=tr$RANDOM
317+ t3=tr$RANDOM
318+ ${MYSQL} ${MYSQL_ARGS} -e "create table $t1 (a int) ENGINE=InnoDB;" race
319+ ${MYSQL} ${MYSQL_ARGS} -e "create table $t2 (a int) ENGINE=InnoDB;" race
320+ ${MYSQL} ${MYSQL_ARGS} -e "create table $t3 (a int) ENGINE=InnoDB;" race
321+ ${MYSQL} ${MYSQL_ARGS} -e "drop table $t1;" race
322+ ${MYSQL} ${MYSQL_ARGS} -e "drop table $t2;" race
323+ ${MYSQL} ${MYSQL_ARGS} -e "drop table $t3;" race
324+ let "race_cycle_cnt=race_cycle_cnt+1"
325+ done
326+}
327+
328+start_server --innodb_file_per_table
329
330 run_cmd race_create_drop &
331
332
333=== modified file 'test/inc/common.sh'
334--- test/inc/common.sh 2012-02-10 20:05:56 +0000
335+++ test/inc/common.sh 2012-06-12 10:40:23 +0000
336@@ -17,25 +17,10 @@
337 echo "`date +"%F %T"`: `basename "$0"`: $@" >&2
338 }
339
340-function clean_datadir()
341-{
342- vlog "Removing MySQL data directory: $mysql_datadir"
343- rm -rf "$mysql_datadir"
344- vlog "Creating MySQL data directory: $mysql_datadir"
345- mkdir -p "$mysql_datadir"
346- init_mysql_dir
347-}
348
349 function clean()
350 {
351- vlog "Removing temporary $topdir"
352- rm -rf "$topdir"
353-}
354-function clean_on_error()
355-{
356-vlog "Exit on error"
357-clean
358-exit -1
359+ rm -rf ${TEST_BASEDIR}/var[0-9]
360 }
361
362 function die()
363@@ -44,86 +29,46 @@
364 exit 1
365 }
366
367-function initdir()
368-{
369- if test -d "$topdir"
370- then
371- vlog "Directory $topdir exists. Removing it..."
372- rm -r "$topdir"
373- fi
374- vlog "Creating temporary directory: $topdir"
375- mkdir -p "$topdir/tmp"
376- vlog "Creating MySQL data directory: $mysql_datadir"
377- mkdir -p "$mysql_datadir"
378-}
379-
380 function init_mysql_dir()
381 {
382- vlog "Creating MySQL database"
383- $MYSQL_INSTALL_DB --no-defaults --basedir=$MYSQL_BASEDIR --datadir="$mysql_datadir" --tmpdir="$mysql_tmpdir"
384-}
385-function set_mysql_port()
386-{
387- i=$mysql_port
388- while [ $i -lt 65536 ]
389- do
390- # check if port $i is used
391- vlog "Checking port $i"
392- port_status=`netstat -an | grep LISTEN | grep tcp | grep -w "$i " || true`
393- if test -z "$port_status"
394- then
395- # port is not used
396- vlog "Port $i is free"
397- mysql_port=$i
398- break
399- else
400- vlog "Port $i is used"
401- let i=$i+1
402- fi
403- done
404+ if [ ! -d "$MYSQLD_VARDIR" ]
405+ then
406+ vlog "Creating server root directory: $MYSQLD_VARDIR"
407+ mkdir "$MYSQLD_VARDIR"
408+ fi
409+ if [ ! -d "$MYSQLD_TMPDIR" ]
410+ then
411+ vlog "Creating server temporary directory: $MYSQLD_TMPDIR"
412+ mkdir "$MYSQLD_TMPDIR"
413+ fi
414+ if [ ! -d "$MYSQLD_DATADIR" ]
415+ then
416+ vlog "Creating server data directory: $MYSQLD_DATADIR"
417+ mkdir -p "$MYSQLD_DATADIR"
418+ vlog "Calling mysql_install_db"
419+ $MYSQL_INSTALL_DB --no-defaults --basedir=$MYSQL_BASEDIR --datadir="$MYSQLD_DATADIR" --tmpdir="$MYSQLD_TMPDIR"
420+ fi
421 }
422
423+########################################################################
424 # Checks whether MySQL is alive
425+########################################################################
426 function mysql_ping()
427 {
428- local result="0"
429- if test -S ${mysql_socket}
430- then
431- result=`${MYSQL} ${MYSQL_ARGS} -e "SELECT IF(COUNT(*)>=0, 1, 1) FROM user;" -s --skip-column-names mysql 2>/dev/null` || result="0"
432- else
433- result="0"
434- fi
435- echo $result
436+ $MYSQLADMIN $MYSQL_ARGS --wait=100 ping >/dev/null 2>&1 || return 1
437 }
438
439 function kill_leftovers()
440 {
441- while test -f "$PIDDIR/mysqld.pid"
442- do
443- vlog "Found a leftover mysqld processes with PID `cat $PIDDIR/mysqld.pid`, stopping it"
444- stop_mysqld 2> /dev/null
445- done
446-}
447-
448-function run_mysqld()
449-{
450- local c=0
451- kill_leftovers
452- ${MYSQLD} ${MYSQLD_ARGS} $* --pid-file="$PIDDIR/mysqld.pid" &
453- while [ "`mysql_ping`" != "1" ]
454- do
455- if [ ${c} -eq 100 ]
456- then
457- vlog "Can't run MySQL!"
458- clean_on_error
459- fi
460- let c=${c}+1
461- sleep 1
462- done
463- if [ -n "$MYSQL_VERSION" -a -n "$INNODB_VERSION" ]
464- then
465- vlog "MySQL $MYSQL_VERSION (InnoDB $INNODB_VERSION) started successfully"
466- fi
467+ local file
468+ for file in ${TEST_BASEDIR}/mysqld*.pid
469+ do
470+ if [ -f $file ]
471+ then
472+ vlog "Found a leftover mysqld processes with PID `cat $file`, stopping it"
473+ kill -9 `cat $file` 2>/dev/null || true
474+ fi
475+ done
476 }
477
478 function run_cmd()
479@@ -152,21 +97,6 @@
480 fi
481 }
482
483-function stop_mysqld()
484-{
485- if [ -f "$PIDDIR/mysqld.pid" ]
486- then
487- ${MYSQLADMIN} ${MYSQL_ARGS} shutdown
488- vlog "Database server has been stopped"
489- if [ -f "$PIDDIR/mysqld.pid" ]
490- then
491- sleep 1;
492- kill -9 `cat $PIDDIR/mysqld.pid`
493- rm -f $PIDDIR/mysqld.pid
494- fi
495- fi
496-}
497-
498 function load_sakila()
499 {
500 vlog "Loading sakila"
501@@ -196,39 +126,236 @@
502 run_cmd ${MYSQL} ${MYSQL_ARGS} -e "DROP DATABASE $1"
503 }
504
505-function init()
506-{
507-initdir
508-init_mysql_dir
509-echo "
510+########################################################################
511+# Choose a free port for a MySQL server instance
512+########################################################################
513+function get_free_port()
514+{
515+ local id=$1
516+ local port
517+ local lockfile
518+
519+ for (( port=PORT_BASE+id; port < 65535; port++))
520+ do
521+ lockfile="/tmp/xtrabackup_port_lock.$port"
522+ # Try to atomically lock the current port number
523+ if ! set -C > $lockfile
524+ then
525+ set +C
526+ # check if the process still exists
527+ if kill -0 "`cat $lockfile`"
528+ then
529+ continue;
530+ fi
531+ # stale file, overwrite it with the current PID
532+ fi
533+ set +C
534+ echo $$ > $lockfile
535+ if ! nc -z -w1 localhost $port >/dev/null 2>&1
536+ then
537+ echo $port
538+ return 0
539+ fi
540+ rm -f $lockfile
541+ done
542+
543+ die "Could not find a free port for server id $id!"
544+}
545+
546+########################################################################
547+# Initialize server variables such as datadir, tmpdir, etc. and store
548+# them with the specified index in SRV_MYSQLD_* arrays to be used by
549+# switch_server() later
550+########################################################################
551+function init_server_variables()
552+{
553+ local id=$1
554+
555+ if [ -n ${SRV_MYSQLD_IDS[$id]:-""} ]
556+ then
557+ die "Server with id $id has already been started"
558+ fi
559+
560+ SRV_MYSQLD_IDS[$id]="$id"
561+ local vardir="${TEST_BASEDIR}/var${id}"
562+ SRV_MYSQLD_VARDIR[$id]="$vardir"
563+ SRV_MYSQLD_DATADIR[$id]="$vardir/data"
564+ SRV_MYSQLD_TMPDIR[$id]="$vardir/tmp"
565+ SRV_MYSQLD_PIDFILE[$id]="${TEST_BASEDIR}/mysqld${id}.pid"
566+ SRV_MYSQLD_PORT[$id]=`get_free_port $id`
567+ SRV_MYSQLD_SOCKET[$id]=`mktemp -t xtrabackup.mysql.sock.XXXXXX`
568+}
569+
570+########################################################################
571+# Reset server variables
572+########################################################################
573+function reset_server_variables()
574+{
575+ local id=$1
576+
577+ if [ -z ${SRV_MYSQLD_VARDIR[$id]:-""} ]
578+ then
579+ # Variables have already been reset
580+ return 0;
581+ fi
582+
583+ SRV_MYSQLD_IDS[$id]=
584+ SRV_MYSQLD_VARDIR[$id]=
585+ SRV_MYSQLD_DATADIR[$id]=
586+ SRV_MYSQLD_TMPDIR[$id]=
587+ SRV_MYSQLD_PIDFILE[$id]=
588+ SRV_MYSQLD_PORT[$id]=
589+ SRV_MYSQLD_SOCKET[$id]=
590+}
591+
592+##########################################################################
593+# Change the environment to make all utilities access the server with an
594+# id specified in the argument.
595+##########################################################################
596+function switch_server()
597+{
598+ local id=$1
599+
600+ MYSQLD_VARDIR="${SRV_MYSQLD_VARDIR[$id]}"
601+ MYSQLD_DATADIR="${SRV_MYSQLD_DATADIR[$id]}"
602+ MYSQLD_TMPDIR="${SRV_MYSQLD_TMPDIR[$id]}"
603+ MYSQLD_PIDFILE="${SRV_MYSQLD_PIDFILE[$id]}"
604+ MYSQLD_PORT="${SRV_MYSQLD_PORT[$id]}"
605+ MYSQLD_SOCKET="${SRV_MYSQLD_SOCKET[$id]}"
606+
607+ MYSQL_ARGS="--no-defaults --socket=${MYSQLD_SOCKET} --user=root"
608+ MYSQLD_ARGS="--no-defaults --basedir=${MYSQL_BASEDIR} \
609+--socket=${MYSQLD_SOCKET} --port=${MYSQLD_PORT} --server-id=$id \
610+--datadir=${MYSQLD_DATADIR} --tmpdir=${MYSQLD_TMPDIR} --log-bin=mysql-bin \
611+--relay-log=mysql-relay-bin --pid-file=${MYSQLD_PIDFILE} ${MYSQLD_EXTRA_ARGS}"
612+ if [ "`whoami`" = "root" ]
613+ then
614+ MYSQLD_ARGS="$MYSQLD_ARGS --user=root"
615+ fi
616+
617+ IB_ARGS="--defaults-file=${MYSQLD_VARDIR}/my.cnf --user=root \
618+--socket=${MYSQLD_SOCKET} --ibbackup=$XB_BIN"
619+ XB_ARGS="--no-defaults"
620+
621+ # Some aliases for compatibility, as tests use the following names
622+ topdir="$MYSQLD_VARDIR"
623+ mysql_datadir="$MYSQLD_DATADIR"
624+ mysql_tmpdir="$MYSQLD_TMPDIR"
625+ mysql_socket="$MYSQLD_SOCKET"
626+}
627+
628+########################################################################
629+# Start server with the id specified as the first argument
630+########################################################################
631+function start_server_with_id()
632+{
633+ local id=$1
634+ shift
635+
636+ vlog "Starting server with id=$id..."
637+
638+ init_server_variables $id
639+ switch_server $id
640+
641+ init_mysql_dir
642+ cat > ${MYSQLD_VARDIR}/my.cnf <<EOF
643 [mysqld]
644-datadir=$mysql_datadir
645-tmpdir=$mysql_tmpdir" > $topdir/my.cnf
646-}
647-
648-function race_create_drop()
649-{
650- vlog "Started create/drop table cycle"
651- race_cycle_num=$1
652- if [ -z $race_cycle_num ]
653- then
654- race_cycle_num=1000
655- fi
656- run_cmd ${MYSQL} ${MYSQL_ARGS} -e "create database race;"
657- race_cycle_cnt=0;
658- while [ "$race_cycle_num" -gt "$race_cycle_cnt"]
659- do
660- t1=tr$RANDOM
661- t2=tr$RANDOM
662- t3=tr$RANDOM
663- ${MYSQL} ${MYSQL_ARGS} -e "create table $t1 (a int) ENGINE=InnoDB;" race
664- ${MYSQL} ${MYSQL_ARGS} -e "create table $t2 (a int) ENGINE=InnoDB;" race
665- ${MYSQL} ${MYSQL_ARGS} -e "create table $t3 (a int) ENGINE=InnoDB;" race
666- ${MYSQL} ${MYSQL_ARGS} -e "drop table $t1;" race
667- ${MYSQL} ${MYSQL_ARGS} -e "drop table $t2;" race
668- ${MYSQL} ${MYSQL_ARGS} -e "drop table $t3;" race
669- let "race_cycle_cnt=race_cycle_cnt+1"
670- done
671+datadir=${MYSQLD_DATADIR}
672+tmpdir=${MYSQLD_TMPDIR}
673+EOF
674+
675+ # Start the server
676+ ${MYSQLD} ${MYSQLD_ARGS} $* &
677+ if ! mysql_ping
678+ then
679+ die "Can't start the server!"
680+ fi
681+ vlog "Server with id=$id has been started on port $MYSQLD_PORT, \
682+socket $MYSQLD_SOCKET"
683+}
684+
685+########################################################################
686+# Stop server with the id specified as the first argument and additional
687+# command line arguments (if specified)
688+########################################################################
689+function stop_server_with_id()
690+{
691+ local id=$1
692+ switch_server $id
693+
694+ vlog "Stopping server with id=$id..."
695+
696+ if [ -f "${MYSQLD_PIDFILE}" ]
697+ then
698+ ${MYSQLADMIN} ${MYSQL_ARGS} --shutdown-timeout=60 shutdown
699+ if [ -f "${MYSQLD_PIDFILE}" ]
700+ then
701+ vlog "Could not stop the server with id=$id, using kill -9"
702+ kill -9 `cat ${MYSQLD_PIDFILE}`
703+ rm -f ${MYSQLD_PIDFILE}
704+ fi
705+ vlog "Server with id=$id has been stopped"
706+ else
707+ vlog "Server pid file '${MYSQLD_PIDFILE}' doesn't exist!"
708+ fi
709+
710+ # unlock the port number
711+ rm -f /tmp/xtrabackup_port_lock.$MYSQLD_PORT
712+
713+ reset_server_variables $id
714+}
715+
716+########################################################################
717+# Start server with id=1 and additional command line arguments
718+# (if specified)
719+########################################################################
720+function start_server()
721+{
722+ start_server_with_id 1 $*
723+}
724+
725+########################################################################
726+# Stop server with id=1
727+########################################################################
728+function stop_server()
729+{
730+ stop_server_with_id 1
731+}
732+
733+########################################################################
734+# Stop all running servers
735+########################################################################
736+function stop_all_servers()
737+{
738+ local id
739+ for id in ${SRV_MYSQLD_IDS[*]}
740+ do
741+ stop_server_with_id ${SRV_MYSQLD_IDS[$id]}
742+ done
743+}
744+
745+########################################################################
746+# Configure a specified server as a slave
747+# Synopsis:
748+# setup_slave <slave_id> <master_id>
749+#########################################################################
750+function setup_slave()
751+{
752+ local slave_id=$1
753+ local master_id=$2
754+
755+ vlog "Setting up server #$slave_id as a slave of server #$master_id"
756+
757+ switch_server $slave_id
758+
759+ run_cmd $MYSQL $MYSQL_ARGS <<EOF
760+CHANGE MASTER TO
761+ MASTER_HOST='localhost',
762+ MASTER_USER='root',
763+ MASTER_PORT=${SRV_MYSQLD_PORT[$master_id]};
764+
765+START SLAVE
766+EOF
767 }
768
769 ########################################################################
770@@ -239,3 +366,6 @@
771 {
772 $MYSQL $MYSQL_ARGS -Ns -e "CHECKSUM TABLE $2" $1 | awk {'print $2'}
773 }
774+
775+# To avoid unbound variable error when no server have been started
776+SRV_MYSQLD_IDS=
777
778=== modified file 'test/inc/ib_stream_common.sh'
779--- test/inc/ib_stream_common.sh 2012-02-10 20:05:56 +0000
780+++ test/inc/ib_stream_common.sh 2012-06-12 10:40:23 +0000
781@@ -12,8 +12,8 @@
782
783 . inc/common.sh
784
785-init
786-run_mysqld --innodb_file_per_table
787+start_server --innodb_file_per_table
788+
789 load_dbase_schema sakila
790 load_dbase_data sakila
791
792@@ -23,7 +23,7 @@
793 mkdir -p $topdir/backup
794 innobackupex --stream=$stream_format $innobackupex_options $topdir/backup > $topdir/backup/out
795
796-stop_mysqld
797+stop_server
798
799 # Remove datadir
800 rm -r $mysql_datadir
801@@ -46,6 +46,6 @@
802 vlog "###########"
803 innobackupex --copy-back $backup_dir
804
805-run_mysqld
806+start_server
807 # Check sakila
808 run_cmd ${MYSQL} ${MYSQL_ARGS} -e "SELECT count(*) from actor" sakila
809
810=== modified file 'test/run.sh'
811--- test/run.sh 2012-02-10 20:05:56 +0000
812+++ test/run.sh 2012-06-12 10:40:23 +0000
813@@ -1,5 +1,7 @@
814 #!/bin/bash
815
816+export DEBUG=
817+
818 . inc/common.sh
819
820 set +e
821@@ -14,7 +16,7 @@
822 Usage: $0 [-f] [-g] [-h] [-s suite] [-t test_name] [-d mysql_basedir] [-c build_conf]
823 -f Continue running tests after failures
824 -d path Server installation directory. Default is './server'.
825--g Output debug information to results/*.out
826+-g Debug mode
827 -t path Run only a single named test
828 -h Print this help message
829 -s suite Select a test suite to run. Possible values: experimental, t.
830@@ -52,13 +54,9 @@
831
832 function set_vars()
833 {
834- topdir="`pwd`/var"
835- mysql_datadir="$topdir/mysql"
836- mysql_tmpdir="$topdir/tmp"
837- mysql_port="3306"
838- mysql_socket=`mktemp -t xtrabackup.mysql.sock.XXXXXX`
839- IB_ARGS="--defaults-file=$topdir/my.cnf --user=root --socket=$mysql_socket"
840- XB_ARGS="--no-defaults"
841+ TEST_BASEDIR="$PWD"
842+ MYSQL_BASEDIR=${MYSQL_BASEDIR:-"$PWD/server"}
843+ PORT_BASE=$((3306 + $RANDOM))
844
845 if gnutar --version > /dev/null 2>&1
846 then
847@@ -67,16 +65,6 @@
848 TAR=tar
849 fi
850
851- MYSQL_BASEDIR=${MYSQL_BASEDIR:-"$PWD/server"}
852-
853- MYSQL_ARGS="--no-defaults --socket=${mysql_socket} --user=root"
854-
855- MYSQLD_ARGS="--no-defaults --basedir=${MYSQL_BASEDIR} --socket=${mysql_socket} --datadir=$mysql_datadir --tmpdir=$mysql_tmpdir --skip-networking"
856- if [ "`whoami`" = "root" ]
857- then
858- MYSQLD_ARGS="$MYSQLD_ARGS --user=root"
859- fi
860-
861 find_program MYSQL_INSTALL_DB mysql_install_db $MYSQL_BASEDIR/bin \
862 $MYSQL_BASEDIR/scripts
863 find_program MYSQLD mysqld $MYSQL_BASEDIR/bin/ $MYSQL_BASEDIR/libexec
864@@ -92,22 +80,26 @@
865
866 PATH="${MYSQL_BASEDIR}/bin:$PATH"
867
868- export topdir mysql_datadir mysql_tmpdir mysql_port mysql_socket OUTFILE \
869- IB_ARGS XB_ARGS TAR MYSQL_BASEDIR MYSQL MYSQLADMIN \
870- MYSQL_ARGS MYSQLD_ARGS MYSQL_INSTALL_DB MYSQLD PATH
871+ export TEST_BASEDIR PORT_BASE TAR MYSQL_BASEDIR MYSQL MYSQLD MYSQLADMIN \
872+MYSQL_INSTALL_DB PATH
873 }
874
875 function get_version_info()
876 {
877+ MYSQLD_EXTRA_ARGS=
878+
879+ XB_BIN=""
880+ IB_ARGS="--user=root --ibbackup=$XB_BIN"
881+ XB_ARGS="--no-defaults"
882+
883 if [ "$XB_BUILD" != "autodetect" ]
884 then
885- XB_BIN=""
886 case "$XB_BUILD" in
887 "innodb51_builtin" )
888 XB_BIN="xtrabackup_51";;
889 "innodb51" )
890 XB_BIN="xtrabackup_plugin"
891- MYSQLD_ARGS="$MYSQLD_ARGS --ignore-builtin-innodb --plugin-load=innodb=ha_innodb_plugin.so";;
892+ MYSQLD_EXTRA_ARGS="--ignore-builtin-innodb --plugin-load=innodb=ha_innodb_plugin.so";;
893 "innodb55" )
894 XB_BIN="xtrabackup_innodb55";;
895 "xtradb51" )
896@@ -124,11 +116,11 @@
897 fi
898 fi
899
900- init >>$OUTFILE 2>&1
901-
902 MYSQL_VERSION=""
903 INNODB_VERSION=""
904- run_mysqld >>$OUTFILE 2>&1
905+
906+ start_server >>$OUTFILE 2>&1
907+
908 # Get MySQL and InnoDB versions
909 MYSQL_VERSION=`$MYSQL ${MYSQL_ARGS} -Nsf -e "SHOW VARIABLES LIKE 'version'"`
910 MYSQL_VERSION=${MYSQL_VERSION#"version "}
911@@ -178,15 +170,15 @@
912 vlog "Cannot find 'innobackupex' in PATH"
913 return 1
914 fi
915- IB_ARGS="$IB_ARGS --ibbackup=$XB_BIN"
916+
917+ stop_server
918
919 export MYSQL_VERSION MYSQL_VERSION_COMMENT INNODB_VERSION XTRADB_VERSION \
920- XB_BIN IB_BIN IB_ARGS
921+ XB_BIN IB_BIN IB_ARGS XB_ARGS MYSQLD_EXTRA_ARGS
922 }
923
924 export SKIPPED_EXIT_CODE=200
925
926-
927 tname=""
928 XTRACE_OPTION=""
929 XB_BUILD="autodetect"
930@@ -195,7 +187,7 @@
931 case $options in
932 f ) force="yes";;
933 t ) tname="$OPTARG";;
934- g ) XTRACE_OPTION="-x";;
935+ g ) XTRACE_OPTION="-x"; DEBUG=on;;
936 h ) usage; exit;;
937 s ) tname="$OPTARG/*.sh";;
938 d ) export MYSQL_BASEDIR="$OPTARG";;
939@@ -219,7 +211,8 @@
940 total_count=0
941
942 export OUTFILE="$PWD/results/setup"
943-export PIDDIR="$PWD"
944+
945+clean >>$OUTFILE 2>&1
946
947 if ! get_version_info
948 then
949@@ -258,6 +251,12 @@
950 bash $XTRACE_OPTION $t > $OUTFILE 2>&1
951 rc=$?
952
953+ if [[ -z "$DEBUG" || -n "$force" ]]
954+ then
955+ kill_leftovers >>$OUTFILE 2>&1
956+ clean >>$OUTFILE 2>&1
957+ fi
958+
959 if [ $rc -eq 0 ]
960 then
961 echo "[passed]"
962@@ -284,20 +283,12 @@
963 then
964 break;
965 fi
966- fi
967-
968- stop_mysqld >/dev/null 2>&1
969- clean >/dev/null 2>&1
970+ fi
971 done
972
973 echo "========================================================================"
974 echo
975
976-if [ -n "$force" -o $failed_count -eq 0 ]
977-then
978- kill_leftovers
979-fi
980-
981 if [ $result -eq 1 ]
982 then
983 echo
984
985=== modified file 'test/t/bug1002688.sh'
986--- test/t/bug1002688.sh 2012-05-22 14:52:54 +0000
987+++ test/t/bug1002688.sh 2012-06-12 10:40:23 +0000
988@@ -3,8 +3,7 @@
989 ############################################################################
990 . inc/common.sh
991
992-init
993-run_mysqld --innodb_file_per_table
994+start_server --innodb_file_per_table
995 load_sakila
996
997 # Full backup
998@@ -44,7 +43,7 @@
999 vlog "Data prepared for restore"
1000
1001 # Destroying mysql data
1002-stop_mysqld
1003+stop_server
1004 rm -rf $mysql_datadir/*
1005 vlog "Data destroyed"
1006
1007@@ -53,7 +52,7 @@
1008 innobackupex --copy-back $full_backup_dir
1009 vlog "Data restored"
1010
1011-run_mysqld --innodb_file_per_table
1012+start_server --innodb_file_per_table
1013
1014 vlog "Checking checksums"
1015 checksum_b=`checksum_table newdb actor_copy`
1016
1017=== modified file 'test/t/bug483827.sh'
1018--- test/t/bug483827.sh 2012-05-18 11:19:17 +0000
1019+++ test/t/bug483827.sh 2012-06-12 10:40:23 +0000
1020@@ -10,12 +10,9 @@
1021
1022 . inc/common.sh
1023
1024-init
1025-mv ${mysql_datadir} ${mysql_datadir}1
1026-run_mysqld --datadir=${mysql_datadir}1
1027+start_server
1028
1029 backup_dir=$topdir/backup
1030-rm -rf $backup_dir
1031
1032 # change defaults file from my.cnf to my_multi.cnf
1033 modify_args
1034@@ -23,23 +20,23 @@
1035 # make my_multi.cnf
1036 echo "
1037 [mysqld1]
1038-datadir=${mysql_datadir}1
1039+datadir=${mysql_datadir}
1040 tmpdir=$mysql_tmpdir" > $topdir/my_multi.cnf
1041
1042 # Backup
1043 innobackupex --no-timestamp --defaults-group=mysqld1 $backup_dir
1044 innobackupex --apply-log $backup_dir
1045
1046-stop_mysqld
1047+stop_server
1048
1049 # clean datadir
1050-rm -rf ${mysql_datadir}1/*
1051+rm -rf ${mysql_datadir}/*
1052
1053 # restore backup
1054 innobackupex --copy-back --defaults-group=mysqld1 $backup_dir
1055
1056 # make sure that data are in correct place
1057-if [ ! -f ${mysql_datadir}1/ibdata1 ] ; then
1058- vlog "Data not found in ${mysql_datadir}1"
1059+if [ ! -f ${mysql_datadir}/ibdata1 ] ; then
1060+ vlog "Data not found in ${mysql_datadir}"
1061 exit -1
1062 fi
1063
1064=== modified file 'test/t/bug489290.sh'
1065--- test/t/bug489290.sh 2012-02-13 12:07:03 +0000
1066+++ test/t/bug489290.sh 2012-06-12 10:40:23 +0000
1067@@ -4,8 +4,7 @@
1068
1069 . inc/common.sh
1070
1071-init
1072-run_mysqld
1073+start_server
1074
1075 backup_dir=$topdir/backup
1076 mkdir -p $backup_dir
1077
1078=== modified file 'test/t/bug514068.sh'
1079--- test/t/bug514068.sh 2012-02-10 20:05:56 +0000
1080+++ test/t/bug514068.sh 2012-06-12 10:40:23 +0000
1081@@ -5,12 +5,11 @@
1082
1083 . inc/common.sh
1084
1085-init
1086-run_mysqld
1087+start_server
1088
1089 innobackupex --no-timestamp $topdir/backup >$topdir/stdout 2>$topdir/stderr
1090
1091-stop_mysqld
1092+stop_server
1093 # Remove datadir
1094 rm -r $mysql_datadir
1095
1096
1097=== modified file 'test/t/bug606981.sh'
1098--- test/t/bug606981.sh 2012-02-10 20:05:56 +0000
1099+++ test/t/bug606981.sh 2012-06-12 10:40:23 +0000
1100@@ -6,15 +6,15 @@
1101 exit $SKIPPED_EXIT_CODE
1102 fi
1103
1104-init
1105-run_mysqld
1106+start_server --innodb_file_per_table
1107+
1108 load_sakila
1109
1110 # Take backup
1111 echo "innodb_flush_method=O_DIRECT" >> $topdir/my.cnf
1112 mkdir -p $topdir/backup
1113 innobackupex --stream=tar $topdir/backup > $topdir/backup/out.tar
1114-stop_mysqld
1115+stop_server
1116
1117 # See if xtrabackup was using O_DIRECT
1118 if ! grep "xtrabackup: using O_DIRECT" $OUTFILE ;
1119@@ -36,6 +36,6 @@
1120 mkdir -p $mysql_datadir
1121 innobackupex --copy-back --defaults-file=$topdir/my.cnf $backup_dir
1122
1123-run_mysqld
1124+start_server
1125 # Check sakila
1126 ${MYSQL} ${MYSQL_ARGS} -e "SELECT count(*) from actor" sakila
1127
1128=== modified file 'test/t/bug722638.sh'
1129--- test/t/bug722638.sh 2011-09-14 15:32:21 +0000
1130+++ test/t/bug722638.sh 2012-06-12 10:40:23 +0000
1131@@ -3,15 +3,14 @@
1132 # created breaks backup
1133 ########################################################################
1134
1135-if ! `$XB_BIN --help | grep debug-sync > /dev/null`; then
1136+. inc/common.sh
1137+
1138+if ! $XB_BIN --help 2>&1 | grep -q debug-sync; then
1139 echo "Requires --debug-sync support" > $SKIPPED_REASON
1140 exit $SKIPPED_EXIT_CODE
1141 fi
1142
1143-. inc/common.sh
1144-
1145-init
1146-run_mysqld --innodb_file_per_table
1147+start_server --innodb_file_per_table
1148
1149 run_cmd $MYSQL $MYSQL_ARGS test <<EOF
1150
1151@@ -88,14 +87,14 @@
1152 # Prepare
1153 xtrabackup --datadir=$mysql_datadir --prepare --target-dir=$topdir/backup
1154
1155-stop_mysqld
1156+stop_server
1157
1158 # Restore
1159 rm -rf $mysql_datadir/ibdata1 $mysql_datadir/ib_logfile* \
1160 $mysql_datadir/test/*.ibd
1161 cp -r $topdir/backup/* $mysql_datadir
1162
1163-run_mysqld --innodb_file_per_table
1164+start_server --innodb_file_per_table
1165
1166 # Verify checksums
1167 checksum_t1_new=`checksum_table test t1`
1168
1169=== modified file 'test/t/bug723097.sh'
1170--- test/t/bug723097.sh 2012-02-02 20:35:45 +0000
1171+++ test/t/bug723097.sh 2012-06-12 10:40:23 +0000
1172@@ -1,7 +1,6 @@
1173 . inc/common.sh
1174
1175-init
1176-run_mysqld --innodb_file_per_table
1177+start_server --innodb_file_per_table
1178
1179 vlog "Loading data from sql file"
1180 run_cmd ${MYSQL} ${MYSQL_ARGS} test < inc/bug723097.sql
1181@@ -18,12 +17,12 @@
1182 vlog "Backup is done"
1183 xtrabackup --datadir=$mysql_datadir --prepare --target-dir=$topdir/data/full
1184 vlog "Data prepared fo restore"
1185-stop_mysqld
1186+stop_server
1187
1188 cd $topdir/data/full/test
1189 cp -r * $mysql_datadir/test
1190 cd -
1191-run_mysqld --innodb_file_per_table
1192+start_server --innodb_file_per_table
1193 checksum_b=`checksum_table test messages`
1194 vlog "Checksum after is $checksum_b"
1195
1196
1197=== modified file 'test/t/bug723318.sh'
1198--- test/t/bug723318.sh 2011-10-13 17:36:00 +0000
1199+++ test/t/bug723318.sh 2012-06-12 10:40:23 +0000
1200@@ -1,7 +1,7 @@
1201 . inc/common.sh
1202
1203-init
1204-run_mysqld
1205+start_server
1206+
1207 load_dbase_schema sakila
1208 load_dbase_data sakila
1209
1210@@ -10,7 +10,8 @@
1211 mkdir -p $topdir/backup/stream
1212 innobackupex --stream=tar $topdir/backup > $topdir/backup/stream/out.tar
1213
1214-stop_mysqld
1215+stop_server
1216+
1217 cd $topdir/backup/stream/
1218 $TAR -ixvf out.tar
1219
1220
1221=== modified file 'test/t/bug729843.sh'
1222--- test/t/bug729843.sh 2011-11-25 18:50:56 +0000
1223+++ test/t/bug729843.sh 2012-06-12 10:40:23 +0000
1224@@ -4,8 +4,7 @@
1225
1226 . inc/common.sh
1227
1228-init
1229-run_mysqld
1230+start_server
1231
1232 mkdir $topdir/backup
1233 logfile=$topdir/backup/innobackupex_log
1234
1235=== modified file 'test/t/bug733651.sh'
1236--- test/t/bug733651.sh 2012-01-31 11:15:25 +0000
1237+++ test/t/bug733651.sh 2012-06-12 10:40:23 +0000
1238@@ -5,14 +5,12 @@
1239
1240 . inc/common.sh
1241
1242-init
1243-
1244 options="innodb_log_files_in_group innodb_log_file_size"
1245 if [ ! -z "$XTRADB_VERSION" ]; then
1246 options="$options innodb_page_size innodb_fast_checksum innodb_log_block_size"
1247 fi
1248
1249-run_mysqld
1250+start_server
1251
1252 mkdir -p $topdir/backup
1253 innobackupex $topdir/backup
1254
1255=== modified file 'test/t/bug759225.sh'
1256--- test/t/bug759225.sh 2012-02-10 20:05:56 +0000
1257+++ test/t/bug759225.sh 2012-06-12 10:40:23 +0000
1258@@ -16,15 +16,14 @@
1259 exit $SKIPPED_EXIT_CODE
1260 fi
1261
1262-init
1263-run_mysqld
1264+start_server
1265 load_sakila
1266
1267 # Take backup
1268 echo "innodb_flush_method=ALL_O_DIRECT" >> $topdir/my.cnf
1269 mkdir -p $topdir/backup
1270 innobackupex --stream=tar $topdir/backup > $topdir/backup/out.tar
1271-stop_mysqld
1272+stop_server
1273
1274 # See if xtrabackup was using ALL_O_DIRECT
1275 if ! grep "xtrabackup: using ALL_O_DIRECT" $OUTFILE ;
1276@@ -46,6 +45,6 @@
1277 mkdir -p $mysql_datadir
1278 innobackupex --copy-back --defaults-file=$topdir/my.cnf $backup_dir
1279
1280-run_mysqld
1281+start_server
1282 # Check sakila
1283 ${MYSQL} ${MYSQL_ARGS} -e "SELECT count(*) from actor" sakila
1284
1285=== modified file 'test/t/bug759701.sh'
1286--- test/t/bug759701.sh 2012-02-02 20:35:45 +0000
1287+++ test/t/bug759701.sh 2012-06-12 10:40:23 +0000
1288@@ -4,8 +4,7 @@
1289 ##########################################################################
1290 . inc/common.sh
1291
1292-init
1293-run_mysqld --innodb_file_per_table
1294+start_server --innodb_file_per_table
1295 load_sakila
1296
1297 # Full backup
1298@@ -45,7 +44,7 @@
1299 vlog "Data prepared for restore"
1300
1301 # Destroying mysql data
1302-stop_mysqld
1303+stop_server
1304 rm -rf $mysql_datadir/*
1305 vlog "Data destroyed"
1306
1307@@ -54,7 +53,7 @@
1308 innobackupex --copy-back $full_backup_dir
1309 vlog "Data restored"
1310
1311-run_mysqld --innodb_file_per_table
1312+start_server --innodb_file_per_table
1313
1314 vlog "Checking checksums"
1315 checksum_b=`checksum_table newdb actor_copy`
1316
1317=== modified file 'test/t/bug766033.sh'
1318--- test/t/bug766033.sh 2012-03-09 05:24:24 +0000
1319+++ test/t/bug766033.sh 2012-06-12 10:40:23 +0000
1320@@ -4,25 +4,20 @@
1321
1322 . inc/common.sh
1323
1324-init
1325-run_mysqld --innodb_file_per_table
1326+start_server --innodb_file_per_table
1327 load_sakila
1328
1329-stop_mysqld
1330+stop_server
1331
1332 # Full backup
1333 vlog "Starting backup"
1334
1335 # corrupt database
1336-dd if=/dev/zero of=$mysql_datadir/sakila/rental.ibd seek=1000 count=16384
1337+dd if=/dev/zero of=$mysql_datadir/sakila/rental.ibd seek=1000 count=1
1338
1339 # we want xtrabackup to be failed on rental.ibd
1340-set +e
1341-COUNT=`xtrabackup --backup --datadir=$mysql_datadir --target-dir=$topdir/backup 2>&1 \
1342- | grep "File ./sakila/rental.ibd seems to be corrupted" | wc -l `
1343-set -e
1344-
1345-if [ "$COUNT" != "1" ] ; then
1346- vlog "test failed"
1347- exit 1
1348-fi
1349+run_cmd_expect_failure $XB_BIN $XB_ARGS --backup --datadir=$mysql_datadir \
1350+ --target-dir=$topdir/backup
1351+
1352+grep -q "File ./sakila/rental.ibd seems to be corrupted" $OUTFILE
1353+
1354
1355=== modified file 'test/t/bug766607.sh'
1356--- test/t/bug766607.sh 2011-07-05 04:17:41 +0000
1357+++ test/t/bug766607.sh 2012-06-12 10:40:23 +0000
1358@@ -1,7 +1,6 @@
1359 . inc/common.sh
1360
1361-init
1362-run_mysqld --innodb_file_per_table
1363+start_server --innodb_file_per_table
1364 load_dbase_schema incremental_sample
1365
1366 # Full backup dir
1367@@ -18,8 +17,8 @@
1368 FLUSH LOGS;
1369 EOF
1370
1371-stop_mysqld
1372-run_mysqld --innodb_file_per_table
1373+stop_server
1374+start_server --innodb_file_per_table
1375
1376 vlog "Making incremental backup"
1377 xtrabackup --datadir=$mysql_datadir --backup --target-dir=$topdir/data/delta --incremental-basedir=$topdir/data/full
1378@@ -37,7 +36,7 @@
1379 xtrabackup --datadir=$mysql_datadir --prepare --target-dir=$topdir/data/full
1380 vlog "Data prepared for restore"
1381
1382-stop_mysqld
1383+stop_server
1384
1385 vlog "Copying files"
1386
1387@@ -46,6 +45,6 @@
1388 cd $topdir
1389
1390 vlog "Data restored"
1391-run_mysqld --innodb_file_per_table
1392+start_server --innodb_file_per_table
1393
1394 run_cmd $MYSQL $MYSQL_ARGS -e "SELECT * FROM t" test
1395
1396=== modified file 'test/t/bug810269.sh'
1397--- test/t/bug810269.sh 2011-09-14 17:41:10 +0000
1398+++ test/t/bug810269.sh 2012-06-12 10:40:23 +0000
1399@@ -5,14 +5,12 @@
1400
1401 . inc/common.sh
1402
1403-init
1404-
1405 if [ -z "$INNODB_VERSION" ]; then
1406 echo "Requires InnoDB plugin or XtraDB" >$SKIPPED_REASON
1407 exit $SKIPPED_EXIT_CODE
1408 fi
1409
1410-run_mysqld "--innodb_strict_mode --innodb_file_per_table \
1411+start_server "--innodb_strict_mode --innodb_file_per_table \
1412 --innodb_file_format=Barracuda"
1413
1414 load_dbase_schema incremental_sample
1415@@ -54,7 +52,7 @@
1416
1417 innobackupex --stream=tar $topdir/backup > $topdir/backup/out.tar
1418
1419-stop_mysqld
1420+stop_server
1421 rm -rf $mysql_datadir
1422
1423 vlog "Applying log"
1424@@ -68,7 +66,7 @@
1425 mkdir -p $mysql_datadir
1426 innobackupex --copy-back $topdir/backup
1427
1428-run_mysqld
1429+start_server
1430
1431 checksum_b=`checksum_table incremental_sample test`
1432
1433
1434=== modified file 'test/t/bug817132.sh'
1435--- test/t/bug817132.sh 2012-02-02 20:35:45 +0000
1436+++ test/t/bug817132.sh 2012-06-12 10:40:23 +0000
1437@@ -12,8 +12,7 @@
1438 exit $SKIPPED_EXIT_CODE
1439 fi
1440
1441-init
1442-run_mysqld
1443+start_server
1444 load_dbase_schema sakila
1445 load_dbase_data sakila
1446
1447@@ -22,7 +21,7 @@
1448 backup_dir=`grep "innobackupex: Backup created in directory" $OUTFILE | awk -F\' '{ print $2}'`
1449 vlog "Backup created in directory $backup_dir"
1450
1451-stop_mysqld
1452+stop_server
1453 # Remove datadir
1454 rm -r $mysql_datadir
1455
1456@@ -37,6 +36,6 @@
1457 # --ibbackup explicitly (see $IB_ARGS).
1458 run_cmd $IB_BIN --defaults-file=$topdir/my.cnf --user=root --socket=$mysql_socket --copy-back $backup_dir
1459
1460-run_mysqld
1461+start_server
1462 # Check sakila
1463 run_cmd ${MYSQL} ${MYSQL_ARGS} -e "SELECT count(*) from actor" sakila
1464
1465=== modified file 'test/t/bug884737.sh'
1466--- test/t/bug884737.sh 2011-11-01 16:17:02 +0000
1467+++ test/t/bug884737.sh 2012-06-12 10:40:23 +0000
1468@@ -5,8 +5,7 @@
1469
1470 . inc/common.sh
1471
1472-init
1473-run_mysqld
1474+start_server
1475
1476 # Check that --parallel=<negative value> doesn't blow up
1477 vlog "Creating the backup directory: $topdir/backup"
1478
1479=== modified file 'test/t/bug891496.sh'
1480--- test/t/bug891496.sh 2012-02-02 20:35:45 +0000
1481+++ test/t/bug891496.sh 2012-06-12 10:40:23 +0000
1482@@ -4,17 +4,14 @@
1483
1484 . inc/common.sh
1485
1486-init
1487-
1488 innodb_data_file_path="ibdata1:3M;ibdata2:10M:autoextend"
1489
1490+start_server --innodb_data_file_path=$innodb_data_file_path
1491+
1492 cat >> $topdir/my.cnf <<EOF
1493 innodb_data_file_path=$innodb_data_file_path
1494 EOF
1495
1496-MYSQLD_ARGS="$MYSQLD_ARGS --innodb_data_file_path=$innodb_data_file_path"
1497-
1498-run_mysqld
1499 load_dbase_schema sakila
1500 load_dbase_data sakila
1501
1502@@ -22,7 +19,7 @@
1503 mkdir -p $topdir/backup
1504 innobackupex --stream=tar $topdir/backup > $topdir/backup/out.tar
1505
1506-stop_mysqld
1507+stop_server
1508 # Remove datadir
1509 rm -r $mysql_datadir
1510 # Restore sakila
1511@@ -42,6 +39,6 @@
1512 vlog "###########"
1513 innobackupex --copy-back $backup_dir
1514
1515-run_mysqld
1516+start_server --innodb_data_file_path=$innodb_data_file_path
1517 # Check sakila
1518 run_cmd ${MYSQL} ${MYSQL_ARGS} -e "SELECT count(*) from actor" sakila
1519
1520=== modified file 'test/t/bug972169.sh'
1521--- test/t/bug972169.sh 2012-05-15 16:53:07 +0000
1522+++ test/t/bug972169.sh 2012-06-12 10:40:23 +0000
1523@@ -4,9 +4,7 @@
1524
1525 . inc/common.sh
1526
1527-init
1528-
1529-run_mysqld
1530+start_server
1531
1532 run_cmd_expect_failure $XB_BIN $XB_ARGS --datadir=$mysql_datadir --backup \
1533 --compress --stream=tar
1534
1535=== added file 'test/t/bug977101.sh'
1536--- test/t/bug977101.sh 1970-01-01 00:00:00 +0000
1537+++ test/t/bug977101.sh 2012-06-12 10:40:23 +0000
1538@@ -0,0 +1,31 @@
1539+########################################################################
1540+# Bug #977101: --safe-slave-backup results in incorrect binlog info
1541+########################################################################
1542+
1543+. inc/common.sh
1544+
1545+master_id=1
1546+slave_id=2
1547+
1548+start_server_with_id $master_id
1549+start_server_with_id $slave_id
1550+
1551+setup_slave $slave_id $master_id
1552+
1553+# Full backup of the slave server
1554+switch_server $slave_id
1555+
1556+# Check that binlog info is correct with --safe-slave-backup
1557+innobackupex --no-timestamp --safe-slave-backup $topdir/backup
1558+egrep -q '^mysql-bin.000001[[:space:]]+[0-9]+[[:space:]]+$' \
1559+ $topdir/backup/xtrabackup_binlog_info
1560+
1561+# Check that both binlog info and slave info are correct with
1562+# --safe-slave-backup
1563+rm -rf $topdir/backup
1564+innobackupex --no-timestamp --slave-info --safe-slave-backup $topdir/backup
1565+egrep -q '^mysql-bin.000001[[:space:]]+[0-9]+[[:space:]]+$' \
1566+ $topdir/backup/xtrabackup_binlog_info
1567+egrep -q '^CHANGE MASTER TO MASTER_LOG_FILE='\''mysql-bin.000001'\'', MASTER_LOG_POS=[0-9]+$' \
1568+ $topdir/backup/xtrabackup_slave_info
1569+
1570
1571=== modified file 'test/t/bug983685.sh'
1572--- test/t/bug983685.sh 2012-05-21 07:54:00 +0000
1573+++ test/t/bug983685.sh 2012-06-12 10:40:23 +0000
1574@@ -4,12 +4,10 @@
1575
1576 . inc/common.sh
1577
1578-init
1579+start_server
1580
1581 options="innodb_data_file_path"
1582
1583-run_mysqld
1584-
1585 mkdir -p $topdir/backup
1586 innobackupex $topdir/backup
1587 backup_dir=`grep "innobackupex: Backup created in directory" $OUTFILE | awk -F\' '{ print $2}'`
1588
1589=== modified file 'test/t/bug983720_galerainfo.sh'
1590--- test/t/bug983720_galerainfo.sh 2012-04-20 06:59:15 +0000
1591+++ test/t/bug983720_galerainfo.sh 2012-06-12 10:40:23 +0000
1592@@ -16,8 +16,7 @@
1593 fi
1594 set -e
1595
1596-init
1597-run_mysqld --log-bin=`hostname`-bin --binlog-format=ROW --wsrep-provider=${MYSQL_BASEDIR}/libgalera_smm.so --wsrep_cluster_address=gcomm://
1598+start_server --log-bin=`hostname`-bin --binlog-format=ROW --wsrep-provider=${MYSQL_BASEDIR}/libgalera_smm.so --wsrep_cluster_address=gcomm://
1599
1600 # take a backup with stream mode
1601 mkdir -p $topdir/backup
1602
1603=== modified file 'test/t/bug983720_lrudump.sh'
1604--- test/t/bug983720_lrudump.sh 2012-04-20 06:59:15 +0000
1605+++ test/t/bug983720_lrudump.sh 2012-06-12 10:40:23 +0000
1606@@ -9,8 +9,7 @@
1607 exit $SKIPPED_EXIT_CODE
1608 fi
1609
1610-init
1611-run_mysqld
1612+start_server
1613
1614 # produce ib_lru_dump
1615 ${MYSQL} ${MYSQL_ARGS} -e "select * from information_schema.XTRADB_ADMIN_COMMAND /*!XTRA_LRU_DUMP*/;"
1616
1617=== modified file 'test/t/bug989397.sh'
1618--- test/t/bug989397.sh 2012-05-17 13:34:43 +0000
1619+++ test/t/bug989397.sh 2012-06-12 10:40:23 +0000
1620@@ -5,8 +5,7 @@
1621
1622 . inc/common.sh
1623
1624-init
1625-run_mysqld --innodb_file_per_table
1626+start_server --innodb_file_per_table
1627
1628 # create table which name ends with opt
1629 ${MYSQL} ${MYSQL_ARGS} -e "create table test.topt (a int auto_increment primary key);"
1630
1631=== modified file 'test/t/bug996493.sh'
1632--- test/t/bug996493.sh 2012-05-18 05:36:49 +0000
1633+++ test/t/bug996493.sh 2012-06-12 10:40:23 +0000
1634@@ -5,16 +5,14 @@
1635
1636 . inc/common.sh
1637
1638-init
1639-
1640-run_mysqld
1641+start_server
1642
1643 backup_dir=$topdir/backup
1644 innobackupex --no-timestamp $backup_dir
1645 vlog "Backup created in directory $backup_dir"
1646
1647 vlog "Stop mysqld"
1648-stop_mysqld
1649+stop_server
1650
1651 vlog "Remove datadir"
1652 rm -r $mysql_datadir/*
1653
1654=== modified file 'test/t/bug999750.sh'
1655--- test/t/bug999750.sh 2012-05-15 16:53:07 +0000
1656+++ test/t/bug999750.sh 2012-06-12 10:40:23 +0000
1657@@ -4,8 +4,6 @@
1658
1659 . inc/common.sh
1660
1661-init
1662-
1663 # Exclude the built-in InnoDB configuration as it requires a different format
1664 # for --incremental-lsn.
1665 if [ -z "$INNODB_VERSION" ]; then
1666@@ -13,7 +11,7 @@
1667 exit $SKIPPED_EXIT_CODE
1668 fi
1669
1670-run_mysqld
1671+start_server
1672
1673 run_cmd_expect_failure $XB_BIN $XB_ARGS --datadir=$mysql_datadir --backup \
1674 --incremental-lsn=0 --stream=tar
1675
1676=== modified file 'test/t/ib_binlog_info.sh'
1677--- test/t/ib_binlog_info.sh 2012-02-06 10:10:40 +0000
1678+++ test/t/ib_binlog_info.sh 2012-06-12 10:40:23 +0000
1679@@ -4,8 +4,7 @@
1680
1681 . inc/common.sh
1682
1683-init
1684-run_mysqld
1685+start_server
1686 load_sakila
1687
1688 innobackupex --no-timestamp $topdir/backup
1689
1690=== modified file 'test/t/ib_csm_csv.sh'
1691--- test/t/ib_csm_csv.sh 2012-02-02 20:35:45 +0000
1692+++ test/t/ib_csm_csv.sh 2012-06-12 10:40:23 +0000
1693@@ -1,7 +1,6 @@
1694 . inc/common.sh
1695
1696-init
1697-run_mysqld --innodb_file_per_table
1698+start_server --innodb_file_per_table
1699 run_cmd ${MYSQL} ${MYSQL_ARGS} -e "create database csv"
1700 run_cmd ${MYSQL} ${MYSQL_ARGS} -e "create table csm (a int NOT NULL ) ENGINE=CSV" csv
1701 # Adding initial rows
1702@@ -37,7 +36,7 @@
1703 vlog "Data prepared for restore"
1704
1705 # Destroying mysql data
1706-stop_mysqld
1707+stop_server
1708 rm -rf $mysql_datadir/*
1709 vlog "Data destroyed"
1710
1711@@ -49,7 +48,7 @@
1712 innobackupex --copy-back $full_backup_dir
1713 vlog "Data restored"
1714
1715-run_mysqld --innodb_file_per_table
1716+start_server --innodb_file_per_table
1717 checksum_b=`checksum_table csv csm`
1718 vlog "Checking checksums: $checksum_a/$checksum_b"
1719
1720
1721=== modified file 'test/t/ib_empty_dir.sh'
1722--- test/t/ib_empty_dir.sh 2011-11-28 09:26:22 +0000
1723+++ test/t/ib_empty_dir.sh 2012-06-12 10:40:23 +0000
1724@@ -1,14 +1,13 @@
1725 # Test for bug https://bugs.launchpad.net/percona-xtrabackup/+bug/737569
1726 . inc/common.sh
1727
1728-init
1729-run_mysqld
1730+start_server
1731
1732 innobackupex --no-timestamp $topdir/backup
1733 backup_dir=$topdir/backup
1734 vlog "Backup created in directory $backup_dir"
1735
1736-stop_mysqld
1737+stop_server
1738 # Remove datadir
1739 rm -r $mysql_datadir
1740 # Restore backup
1741
1742=== modified file 'test/t/ib_incremental.sh'
1743--- test/t/ib_incremental.sh 2012-02-02 20:35:45 +0000
1744+++ test/t/ib_incremental.sh 2012-06-12 10:40:23 +0000
1745@@ -1,7 +1,6 @@
1746 . inc/common.sh
1747
1748-init
1749-run_mysqld --innodb_file_per_table
1750+start_server --innodb_file_per_table
1751 load_dbase_schema incremental_sample
1752
1753 # Adding initial rows
1754@@ -72,7 +71,7 @@
1755 vlog "Data prepared for restore"
1756
1757 # Destroying mysql data
1758-stop_mysqld
1759+stop_server
1760 rm -rf $mysql_datadir/*
1761 vlog "Data destroyed"
1762
1763@@ -84,7 +83,7 @@
1764 innobackupex --copy-back $full_backup_dir
1765 vlog "Data restored"
1766
1767-run_mysqld --innodb_file_per_table
1768+start_server --innodb_file_per_table
1769
1770 vlog "Checking checksums"
1771 checksum_b=`checksum_table incremental_sample test`
1772
1773=== modified file 'test/t/ib_lru_dump_basic.sh'
1774--- test/t/ib_lru_dump_basic.sh 2012-02-06 10:53:43 +0000
1775+++ test/t/ib_lru_dump_basic.sh 2012-06-12 10:40:23 +0000
1776@@ -9,8 +9,7 @@
1777 exit $SKIPPED_EXIT_CODE
1778 fi
1779
1780-init
1781-run_mysqld
1782+start_server
1783
1784 # produce ib_lru_dump
1785 ${MYSQL} ${MYSQL_ARGS} -e "select * from information_schema.XTRADB_ADMIN_COMMAND /*!XTRA_LRU_DUMP*/;"
1786
1787=== modified file 'test/t/ib_lru_dump_rsync.sh'
1788--- test/t/ib_lru_dump_rsync.sh 2012-02-06 10:53:43 +0000
1789+++ test/t/ib_lru_dump_rsync.sh 2012-06-12 10:40:23 +0000
1790@@ -14,8 +14,7 @@
1791 exit $SKIPPED_EXIT_CODE
1792 fi
1793
1794-init
1795-run_mysqld
1796+start_server
1797
1798 # produce ib_lru_dump
1799 ${MYSQL} ${MYSQL_ARGS} -e "select * from information_schema.XTRADB_ADMIN_COMMAND /*!XTRA_LRU_DUMP*/;"
1800
1801=== modified file 'test/t/ib_lru_dump_stream.sh'
1802--- test/t/ib_lru_dump_stream.sh 2012-02-06 10:53:43 +0000
1803+++ test/t/ib_lru_dump_stream.sh 2012-06-12 10:40:23 +0000
1804@@ -9,8 +9,7 @@
1805 exit $SKIPPED_EXIT_CODE
1806 fi
1807
1808-init
1809-run_mysqld
1810+start_server
1811
1812 # produce ib_lru_dump
1813 ${MYSQL} ${MYSQL_ARGS} -e "select * from information_schema.XTRADB_ADMIN_COMMAND /*!XTRA_LRU_DUMP*/;"
1814
1815=== modified file 'test/t/ib_rsync.sh'
1816--- test/t/ib_rsync.sh 2011-11-15 13:01:05 +0000
1817+++ test/t/ib_rsync.sh 2012-06-12 10:40:23 +0000
1818@@ -6,13 +6,12 @@
1819 exit $SKIPPED_EXIT_CODE
1820 fi
1821
1822-init
1823-run_mysqld --innodb_file_per_table
1824+start_server --innodb_file_per_table
1825 load_sakila
1826
1827 innobackupex --rsync --no-timestamp $topdir/backup
1828
1829-stop_mysqld
1830+stop_server
1831
1832 run_cmd rm -r $mysql_datadir
1833
1834@@ -22,5 +21,5 @@
1835
1836 innobackupex --copy-back $topdir/backup
1837
1838-run_mysqld
1839+start_server
1840 run_cmd ${MYSQL} ${MYSQL_ARGS} -e "SELECT COUNT(*) FROM actor" sakila
1841
1842=== modified file 'test/t/ib_slave_info.sh'
1843--- test/t/ib_slave_info.sh 2011-08-29 19:54:47 +0000
1844+++ test/t/ib_slave_info.sh 2012-06-12 10:40:23 +0000
1845@@ -1,7 +1,14 @@
1846 . inc/common.sh
1847
1848-init
1849-run_mysqld --innodb_file_per_table
1850+master_id=1
1851+slave_id=2
1852+
1853+start_server_with_id $master_id
1854+start_server_with_id $slave_id
1855+
1856+setup_slave $slave_id $master_id
1857+
1858+switch_server $master_id
1859 load_dbase_schema incremental_sample
1860
1861 # Adding initial rows
1862@@ -15,11 +22,15 @@
1863 done
1864 vlog "Initial rows added"
1865
1866-# Full backup
1867-# backup root directory
1868-mkdir -p $topdir/backup
1869+# Full backup of the slave server
1870+switch_server $slave_id
1871
1872 vlog "Check that --slave-info with --no-lock and no --safe-slave-backup fails"
1873-run_cmd_expect_failure $IB_BIN $IB_ARGS --slave-info --no-lock $topdir/backup
1874+run_cmd_expect_failure $IB_BIN $IB_ARGS --no-timestamp --slave-info --no-lock \
1875+ $topdir/backup
1876
1877-# TODO: add positive tests when the test suite is able to setup replication
1878+innobackupex --no-timestamp --slave-info $topdir/backup
1879+egrep -q '^mysql-bin.000001[[:space:]]+[0-9]+[[:space:]]+$' \
1880+ $topdir/backup/xtrabackup_binlog_info
1881+egrep -q '^CHANGE MASTER TO MASTER_LOG_FILE='\''mysql-bin.000001'\'', MASTER_LOG_POS=[0-9]+$' \
1882+ $topdir/backup/xtrabackup_slave_info
1883
1884=== modified file 'test/t/ib_specialchar.sh'
1885--- test/t/ib_specialchar.sh 2012-02-02 20:35:45 +0000
1886+++ test/t/ib_specialchar.sh 2012-06-12 10:40:23 +0000
1887@@ -1,7 +1,7 @@
1888 . inc/common.sh
1889
1890-init
1891-run_mysqld
1892+start_server
1893+
1894 load_dbase_schema sakila
1895 load_dbase_data sakila
1896
1897@@ -20,7 +20,7 @@
1898 run_cmd ${MYSQLADMIN} ${MYSQL_ARGS} -p'$PASSWD' password ''
1899
1900 vlog "Stopping database server"
1901-stop_mysqld
1902+stop_server
1903 # Remove datadir
1904 vlog "Removing data folder"
1905 rm -r $mysql_datadir
1906@@ -40,7 +40,7 @@
1907
1908 vlog "Starting database server"
1909 # using --skip-grant-tables to override root password restored from backup
1910-run_mysqld --skip-grant-tables
1911+start_server --skip-grant-tables
1912 vlog "Database server started"
1913 # Check sakila
1914 run_cmd ${MYSQL} ${MYSQL_ARGS} -e "SELECT count(*) from actor" sakila
1915
1916=== modified file 'test/t/ib_stream_incremental.sh'
1917--- test/t/ib_stream_incremental.sh 2012-05-15 16:53:07 +0000
1918+++ test/t/ib_stream_incremental.sh 2012-06-12 10:40:23 +0000
1919@@ -18,8 +18,7 @@
1920 vlog "Testing a streaming incremental backup with the '$stream_format' format"
1921 vlog "************************************************************************"
1922
1923- init
1924- run_mysqld --innodb_file_per_table
1925+ start_server
1926 load_dbase_schema incremental_sample
1927
1928 # Adding initial rows
1929@@ -79,7 +78,7 @@
1930 vlog "Data prepared for restore"
1931
1932 # Destroying mysql data
1933- stop_mysqld
1934+ stop_server
1935 rm -rf $mysql_datadir/*
1936 vlog "Data destroyed"
1937
1938@@ -88,7 +87,7 @@
1939 innobackupex --copy-back $full_backup_dir
1940 vlog "Data restored"
1941
1942- run_mysqld --innodb_file_per_table
1943+ start_server --innodb_file_per_table
1944
1945 vlog "Checking checksums"
1946 checksum_b=`checksum_table incremental_sample test`
1947
1948=== modified file 'test/t/tar4ibd_symlink.sh'
1949--- test/t/tar4ibd_symlink.sh 2012-02-10 20:05:56 +0000
1950+++ test/t/tar4ibd_symlink.sh 2012-06-12 10:40:23 +0000
1951@@ -4,37 +4,41 @@
1952
1953 . inc/common.sh
1954
1955-init
1956-run_mysqld --innodb_file_per_table
1957+start_server --innodb_file_per_table
1958+
1959 load_dbase_schema sakila
1960 load_dbase_data sakila
1961
1962+# Force a checkpoint
1963+stop_server
1964+start_server
1965+
1966 # Copy some .ibd files to a temporary location and replace them with symlinks
1967
1968-mv $topdir/mysql/sakila/actor.ibd $topdir
1969-ln -s $topdir/actor.ibd $topdir/mysql/sakila
1970+mv $MYSQLD_DATADIR/sakila/actor.ibd $MYSQLD_VARDIR/
1971+ln -s $MYSQLD_VARDIR/actor.ibd $MYSQLD_DATADIR/sakila/actor.ibd
1972
1973-mv $topdir/mysql/sakila/customer.ibd $topdir
1974-ln -s $topdir/customer.ibd $topdir/customer_link.ibd
1975-ln -s $topdir/customer_link.ibd $topdir/mysql/sakila/customer.ibd
1976+mv $MYSQLD_DATADIR/sakila/customer.ibd $MYSQLD_VARDIR/customer.ibd
1977+ln -s $MYSQLD_VARDIR/customer.ibd $MYSQLD_VARDIR/customer_link.ibd
1978+ln -s $MYSQLD_VARDIR/customer_link.ibd $MYSQLD_DATADIR/sakila/customer.ibd
1979
1980 # Take backup
1981-mkdir -p $topdir/backup
1982-innobackupex --stream=tar $topdir/backup > $topdir/backup/out.tar
1983+mkdir -p $MYSQLD_VARDIR/backup
1984+innobackupex --stream=tar $MYSQLD_VARDIR/backup > $MYSQLD_VARDIR/backup/out.tar
1985
1986-stop_mysqld
1987+stop_server
1988
1989 # Remove datadir
1990 rm -r $mysql_datadir
1991
1992 # Remove the temporary files referenced by symlinks
1993-rm -f $topdir/actor.ibd
1994-rm -f $topdir/customer.ibd
1995-rm -f $topdir/customer_link.ibd
1996+rm -f $MYSQLD_VARDIR/actor.ibd
1997+rm -f $MYSQLD_VARDIR/customer.ibd
1998+rm -f $MYSQLD_VARDIR/customer_link.ibd
1999
2000 # Restore sakila
2001 vlog "Applying log"
2002-backup_dir=$topdir/backup
2003+backup_dir=$MYSQLD_VARDIR/backup
2004 cd $backup_dir
2005 run_cmd $TAR -ixvf out.tar
2006 cd - >/dev/null 2>&1
2007@@ -46,7 +50,7 @@
2008
2009 innobackupex --copy-back $backup_dir
2010
2011-run_mysqld
2012+start_server
2013
2014 # Check sakila
2015 run_cmd ${MYSQL} ${MYSQL_ARGS} -e "SELECT COUNT(*) FROM actor" sakila
2016
2017=== modified file 'test/t/xb_basic.sh'
2018--- test/t/xb_basic.sh 2012-02-02 20:35:45 +0000
2019+++ test/t/xb_basic.sh 2012-06-12 10:40:23 +0000
2020@@ -1,16 +1,16 @@
2021 . inc/common.sh
2022
2023-init
2024-run_mysqld
2025+start_server
2026+
2027 load_dbase_schema sakila
2028 load_dbase_data sakila
2029
2030 mkdir -p $topdir/backup
2031-innobackupex $topdir/backup
2032+innobackupex $topdir/backup
2033 backup_dir=`grep "innobackupex: Backup created in directory" $OUTFILE | awk -F\' '{ print $2}'`
2034 vlog "Backup created in directory $backup_dir"
2035
2036-stop_mysqld
2037+stop_server
2038 # Remove datadir
2039 rm -r $mysql_datadir
2040 #init_mysql_dir
2041@@ -27,6 +27,6 @@
2042 vlog "###########"
2043 innobackupex --copy-back $backup_dir
2044
2045-run_mysqld
2046+start_server
2047 # Check sakila
2048 run_cmd ${MYSQL} ${MYSQL_ARGS} -e "SELECT count(*) from actor" sakila
2049
2050=== modified file 'test/t/xb_defaults_file.sh'
2051--- test/t/xb_defaults_file.sh 2011-06-21 01:22:59 +0000
2052+++ test/t/xb_defaults_file.sh 2012-06-12 10:40:23 +0000
2053@@ -6,8 +6,7 @@
2054
2055 . inc/common.sh
2056
2057-init
2058-run_mysqld
2059+start_server
2060
2061 # The following should succeed (can't use xtrabackup directly as it uses
2062 # --no-defaults)
2063
2064=== modified file 'test/t/xb_export.sh'
2065--- test/t/xb_export.sh 2012-02-02 20:35:45 +0000
2066+++ test/t/xb_export.sh 2012-06-12 10:40:23 +0000
2067@@ -1,11 +1,5 @@
2068 . inc/common.sh
2069
2070-init
2071-
2072-backup_dir=$topdir/xb_export_backup
2073-rm -rf $backup_dir
2074-mkdir $backup_dir
2075-
2076 if [ -z "$XTRADB_VERSION" ]; then
2077 echo "Requires XtraDB" > $SKIPPED_REASON
2078 exit $SKIPPED_EXIT_CODE
2079@@ -18,11 +12,15 @@
2080 import_option="--innodb_expand_import=1"
2081 fi
2082
2083-MYSQLD_ARGS="$MYSQLD_ARGS --innodb_file_per_table $import_option \
2084+mysql_extra_args="--innodb_file_per_table $import_option \
2085 --innodb_file_format=Barracuda"
2086
2087 # Starting database server
2088-run_mysqld
2089+start_server $mysql_extra_args
2090+
2091+backup_dir=$topdir/xb_export_backup
2092+rm -rf $backup_dir
2093+mkdir $backup_dir
2094
2095 # Loading table schema
2096 load_dbase_schema incremental_sample
2097@@ -48,10 +46,9 @@
2098 vlog "Table was backed up"
2099
2100 vlog "Re-initializing database server"
2101-stop_mysqld
2102-# Can't use clean/init because that will remove $backup_dir as well
2103-clean_datadir
2104-run_mysqld
2105+stop_server
2106+rm -rf ${MYSQLD_DATADIR}
2107+start_server $mysql_extra_args
2108 load_dbase_schema incremental_sample
2109 vlog "Database was re-initialized"
2110
2111@@ -91,8 +88,8 @@
2112 # consistent backup results. Otherwise we risk ending up with no test.ibd
2113 # in the backup in case importing has not finished before taking backup
2114
2115-stop_mysqld
2116-run_mysqld
2117+stop_server
2118+start_server $mysql_extra_args
2119
2120 # Some testing queries
2121 run_cmd ${MYSQL} ${MYSQL_ARGS} -e "select count(*) from test;" incremental_sample
2122@@ -111,13 +108,13 @@
2123
2124 run_cmd ${MYSQL} ${MYSQL_ARGS} -e "delete from test;" incremental_sample
2125
2126-stop_mysqld
2127+stop_server
2128
2129 cd $topdir/backup/full
2130 cp -r * $mysql_datadir
2131 cd -
2132
2133-run_mysqld
2134+start_server $mysql_extra_args
2135
2136 vlog "Cheking checksums"
2137 checksum_3=`checksum_table incremental_sample test`
2138@@ -131,6 +128,6 @@
2139
2140 vlog "Checksums are OK"
2141
2142-stop_mysqld
2143+stop_server
2144
2145 rm -rf $backup_dir
2146
2147=== modified file 'test/t/xb_galera_info.sh'
2148--- test/t/xb_galera_info.sh 2012-02-02 20:13:09 +0000
2149+++ test/t/xb_galera_info.sh 2012-06-12 10:40:23 +0000
2150@@ -12,8 +12,7 @@
2151 fi
2152 set -e
2153
2154-init
2155-run_mysqld --log-bin=`hostname`-bin --binlog-format=ROW --wsrep-provider=${MYSQL_BASEDIR}/libgalera_smm.so --wsrep_cluster_address=gcomm://
2156+start_server --log-bin=`hostname`-bin --binlog-format=ROW --wsrep-provider=${MYSQL_BASEDIR}/libgalera_smm.so --wsrep_cluster_address=gcomm://
2157
2158 innobackupex --no-timestamp --galera-info $topdir/backup
2159 backup_dir=$topdir/backup
2160@@ -26,4 +25,4 @@
2161 exit 1
2162 fi
2163
2164-stop_mysqld
2165+stop_server
2166
2167=== modified file 'test/t/xb_incremental.sh'
2168--- test/t/xb_incremental.sh 2012-02-02 20:35:45 +0000
2169+++ test/t/xb_incremental.sh 2012-06-12 10:40:23 +0000
2170@@ -1,7 +1,7 @@
2171 . inc/common.sh
2172
2173-init
2174-run_mysqld --innodb_file_per_table
2175+start_server --innodb_file_per_table
2176+
2177 load_dbase_schema incremental_sample
2178
2179 # Adding 10k rows
2180@@ -73,14 +73,14 @@
2181 run_cmd ${MYSQL} ${MYSQL_ARGS} -e "delete from test;" incremental_sample
2182
2183 # Restore backup
2184-stop_mysqld
2185+stop_server
2186 vlog "Copying files"
2187 cd $topdir/data/full/
2188 cp -r * $mysql_datadir
2189 cd $topdir
2190
2191 vlog "Data restored"
2192-run_mysqld --innodb_file_per_table
2193+start_server --innodb_file_per_table
2194
2195 vlog "Checking checksums"
2196 checksum_b=`checksum_table incremental_sample test`
2197
2198=== modified file 'test/t/xb_incremental_compressed.sh'
2199--- test/t/xb_incremental_compressed.sh 2012-02-10 20:05:56 +0000
2200+++ test/t/xb_incremental_compressed.sh 2012-06-12 10:40:23 +0000
2201@@ -4,8 +4,6 @@
2202
2203 . inc/common.sh
2204
2205-init
2206-
2207 if [ -z "$INNODB_VERSION" ]; then
2208 echo "Requires InnoDB plugin or XtraDB" >$SKIPPED_REASON
2209 exit $SKIPPED_EXIT_CODE
2210@@ -27,7 +25,7 @@
2211 mysqld_additional_args="--innodb_strict_mode --innodb_file_per_table \
2212 --innodb_file_format=Barracuda"
2213
2214- run_mysqld ${mysqld_additional_args}
2215+ start_server ${mysqld_additional_args}
2216
2217 load_dbase_schema incremental_sample
2218
2219@@ -134,7 +132,7 @@
2220
2221 # Restore backup
2222
2223- stop_mysqld
2224+ stop_server
2225
2226 vlog "Copying files"
2227
2228@@ -144,7 +142,7 @@
2229
2230 vlog "Data restored"
2231
2232- run_mysqld ${mysqld_additional_args}
2233+ start_server ${mysqld_additional_args}
2234
2235 vlog "Cheking checksums"
2236 checksum_b=`checksum_table incremental_sample test`
2237@@ -156,10 +154,11 @@
2238 fi
2239
2240 vlog "Checksums are OK"
2241+
2242+ stop_server
2243 }
2244
2245 for page_size in 1 2 4 8 16; do
2246- init
2247 test_incremental_compressed ${page_size}
2248 clean
2249 done
2250
2251=== modified file 'test/t/xb_log_overwrap.sh'
2252--- test/t/xb_log_overwrap.sh 2011-07-04 19:38:26 +0000
2253+++ test/t/xb_log_overwrap.sh 2012-06-12 10:40:23 +0000
2254@@ -1,7 +1,7 @@
2255 . inc/common.sh
2256
2257-init
2258-run_mysqld --innodb_log_file_size=1M --innodb_thread_concurrency=1
2259+start_server --innodb_log_file_size=1M --innodb_thread_concurrency=1
2260+
2261 load_dbase_schema sakila
2262 load_dbase_data sakila
2263 mkdir $topdir/backup
2264
2265=== modified file 'test/t/xb_parallel.sh'
2266--- test/t/xb_parallel.sh 2012-02-02 20:35:45 +0000
2267+++ test/t/xb_parallel.sh 2012-06-12 10:40:23 +0000
2268@@ -1,7 +1,7 @@
2269 . inc/common.sh
2270
2271-init
2272-run_mysqld --innodb_file_per_table
2273+start_server --innodb_file_per_table
2274+
2275 load_dbase_schema sakila
2276 load_dbase_data sakila
2277
2278@@ -13,7 +13,7 @@
2279
2280 #echo "Backup dir in $backup_dir"
2281
2282-stop_mysqld
2283+stop_server
2284 # Remove datadir
2285 rm -r $mysql_datadir
2286 # Restore sakila
2287@@ -29,6 +29,6 @@
2288 vlog "###########"
2289 innobackupex --copy-back $backup_dir
2290
2291-run_mysqld
2292+start_server
2293 # Check sakila
2294 run_cmd ${MYSQL} ${MYSQL_ARGS} -e "SELECT count(*) from actor" sakila
2295
2296=== modified file 'test/t/xb_parallel_incremental.sh'
2297--- test/t/xb_parallel_incremental.sh 2012-02-02 20:35:45 +0000
2298+++ test/t/xb_parallel_incremental.sh 2012-06-12 10:40:23 +0000
2299@@ -4,8 +4,8 @@
2300
2301 . inc/common.sh
2302
2303-init
2304-run_mysqld --innodb_file_per_table
2305+start_server --innodb_file_per_table
2306+
2307 load_dbase_schema sakila
2308 load_dbase_data sakila
2309
2310@@ -38,7 +38,7 @@
2311 innobackupex --incremental --no-timestamp --parallel=8 \
2312 --incremental-basedir=$topdir/full_backup $topdir/inc_backup
2313
2314-stop_mysqld
2315+stop_server
2316 # Remove datadir
2317 rm -r $mysql_datadir
2318
2319@@ -52,7 +52,7 @@
2320 mkdir -p $mysql_datadir
2321 innobackupex --copy-back $topdir/full_backup
2322
2323-run_mysqld
2324+start_server
2325
2326 # Check sakila
2327 run_cmd ${MYSQL} ${MYSQL_ARGS} -e "SELECT count(*) from actor" sakila
2328
2329=== modified file 'test/t/xb_part_range.sh'
2330--- test/t/xb_part_range.sh 2012-02-02 20:35:45 +0000
2331+++ test/t/xb_part_range.sh 2012-06-12 10:40:23 +0000
2332@@ -1,7 +1,6 @@
2333 . inc/common.sh
2334
2335-init
2336-run_mysqld
2337+start_server
2338
2339 run_cmd $MYSQL $MYSQL_ARGS test <<EOF
2340 CREATE TABLE test (
2341@@ -89,7 +88,7 @@
2342
2343 # Restore backup
2344
2345-stop_mysqld
2346+stop_server
2347
2348 vlog "Copying files"
2349
2350@@ -99,7 +98,7 @@
2351
2352 vlog "Data restored"
2353
2354-run_mysqld
2355+start_server
2356
2357 vlog "Cheking checksums"
2358 checksum_b=`checksum_table test test`
2359
2360=== modified file 'test/t/xb_partial.sh'
2361--- test/t/xb_partial.sh 2012-02-02 20:35:45 +0000
2362+++ test/t/xb_partial.sh 2012-06-12 10:40:23 +0000
2363@@ -1,7 +1,7 @@
2364 . inc/common.sh
2365
2366-init
2367-run_mysqld --innodb_file_per_table
2368+start_server --innodb_file_per_table
2369+
2370 load_dbase_schema incremental_sample
2371
2372 # Adding 10k rows
2373@@ -34,13 +34,13 @@
2374 vlog "Table cleared"
2375
2376 # Restore backup
2377-stop_mysqld
2378+stop_server
2379 vlog "Copying files"
2380 cd $topdir/data/parted/
2381 cp -r * $mysql_datadir
2382 cd $topdir
2383 vlog "Data restored"
2384-run_mysqld --innodb_file_per_table
2385+start_server --innodb_file_per_table
2386 vlog "Checking checksums"
2387 checksum_b=`checksum_table incremental_sample test`
2388
2389
2390=== modified file 'test/t/xb_perm_basic.sh'
2391--- test/t/xb_perm_basic.sh 2012-02-02 20:35:45 +0000
2392+++ test/t/xb_perm_basic.sh 2012-06-12 10:40:23 +0000
2393@@ -1,8 +1,7 @@
2394 # Test for fix of https://bugs.launchpad.net/percona-xtrabackup/+bug/691090
2395 . inc/common.sh
2396
2397-init
2398-run_mysqld
2399+start_server
2400
2401 chmod -R 500 $mysql_datadir
2402 trap "vlog restoring permissions on datadir $mysql_datadir ; \
2403
2404=== modified file 'test/t/xb_perm_stream.sh'
2405--- test/t/xb_perm_stream.sh 2012-02-02 20:35:45 +0000
2406+++ test/t/xb_perm_stream.sh 2012-06-12 10:40:23 +0000
2407@@ -1,8 +1,7 @@
2408 # Test for fix of https://bugs.launchpad.net/percona-xtrabackup/+bug/691090
2409 . inc/common.sh
2410
2411-init
2412-run_mysqld
2413+start_server
2414
2415 # Take backup
2416 chmod -R 500 $mysql_datadir
2417
2418=== modified file 'test/t/xb_stats.sh'
2419--- test/t/xb_stats.sh 2012-02-02 20:35:45 +0000
2420+++ test/t/xb_stats.sh 2012-06-12 10:40:23 +0000
2421@@ -1,7 +1,7 @@
2422 . inc/common.sh
2423
2424-init
2425-run_mysqld
2426+start_server
2427+
2428 load_dbase_schema sakila
2429 load_dbase_data sakila
2430

Subscribers

People subscribed via source and target branches