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

Proposed by Valentine Gostev
Status: Superseded
Proposed branch: lp:~percona-dev/percona-xtrabackup/xb_export
Merge into: lp:percona-xtrabackup/2.0
Diff against target: 98 lines (+94/-0)
1 file modified
test/t/xb_export.sh (+94/-0)
To merge this branch: bzr merge lp:~percona-dev/percona-xtrabackup/xb_export
Reviewer Review Type Date Requested Status
Yasufumi Kinoshita (community) (please confirm to work correctly) Approve
Alexey Kopytov Pending
Review via email: mp+48107@code.launchpad.net

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

This proposal has been superseded by a proposal from 2011-02-01.

Description of the change

Fixed xb_export test to perform prepare with export.
Added full backup test after importing.

To post a comment you must log in.
Revision history for this message
Yasufumi Kinoshita (yasufumi-kinoshita) wrote : Posted in a previous version of this proposal

You don't understand xtrabackup at all, basically....
I don't understand what is tested here. It is completely wrong usage.

xtrabackup should be executed 2 times.
--backup and --prepare.
In addition, to export tables, --export is needed with --prepare.

You should not make test cases until you understand xtrabackup/InnoDB/MySQL.

review: Disapprove
Revision history for this message
Yasufumi Kinoshita (yasufumi-kinoshita) wrote :

If passed with 5.1.54-fix_expand_import_and_dict_size_limit branch.
I am OK.

review: Approve ((please confirm to work correctly))

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added file 'test/t/xb_export.sh'
2--- test/t/xb_export.sh 1970-01-01 00:00:00 +0000
3+++ test/t/xb_export.sh 2011-02-01 06:01:52 +0000
4@@ -0,0 +1,94 @@
5+. inc/common.sh
6+
7+init
8+
9+backup_dir=/tmp/xb_export_backup
10+rm -rf $backup_dir
11+mkdir $backup_dir
12+# Starting database server
13+run_mysqld --innodb_file_per_table
14+
15+# Loading table schema
16+load_dbase_schema incremental_sample
17+
18+# Adding some data to database
19+vlog "Adding initial rows to database..."
20+numrow=100
21+count=0
22+while [ "$numrow" -gt "$count" ]
23+do
24+ run_cmd ${MYSQL} ${MYSQL_ARGS} -e "insert into test values ($count, $numrow);" incremental_sample
25+ let "count=count+1"
26+done
27+vlog "Initial rows added"
28+
29+checksum_1=`${MYSQL} ${MYSQL_ARGS} -e "checksum table test" incremental_sample | awk '{print $2}'`
30+vlog "checksum_1 is $checksum_1"
31+
32+# Creating a directory for tables
33+mkdir -p $topdir/../backup
34+
35+# Performing table backup
36+run_cmd ${XB_BIN} --datadir=$mysql_datadir --backup --tables="^incremental_sample[.]test" --target-dir=$backup_dir
37+vlog "Table was backed up"
38+
39+vlog "Re-initializing database server"
40+stop_mysqld
41+clean
42+init
43+run_mysqld --innodb_file_per_table --innodb_expand_import=1
44+load_dbase_schema incremental_sample
45+vlog "Database was re-initialized"
46+
47+run_cmd ${MYSQL} ${MYSQL_ARGS} -e "alter table test discard tablespace" incremental_sample
48+run_cmd ${XB_BIN} --datadir=$mysql_datadir --prepare --export --target-dir=$backup_dir
49+cp $backup_dir/incremental_sample/test* $mysql_datadir/incremental_sample/
50+run_cmd ${MYSQL} ${MYSQL_ARGS} -e "alter table test import tablespace" incremental_sample
51+vlog "Table has been imported"
52+
53+vlog "Cheking checksums"
54+checksum_2=`${MYSQL} ${MYSQL_ARGS} -Ns -e "checksum table test;" incremental_sample | awk '{print $2}'`
55+
56+if [ $checksum_1 -ne $checksum_2 ]
57+then
58+ vlog "Checksums are not equal"
59+ exit -1
60+fi
61+
62+vlog "Checksums are OK"
63+
64+# Some testing queries
65+run_cmd ${MYSQL} ${MYSQL_ARGS} -e "select count(*) from test;" incremental_sample
66+run_cmd ${MYSQL} ${MYSQL_ARGS} -e "show create table test;" incremental_sample
67+
68+# Performing full backup of imported table
69+mkdir -p $topdir/backup/full
70+
71+xtrabackup --datadir=$mysql_datadir --backup --target-dir=$topdir/backup/full
72+xtrabackup --datadir=$mysql_datadir --prepare --apply-log-only --target-dir=$topdir/backup/full
73+xtrabackup --datadir=$mysql_datadir --prepare --target-dir=$topdir/backup/full
74+
75+run_cmd ${MYSQL} ${MYSQL_ARGS} -e "delete from test;" incremental_sample
76+
77+stop_mysqld
78+
79+cd $topdir/backup/full
80+cp -r * $mysql_datadir
81+cd -
82+
83+run_mysqld --innodb_file_per_table
84+
85+vlog "Cheking checksums"
86+checksum_3=`${MYSQL} ${MYSQL_ARGS} -Ns -e "checksum table test;" incremental_sample | awk '{print $2}'`
87+
88+if [ $checksum_3 -ne $checksum_2 ]
89+then
90+ vlog "Checksums are not equal"
91+ exit -1
92+fi
93+
94+vlog "Checksums are OK"
95+
96+rm -rf $backup_dir
97+stop_mysqld
98+clean

Subscribers

People subscribed via source and target branches