Merge lp:~sergei.glushchenko/percona-xtrabackup/BT-26901-2.1 into lp:percona-xtrabackup/2.1

Proposed by Sergei Glushchenko on 2012-11-15
Status: Merged
Approved by: Alexey Kopytov on 2012-11-15
Approved revision: 442
Merged at revision: 454
Proposed branch: lp:~sergei.glushchenko/percona-xtrabackup/BT-26901-2.1
Merge into: lp:percona-xtrabackup/2.1
Diff against target: 200 lines (+144/-2)
3 files modified
innobackupex (+14/-1)
src/xtrabackup.c (+10/-1)
test/t/ib_doublewrite.sh (+120/-0)
To merge this branch: bzr merge lp:~sergei.glushchenko/percona-xtrabackup/BT-26901-2.1
Reviewer Review Type Date Requested Status
Alexey Kopytov (community) 2012-11-15 Approve on 2012-11-15
Laurynas Biveinis 2012-11-15 Pending
Review via email: mp+134516@code.launchpad.net

This proposal supersedes a proposal from 2012-10-18.

Description of the change

To post a comment you must log in.
Sergei Glushchenko (sergei.glushchenko) wrote : Posted in a previous version of this proposal

#26901

Laurynas Biveinis (laurynas-biveinis) wrote : Posted in a previous version of this proposal

There is a conflict in innobackupex.

(Just a heads-up, not a full review)

review: Needs Fixing
Laurynas Biveinis (laurynas-biveinis) wrote : Posted in a previous version of this proposal

Ah, wrong target branch.

Sergei Glushchenko (sergei.glushchenko) wrote : Posted in a previous version of this proposal

Resubmitted to 2.1

Laurynas Biveinis (laurynas-biveinis) wrote : Posted in a previous version of this proposal

Same comments as for 2.0 (in 2.1 please use innodb_int for the wrapper).

review: Needs Fixing
Laurynas Biveinis (laurynas-biveinis) wrote : Posted in a previous version of this proposal

OK with innodb_int.h changes following the style used in the rest in that file.

review: Approve
Laurynas Biveinis (laurynas-biveinis) wrote : Posted in a previous version of this proposal

Please re-push and set to "Approved" then, thanks.

Alexey Kopytov (akopytov) wrote : Posted in a previous version of this proposal

See comments in the 2.0 MP.

