Merge lp:~akopytov/percona-xtrabackup/bug1213036-2.1 into lp:percona-xtrabackup/2.1

Proposed by Alexey Kopytov
Status: Merged
Approved by: Stewart Smith
Approved revision: no longer in the source branch.
Merged at revision: 664
Proposed branch: lp:~akopytov/percona-xtrabackup/bug1213036-2.1
Merge into: lp:percona-xtrabackup/2.1
Diff against target: 318 lines (+50/-137)
8 files modified
test/inc/common.sh (+29/-0)
test/inc/ib_incremental_common.sh (+10/-36)
test/t/bug1182726.sh (+1/-9)
test/t/bug810269.sh (+1/-22)
test/t/ib_slave_info.sh (+1/-9)
test/t/ib_stream_incremental.sh (+2/-19)
test/t/xb_export.sh (+1/-9)
test/t/xb_incremental_compressed.inc (+5/-33)
To merge this branch: bzr merge lp:~akopytov/percona-xtrabackup/bug1213036-2.1
Reviewer Review Type Date Requested Status
Stewart Smith (community) Approve
Registry Administrators Pending
Review via email: mp+180763@code.launchpad.net

Description of the change

    Bug #1213036: ib_incremental_* tests are too slow

    Changed ib_incremental_* tests and a few other ones to use multi-row
    INSERT statements instead of inserting multiple rows by calling mysql
    command line client for each row. Introduced a convenience function
    insert_rows() in common.sh to avoid code repetition in multiple tests.

http://jenkins.percona.com/view/XtraBackup/job/percona-xtrabackup-2.1-param/436/

