Merge lp:~percona-dev/percona-xtrabackup/lp713799_test into lp:percona-xtrabackup/2.0

Proposed by Valentine Gostev
Status: Merged
Approved by: Valentine Gostev
Approved revision: no longer in the source branch.
Merged at revision: 227
Proposed branch: lp:~percona-dev/percona-xtrabackup/lp713799_test
Merge into: lp:percona-xtrabackup/2.0
Diff against target: 77 lines (+43/-1)
3 files modified
test/experimental/xb_race_drop.sh (+15/-0)
test/inc/common.sh (+25/-0)
test/run.sh (+3/-1)
To merge this branch: bzr merge lp:~percona-dev/percona-xtrabackup/lp713799_test
Reviewer Review Type Date Requested Status
Alexey Kopytov (community) Approve
Review via email: mp+51784@code.launchpad.net

This proposal supersedes a proposal from 2011-03-01.

Description of the change

Added test case for bug lp:713799

To post a comment you must log in.
Revision history for this message
Alexey Kopytov (akopytov) wrote : Posted in a previous version of this proposal
Download full text (3.1 KiB)

Hi Valentine,

Thanks for the quick turnaround with the test case. Some comments below:

On 07.02.11 8:36, Valentine Gostev wrote:
> Valentine Gostev has proposed merging lp:~percona-dev/percona-xtrabackup/lp713799_test into lp:percona-xtrabackup.
>
> Requested reviews:
> Alexey Kopytov (akopytov)
> Related bugs:
> #712441 Test backup during intensive create/drop/alter table statements
> https://bugs.launchpad.net/bugs/712441
> #713799 xtrabackup: race condition when trying to open an already removed tablespace
> https://bugs.launchpad.net/bugs/713799
>
> For more details, see:
> https://code.launchpad.net/~percona-dev/percona-xtrabackup/lp713799_test/+merge/48750
>
> Added test case for bug lp:713799

> === added file 'test/inc/race_table_create.sh'
> --- test/inc/race_table_create.sh 1970-01-01 00:00:00 +0000
> +++ test/inc/race_table_create.sh 2011-02-07 05:36:05 +0000
> @@ -0,0 +1,20 @@
> +. inc/common.sh
> +
> +COMMD="mysql --no-defaults --socket=/tmp/xtrabackup.mysql.sock --user=root"
> +run_cmd ${COMMD} -e "create database race;"
> +

All other tests use " ${MYSQL} ${MYSQL_ARGS} -e ..." to run the mysql
client. It looks like the same should work here. Or am I missing something?

> +rows=1000

I can imaging that on a fast machine (and with a bit of luck) the
create/drop loop can finish before the parent process actually starts to
backup. Which makes the test unreliable.

> +rowc=0
> +while [ "$rows" -gt "$rowc" ]
> +do
> + t1=tr$RANDOM
> + t2=tr$RANDOM
> + t3=tr$RANDOM
> + ${COMMD} -e "create table $t1 (a int) ENGINE=InnoDB;" race
> + ${COMMD} -e "create table $t2 (a int) ENGINE=InnoDB;" race
> + ${COMMD} -e "create table $t3 (a int) ENGINE=InnoDB;" race
> + ${COMMD} -e "drop table $t1;" race
> + ${COMMD} -e "drop table $t2;" race
> + ${COMMD} -e "drop table $t3;" race
> + let "rowc=rowc+1"
> +done
>
> === added file 'test/t/xb_table_race.sh'
> --- test/t/xb_table_race.sh 1970-01-01 00:00:00 +0000
> +++ test/t/xb_table_race.sh 2011-02-07 05:36:05 +0000
> @@ -0,0 +1,20 @@
> +. inc/common.sh
> +
> +init
> +run_mysqld --innodb_file_per_table
> +
> +run_cmd bash inc/race_table_create.sh &
> +

I would make race_table_create a function rather than a separate script.

> +sleep 3
> +

Same comments as before. Using sleeps to synchronize asynchronous
process is generally a bad idea.

> +# Full backup
> +# Full backup folder
> +mkdir -p $topdir/data/full
> +vlog "Starting backup"
> +
> +xtrabackup --datadir=$mysql_datadir --backup --target-dir=$topdir/data/full
> +
> +vlog "Full backup done"
> +

It would also make sense to actually test restoring from the backup to
verify its integrity. That would require creating some permanent
table(s) in addition to the transient ones being created in
race_table_create.

> +stop_mysqld
> +clean
>