review: Needs Fixing
Alexey Kopytov (akopytov) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'innobackupex'
2--- innobackupex 2012-11-07 06:45:28 +0000
3+++ innobackupex 2012-11-15 16:55:39 +0000
4@@ -700,6 +700,13 @@
5 my $file;
6 my $backup_innodb_data_file_path;
7
8+ if (has_option(\%config, $option_defaults_group, 'innodb_doublewrite_file')) {
9+ my $doublewrite_file =
10+ get_option(\%config, $option_defaults_group,
11+ 'innodb_doublewrite_file');
12+ $excluded_files = $excluded_files . '|' . $doublewrite_file;
13+ }
14+
15 # check whether files should be copied or moved to dest directory
16 my $move_or_copy_file = $move_flag ? \&move_file : \&copy_file;
17 my $move_or_copy_dir = $move_flag ?
18@@ -1590,7 +1597,7 @@
19 "innodb_log_file_size",
20 "innodb_fast_checksum",
21 "innodb_page_size",
22- "innodb_log_block_size",
23+ "innodb_log_block_size"
24 );
25
26 my $options_dump = "# This MySQL options file was generated by $innobackup_script.\n\n" .
27@@ -1604,6 +1611,12 @@
28 $options_dump .= "$option_name=$option_value\n";
29 }
30 }
31+ if (has_option(\%config,
32+ $option_defaults_group, "innodb_doublewrite_file")) {
33+ $options_dump .= "innodb_doublewrite_file=" . (split(/\/+/,
34+ get_option(\%config, $option_defaults_group,
35+ 'innodb_doublewrite_file')))[-1] . "\n";
36+ }
37
38 print FILE $options_dump;
39 close(FILE);
40
41=== modified file 'src/xtrabackup.c'
42--- src/xtrabackup.c 2012-11-08 23:42:20 +0000
43+++ src/xtrabackup.c 2012-11-15 16:55:39 +0000
44@@ -3879,7 +3879,9 @@
45 os_file_t file = 0;
46 ulint tablespace_flags;
47
48- ut_a(dbname != NULL || space_id == 0 || space_id == ULINT_UNDEFINED);
49+ ut_a(dbname != NULL ||
50+ trx_sys_sys_space(space_id) ||
51+ space_id == ULINT_UNDEFINED);
52
53 *success = FALSE;
54
55@@ -3908,6 +3910,10 @@
56 return file;
57 }
58
59+ if (trx_sys_sys_space(space_id)) {
60+ goto found;
61+ }
62+
63 mutex_enter(&fil_system->mutex);
64 fil_space = xb_space_get_by_name(dest_space_name);
65 mutex_exit(&fil_system->mutex);
66@@ -5156,6 +5162,9 @@
67 printf("innodb_fast_checksum = %d\n", innobase_fast_checksum);
68 printf("innodb_page_size = %ld\n", innobase_page_size);
69 printf("innodb_log_block_size = %lu\n", innobase_log_block_size);
70+ if (innobase_doublewrite_file != NULL) {
71+ printf("innodb_doublewrite_file = %s\n", innobase_doublewrite_file);
72+ }
73 #endif
74 exit(EXIT_SUCCESS);
75 }
76
77=== added file 'test/t/ib_doublewrite.sh'
78--- test/t/ib_doublewrite.sh 1970-01-01 00:00:00 +0000
79+++ test/t/ib_doublewrite.sh 2012-11-15 16:55:39 +0000
80@@ -0,0 +1,120 @@
81+########################################################################
82+# Bug #1066843: Fix for bug #932623 does not take separate doublewrite
83+# tablespace into account
84+# Bug #1068470: XtraBackup handles separate doublewrite buffer file
85+# incorrectly
86+# We testing full and incremental backup and restore to check that
87+# separate doublewrite buffer file handled correctly
88+########################################################################
89+
90+. inc/common.sh
91+
92+if [ -z "$XTRADB_VERSION" ]; then
93+ echo "Requires XtraDB" > $SKIPPED_REASON
94+ exit $SKIPPED_EXIT_CODE
95+fi
96+
97+DBLWR=${TEST_BASEDIR}/var1/data/dblwr.ibd
98+start_server --innodb_file_per_table --innodb_doublewrite_file=${DBLWR}
99+load_dbase_schema incremental_sample
100+
101+# Workaround for bug #1072695
102+IB_ARGS_NO_DEFAULTS_FILE=`echo $IB_ARGS | sed -e 's/--defaults-file=[^ ]* / /'`
103+function innobackupex_no_defaults_file ()
104+{
105+ run_cmd $IB_BIN $IB_ARGS_NO_DEFAULTS_FILE $*
106+}
107+
108+echo "innodb_doublewrite_file=${DBLWR}" >>$topdir/my.cnf
109+
110+# Adding initial rows
111+vlog "Adding initial rows to database..."
112+${MYSQL} ${MYSQL_ARGS} -e "insert into test values (1, 1);" incremental_sample
113+
114+# Full backup
115+# backup root directory
116+mkdir -p $topdir/backup
117+
118+vlog "Starting backup"
119+full_backup_dir=$topdir/backup/full
120+innobackupex --no-timestamp $full_backup_dir
121+vlog "Full backup done to directory $full_backup_dir"
122+cat $full_backup_dir/backup-my.cnf
123+
124+# Changing data
125+
126+vlog "Making changes to database"
127+${MYSQL} ${MYSQL_ARGS} -e "create table t2 (a int(11) default null, number int(11) default null) engine=innodb" incremental_sample
128+${MYSQL} ${MYSQL_ARGS} -e "insert into test values (10, 1);" incremental_sample
129+${MYSQL} ${MYSQL_ARGS} -e "insert into t2 values (10, 1);" incremental_sample
130+vlog "Changes done"
131+
132+# Saving the checksum of original table
133+checksum_test_a=`checksum_table incremental_sample test`
134+checksum_t2_a=`checksum_table incremental_sample t2`
135+vlog "Table 'test' checksum is $checksum_test_a"
136+vlog "Table 't2' checksum is $checksum_t2_a"
137+
138+vlog "Making incremental backup"
139+
140+vlog "###############"
141+vlog "# INCREMENTAL #"
142+vlog "###############"
143+
144+# Incremental backup
145+inc_backup_dir=$topdir/backup/inc
146+innobackupex --no-timestamp --incremental --incremental-basedir=$full_backup_dir \
147+ $inc_backup_dir
148+vlog "Incremental backup done to directory $inc_backup_dir"
149+
150+vlog "Preparing backup"
151+# Prepare backup
152+vlog "##############"
153+vlog "# PREPARE #1 #"
154+vlog "##############"
155+innobackupex_no_defaults_file --apply-log --redo-only $full_backup_dir
156+vlog "Log applied to full backup"
157+vlog "##############"
158+vlog "# PREPARE #2 #"
159+vlog "##############"
160+innobackupex_no_defaults_file --apply-log --redo-only --incremental-dir=$inc_backup_dir \
161+ $full_backup_dir
162+vlog "Delta applied to full backup"
163+vlog "##############"
164+vlog "# PREPARE #3 #"
165+vlog "##############"
166+innobackupex_no_defaults_file --apply-log $full_backup_dir
167+vlog "Data prepared for restore"
168+
169+# Destroying mysql data
170+stop_server
171+rm -rf $mysql_datadir/*
172+vlog "Data destroyed"
173+
174+# Restore backup
175+vlog "Copying files"
176+vlog "###########"
177+vlog "# RESTORE #"
178+vlog "###########"
179+innobackupex --copy-back $full_backup_dir
180+vlog "Data restored"
181+
182+start_server --innodb_file_per_table --innodb_doublewrite_file=${DBLWR}
183+
184+vlog "Checking checksums"
185+checksum_test_b=`checksum_table incremental_sample test`
186+checksum_t2_b=`checksum_table incremental_sample t2`
187+
188+if [ "$checksum_test_a" != "$checksum_test_b" ]
189+then
190+ vlog "Checksums for table 'test' are not equal"
191+ exit -1
192+fi
193+
194+if [ "$checksum_t2_a" != "$checksum_t2_b" ]
195+then
196+ vlog "Checksums for table 't2' are not equal"
197+ exit -1
198+fi
199+
200+vlog "Checksums are OK"

Subscribers

People subscribed via source and target branches