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

Proposed by Valentine Gostev
Status: Superseded
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 Pending
Review via email: mp+51774@code.launchpad.net

This proposal supersedes a proposal from 2011-02-07.

This proposal has been superseded by 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 :

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.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== added directory 'test/experimental'
=== added file 'test/experimental/xb_race_drop.sh'
--- test/experimental/xb_race_drop.sh 1970-01-01 00:00:00 +0000
+++ test/experimental/xb_race_drop.sh 2011-03-01 17:05:48 +0000
@@ -0,0 +1,15 @@
1. inc/common.sh
2
3init
4run_mysqld --innodb_file_per_table
5
6run_cmd race_create_drop &
7
8sleep 3
9# Full backup
10mkdir -p $topdir/data/full
11vlog "Starting backup"
12xtrabackup --datadir=$mysql_datadir --backup --target-dir=$topdir/data/full
13vlog "Full backup done"
14stop_mysqld
15clean
016
=== modified file 'test/inc/common.sh'
--- test/inc/common.sh 2011-01-03 07:55:23 +0000
+++ test/inc/common.sh 2011-03-01 17:05:48 +0000
@@ -237,3 +237,28 @@
237init_mysql_dir237init_mysql_dir
238set_mysl_port238set_mysl_port
239}239}
240
241function race_create_drop()
242{
243 vlog "Started create/drop table cycle"
244 race_cycle_num=$1
245 if [ -z $race_cycle_num ]
246 then
247 race_cycle_num=1000
248 fi
249 run_cmd ${MYSQL} ${MYSQL_ARGS} -e "create database race;"
250 race_cycle_cnt=0;
251 while [ "$race_cycle_num" -gt "$race_cycle_cnt"]
252 do
253 t1=tr$RANDOM
254 t2=tr$RANDOM
255 t3=tr$RANDOM
256 ${MYSQL} ${MYSQL_ARGS} -e "create table $t1 (a int) ENGINE=InnoDB;" race
257 ${MYSQL} ${MYSQL_ARGS} -e "create table $t2 (a int) ENGINE=InnoDB;" race
258 ${MYSQL} ${MYSQL_ARGS} -e "create table $t3 (a int) ENGINE=InnoDB;" race
259 ${MYSQL} ${MYSQL_ARGS} -e "drop table $t1;" race
260 ${MYSQL} ${MYSQL_ARGS} -e "drop table $t2;" race
261 ${MYSQL} ${MYSQL_ARGS} -e "drop table $t3;" race
262 let "race_cycle_cnt=race_cycle_cnt+1"
263 done
264}
240265
=== modified file 'test/run.sh'
--- test/run.sh 2010-12-30 16:52:32 +0000
+++ test/run.sh 2011-03-01 17:05:48 +0000
@@ -10,16 +10,18 @@
10 echo "-g Output debug information to results/*.out"10 echo "-g Output debug information to results/*.out"
11 echo "-t Run only a single named test"11 echo "-t Run only a single named test"
12 echo "-h Print this help megssage"12 echo "-h Print this help megssage"
13 echo "-s Select a test suite to run. Possible values: experimental, t. Default is t"
13}14}
14XTRACE_OPTION=""15XTRACE_OPTION=""
15export SKIPPED_EXIT_CODE=20016export SKIPPED_EXIT_CODE=200
16export MYSQL_VERSION="system"17export MYSQL_VERSION="system"
17while getopts "gh?m:t:" options; do18while getopts "gh?m:t:s:" options; do
18 case $options in19 case $options in
19 m ) export MYSQL_VERSION="$OPTARG";;20 m ) export MYSQL_VERSION="$OPTARG";;
20 t ) tname="$OPTARG";;21 t ) tname="$OPTARG";;
21 g ) XTRACE_OPTION="-x";;22 g ) XTRACE_OPTION="-x";;
22 h ) usage; exit;;23 h ) usage; exit;;
24 s ) tname="$OPTARG/*.sh";;
23 \? ) usage; exit -1;;25 \? ) usage; exit -1;;
24 * ) usage; exit -1;;26 * ) usage; exit -1;;
25 esac27 esac

Subscribers

People subscribed via source and target branches