Merge lp:~laurynas-biveinis/percona-xtrabackup/bug1028949-2.1 into lp:percona-xtrabackup/2.1

Proposed by Laurynas Biveinis
Status: Merged
Approved by: Laurynas Biveinis
Approved revision: no longer in the source branch.
Merged at revision: 417
Proposed branch: lp:~laurynas-biveinis/percona-xtrabackup/bug1028949-2.1
Merge into: lp:percona-xtrabackup/2.1
Prerequisite: lp:~laurynas-biveinis/percona-xtrabackup/bug1022562-2.1
Diff against target: 153 lines (+129/-2)
2 files modified
src/xtrabackup.c (+19/-2)
test/t/bug1028949.sh (+110/-0)
To merge this branch: bzr merge lp:~laurynas-biveinis/percona-xtrabackup/bug1028949-2.1
Reviewer Review Type Date Requested Status
Laurynas Biveinis (community) Approve
Review via email: mp+117612@code.launchpad.net

Description of the change

Automerge bug 1028949 fix from 2.0

To post a comment you must log in.
Revision history for this message
Laurynas Biveinis (laurynas-biveinis) wrote :

Fix for 2.0 was approved, setting this automerge to approved too.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/xtrabackup.c'
2--- src/xtrabackup.c 2012-08-01 10:52:18 +0000
3+++ src/xtrabackup.c 2012-08-01 10:52:18 +0000
4@@ -3820,6 +3820,7 @@
5 ibool ok;
6 fil_space_t* fil_space;
7 os_file_t file = 0;
8+ ulint tablespace_flags;
9
10 ut_a(dbname || space_id == 0);
11
12@@ -3909,8 +3910,24 @@
13 to ensure the correct tablespace image. */
14
15 #ifdef INNODB_VERSION_SHORT
16- if (!fil_space_create(dest_space_name, space_id,
17- zip_size, FIL_TABLESPACE)) {
18+ /* Calculate correct tablespace flags for compressed tablespaces. Do
19+ not bother to set all flags correctly, just enough for
20+ fil_space_create() to work. The full flags will be restored from the
21+ delta later. */
22+ if (!zip_size) {
23+ tablespace_flags = 0;
24+ }
25+ else {
26+ tablespace_flags
27+ = (get_bit_shift(zip_size >> PAGE_ZIP_MIN_SIZE_SHIFT
28+ << 1)
29+ << DICT_TF_ZSSIZE_SHIFT)
30+ | DICT_TF_COMPACT
31+ | (DICT_TF_FORMAT_ZIP << DICT_TF_FORMAT_SHIFT);
32+ }
33+ ut_a(dict_table_flags_to_zip_size(tablespace_flags) == zip_size);
34+ if (!fil_space_create(dest_space_name, space_id, tablespace_flags,
35+ FIL_TABLESPACE)) {
36 #else
37 if (!fil_space_create(dest_space_name, space_id,
38 FIL_TABLESPACE)) {
39
40=== added file 'test/t/bug1028949.sh'
41--- test/t/bug1028949.sh 1970-01-01 00:00:00 +0000
42+++ test/t/bug1028949.sh 2012-08-01 10:52:18 +0000
43@@ -0,0 +1,110 @@
44+. inc/common.sh
45+
46+if [ -z "$INNODB_VERSION" ]; then
47+ echo "Requires InnoDB plugin or XtraDB" >$SKIPPED_REASON
48+ exit $SKIPPED_EXIT_CODE
49+fi
50+
51+function test_bug_1028949()
52+{
53+ page_size=$1
54+
55+ mysqld_additional_args="--innodb_file_per_table --innodb_strict_mode \
56+--innodb_file_format=Barracuda"
57+
58+ start_server ${mysqld_additional_args}
59+
60+ load_dbase_schema incremental_sample
61+
62+ # Full backup
63+
64+ # Full backup folder
65+ rm -rf $topdir/data/full
66+ mkdir -p $topdir/data/full
67+ # Incremental data
68+ rm -rf $topdir/data/delta
69+ mkdir -p $topdir/data/delta
70+
71+ vlog "Starting backup"
72+
73+ xtrabackup --datadir=$mysql_datadir --backup --target-dir=$topdir/data/full \
74+ $mysqld_additional_args
75+
76+ vlog "Full backup done"
77+
78+ # Changing data in sakila
79+
80+ vlog "Making changes to database"
81+
82+ ${MYSQL} ${MYSQL_ARGS} -e "CREATE TABLE t2 (a INT(11) DEFAULT NULL, \
83+ number INT(11) DEFAULT NULL) ENGINE=INNODB\
84+ ROW_FORMAT=compressed KEY_BLOCK_SIZE=$page_size" incremental_sample
85+ ${MYSQL} ${MYSQL_ARGS} -e "INSERT INTO t2 VALUES (1, 1)" incremental_sample
86+
87+ vlog "Changes done"
88+
89+ # Saving the checksum of original table
90+ checksum_t2_a=`checksum_table incremental_sample t2`
91+
92+ vlog "Table 't2' checksum is $checksum_t2_a"
93+
94+ vlog "Making incremental backup"
95+
96+ # Incremental backup
97+ xtrabackup --datadir=$mysql_datadir --backup \
98+ --target-dir=$topdir/data/delta --incremental-basedir=$topdir/data/full \
99+ $mysqld_additional_args
100+
101+ vlog "Incremental backup done"
102+ vlog "Preparing backup"
103+
104+ # Prepare backup
105+ xtrabackup --datadir=$mysql_datadir --prepare --apply-log-only \
106+ --target-dir=$topdir/data/full $mysqld_additional_args
107+ vlog "Log applied to backup"
108+
109+ xtrabackup --datadir=$mysql_datadir --prepare --apply-log-only \
110+ --target-dir=$topdir/data/full --incremental-dir=$topdir/data/delta \
111+ $mysqld_additional_args
112+ vlog "Delta applied to backup"
113+
114+ xtrabackup --datadir=$mysql_datadir --prepare --target-dir=$topdir/data/full \
115+ $mysqld_additional_args
116+ vlog "Data prepared for restore"
117+
118+ # removing rows
119+ ${MYSQL} ${MYSQL_ARGS} -e "delete from t2;" incremental_sample
120+ vlog "Table cleared"
121+
122+ # Restore backup
123+
124+ stop_server
125+
126+ vlog "Copying files"
127+
128+ cd $topdir/data/full/
129+ cp -r * $mysql_datadir
130+ cd -
131+
132+ vlog "Data restored"
133+
134+ start_server ${mysqld_additional_args}
135+
136+ vlog "Checking checksums"
137+ checksum_t2_b=`checksum_table incremental_sample t2`
138+
139+ if [ "$checksum_t2_a" != "$checksum_t2_b" ]
140+ then
141+ vlog "Checksums of table 't2' are not equal"
142+ exit -1
143+ fi
144+
145+ vlog "Checksums are OK"
146+
147+ stop_server
148+}
149+
150+for page_size in 1 2 4 8 16; do
151+ test_bug_1028949 ${page_size}
152+ clean
153+done

Subscribers

People subscribed via source and target branches