Merge lp:~akopytov/percona-xtrabackup/bug826632-1.6 into lp:percona-xtrabackup/1.6

Proposed by Alexey Kopytov
Status: Merged
Approved by: Stewart Smith
Approved revision: no longer in the source branch.
Merged at revision: 321
Proposed branch: lp:~akopytov/percona-xtrabackup/bug826632-1.6
Merge into: lp:percona-xtrabackup/1.6
Diff against target: 316 lines (+108/-49)
5 files modified
test/inc/sakila-db/sakila-data.sql (+1/-22)
test/inc/sakila-db/sakila-schema.sql (+22/-0)
test/t/xb_parallel.sh (+1/-1)
test/t/xb_parallel_incremental.sh (+58/-0)
xtrabackup.c (+26/-26)
To merge this branch: bzr merge lp:~akopytov/percona-xtrabackup/bug826632-1.6
Reviewer Review Type Date Requested Status
Stewart Smith (community) Approve
Review via email: mp+87011@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Alexey Kopytov (akopytov) wrote :
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
1=== modified file 'test/inc/sakila-db/sakila-data.sql'
2--- test/inc/sakila-db/sakila-data.sql 2010-06-02 13:05:00 +0000
3+++ test/inc/sakila-db/sakila-data.sql 2011-12-28 14:00:30 +0000
4@@ -67,13 +67,6 @@
5 COMMIT;
6
7 --
8--- Trigger to enforce create dates on INSERT
9---
10-
11-CREATE TRIGGER customer_create_date BEFORE INSERT ON customer
12- FOR EACH ROW SET NEW.create_date = NOW();
13-
14---
15 -- Dumping data for table film
16 --
17
18@@ -123,13 +116,6 @@
19 COMMIT;
20
21 --
22--- Trigger to enforce payment_date during INSERT
23---
24-
25-CREATE TRIGGER payment_date BEFORE INSERT ON payment
26- FOR EACH ROW SET NEW.payment_date = NOW();
27-
28---
29 -- Dumping data for table rental
30 --
31
32@@ -139,13 +125,6 @@
33 COMMIT;
34
35 --
36--- Trigger to enforce rental_date on INSERT
37---
38-
39-CREATE TRIGGER rental_date BEFORE INSERT ON rental
40- FOR EACH ROW SET NEW.rental_date = NOW();
41-
42---
43 -- Dumping data for table staff
44 --
45
46@@ -163,4 +142,4 @@
47
48 SET SQL_MODE=@OLD_SQL_MODE;
49 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;
50-SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;
51\ No newline at end of file
52+SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;
53
54=== modified file 'test/inc/sakila-db/sakila-schema.sql'
55--- test/inc/sakila-db/sakila-schema.sql 2010-06-02 13:05:00 +0000
56+++ test/inc/sakila-db/sakila-schema.sql 2011-12-28 14:00:30 +0000
57@@ -636,6 +636,28 @@
58
59 DELIMITER ;
60
61+--
62+-- Trigger to enforce payment_date during INSERT
63+--
64+
65+CREATE TRIGGER payment_date BEFORE INSERT ON payment
66+ FOR EACH ROW SET NEW.payment_date = NOW();
67+
68+--
69+-- Trigger to enforce create dates on INSERT
70+--
71+
72+CREATE TRIGGER customer_create_date BEFORE INSERT ON customer
73+ FOR EACH ROW SET NEW.create_date = NOW();
74+
75+--
76+-- Trigger to enforce rental_date on INSERT
77+--
78+
79+CREATE TRIGGER rental_date BEFORE INSERT ON rental
80+ FOR EACH ROW SET NEW.rental_date = NOW();
81+
82+
83 SET SQL_MODE=@OLD_SQL_MODE;
84 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;
85 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;
86
87=== modified file 'test/t/xb_parallel.sh'
88--- test/t/xb_parallel.sh 2011-12-07 13:28:47 +0000
89+++ test/t/xb_parallel.sh 2011-12-28 14:00:30 +0000
90@@ -1,7 +1,7 @@
91 . inc/common.sh
92
93 init
94-run_mysqld
95+run_mysqld --innodb_file_per_table
96 load_dbase_schema sakila
97 load_dbase_data sakila
98
99
100=== added file 'test/t/xb_parallel_incremental.sh'
101--- test/t/xb_parallel_incremental.sh 1970-01-01 00:00:00 +0000
102+++ test/t/xb_parallel_incremental.sh 2011-12-28 14:00:30 +0000
103@@ -0,0 +1,58 @@
104+##########################################################################
105+# Bug #826632: parallel option breaks incremental backups #
106+##########################################################################
107+
108+. inc/common.sh
109+
110+init
111+run_mysqld --innodb_file_per_table
112+load_dbase_schema sakila
113+load_dbase_data sakila
114+
115+# Take backup
116+vlog "Creating the backup directory: $topdir/backup"
117+backup_dir="$topdir/backup"
118+innobackupex $topdir/full_backup --no-timestamp --parallel=8
119+
120+# Make some changes for incremental backup by truncating and reloading
121+# tables. TRUNCATE cannot be used here, because that would be executed
122+# as DROP + CREATE internally for InnoDB tables, so tablespace IDs
123+# would change.
124+
125+table_list=`$MYSQL $MYSQL_ARGS -Ns -e \
126+"SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='sakila' \
127+AND TABLE_TYPE='BASE TABLE'"`
128+
129+for t in $table_list
130+do
131+ run_cmd $MYSQL $MYSQL_ARGS -s sakila <<EOF
132+SET foreign_key_checks=0;
133+DELETE FROM $t;
134+SET foreign_key_checks=1;
135+EOF
136+done
137+
138+load_dbase_data sakila
139+
140+# Do an incremental parallel backup
141+innobackupex --incremental --no-timestamp --parallel=8 \
142+ --incremental-basedir=$topdir/full_backup $topdir/inc_backup
143+
144+stop_mysqld
145+# Remove datadir
146+rm -r $mysql_datadir
147+
148+vlog "Applying log"
149+innobackupex --apply-log --redo-only $topdir/full_backup
150+innobackupex --apply-log --redo-only --incremental-dir=$topdir/inc_backup \
151+ $topdir/full_backup
152+innobackupex --apply-log $topdir/full_backup
153+
154+vlog "Restoring MySQL datadir"
155+mkdir -p $mysql_datadir
156+innobackupex --copy-back $topdir/full_backup
157+
158+run_mysqld
159+
160+# Check sakila
161+run_cmd ${MYSQL} ${MYSQL_ARGS} -e "SELECT count(*) from actor" sakila
162
163=== modified file 'xtrabackup.c'
164--- xtrabackup.c 2011-12-05 12:35:43 +0000
165+++ xtrabackup.c 2011-12-28 14:00:30 +0000
166@@ -610,8 +610,6 @@
167 LSN64 incremental_lsn;
168 LSN64 incremental_to_lsn;
169 LSN64 incremental_last_lsn;
170-byte* incremental_buffer = NULL;
171-byte* incremental_buffer_base = NULL;
172
173 char *xtrabackup_incremental_basedir = NULL; /* for --backup */
174 char *xtrabackup_extra_lsndir = NULL; /* for --backup with --extra-lsndir */
175@@ -2591,6 +2589,8 @@
176 IB_INT64 offset;
177 ulint page_in_buffer;
178 ulint incremental_buffers = 0;
179+ byte* incremental_buffer;
180+ byte* incremental_buffer_base = NULL;
181 ulint page_size;
182 ulint page_size_shift;
183 #ifdef INNODB_VERSION_SHORT
184@@ -2740,6 +2740,12 @@
185 }
186
187 if (xtrabackup_incremental) {
188+ /* allocate buffer for incremental backup (4096 pages) */
189+ incremental_buffer_base = ut_malloc((UNIV_PAGE_SIZE_MAX / 4 + 1)
190+ * UNIV_PAGE_SIZE_MAX);
191+ incremental_buffer = ut_align(incremental_buffer_base,
192+ UNIV_PAGE_SIZE_MAX);
193+
194 snprintf(meta_path, sizeof(meta_path),
195 "%s%s", dst_path, XB_DELTA_INFO_SUFFIX);
196 strcat(dst_path, ".delta");
197@@ -3003,6 +3009,8 @@
198 os_file_close(src_file);
199 }
200 os_file_close(dst_file);
201+ if (incremental_buffer_base)
202+ ut_free(incremental_buffer_base);
203 ut_free(buf2);
204 return(FALSE);
205 error:
206@@ -3010,6 +3018,8 @@
207 os_file_close(src_file);
208 if (dst_file != -1)
209 os_file_close(dst_file);
210+ if (incremental_buffer_base)
211+ ut_free(incremental_buffer_base);
212 if (buf2)
213 ut_free(buf2);
214 fprintf(stderr, "[%02u] xtrabackup: Error: "
215@@ -3021,6 +3031,8 @@
216 os_file_close(src_file);
217 if (dst_file != -1)
218 os_file_close(dst_file);
219+ if (incremental_buffer_base)
220+ ut_free(incremental_buffer_base);
221 if (buf2)
222 ut_free(buf2);
223 fprintf(stderr, "[%02u] xtrabackup: Warning: skipping file %s.\n",
224@@ -5087,6 +5099,8 @@
225 xb_delta_info_t info;
226 ulint page_size;
227 ulint page_size_shift;
228+ byte* incremental_buffer_base = NULL;
229+ byte* incremental_buffer;
230
231 ut_a(xtrabackup_incremental);
232
233@@ -5200,6 +5214,12 @@
234 os_file_set_nocache(dst_file, dst_path, "OPEN");
235 }
236
237+ /* allocate buffer for incremental backup (4096 pages) */
238+ incremental_buffer_base = ut_malloc((UNIV_PAGE_SIZE_MAX / 4 + 1) *
239+ UNIV_PAGE_SIZE_MAX);
240+ incremental_buffer = ut_align(incremental_buffer_base,
241+ UNIV_PAGE_SIZE_MAX);
242+
243 fprintf(stderr, "Applying %s ...\n", src_path);
244
245 while (!last_buffer) {
246@@ -5282,6 +5302,8 @@
247 incremental_buffers++;
248 }
249
250+ if (incremental_buffer_base)
251+ ut_free(incremental_buffer_base);
252 if (src_file != -1)
253 os_file_close(src_file);
254 if (dst_file != -1)
255@@ -5289,6 +5311,8 @@
256 return TRUE;
257
258 error:
259+ if (incremental_buffer_base)
260+ ut_free(incremental_buffer_base);
261 if (src_file != -1)
262 os_file_close(src_file);
263 if (dst_file != -1)
264@@ -6184,12 +6208,6 @@
265 xtrabackup_incremental);
266 exit(EXIT_FAILURE);
267 }
268-
269- /* allocate buffer for incremental backup (4096 pages) */
270- incremental_buffer_base = malloc((UNIV_PAGE_SIZE_MAX / 4 + 1) *
271- UNIV_PAGE_SIZE_MAX);
272- incremental_buffer = ut_align(incremental_buffer_base,
273- UNIV_PAGE_SIZE_MAX);
274 } else if (xtrabackup_backup && xtrabackup_incremental_basedir) {
275 char filename[FN_REFLEN];
276
277@@ -6204,12 +6222,6 @@
278
279 incremental_lsn = metadata_to_lsn;
280 xtrabackup_incremental = xtrabackup_incremental_basedir; //dummy
281-
282- /* allocate buffer for incremental backup (4096 pages) */
283- incremental_buffer_base = malloc((UNIV_PAGE_SIZE_MAX / 4 + 1) *
284- UNIV_PAGE_SIZE_MAX);
285- incremental_buffer = ut_align(incremental_buffer_base,
286- UNIV_PAGE_SIZE_MAX);
287 } else if (xtrabackup_prepare && xtrabackup_incremental_dir) {
288 char filename[FN_REFLEN];
289
290@@ -6227,17 +6239,7 @@
291 incremental_last_lsn = metadata_last_lsn;
292 xtrabackup_incremental = xtrabackup_incremental_dir; //dummy
293
294- /* allocate buffer for incremental backup (4096 pages) */
295- incremental_buffer_base = malloc((UNIV_PAGE_SIZE / 4 + 1) *
296- UNIV_PAGE_SIZE);
297- incremental_buffer = ut_align(incremental_buffer_base,
298- UNIV_PAGE_SIZE);
299 } else {
300- /* allocate buffer for applying incremental (for header page only) */
301- incremental_buffer_base = malloc((1 + 1) * UNIV_PAGE_SIZE_MAX);
302- incremental_buffer = ut_align(incremental_buffer_base,
303- UNIV_PAGE_SIZE_MAX);
304-
305 xtrabackup_incremental = NULL;
306 }
307
308@@ -6324,8 +6326,6 @@
309 if (xtrabackup_prepare)
310 xtrabackup_prepare_func();
311
312- free(incremental_buffer_base);
313-
314 if (xtrabackup_tables) {
315 /* free regexp */
316 int i;

Subscribers

People subscribed via source and target branches