On a general level, I think this test is good for an ad-hoc testing of
the fix for bug #713799 (when you can manually verify the results), but
it's too flaky to include it into the test suite. We either need to add
some synchronization facilities to the xtrabackup test framework, or
create a separate stress test suite for such tes...

Read more...

Revision history for this message
Vadim Tkachenko (vadim-tk) wrote : Posted in a previous version of this proposal

I think we need special tests which run manually, not in automatic mode.
This test is good to include into manual tests

Revision history for this message
Valentine Gostev (longbow) wrote : Posted in a previous version of this proposal

Changes:

Added suites support, usage:
./run.sh -s <suite name>, where suite name is a name of directory with tests
Added function for cycling create/drop table statements (function accepts number of cycles as argument, 1000 cycles - default number)
Test case for bug 713799 was improved.

Revision history for this message
Valentine Gostev (longbow) wrote :

Added comment on usage to help output

Revision history for this message
Alexey Kopytov (akopytov) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added directory 'test/experimental'
2=== added file 'test/experimental/xb_race_drop.sh'
3--- test/experimental/xb_race_drop.sh 1970-01-01 00:00:00 +0000
4+++ test/experimental/xb_race_drop.sh 2011-03-01 17:10:41 +0000
5@@ -0,0 +1,15 @@
6+. inc/common.sh
7+
8+init
9+run_mysqld --innodb_file_per_table
10+
11+run_cmd race_create_drop &
12+
13+sleep 3
14+# Full backup
15+mkdir -p $topdir/data/full
16+vlog "Starting backup"
17+xtrabackup --datadir=$mysql_datadir --backup --target-dir=$topdir/data/full
18+vlog "Full backup done"
19+stop_mysqld
20+clean
21
22=== modified file 'test/inc/common.sh'
23--- test/inc/common.sh 2011-01-03 07:55:23 +0000
24+++ test/inc/common.sh 2011-03-01 17:10:41 +0000
25@@ -237,3 +237,28 @@
26 init_mysql_dir
27 set_mysl_port
28 }
29+
30+function race_create_drop()
31+{
32+ vlog "Started create/drop table cycle"
33+ race_cycle_num=$1
34+ if [ -z $race_cycle_num ]
35+ then
36+ race_cycle_num=1000
37+ fi
38+ run_cmd ${MYSQL} ${MYSQL_ARGS} -e "create database race;"
39+ race_cycle_cnt=0;
40+ while [ "$race_cycle_num" -gt "$race_cycle_cnt"]
41+ do
42+ t1=tr$RANDOM
43+ t2=tr$RANDOM
44+ t3=tr$RANDOM
45+ ${MYSQL} ${MYSQL_ARGS} -e "create table $t1 (a int) ENGINE=InnoDB;" race
46+ ${MYSQL} ${MYSQL_ARGS} -e "create table $t2 (a int) ENGINE=InnoDB;" race
47+ ${MYSQL} ${MYSQL_ARGS} -e "create table $t3 (a int) ENGINE=InnoDB;" race
48+ ${MYSQL} ${MYSQL_ARGS} -e "drop table $t1;" race
49+ ${MYSQL} ${MYSQL_ARGS} -e "drop table $t2;" race
50+ ${MYSQL} ${MYSQL_ARGS} -e "drop table $t3;" race
51+ let "race_cycle_cnt=race_cycle_cnt+1"
52+ done
53+}
54
55=== modified file 'test/run.sh'
56--- test/run.sh 2010-12-30 16:52:32 +0000
57+++ test/run.sh 2011-03-01 17:10:41 +0000
58@@ -10,16 +10,18 @@
59 echo "-g Output debug information to results/*.out"
60 echo "-t Run only a single named test"
61 echo "-h Print this help megssage"
62+ echo "-s Select a test suite to run. Possible values: experimental, t. Default is t"
63 }
64 XTRACE_OPTION=""
65 export SKIPPED_EXIT_CODE=200
66 export MYSQL_VERSION="system"
67-while getopts "gh?m:t:" options; do
68+while getopts "gh?m:t:s:" options; do
69 case $options in
70 m ) export MYSQL_VERSION="$OPTARG";;
71 t ) tname="$OPTARG";;
72 g ) XTRACE_OPTION="-x";;
73 h ) usage; exit;;
74+ s ) tname="$OPTARG/*.sh";;
75 \? ) usage; exit -1;;
76 * ) usage; exit -1;;
77 esac

Subscribers

People subscribed via source and target branches