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

Proposed by Valentine Gostev
Status: Merged
Approved by: Vadim Tkachenko
Approved revision: no longer in the source branch.
Merged at revision: 224
Proposed branch: lp:~percona-dev/percona-xtrabackup/xb_export
Merge into: lp:percona-xtrabackup/2.0
Diff against target: 104 lines (+100/-0)
1 file modified
test/t/xb_export.sh (+100/-0)
To merge this branch: bzr merge lp:~percona-dev/percona-xtrabackup/xb_export
Reviewer Review Type Date Requested Status
Vadim Tkachenko Approve
Yasufumi Kinoshita Pending
Alexey Kopytov Pending
Review via email: mp+48111@code.launchpad.net

This proposal supersedes 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.

UPD: merged my revisions to single one

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 : Posted in a previous version of this proposal

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

review: Approve ((please confirm to work correctly))
Revision history for this message
Alexey Kopytov (akopytov) wrote :

Why was this one rejected? Isn't it an improved version of the superseded one?

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

At the first time I've forgot to add the line with --prepare and --export, which caused server crash.

After adding string:
+run_cmd ${XB_BIN} --datadir=$mysql_datadir --prepare --export --target-dir=$backup_dir

test case passes ok on importing, then exporting table.

Revision history for this message
Vadim Tkachenko (vadim-tk) wrote :

I am lost in two proposals, but OK to merge good version.

review: Approve

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-10 12:12:02 +0000
4@@ -0,0 +1,100 @@
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 --innodb_file_format=Barracuda
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+ ${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} -Ns -e "checksum table test" incremental_sample | awk '{print $2}'`
30+rowsnum_1=`${MYSQL} ${MYSQL_ARGS} -Ns -e "select count(*) from test" incremental_sample`
31+vlog "rowsnum_1 is $rowsnum_1"
32+vlog "checksum_1 is $checksum_1"
33+
34+# Performing table backup
35+#run_cmd xtrabackup --datadir=$mysql_datadir --backup --tables="^incremental_sample[.]test" --target-dir=$backup_dir
36+run_cmd xtrabackup --datadir=$mysql_datadir --backup --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 --innodb_file_format=Barracuda
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 xtrabackup --datadir=$mysql_datadir --prepare --target-dir=$backup_dir
49+run_cmd xtrabackup --datadir=$mysql_datadir --prepare --export --target-dir=$backup_dir
50+run_cmd cp $backup_dir/incremental_sample/test* $mysql_datadir/incremental_sample/
51+run_cmd ls -lah $mysql_datadir/incremental_sample/
52+run_cmd ${MYSQL} ${MYSQL_ARGS} -e "alter table test import tablespace" incremental_sample
53+vlog "Table has been imported"
54+
55+vlog "Cheking checksums"
56+checksum_2=`${MYSQL} ${MYSQL_ARGS} -Ns -e "checksum table test;" incremental_sample | awk '{print $2}'`
57+vlog "checksum_2 is $checksum_2"
58+rowsnum_1=`${MYSQL} ${MYSQL_ARGS} -Ns -e "select count(*) from test" incremental_sample`
59+vlog "rowsnum_1 is $rowsnum_1"
60+
61+if [ $checksum_1 -ne $checksum_2 ]
62+then
63+ vlog "Checksums are not equal"
64+ exit -1
65+fi
66+
67+vlog "Checksums are OK"
68+
69+# Some testing queries
70+run_cmd ${MYSQL} ${MYSQL_ARGS} -e "select count(*) from test;" incremental_sample
71+run_cmd ${MYSQL} ${MYSQL_ARGS} -e "show create table test;" incremental_sample
72+
73+# Performing full backup of imported table
74+mkdir -p $topdir/backup/full
75+
76+xtrabackup --datadir=$mysql_datadir --backup --target-dir=$topdir/backup/full
77+xtrabackup --datadir=$mysql_datadir --prepare --apply-log-only --target-dir=$topdir/backup/full
78+xtrabackup --datadir=$mysql_datadir --prepare --target-dir=$topdir/backup/full
79+
80+run_cmd ${MYSQL} ${MYSQL_ARGS} -e "delete from test;" incremental_sample
81+
82+stop_mysqld
83+
84+cd $topdir/backup/full
85+cp -r * $mysql_datadir
86+cd -
87+
88+run_mysqld --innodb_file_per_table
89+
90+vlog "Cheking checksums"
91+checksum_3=`${MYSQL} ${MYSQL_ARGS} -Ns -e "checksum table test;" incremental_sample | awk '{print $2}'`
92+vlog "checksum_3 is $checksum_3"
93+
94+if [ $checksum_3 -ne $checksum_2 ]
95+then
96+ vlog "Checksums are not equal"
97+ exit -1
98+fi
99+
100+vlog "Checksums are OK"
101+
102+rm -rf $backup_dir
103+stop_mysqld
104+clean

Subscribers

People subscribed via source and target branches