To post a comment you must log in.
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
=== modified file 'test/inc/common.sh'
--- test/inc/common.sh 2013-07-25 15:04:49 +0000
+++ test/inc/common.sh 2013-08-19 04:08:39 +0000
@@ -721,5 +721,34 @@
721 fi721 fi
722}722}
723723
724##############################################################################
725# Execute a multi-row INSERT into a specified table.
726#
727# Arguments:
728#
729# $1 -- table specification
730#
731# all subsequent arguments represent tuples to insert in the form:
732# (value1, ..., valueN)
733#
734# Notes:
735#
736# 1. Bash special characters in the arguments must be quoted to screen them
737# from interpreting by Bash, i.e. \(1,...,\'a'\)
738#
739# 2. you can use Bash brace expansion to generate multiple tuples, e.g.:
740# \({1..1000},\'a'\) will generate 1000 tuples (1,'a'), ..., (1000, 'a')
741##############################################################################
742function multi_row_insert()
743{
744 local table=$1
745 shift
746
747 vlog "Inserting $# rows into $table..."
748 (IFS=,; echo "INSERT INTO $table VALUES $*") | \
749 $MYSQL $MYSQL_ARGS
750 vlog "Done."
751}
752
724# To avoid unbound variable error when no server have been started753# To avoid unbound variable error when no server have been started
725SRV_MYSQLD_IDS=754SRV_MYSQLD_IDS=
726755
=== modified file 'test/inc/ib_incremental_common.sh'
--- test/inc/ib_incremental_common.sh 2013-07-25 15:04:49 +0000
+++ test/inc/ib_incremental_common.sh 2013-08-19 04:08:39 +0000
@@ -15,50 +15,25 @@
15load_dbase_schema incremental_sample15load_dbase_schema incremental_sample
1616
17# Adding initial rows17# Adding initial rows
18vlog "Adding initial rows to database..."18multi_row_insert incremental_sample.test \({1..100},100\)
19numrow=100
20count=0
21while [ "$numrow" -gt "$count" ]
22do
23 ${MYSQL} ${MYSQL_ARGS} -e "insert into test values ($count, $numrow);" incremental_sample
24 let "count=count+1"
25done
26vlog "Initial rows added"
27
28# Full backup
29# backup root directory
30mkdir -p $topdir/backup
3119
32vlog "Starting backup"20vlog "Starting backup"
33innobackupex $topdir/backup21full_backup_dir=$topdir/full_backup
34full_backup_dir=`grep "innobackupex: Backup created in directory" $OUTFILE | awk -F\' '{print $2}'`22innobackupex --no-timestamp $full_backup_dir
35vlog "Full backup done to directory $full_backup_dir"
3623
37# Changing data24# Changing data
3825
39vlog "Making changes to database"26vlog "Making changes to database"
40${MYSQL} ${MYSQL_ARGS} -e "create table t2 (a int(11) default null, number int(11) default null) engine=innodb" incremental_sample27${MYSQL} ${MYSQL_ARGS} -e "create table t2 (a int(11) default null, number int(11) default null) engine=innodb" incremental_sample
41let "count=numrow+1"28
42let "numrow=1000"29multi_row_insert incremental_sample.test \({101..1000},1000\)
43while [ "$numrow" -gt "$count" ]30multi_row_insert incremental_sample.t2 \({101..1000},1000\)
44do
45 ${MYSQL} ${MYSQL_ARGS} -e "insert into test values ($count, $numrow);" incremental_sample
46 ${MYSQL} ${MYSQL_ARGS} -e "insert into t2 values ($count, $numrow);" incremental_sample
47 let "count=count+1"
48done
4931
50# Rotate bitmap file here and force checkpoint at the same time32# Rotate bitmap file here and force checkpoint at the same time
51shutdown_server33shutdown_server
52start_server34start_server
5335
54i=100136multi_row_insert incremental_sample.t2 \({1001..7500},REPEAT\(\'ab\',32500\)\)
55while [ "$i" -lt "7500" ]
56do
57 ${MYSQL} ${MYSQL_ARGS} -e "insert into t2 values ($i, repeat(\"ab\", 32500));" incremental_sample
58 let "i=i+1"
59done
60
61vlog "Changes done"
6237
63# Saving the checksum of original table38# Saving the checksum of original table
64checksum_test_a=`checksum_table incremental_sample test`39checksum_test_a=`checksum_table incremental_sample test`
@@ -73,10 +48,9 @@
73vlog "###############"48vlog "###############"
7449
75# Incremental backup50# Incremental backup
76innobackupex --incremental --incremental-basedir=$full_backup_dir \51inc_backup_dir=$topdir/backup_incremental
77 $topdir/backup $ib_inc_extra_args52innobackupex --no-timestamp --incremental --incremental-basedir=$full_backup_dir \
78inc_backup_dir=`grep "innobackupex: Backup created in directory" $OUTFILE | tail -n 1 | awk -F\' '{print $2}'`53 $inc_backup_dir $ib_inc_extra_args
79vlog "Incremental backup done to directory $inc_backup_dir"
8054
81vlog "Preparing backup"55vlog "Preparing backup"
82# Prepare backup56# Prepare backup
8357
=== modified file 'test/t/bug1182726.sh'
--- test/t/bug1182726.sh 2013-07-08 09:28:05 +0000
+++ test/t/bug1182726.sh 2013-08-19 04:08:39 +0000
@@ -19,15 +19,7 @@
19load_dbase_schema incremental_sample19load_dbase_schema incremental_sample
2020
21# Adding initial rows21# Adding initial rows
22vlog "Adding initial rows to database..."22multi_row_insert incremental_sample.test \({1..100},100\)
23numrow=100
24count=0
25while [ "$numrow" -gt "$count" ]
26do
27 ${MYSQL} ${MYSQL_ARGS} -e "insert into test values ($count, $numrow);" incremental_sample
28 let "count=count+1"
29done
30vlog "Initial rows added"
3123
32# Full backup of the slave server24# Full backup of the slave server
33switch_server $slave_id25switch_server $slave_id
3426
=== modified file 'test/t/bug810269.sh'
--- test/t/bug810269.sh 2013-07-25 15:04:49 +0000
+++ test/t/bug810269.sh 2013-08-19 04:08:39 +0000
@@ -20,28 +20,7 @@
20 "ALTER TABLE test ENGINE=InnoDB ROW_FORMAT=compressed \20 "ALTER TABLE test ENGINE=InnoDB ROW_FORMAT=compressed \
21KEY_BLOCK_SIZE=4" incremental_sample21KEY_BLOCK_SIZE=4" incremental_sample
2222
23vlog "Adding initial rows to table"23multi_row_insert incremental_sample.test \({1..10000},10000\)
24
25numrow=10000
26count=0
27while [ "$numrow" -gt "$count" ]; do
28 sql="INSERT INTO test VALUES ($count, $numrow)"
29 let "count=count+1"
30 for ((i=0; $i<99; i++)); do
31 sql="$sql,($count, $numrow)"
32 let "count=count+1"
33 done
34 ${MYSQL} ${MYSQL_ARGS} -e "$sql" incremental_sample
35done
36
37rows=`${MYSQL} ${MYSQL_ARGS} -Ns -e "SELECT COUNT(*) FROM test" \
38 incremental_sample`
39if [ "$rows" != "10000" ]; then
40 vlog "Failed to add initial rows"
41 exit -1
42fi
43
44vlog "Initial rows added"
4524
46checksum_a=`checksum_table incremental_sample test`25checksum_a=`checksum_table incremental_sample test`
4726
4827
=== modified file 'test/t/ib_slave_info.sh'
--- test/t/ib_slave_info.sh 2013-04-27 18:46:54 +0000
+++ test/t/ib_slave_info.sh 2013-08-19 04:08:39 +0000
@@ -12,15 +12,7 @@
12load_dbase_schema incremental_sample12load_dbase_schema incremental_sample
1313
14# Adding initial rows14# Adding initial rows
15vlog "Adding initial rows to database..."15multi_row_insert incremental_sample.test \({1..100},100\)
16numrow=100
17count=0
18while [ "$numrow" -gt "$count" ]
19do
20 ${MYSQL} ${MYSQL_ARGS} -e "insert into test values ($count, $numrow);" incremental_sample
21 let "count=count+1"
22done
23vlog "Initial rows added"
2416
25# Full backup of the slave server17# Full backup of the slave server
26switch_server $slave_id18switch_server $slave_id
2719
=== modified file 'test/t/ib_stream_incremental.sh'
--- test/t/ib_stream_incremental.sh 2013-07-03 18:30:28 +0000
+++ test/t/ib_stream_incremental.sh 2013-08-19 04:08:39 +0000
@@ -22,15 +22,7 @@
22 load_dbase_schema incremental_sample22 load_dbase_schema incremental_sample
2323
24# Adding initial rows24# Adding initial rows
25 vlog "Adding initial rows to database..."25 multi_row_insert incremental_sample.test \({1..100},100\)
26 numrow=100
27 count=0
28 while [ "$numrow" -gt "$count" ]
29 do
30 ${MYSQL} ${MYSQL_ARGS} -e "insert into test values ($count, $numrow);" incremental_sample
31 let "count=count+1"
32 done
33 vlog "Initial rows added"
3426
35 full_backup_dir=$topdir/full_backup27 full_backup_dir=$topdir/full_backup
3628
@@ -38,16 +30,7 @@
38 innobackupex --no-timestamp $full_backup_dir30 innobackupex --no-timestamp $full_backup_dir
3931
40# Changing data32# Changing data
4133 multi_row_insert incremental_sample.test \({101..500},500\)
42 vlog "Making changes to database"
43 let "count=numrow+1"
44 let "numrow=500"
45 while [ "$numrow" -gt "$count" ]
46 do
47 ${MYSQL} ${MYSQL_ARGS} -e "insert into test values ($count, $numrow);" incremental_sample
48 let "count=count+1"
49 done
50 vlog "Changes done"
5134
52# Saving the checksum of original table35# Saving the checksum of original table
53 checksum_a=`checksum_table incremental_sample test`36 checksum_a=`checksum_table incremental_sample test`
5437
=== modified file 'test/t/xb_export.sh'
--- test/t/xb_export.sh 2013-07-25 15:04:49 +0000
+++ test/t/xb_export.sh 2013-08-19 04:08:39 +0000
@@ -35,15 +35,7 @@
35load_dbase_schema incremental_sample35load_dbase_schema incremental_sample
3636
37# Adding some data to database37# Adding some data to database
38vlog "Adding initial rows to database..."38multi_row_insert incremental_sample.test \({1..100},100\)
39numrow=100
40count=0
41while [ "$numrow" -gt "$count" ]
42do
43 ${MYSQL} ${MYSQL_ARGS} -e "insert into test values ($count, $numrow);" incremental_sample
44 let "count=count+1"
45done
46vlog "Initial rows added"
4739
48checksum_1=`checksum_table incremental_sample test`40checksum_1=`checksum_table incremental_sample test`
49rowsnum_1=`${MYSQL} ${MYSQL_ARGS} -Ns -e "select count(*) from test" incremental_sample`41rowsnum_1=`${MYSQL} ${MYSQL_ARGS} -Ns -e "select count(*) from test" incremental_sample`
5042
=== modified file 'test/t/xb_incremental_compressed.inc'
--- test/t/xb_incremental_compressed.inc 2013-07-25 15:04:49 +0000
+++ test/t/xb_incremental_compressed.inc 2013-08-19 04:08:39 +0000
@@ -12,23 +12,6 @@
1212
13. inc/common.sh13. inc/common.sh
1414
15function add_rows()
16{
17 local table=$1
18 local start=$2
19 local limit=$3
20
21 while [ "$limit" -gt "$start" ]; do
22 sql="INSERT INTO $table VALUES ($start, $limit)"
23 let "start=start+1"
24 for ((i=0; $i<99; i++)); do
25 sql="${sql},($start, $limit)"
26 let "start=start+1"
27 done
28 ${MYSQL} ${MYSQL_ARGS} -e "$sql" incremental_sample
29 done
30}
31
32#15#
33# Test incremental backup of a compressed tablespace with a specific page size16# Test incremental backup of a compressed tablespace with a specific page size
34#17#
@@ -61,18 +44,7 @@
6144
62 # Adding 10k rows45 # Adding 10k rows
6346
64 vlog "Adding initial rows to database..."47 multi_row_insert incremental_sample.test \({1..10000},10000\)
65
66 add_rows test 0 10000
67
68 rows=`${MYSQL} ${MYSQL_ARGS} -Ns -e "SELECT COUNT(*) FROM test" \
69incremental_sample`
70 if [ "$rows" != "10000" ]; then
71 vlog "Failed to add initial rows"
72 exit -1
73 fi
74
75 vlog "Initial rows added"
7648
77 # Full backup49 # Full backup
7850
@@ -97,15 +69,15 @@
97number INT(11) DEFAULT NULL) ENGINE=INNODB \69number INT(11) DEFAULT NULL) ENGINE=INNODB \
98ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=$page_size" incremental_sample70ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=$page_size" incremental_sample
9971
100 add_rows test 10001 1250072 multi_row_insert incremental_sample.test \({10001..12500},12500\)
101 add_rows t2 10001 1250073 multi_row_insert incremental_sample.t2 \({10001..12500},12500\)
10274
103 # Rotate bitmap file here and force checkpoint at the same time75 # Rotate bitmap file here and force checkpoint at the same time
104 shutdown_server76 shutdown_server
105 start_server77 start_server
10678
107 add_rows test 12501 1500079 multi_row_insert incremental_sample.test \({12501..15000},15000\)
108 add_rows t2 12501 1500080 multi_row_insert incremental_sample.t2 \({12501..15000},15000\)
10981
110 rows=`${MYSQL} ${MYSQL_ARGS} -Ns -e "SELECT COUNT(*) FROM test" \82 rows=`${MYSQL} ${MYSQL_ARGS} -Ns -e "SELECT COUNT(*) FROM test" \
111incremental_sample`83incremental_sample`

Subscribers

People subscribed via source and target branches

to all changes: