Merge lp:~akopytov/percona-xtrabackup/bug722638-trunk into lp:percona-xtrabackup/2.0

Proposed by Alexey Kopytov
Status: Merged
Approved by: Stewart Smith
Approved revision: no longer in the source branch.
Merged at revision: 303
Proposed branch: lp:~akopytov/percona-xtrabackup/bug722638-trunk
Merge into: lp:percona-xtrabackup/2.0
Diff against target: 2266 lines (+476/-254)
17 files modified
patches/innodb51.patch (+42/-41)
patches/innodb51_builtin.patch (+113/-37)
patches/innodb55.patch (+39/-35)
patches/xtradb51.patch (+38/-36)
patches/xtradb55.patch (+38/-36)
test/inc/common.sh (+9/-0)
test/t/bug722638.sh (+119/-0)
test/t/bug723097.sh (+2/-2)
test/t/bug810269.sh (+2/-4)
test/t/ib_csm_csv.sh (+4/-4)
test/t/ib_incremental.sh (+2/-2)
test/t/xb_export.sh (+3/-3)
test/t/xb_incremental.sh (+2/-2)
test/t/xb_incremental_compressed.sh (+2/-4)
test/t/xb_part_range.sh (+2/-2)
test/t/xb_partial.sh (+2/-2)
xtrabackup.c (+57/-44)
To merge this branch: bzr merge lp:~akopytov/percona-xtrabackup/bug722638-trunk
Reviewer Review Type Date Requested Status
Stewart Smith (community) Approve
Review via email: mp+75468@code.launchpad.net

Description of the change

Bug #722638: xtrabackup: taking backup while tables are droped and
created breaks backup

The root cause of the problem was that xtrabackup iterated .ibd files
based on a data dictionary snapshot taken at the very start of a backup
process. If a tablespace id changed due to dropping and recreating the
table with the same name, or an ALTER TABLE that requires a table copy,
or TRUNCATE (if it was performed as DROP + CREATE TABLE), InnoDB
complained about id mismatch, and crashed with an assertion failure.

The idea of the fix is to ignore tablespaces with wrong ids at the
backup stage. They will be (re)created when doing recovery at the prepare
stage, since the corresponding delete/create log records will be
replayed on recovery.

Fixed by modifying fil_node_open_file() in all XtraBackup patches to
InnoDB/XtraDB source to signal id mismatches back to the caller (with an
descriptive warning) rather than crash with an error.

Warning messages in xtrabackup.c were also adjusted to take this new
case into account.

This patch also introduces a new command line switch to xtrabackup,
--debug-sync, to make possible automatic testing of the fix.

To post a comment you must log in.
Revision history for this message
Alexey Kopytov (akopytov) wrote :

Can't link a Jenkins build as it have been stuck for a few days.

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 'patches/innodb51.patch'
2--- patches/innodb51.patch 2011-06-26 03:06:10 +0000
3+++ patches/innodb51.patch 2011-09-15 04:23:22 +0000
4@@ -1,4 +1,3 @@
5-diff -ruN a/storage/innodb_plugin/btr/btr0btr.c b/storage/innodb_plugin/btr/btr0btr.c
6 --- a/storage/innodb_plugin/btr/btr0btr.c
7 +++ b/storage/innodb_plugin/btr/btr0btr.c
8 @@ -120,7 +120,7 @@
9@@ -19,7 +18,6 @@
10 buf_block_t*
11 btr_node_ptr_get_child(
12 /*===================*/
13-diff -ruN a/storage/innodb_plugin/buf/buf0buf.c b/storage/innodb_plugin/buf/buf0buf.c
14 --- a/storage/innodb_plugin/buf/buf0buf.c
15 +++ b/storage/innodb_plugin/buf/buf0buf.c
16 @@ -358,7 +358,7 @@
17@@ -51,7 +49,6 @@
18 ibuf_merge_or_delete_for_page(
19 (buf_block_t*) bpage, bpage->space,
20 bpage->offset, buf_page_get_zip_size(bpage),
21-diff -ruN a/storage/innodb_plugin/buf/buf0rea.c b/storage/innodb_plugin/buf/buf0rea.c
22 --- a/storage/innodb_plugin/buf/buf0rea.c
23 +++ b/storage/innodb_plugin/buf/buf0rea.c
24 @@ -120,6 +120,45 @@
25@@ -151,7 +148,6 @@
26 return;
27 }
28
29-diff -ruN a/storage/innodb_plugin/fil/fil0fil.c b/storage/innodb_plugin/fil/fil0fil.c
30 --- a/storage/innodb_plugin/fil/fil0fil.c
31 +++ b/storage/innodb_plugin/fil/fil0fil.c
32 @@ -48,6 +48,8 @@
33@@ -190,7 +186,7 @@
34 fil_node_open_file(
35 /*===============*/
36 fil_node_t* node, /*!< in: file node */
37-@@ -657,7 +659,14 @@
38+@@ -657,7 +659,17 @@
39 node->name, OS_FILE_OPEN, OS_FILE_READ_ONLY, &success);
40 if (!success) {
41 /* The following call prints an error message */
42@@ -199,14 +195,36 @@
43 + {
44 + ut_print_timestamp(stderr);
45 + fprintf(stderr,
46-+ " InnoDB: Warning: cannot open %s\n",
47++ " InnoDB: Warning: cannot open %s\n"
48++ "InnoDB: this can happen if the table "
49++ "was removed or renamed during an \n"
50++ "InnoDB: xtrabackup run and is not dangerous.\n",
51 + node->name);
52 + return(OS_FILE_NOT_FOUND);
53 + }
54
55 ut_print_timestamp(stderr);
56
57-@@ -747,8 +756,8 @@
58+@@ -718,12 +730,15 @@
59+
60+ if (UNIV_UNLIKELY(space_id != space->id)) {
61+ fprintf(stderr,
62+- "InnoDB: Error: tablespace id is %lu"
63++ "InnoDB: Warning: tablespace id is %lu"
64+ " in the data dictionary\n"
65+- "InnoDB: but in file %s it is %lu!\n",
66++ "InnoDB: but in file %s it is %lu!\n"
67++ "InnoDB: this can happen if the table metadata "
68++ "was modified during an xtrabackup run\n"
69++ "InnoDB: and is not dangerous.\n",
70+ space->id, node->name, space_id);
71+
72+- ut_error;
73++ return(OS_FILE_NOT_FOUND);
74+ }
75+
76+ if (UNIV_UNLIKELY(space_id == ULINT_UNDEFINED
77+@@ -747,8 +762,8 @@
78 }
79
80 if (size_bytes >= 1024 * 1024) {
81@@ -217,7 +235,7 @@
82 }
83
84 if (!(flags & DICT_TF_ZSSIZE_MASK)) {
85-@@ -793,6 +802,8 @@
86+@@ -793,6 +808,8 @@
87 /* Put the node to the LRU list */
88 UT_LIST_ADD_FIRST(LRU, system->LRU, node);
89 }
90@@ -226,7 +244,7 @@
91 }
92
93 /**********************************************************************//**
94-@@ -1418,7 +1429,12 @@
95+@@ -1418,7 +1435,12 @@
96 the file yet; the following calls will open it and update the
97 size fields */
98
99@@ -240,7 +258,7 @@
100 fil_node_complete_io(node, fil_system, OS_FILE_READ);
101 }
102
103-@@ -1470,7 +1486,12 @@
104+@@ -1470,7 +1492,12 @@
105 the file yet; the following calls will open it and update the
106 size fields */
107
108@@ -254,7 +272,7 @@
109 fil_node_complete_io(node, fil_system, OS_FILE_READ);
110 }
111
112-@@ -1910,7 +1931,7 @@
113+@@ -1910,7 +1937,7 @@
114 mem_free(path);
115 }
116
117@@ -263,7 +281,7 @@
118 /********************************************************//**
119 Writes a log record about an .ibd file create/rename/delete. */
120 static
121-@@ -2134,7 +2155,7 @@
122+@@ -2134,7 +2161,7 @@
123 if (fil_create_new_single_table_tablespace(
124 space_id, name, FALSE, flags,
125 FIL_IBD_FILE_INITIAL_SIZE) != DB_SUCCESS) {
126@@ -272,7 +290,7 @@
127 }
128 }
129
130-@@ -2297,7 +2318,7 @@
131+@@ -2297,7 +2324,7 @@
132 }
133
134 if (success) {
135@@ -281,7 +299,7 @@
136 /* Write a log record about the deletion of the .ibd
137 file, so that ibbackup can replay it in the
138 --apply-log phase. We use a dummy mtr and the familiar
139-@@ -2598,7 +2619,7 @@
140+@@ -2598,7 +2625,7 @@
141
142 mutex_exit(&fil_system->mutex);
143
144@@ -290,7 +308,7 @@
145 if (success) {
146 mtr_t mtr;
147
148-@@ -2788,7 +2809,7 @@
149+@@ -2788,7 +2815,7 @@
150
151 fil_node_create(path, size, space_id, FALSE);
152
153@@ -299,7 +317,7 @@
154 {
155 mtr_t mtr;
156
157-@@ -3041,19 +3062,97 @@
158+@@ -3041,19 +3068,97 @@
159 "InnoDB: open the tablespace file ", stderr);
160 ut_print_filename(stderr, filepath);
161 fputs("!\n"
162@@ -407,7 +425,7 @@
163 return(FALSE);
164 }
165
166-@@ -3284,7 +3383,7 @@
167+@@ -3284,7 +3389,7 @@
168 cannot be ok. */
169
170 size = (((ib_int64_t)size_high) << 32) + (ib_int64_t)size_low;
171@@ -416,7 +434,7 @@
172 if (size < FIL_IBD_FILE_INITIAL_SIZE * UNIV_PAGE_SIZE) {
173 fprintf(stderr,
174 "InnoDB: Error: the size of single-table tablespace"
175-@@ -3425,7 +3524,7 @@
176+@@ -3425,7 +3530,7 @@
177 idea is to read as much good data as we can and jump over bad data.
178 @return 0 if ok, -1 if error even after the retries, 1 if at the end
179 of the directory */
180@@ -425,7 +443,7 @@
181 int
182 fil_file_readdir_next_file(
183 /*=======================*/
184-@@ -3724,15 +3823,97 @@
185+@@ -3724,15 +3829,97 @@
186 "InnoDB: in InnoDB data dictionary"
187 " has tablespace id %lu,\n"
188 "InnoDB: but tablespace with that id"
189@@ -531,7 +549,7 @@
190 } else {
191 ut_print_timestamp(stderr);
192 fputs(" InnoDB: Error: table ", stderr);
193-@@ -4121,7 +4302,7 @@
194+@@ -4121,7 +4308,7 @@
195 off the LRU list if it is in the LRU list. The caller must hold the fil_sys
196 mutex. */
197 static
198@@ -540,7 +558,7 @@
199 fil_node_prepare_for_io(
200 /*====================*/
201 fil_node_t* node, /*!< in: file node */
202-@@ -4141,10 +4322,13 @@
203+@@ -4141,10 +4328,13 @@
204 }
205
206 if (node->open == FALSE) {
207@@ -555,7 +573,7 @@
208 }
209
210 if (node->n_pending == 0 && space->purpose == FIL_TABLESPACE
211-@@ -4157,6 +4341,8 @@
212+@@ -4157,6 +4347,8 @@
213 }
214
215 node->n_pending++;
216@@ -564,7 +582,7 @@
217 }
218
219 /********************************************************************//**
220-@@ -4292,7 +4478,9 @@
221+@@ -4292,7 +4484,9 @@
222 ut_ad(recv_no_ibuf_operations || (type == OS_FILE_WRITE)
223 || !ibuf_bitmap_page(zip_size, block_offset)
224 || sync || is_log);
225@@ -575,7 +593,7 @@
226 || ibuf_page(space_id, zip_size, block_offset, NULL));
227 # endif /* UNIV_LOG_DEBUG */
228 if (sync) {
229-@@ -4341,6 +4529,16 @@
230+@@ -4341,6 +4535,16 @@
231
232 ut_ad((mode != OS_AIO_IBUF) || (space->purpose == FIL_TABLESPACE));
233
234@@ -592,7 +610,6 @@
235 node = UT_LIST_GET_FIRST(space->chain);
236
237 for (;;) {
238-diff -ruN a/storage/innodb_plugin/ibuf/ibuf0ibuf.c b/storage/innodb_plugin/ibuf/ibuf0ibuf.c
239 --- a/storage/innodb_plugin/ibuf/ibuf0ibuf.c
240 +++ b/storage/innodb_plugin/ibuf/ibuf0ibuf.c
241 @@ -1061,6 +1061,9 @@
242@@ -615,7 +632,6 @@
243 while (sum_pages < n_pages) {
244 n_bytes = ibuf_contract_ext(&n_pag2, sync);
245
246-diff -ruN a/storage/innodb_plugin/include/mem0mem.ic b/storage/innodb_plugin/include/mem0mem.ic
247 --- a/storage/innodb_plugin/include/mem0mem.ic
248 +++ b/storage/innodb_plugin/include/mem0mem.ic
249 @@ -367,7 +367,7 @@
250@@ -627,7 +643,6 @@
251 #endif
252
253 return(buf);
254-diff -ruN a/storage/innodb_plugin/include/mtr0mtr.ic b/storage/innodb_plugin/include/mtr0mtr.ic
255 --- a/storage/innodb_plugin/include/mtr0mtr.ic
256 +++ b/storage/innodb_plugin/include/mtr0mtr.ic
257 @@ -160,7 +160,7 @@
258@@ -639,7 +654,6 @@
259
260 if ((object == slot->object) && (type == slot->type)) {
261
262-diff -ruN a/storage/innodb_plugin/include/srv0srv.h b/storage/innodb_plugin/include/srv0srv.h
263 --- a/storage/innodb_plugin/include/srv0srv.h
264 +++ b/storage/innodb_plugin/include/srv0srv.h
265 @@ -201,6 +201,10 @@
266@@ -653,7 +667,6 @@
267 /*-------------------------------------------*/
268
269 extern ulint srv_n_rows_inserted;
270-diff -ruN a/storage/innodb_plugin/include/srv0start.h b/storage/innodb_plugin/include/srv0start.h
271 --- a/storage/innodb_plugin/include/srv0start.h
272 +++ b/storage/innodb_plugin/include/srv0start.h
273 @@ -91,6 +91,8 @@
274@@ -665,7 +678,6 @@
275 #ifdef __NETWARE__
276 void set_panic_flag_for_netware(void);
277 #endif
278-diff -ruN a/storage/innodb_plugin/include/ut0byte.ic b/storage/innodb_plugin/include/ut0byte.ic
279 --- a/storage/innodb_plugin/include/ut0byte.ic
280 +++ b/storage/innodb_plugin/include/ut0byte.ic
281 @@ -168,6 +168,16 @@
282@@ -713,7 +725,6 @@
283 return(diff);
284 }
285
286-diff -ruN a/storage/innodb_plugin/log/log0log.c b/storage/innodb_plugin/log/log0log.c
287 --- a/storage/innodb_plugin/log/log0log.c
288 +++ b/storage/innodb_plugin/log/log0log.c
289 @@ -564,7 +564,9 @@
290@@ -760,7 +771,6 @@
291
292 if (srv_fast_shutdown == 2) {
293 /* In this fastest shutdown we do not flush the buffer pool:
294-diff -ruN a/storage/innodb_plugin/log/log0recv.c b/storage/innodb_plugin/log/log0recv.c
295 --- a/storage/innodb_plugin/log/log0recv.c
296 +++ b/storage/innodb_plugin/log/log0recv.c
297 @@ -42,27 +42,27 @@
298@@ -912,7 +922,6 @@
299 trx_rollback_or_clean_recovered(FALSE);
300 }
301
302-diff -ruN a/storage/innodb_plugin/os/os0file.c b/storage/innodb_plugin/os/os0file.c
303 --- a/storage/innodb_plugin/os/os0file.c
304 +++ b/storage/innodb_plugin/os/os0file.c
305 @@ -514,7 +514,7 @@
306@@ -968,7 +977,6 @@
307 ret = os_file_pwrite(file, buf, n, offset, offset_high);
308
309 if ((ulint)ret == n) {
310-diff -ruN a/storage/innodb_plugin/os/os0thread.c b/storage/innodb_plugin/os/os0thread.c
311 --- a/storage/innodb_plugin/os/os0thread.c
312 +++ b/storage/innodb_plugin/os/os0thread.c
313 @@ -287,12 +287,17 @@
314@@ -989,7 +997,6 @@
315 #endif
316 }
317
318-diff -ruN a/storage/innodb_plugin/row/row0merge.c b/storage/innodb_plugin/row/row0merge.c
319 --- a/storage/innodb_plugin/row/row0merge.c
320 +++ b/storage/innodb_plugin/row/row0merge.c
321 @@ -453,7 +453,9 @@
322@@ -1030,7 +1037,6 @@
323
324 /* Read clustered index of the table and create files for
325 secondary index entries for merge sort */
326-diff -ruN a/storage/innodb_plugin/srv/srv0srv.c b/storage/innodb_plugin/srv/srv0srv.c
327 --- a/storage/innodb_plugin/srv/srv0srv.c
328 +++ b/storage/innodb_plugin/srv/srv0srv.c
329 @@ -372,6 +372,9 @@
330@@ -1068,7 +1074,6 @@
331 }
332
333 /*********************************************************************//**
334-diff -ruN a/storage/innodb_plugin/srv/srv0start.c b/storage/innodb_plugin/srv/srv0start.c
335 --- a/storage/innodb_plugin/srv/srv0start.c
336 +++ b/storage/innodb_plugin/srv/srv0start.c
337 @@ -94,6 +94,8 @@
338@@ -1153,7 +1158,6 @@
339 srv_file_per_table = srv_file_per_table_original_value;
340
341 srv_was_started = TRUE;
342-diff -ruN a/storage/innodb_plugin/trx/trx0purge.c b/storage/innodb_plugin/trx/trx0purge.c
343 --- a/storage/innodb_plugin/trx/trx0purge.c
344 +++ b/storage/innodb_plugin/trx/trx0purge.c
345 @@ -1087,6 +1087,9 @@
346@@ -1166,7 +1170,6 @@
347 mutex_enter(&(purge_sys->mutex));
348
349 if (purge_sys->trx->n_active_thrs > 0) {
350-diff -ruN a/storage/innodb_plugin/trx/trx0rseg.c b/storage/innodb_plugin/trx/trx0rseg.c
351 --- a/storage/innodb_plugin/trx/trx0rseg.c
352 +++ b/storage/innodb_plugin/trx/trx0rseg.c
353 @@ -143,9 +143,11 @@
354@@ -1181,7 +1184,6 @@
355
356 undo = UT_LIST_GET_FIRST(rseg->update_undo_cached);
357
358-diff -ruN a/storage/innodb_plugin/trx/trx0sys.c b/storage/innodb_plugin/trx/trx0sys.c
359 --- a/storage/innodb_plugin/trx/trx0sys.c
360 +++ b/storage/innodb_plugin/trx/trx0sys.c
361 @@ -1607,10 +1607,12 @@
362@@ -1197,7 +1199,6 @@
363
364 mem_free(trx_sys);
365
366-diff -ruN a/storage/innodb_plugin/trx/trx0trx.c b/storage/innodb_plugin/trx/trx0trx.c
367 --- a/storage/innodb_plugin/trx/trx0trx.c
368 +++ b/storage/innodb_plugin/trx/trx0trx.c
369 @@ -461,8 +461,8 @@
370
371=== modified file 'patches/innodb51_builtin.patch'
372--- patches/innodb51_builtin.patch 2011-06-26 03:06:10 +0000
373+++ patches/innodb51_builtin.patch 2011-09-15 04:23:22 +0000
374@@ -1,4 +1,3 @@
375-diff -ruN a/storage/innobase/btr/btr0btr.c b/storage/innobase/btr/btr0btr.c
376 --- a/storage/innobase/btr/btr0btr.c
377 +++ b/storage/innobase/btr/btr0btr.c
378 @@ -515,7 +515,7 @@
379@@ -10,7 +9,6 @@
380 page_t*
381 btr_node_ptr_get_child(
382 /*===================*/
383-diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c
384 --- a/storage/innobase/buf/buf0buf.c
385 +++ b/storage/innobase/buf/buf0buf.c
386 @@ -304,7 +304,7 @@
387@@ -50,7 +48,6 @@
388 ibuf_merge_or_delete_for_page(
389 block->frame, block->space, block->offset,
390 TRUE);
391-diff -ruN a/storage/innobase/buf/buf0flu.c b/storage/innobase/buf/buf0flu.c
392 --- a/storage/innobase/buf/buf0flu.c
393 +++ b/storage/innobase/buf/buf0flu.c
394 @@ -81,6 +81,22 @@
395@@ -84,7 +81,6 @@
396
397 ut_ad(buf_flush_validate_low());
398 }
399-diff -ruN a/storage/innobase/buf/buf0rea.c b/storage/innobase/buf/buf0rea.c
400 --- a/storage/innobase/buf/buf0rea.c
401 +++ b/storage/innobase/buf/buf0rea.c
402 @@ -114,6 +114,45 @@
403@@ -147,7 +143,6 @@
404 fprintf(stderr,
405 "InnoDB: Error: InnoDB has waited for"
406 " 50 seconds for pending\n"
407-diff -ruN a/storage/innobase/fil/fil0fil.c b/storage/innobase/fil/fil0fil.c
408 --- a/storage/innobase/fil/fil0fil.c
409 +++ b/storage/innobase/fil/fil0fil.c
410 @@ -26,6 +26,10 @@
411@@ -161,7 +156,60 @@
412
413
414 /*
415-@@ -604,9 +608,9 @@
416+@@ -260,7 +264,7 @@
417+ off the LRU list if it is in the LRU list. The caller must hold the fil_sys
418+ mutex. */
419+ static
420+-void
421++ulint
422+ fil_node_prepare_for_io(
423+ /*====================*/
424+ fil_node_t* node, /* in: file node */
425+@@ -494,7 +498,7 @@
426+ Opens a the file of a node of a tablespace. The caller must own the fil_system
427+ mutex. */
428+ static
429+-void
430++ulint
431+ fil_node_open_file(
432+ /*===============*/
433+ fil_node_t* node, /* in: file node */
434+@@ -529,7 +533,18 @@
435+ node->name, OS_FILE_OPEN, OS_FILE_READ_ONLY, &success);
436+ if (!success) {
437+ /* The following call prints an error message */
438+- os_file_get_last_error(TRUE);
439++ if (os_file_get_last_error(TRUE) == OS_FILE_NOT_FOUND)
440++ {
441++ ut_print_timestamp(stderr);
442++ fprintf(stderr,
443++ " InnoDB: Warning: cannot open %s\n"
444++ "InnoDB: this can happen if the table "
445++ "was removed or renamed during an \n"
446++ "InnoDB: xtrabackup run and is not dangerous.\n",
447++ node->name);
448++ return(OS_FILE_NOT_FOUND);
449++ }
450++
451+
452+ ut_print_timestamp(stderr);
453+
454+@@ -595,18 +610,21 @@
455+
456+ if (space_id != space->id) {
457+ fprintf(stderr,
458+- "InnoDB: Error: tablespace id is %lu"
459++ "InnoDB: Warning: tablespace id is %lu"
460+ " in the data dictionary\n"
461+- "InnoDB: but in file %s it is %lu!\n",
462++ "InnoDB: but in file %s it is %lu!\n"
463++ "InnoDB: this can happen if the table metadata "
464++ "was modified during an xtrabackup run\n"
465++ "InnoDB: and is not dangerous.\n",
466+ space->id, node->name, space_id);
467+
468+- ut_a(0);
469++ return(OS_FILE_NOT_FOUND);
470 }
471
472 if (size_bytes >= FSP_EXTENT_SIZE * UNIV_PAGE_SIZE) {
473@@ -174,7 +222,30 @@
474 } else {
475 node->size = (ulint) (size_bytes / UNIV_PAGE_SIZE);
476 }
477-@@ -1755,7 +1759,7 @@
478+@@ -642,6 +660,8 @@
479+ /* Put the node to the LRU list */
480+ UT_LIST_ADD_FIRST(LRU, system->LRU, node);
481+ }
482++
483++ return(0);
484+ }
485+
486+ /**************************************************************************
487+@@ -1288,7 +1308,12 @@
488+ the file yet; the following calls will open it and update the
489+ size fields */
490+
491+- fil_node_prepare_for_io(node, system, space);
492++ if (fil_node_prepare_for_io(node, system, space))
493++ {
494++ mutex_exit(&(system->mutex));
495++
496++ return(0);
497++ }
498+ fil_node_complete_io(node, system, OS_FILE_READ);
499+ }
500+
501+@@ -1755,7 +1780,7 @@
502 mem_free(path);
503 }
504
505@@ -183,7 +254,7 @@
506 /************************************************************
507 Writes a log record about an .ibd file create/rename/delete. */
508 static
509-@@ -1957,7 +1961,7 @@
510+@@ -1957,7 +1982,7 @@
511 if (fil_create_new_single_table_tablespace(
512 &space_id, name, FALSE,
513 FIL_IBD_FILE_INITIAL_SIZE) != DB_SUCCESS) {
514@@ -192,7 +263,7 @@
515 }
516 }
517 }
518-@@ -2116,7 +2120,7 @@
519+@@ -2116,7 +2141,7 @@
520 }
521
522 if (success) {
523@@ -201,7 +272,7 @@
524 /* Write a log record about the deletion of the .ibd
525 file, so that ibbackup can replay it in the
526 --apply-log phase. We use a dummy mtr and the familiar
527-@@ -2392,7 +2396,7 @@
528+@@ -2392,7 +2417,7 @@
529
530 mutex_exit(&(system->mutex));
531
532@@ -210,7 +281,7 @@
533 if (success) {
534 mtr_t mtr;
535
536-@@ -2568,7 +2572,7 @@
537+@@ -2568,7 +2593,7 @@
538
539 fil_node_create(path, size, *space_id, FALSE);
540
541@@ -219,7 +290,7 @@
542 {
543 mtr_t mtr;
544
545-@@ -2786,20 +2790,99 @@
546+@@ -2786,20 +2811,99 @@
547 "InnoDB: open the tablespace file ", stderr);
548 ut_print_filename(stderr, filepath);
549 fputs("!\n"
550@@ -330,7 +401,7 @@
551 return(FALSE);
552 }
553
554-@@ -3025,7 +3108,7 @@
555+@@ -3025,7 +3129,7 @@
556 cannot be ok. */
557
558 size = (((ib_longlong)size_high) << 32) + (ib_longlong)size_low;
559@@ -339,7 +410,7 @@
560 if (size < FIL_IBD_FILE_INITIAL_SIZE * UNIV_PAGE_SIZE) {
561 fprintf(stderr,
562 "InnoDB: Error: the size of single-table tablespace"
563-@@ -3152,7 +3235,7 @@
564+@@ -3152,7 +3256,7 @@
565 A fault-tolerant function that tries to read the next file name in the
566 directory. We retry 100 times if os_file_readdir_next_file() returns -1. The
567 idea is to read as much good data as we can and jump over bad data. */
568@@ -348,7 +419,7 @@
569 int
570 fil_file_readdir_next_file(
571 /*=======================*/
572-@@ -3500,15 +3583,100 @@
573+@@ -3500,15 +3604,100 @@
574 "InnoDB: in InnoDB data dictionary"
575 " has tablespace id %lu,\n"
576 "InnoDB: but tablespace with that id"
577@@ -457,7 +528,32 @@
578 } else {
579 ut_print_timestamp(stderr);
580 fputs(" InnoDB: Error: table ", stderr);
581-@@ -4067,7 +4235,9 @@
582+@@ -3901,7 +4090,7 @@
583+ off the LRU list if it is in the LRU list. The caller must hold the fil_sys
584+ mutex. */
585+ static
586+-void
587++ulint
588+ fil_node_prepare_for_io(
589+ /*====================*/
590+ fil_node_t* node, /* in: file node */
591+@@ -3921,10 +4110,14 @@
592+ }
593+
594+ if (node->open == FALSE) {
595++ ulint err;
596+ /* File is closed: open it */
597+ ut_a(node->n_pending == 0);
598+
599+- fil_node_open_file(node, system, space);
600++ err = fil_node_open_file(node, system, space);
601++ if (err) {
602++ return(err);
603++ }
604+ }
605+
606+ if (node->n_pending == 0 && space->purpose == FIL_TABLESPACE
607+@@ -4067,7 +4259,9 @@
608 ut_ad(recv_no_ibuf_operations || (type == OS_FILE_WRITE)
609 || !ibuf_bitmap_page(block_offset) || sync || is_log);
610 #ifdef UNIV_SYNC_DEBUG
611@@ -468,7 +564,7 @@
612 || ibuf_page(space_id, block_offset));
613 #endif
614 #endif
615-@@ -4112,6 +4282,16 @@
616+@@ -4112,6 +4306,16 @@
617
618 ut_ad((mode != OS_AIO_IBUF) || (space->purpose == FIL_TABLESPACE));
619
620@@ -485,7 +581,6 @@
621 node = UT_LIST_GET_FIRST(space->chain);
622
623 for (;;) {
624-diff -ruN a/storage/innobase/ibuf/ibuf0ibuf.c b/storage/innobase/ibuf/ibuf0ibuf.c
625 --- a/storage/innobase/ibuf/ibuf0ibuf.c
626 +++ b/storage/innobase/ibuf/ibuf0ibuf.c
627 @@ -984,7 +984,7 @@
628@@ -507,7 +602,6 @@
629 while (sum_pages < n_pages) {
630 n_bytes = ibuf_contract_ext(&n_pag2, sync);
631
632-diff -ruN a/storage/innobase/include/mem0mem.h b/storage/innobase/include/mem0mem.h
633 --- a/storage/innobase/include/mem0mem.h
634 +++ b/storage/innobase/include/mem0mem.h
635 @@ -401,6 +401,7 @@
636@@ -518,7 +612,6 @@
637 #ifdef MEM_PERIODIC_CHECK
638 UT_LIST_NODE_T(mem_block_t) mem_block_list;
639 /* List of all mem blocks allocated; protected
640-diff -ruN a/storage/innobase/include/mem0mem.ic b/storage/innobase/include/mem0mem.ic
641 --- a/storage/innobase/include/mem0mem.ic
642 +++ b/storage/innobase/include/mem0mem.ic
643 @@ -452,6 +452,7 @@
644@@ -552,7 +645,6 @@
645
646 if (heap->free_block) {
647 size += UNIV_PAGE_SIZE;
648-diff -ruN a/storage/innobase/include/srv0srv.h b/storage/innobase/include/srv0srv.h
649 --- a/storage/innobase/include/srv0srv.h
650 +++ b/storage/innobase/include/srv0srv.h
651 @@ -60,6 +60,8 @@
652@@ -583,7 +675,6 @@
653 /*-------------------------------------------*/
654
655 extern ulint srv_n_rows_inserted;
656-diff -ruN a/storage/innobase/include/srv0start.h b/storage/innobase/include/srv0start.h
657 --- a/storage/innobase/include/srv0start.h
658 +++ b/storage/innobase/include/srv0start.h
659 @@ -80,6 +80,7 @@
660@@ -594,7 +685,6 @@
661
662 #ifdef __NETWARE__
663 void set_panic_flag_for_netware(void);
664-diff -ruN a/storage/innobase/include/ut0byte.ic b/storage/innobase/include/ut0byte.ic
665 --- a/storage/innobase/include/ut0byte.ic
666 +++ b/storage/innobase/include/ut0byte.ic
667 @@ -152,6 +152,16 @@
668@@ -642,7 +732,6 @@
669 return(diff);
670 }
671
672-diff -ruN a/storage/innobase/include/ut0mem.h b/storage/innobase/include/ut0mem.h
673 --- a/storage/innobase/include/ut0mem.h
674 +++ b/storage/innobase/include/ut0mem.h
675 @@ -30,6 +30,13 @@
676@@ -659,7 +748,6 @@
677 Allocates memory. Sets it also to zero if UNIV_SET_MEM_TO_ZERO is
678 defined and set_to_zero is TRUE. */
679
680-diff -ruN a/storage/innobase/include/ut0rnd.ic b/storage/innobase/include/ut0rnd.ic
681 --- a/storage/innobase/include/ut0rnd.ic
682 +++ b/storage/innobase/include/ut0rnd.ic
683 @@ -172,7 +172,7 @@
684@@ -680,7 +768,6 @@
685 i++;
686 ut_a(i < 100);
687 #endif
688-diff -ruN a/storage/innobase/log/log0log.c b/storage/innobase/log/log0log.c
689 --- a/storage/innobase/log/log0log.c
690 +++ b/storage/innobase/log/log0log.c
691 @@ -538,7 +538,9 @@
692@@ -718,7 +805,6 @@
693
694 if (srv_fast_shutdown == 2) {
695 /* In this fastest shutdown we do not flush the buffer pool:
696-diff -ruN a/storage/innobase/log/log0recv.c b/storage/innobase/log/log0recv.c
697 --- a/storage/innobase/log/log0recv.c
698 +++ b/storage/innobase/log/log0recv.c
699 @@ -35,19 +35,19 @@
700@@ -861,7 +947,6 @@
701 }
702
703 /**********************************************************
704-diff -ruN a/storage/innobase/mem/mem0dbg.c b/storage/innobase/mem/mem0dbg.c
705 --- a/storage/innobase/mem/mem0dbg.c
706 +++ b/storage/innobase/mem/mem0dbg.c
707 @@ -133,6 +133,14 @@
708@@ -879,7 +964,6 @@
709 mem_comm_pool = mem_pool_create(size);
710 }
711
712-diff -ruN a/storage/innobase/mem/mem0mem.c b/storage/innobase/mem/mem0mem.c
713 --- a/storage/innobase/mem/mem0mem.c
714 +++ b/storage/innobase/mem/mem0mem.c
715 @@ -472,6 +472,7 @@
716@@ -914,7 +998,6 @@
717
718 if (init_block) {
719 /* Do not have to free: do nothing */
720-diff -ruN a/storage/innobase/mem/mem0pool.c b/storage/innobase/mem/mem0pool.c
721 --- a/storage/innobase/mem/mem0pool.c
722 +++ b/storage/innobase/mem/mem0pool.c
723 @@ -11,6 +11,7 @@
724@@ -957,7 +1040,6 @@
725 /* It may be that the area was really allocated from the OS with
726 regular malloc: check if ptr points within our memory pool */
727
728-diff -ruN a/storage/innobase/os/os0file.c b/storage/innobase/os/os0file.c
729 --- a/storage/innobase/os/os0file.c
730 +++ b/storage/innobase/os/os0file.c
731 @@ -466,7 +466,7 @@
732@@ -1058,7 +1140,6 @@
733
734 array->n_reserved++;
735
736-diff -ruN a/storage/innobase/os/os0thread.c b/storage/innobase/os/os0thread.c
737 --- a/storage/innobase/os/os0thread.c
738 +++ b/storage/innobase/os/os0thread.c
739 @@ -273,12 +273,17 @@
740@@ -1079,7 +1160,6 @@
741 #endif
742 }
743
744-diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c
745 --- a/storage/innobase/srv/srv0srv.c
746 +++ b/storage/innobase/srv/srv0srv.c
747 @@ -94,6 +94,8 @@
748@@ -1118,7 +1198,6 @@
749 os_sync_init();
750 sync_init();
751 mem_init(srv_mem_pool_size);
752-diff -ruN a/storage/innobase/srv/srv0start.c b/storage/innobase/srv/srv0start.c
753 --- a/storage/innobase/srv/srv0start.c
754 +++ b/storage/innobase/srv/srv0start.c
755 @@ -61,6 +61,8 @@
756@@ -1231,7 +1310,6 @@
757 srv_file_per_table = srv_file_per_table_original_value;
758
759 return((int) DB_SUCCESS);
760-diff -ruN a/storage/innobase/trx/trx0purge.c b/storage/innobase/trx/trx0purge.c
761 --- a/storage/innobase/trx/trx0purge.c
762 +++ b/storage/innobase/trx/trx0purge.c
763 @@ -1024,6 +1024,9 @@
764@@ -1244,7 +1322,6 @@
765 mutex_enter(&(purge_sys->mutex));
766
767 if (purge_sys->trx->n_active_thrs > 0) {
768-diff -ruN a/storage/innobase/trx/trx0trx.c b/storage/innobase/trx/trx0trx.c
769 --- a/storage/innobase/trx/trx0trx.c
770 +++ b/storage/innobase/trx/trx0trx.c
771 @@ -478,8 +478,8 @@
772@@ -1270,7 +1347,6 @@
773 } else {
774 fprintf(stderr,
775 "InnoDB: Since"
776-diff -ruN a/storage/innobase/ut/ut0mem.c b/storage/innobase/ut/ut0mem.c
777 --- a/storage/innobase/ut/ut0mem.c
778 +++ b/storage/innobase/ut/ut0mem.c
779 @@ -15,6 +15,7 @@
780
781=== modified file 'patches/innodb55.patch'
782--- patches/innodb55.patch 2011-06-26 03:06:10 +0000
783+++ patches/innodb55.patch 2011-09-15 04:23:22 +0000
784@@ -1,4 +1,3 @@
785-diff -ruN a/storage/innobase/btr/btr0btr.c b/storage/innobase/btr/btr0btr.c
786 --- a/storage/innobase/btr/btr0btr.c
787 +++ b/storage/innobase/btr/btr0btr.c
788 @@ -120,7 +120,7 @@
789@@ -19,7 +18,6 @@
790 buf_block_t*
791 btr_node_ptr_get_child(
792 /*===================*/
793-diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c
794 --- a/storage/innobase/buf/buf0buf.c
795 +++ b/storage/innobase/buf/buf0buf.c
796 @@ -517,7 +517,7 @@
797@@ -51,7 +49,6 @@
798 ibuf_merge_or_delete_for_page(
799 (buf_block_t*) bpage, bpage->space,
800 bpage->offset, buf_page_get_zip_size(bpage),
801-diff -ruN a/storage/innobase/buf/buf0rea.c b/storage/innobase/buf/buf0rea.c
802 --- a/storage/innobase/buf/buf0rea.c
803 +++ b/storage/innobase/buf/buf0rea.c
804 @@ -122,6 +122,45 @@
805@@ -151,7 +148,6 @@
806 return;
807 }
808
809-diff -ruN a/storage/innobase/fil/fil0fil.c b/storage/innobase/fil/fil0fil.c
810 --- a/storage/innobase/fil/fil0fil.c
811 +++ b/storage/innobase/fil/fil0fil.c
812 @@ -40,6 +40,8 @@
813@@ -190,7 +186,7 @@
814 fil_node_open_file(
815 /*===============*/
816 fil_node_t* node, /*!< in: file node */
817-@@ -696,7 +698,14 @@
818+@@ -696,7 +698,17 @@
819 OS_FILE_READ_ONLY, &success);
820 if (!success) {
821 /* The following call prints an error message */
822@@ -199,14 +195,36 @@
823 + {
824 + ut_print_timestamp(stderr);
825 + fprintf(stderr,
826-+ " InnoDB: Warning: cannot open %s\n",
827++ " InnoDB: Warning: cannot open %s\n"
828++ "InnoDB: this can happen if the table "
829++ "was removed or renamed during an \n"
830++ "InnoDB: xtrabackup run and is not dangerous.\n",
831 + node->name);
832 + return(OS_FILE_NOT_FOUND);
833 + }
834
835 ut_print_timestamp(stderr);
836
837-@@ -786,8 +795,8 @@
838+@@ -757,12 +769,15 @@
839+
840+ if (UNIV_UNLIKELY(space_id != space->id)) {
841+ fprintf(stderr,
842+- "InnoDB: Error: tablespace id is %lu"
843++ "InnoDB: Warning: tablespace id is %lu"
844+ " in the data dictionary\n"
845+- "InnoDB: but in file %s it is %lu!\n",
846++ "InnoDB: but in file %s it is %lu!\n"
847++ "InnoDB: this can happen if the table metadata "
848++ "was modified during an xtrabackup run\n"
849++ "InnoDB: and is not dangerous.\n",
850+ space->id, node->name, space_id);
851+
852+- ut_error;
853++ return(OS_FILE_NOT_FOUND);
854+ }
855+
856+ if (UNIV_UNLIKELY(space_id == ULINT_UNDEFINED
857+@@ -786,8 +801,8 @@
858 }
859
860 if (size_bytes >= 1024 * 1024) {
861@@ -217,7 +235,7 @@
862 }
863
864 if (!(flags & DICT_TF_ZSSIZE_MASK)) {
865-@@ -838,6 +847,8 @@
866+@@ -838,6 +853,8 @@
867 /* Put the node to the LRU list */
868 UT_LIST_ADD_FIRST(LRU, system->LRU, node);
869 }
870@@ -226,7 +244,7 @@
871 }
872
873 /**********************************************************************//**
874-@@ -1463,7 +1474,12 @@
875+@@ -1463,7 +1480,12 @@
876 the file yet; the following calls will open it and update the
877 size fields */
878
879@@ -240,7 +258,7 @@
880 fil_node_complete_io(node, fil_system, OS_FILE_READ);
881 }
882
883-@@ -1515,7 +1531,12 @@
884+@@ -1515,7 +1537,12 @@
885 the file yet; the following calls will open it and update the
886 size fields */
887
888@@ -272,7 +290,7 @@
889 }
890 }
891
892-@@ -2343,7 +2364,7 @@
893+@@ -2343,7 +2370,7 @@
894 }
895
896 if (success) {
897@@ -281,7 +299,7 @@
898 /* Write a log record about the deletion of the .ibd
899 file, so that ibbackup can replay it in the
900 --apply-log phase. We use a dummy mtr and the familiar
901-@@ -2644,7 +2665,7 @@
902+@@ -2644,7 +2671,7 @@
903
904 mutex_exit(&fil_system->mutex);
905
906@@ -290,7 +308,7 @@
907 if (success) {
908 mtr_t mtr;
909
910-@@ -2835,7 +2856,7 @@
911+@@ -2835,7 +2862,7 @@
912
913 fil_node_create(path, size, space_id, FALSE);
914
915@@ -299,7 +317,7 @@
916 {
917 mtr_t mtr;
918
919-@@ -3090,19 +3111,97 @@
920+@@ -3090,19 +3117,97 @@
921 "InnoDB: open the tablespace file ", stderr);
922 ut_print_filename(stderr, filepath);
923 fputs("!\n"
924@@ -407,7 +425,7 @@
925 return(FALSE);
926 }
927
928-@@ -3334,7 +3433,7 @@
929+@@ -3334,7 +3439,7 @@
930 cannot be ok. */
931
932 size = (((ib_int64_t)size_high) << 32) + (ib_int64_t)size_low;
933@@ -416,7 +434,7 @@
934 if (size < FIL_IBD_FILE_INITIAL_SIZE * UNIV_PAGE_SIZE) {
935 fprintf(stderr,
936 "InnoDB: Error: the size of single-table tablespace"
937-@@ -3475,7 +3574,7 @@
938+@@ -3475,7 +3580,7 @@
939 idea is to read as much good data as we can and jump over bad data.
940 @return 0 if ok, -1 if error even after the retries, 1 if at the end
941 of the directory */
942@@ -425,7 +443,7 @@
943 int
944 fil_file_readdir_next_file(
945 /*=======================*/
946-@@ -3774,15 +3873,97 @@
947+@@ -3774,15 +3879,97 @@
948 "InnoDB: in InnoDB data dictionary"
949 " has tablespace id %lu,\n"
950 "InnoDB: but tablespace with that id"
951@@ -531,7 +549,7 @@
952 } else {
953 ut_print_timestamp(stderr);
954 fputs(" InnoDB: Error: table ", stderr);
955-@@ -4171,7 +4352,7 @@
956+@@ -4171,7 +4358,7 @@
957 off the LRU list if it is in the LRU list. The caller must hold the fil_sys
958 mutex. */
959 static
960@@ -540,7 +558,7 @@
961 fil_node_prepare_for_io(
962 /*====================*/
963 fil_node_t* node, /*!< in: file node */
964-@@ -4191,10 +4372,13 @@
965+@@ -4191,10 +4378,13 @@
966 }
967
968 if (node->open == FALSE) {
969@@ -555,7 +573,7 @@
970 }
971
972 if (node->n_pending == 0 && space->purpose == FIL_TABLESPACE
973-@@ -4207,6 +4391,8 @@
974+@@ -4207,6 +4397,8 @@
975 }
976
977 node->n_pending++;
978@@ -592,7 +610,6 @@
979 node = UT_LIST_GET_FIRST(space->chain);
980
981 for (;;) {
982-diff -ruN a/storage/innobase/ibuf/ibuf0ibuf.c b/storage/innobase/ibuf/ibuf0ibuf.c
983 --- a/storage/innobase/ibuf/ibuf0ibuf.c
984 +++ b/storage/innobase/ibuf/ibuf0ibuf.c
985 @@ -1160,6 +1160,9 @@
986@@ -630,7 +647,6 @@
987 while (sum_pages < n_pages) {
988 n_bytes = ibuf_contract_ext(&n_pag2, sync);
989
990-diff -ruN a/storage/innobase/include/srv0srv.h b/storage/innobase/include/srv0srv.h
991 --- a/storage/innobase/include/srv0srv.h
992 +++ b/storage/innobase/include/srv0srv.h
993 @@ -216,6 +216,10 @@
994@@ -644,7 +660,6 @@
995 /*-------------------------------------------*/
996
997 extern ulint srv_n_rows_inserted;
998-diff -ruN a/storage/innobase/include/srv0start.h b/storage/innobase/include/srv0start.h
999 --- a/storage/innobase/include/srv0start.h
1000 +++ b/storage/innobase/include/srv0start.h
1001 @@ -91,6 +91,8 @@
1002@@ -656,7 +671,6 @@
1003 #ifdef HAVE_DARWIN_THREADS
1004 /** TRUE if the F_FULLFSYNC option is available */
1005 extern ibool srv_have_fullfsync;
1006-diff -ruN a/storage/innobase/log/log0log.c b/storage/innobase/log/log0log.c
1007 --- a/storage/innobase/log/log0log.c
1008 +++ b/storage/innobase/log/log0log.c
1009 @@ -576,7 +576,9 @@
1010@@ -703,7 +717,6 @@
1011
1012 if (srv_fast_shutdown == 2) {
1013 /* In this fastest shutdown we do not flush the buffer pool:
1014-diff -ruN a/storage/innobase/log/log0recv.c b/storage/innobase/log/log0recv.c
1015 --- a/storage/innobase/log/log0recv.c
1016 +++ b/storage/innobase/log/log0recv.c
1017 @@ -42,27 +42,27 @@
1018@@ -855,7 +868,6 @@
1019 trx_rollback_or_clean_recovered(FALSE);
1020 }
1021
1022-diff -ruN a/storage/innobase/os/os0file.c b/storage/innobase/os/os0file.c
1023 --- a/storage/innobase/os/os0file.c
1024 +++ b/storage/innobase/os/os0file.c
1025 @@ -656,7 +656,7 @@
1026@@ -911,7 +923,6 @@
1027 ret = os_file_pwrite(file, buf, n, offset, offset_high);
1028
1029 if ((ulint)ret == n) {
1030-diff -ruN a/storage/innobase/os/os0thread.c b/storage/innobase/os/os0thread.c
1031 --- a/storage/innobase/os/os0thread.c
1032 +++ b/storage/innobase/os/os0thread.c
1033 @@ -266,12 +266,17 @@
1034@@ -932,7 +943,6 @@
1035 #endif
1036 }
1037
1038-diff -ruN a/storage/innobase/row/row0merge.c b/storage/innobase/row/row0merge.c
1039 --- a/storage/innobase/row/row0merge.c
1040 +++ b/storage/innobase/row/row0merge.c
1041 @@ -459,7 +459,9 @@
1042@@ -960,7 +970,7 @@
1043 mem_heap_free(heap);
1044 return(DB_DUPLICATE_KEY);
1045 }
1046-@@ -2628,7 +2634,9 @@
1047+@@ -2628,7 +2632,9 @@
1048
1049 /* Reset the MySQL row buffer that is used when reporting
1050 duplicate keys. */
1051@@ -971,7 +981,6 @@
1052
1053 /* Read clustered index of the table and create files for
1054 secondary index entries for merge sort */
1055-diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c
1056 --- a/storage/innobase/srv/srv0srv.c
1057 +++ b/storage/innobase/srv/srv0srv.c
1058 @@ -401,6 +401,9 @@
1059@@ -1018,7 +1027,6 @@
1060 }
1061
1062 if (trx->was_chosen_as_deadlock_victim) {
1063-diff -ruN a/storage/innobase/srv/srv0start.c b/storage/innobase/srv/srv0start.c
1064 --- a/storage/innobase/srv/srv0start.c
1065 +++ b/storage/innobase/srv/srv0start.c
1066 @@ -94,6 +94,8 @@
1067@@ -1102,7 +1110,6 @@
1068 srv_file_per_table = srv_file_per_table_original_value;
1069
1070 srv_was_started = TRUE;
1071-diff -ruN a/storage/innobase/trx/trx0purge.c b/storage/innobase/trx/trx0purge.c
1072 --- a/storage/innobase/trx/trx0purge.c
1073 +++ b/storage/innobase/trx/trx0purge.c
1074 @@ -1100,6 +1100,9 @@
1075@@ -1115,7 +1122,6 @@
1076 mutex_enter(&(purge_sys->mutex));
1077
1078 if (purge_sys->trx->n_active_thrs > 0) {
1079-diff -ruN a/storage/innobase/trx/trx0rseg.c b/storage/innobase/trx/trx0rseg.c
1080 --- a/storage/innobase/trx/trx0rseg.c
1081 +++ b/storage/innobase/trx/trx0rseg.c
1082 @@ -140,9 +140,11 @@
1083@@ -1130,7 +1136,6 @@
1084
1085 undo = UT_LIST_GET_FIRST(rseg->update_undo_cached);
1086
1087-diff -ruN a/storage/innobase/trx/trx0sys.c b/storage/innobase/trx/trx0sys.c
1088 --- a/storage/innobase/trx/trx0sys.c
1089 +++ b/storage/innobase/trx/trx0sys.c
1090 @@ -1641,10 +1641,12 @@
1091@@ -1146,7 +1151,6 @@
1092
1093 mem_free(trx_sys);
1094
1095-diff -ruN a/storage/innobase/trx/trx0trx.c b/storage/innobase/trx/trx0trx.c
1096 --- a/storage/innobase/trx/trx0trx.c
1097 +++ b/storage/innobase/trx/trx0trx.c
1098 @@ -469,8 +469,8 @@
1099
1100=== modified file 'patches/xtradb51.patch'
1101--- patches/xtradb51.patch 2011-06-26 03:06:10 +0000
1102+++ patches/xtradb51.patch 2011-09-15 04:23:22 +0000
1103@@ -1,4 +1,3 @@
1104-diff -ruN a/storage/innodb_plugin/btr/btr0btr.c b/storage/innodb_plugin/btr/btr0btr.c
1105 --- a/storage/innodb_plugin/btr/btr0btr.c
1106 +++ b/storage/innodb_plugin/btr/btr0btr.c
1107 @@ -120,7 +120,7 @@
1108@@ -19,7 +18,6 @@
1109 buf_block_t*
1110 btr_node_ptr_get_child(
1111 /*===================*/
1112-diff -ruN a/storage/innodb_plugin/buf/buf0buf.c b/storage/innodb_plugin/buf/buf0buf.c
1113 --- a/storage/innodb_plugin/buf/buf0buf.c
1114 +++ b/storage/innodb_plugin/buf/buf0buf.c
1115 @@ -440,7 +440,7 @@
1116@@ -51,7 +49,6 @@
1117 ibuf_merge_or_delete_for_page(
1118 /* Delete possible entries, if bpage is_corrupt */
1119 (srv_pass_corrupt_table && bpage->is_corrupt) ? NULL :
1120-diff -ruN a/storage/innodb_plugin/fil/fil0fil.c b/storage/innodb_plugin/fil/fil0fil.c
1121 --- a/storage/innodb_plugin/fil/fil0fil.c
1122 +++ b/storage/innodb_plugin/fil/fil0fil.c
1123 @@ -294,7 +294,7 @@
1124@@ -81,7 +78,7 @@
1125 fil_node_open_file(
1126 /*===============*/
1127 fil_node_t* node, /*!< in: file node */
1128-@@ -664,7 +664,14 @@
1129+@@ -664,7 +664,17 @@
1130 node->name, OS_FILE_OPEN, OS_FILE_READ_ONLY, &success);
1131 if (!success) {
1132 /* The following call prints an error message */
1133@@ -90,14 +87,36 @@
1134 + {
1135 + ut_print_timestamp(stderr);
1136 + fprintf(stderr,
1137-+ " InnoDB: Warning: cannot open %s\n",
1138++ " InnoDB: Warning: cannot open %s\n"
1139++ "InnoDB: this can happen if the table "
1140++ "was removed or renamed during an \n"
1141++ "InnoDB: xtrabackup run and is not dangerous.\n",
1142 + node->name);
1143 + return(OS_FILE_NOT_FOUND);
1144 + }
1145
1146 ut_print_timestamp(stderr);
1147
1148-@@ -754,8 +761,8 @@
1149+@@ -725,12 +735,14 @@
1150+
1151+ if (UNIV_UNLIKELY(space_id != space->id)) {
1152+ fprintf(stderr,
1153+- "InnoDB: Error: tablespace id is %lu"
1154++ "InnoDB: Warning: tablespace id is %lu"
1155+ " in the data dictionary\n"
1156+- "InnoDB: but in file %s it is %lu!\n",
1157++ "InnoDB: but in file %s it is %lu!\n"
1158++ "InnoDB: this can happen if the table metadata "
1159++ "was modified during an xtrabackup run\n"
1160++ "InnoDB: and is not dangerous.\n",
1161+ space->id, node->name, space_id);
1162+-
1163+- ut_error;
1164++ return(OS_FILE_NOT_FOUND);
1165+ }
1166+
1167+ if (UNIV_UNLIKELY(space_id == ULINT_UNDEFINED
1168+@@ -754,8 +766,8 @@
1169 }
1170
1171 if (size_bytes >= 1024 * 1024) {
1172@@ -108,7 +127,7 @@
1173 }
1174
1175 if (!(flags & DICT_TF_ZSSIZE_MASK)) {
1176-@@ -800,6 +807,8 @@
1177+@@ -800,6 +812,8 @@
1178 /* Put the node to the LRU list */
1179 UT_LIST_ADD_FIRST(LRU, system->LRU, node);
1180 }
1181@@ -117,7 +136,7 @@
1182 }
1183
1184 /**********************************************************************//**
1185-@@ -1428,7 +1437,12 @@
1186+@@ -1428,7 +1442,12 @@
1187 the file yet; the following calls will open it and update the
1188 size fields */
1189
1190@@ -131,7 +150,7 @@
1191 fil_node_complete_io(node, fil_system, OS_FILE_READ);
1192 }
1193
1194-@@ -1480,7 +1494,12 @@
1195+@@ -1480,7 +1499,12 @@
1196 the file yet; the following calls will open it and update the
1197 size fields */
1198
1199@@ -163,7 +182,7 @@
1200 }
1201 }
1202
1203-@@ -2316,7 +2335,7 @@
1204+@@ -2316,7 +2340,7 @@
1205 }
1206
1207 if (success) {
1208@@ -172,7 +191,7 @@
1209 /* Write a log record about the deletion of the .ibd
1210 file, so that ibbackup can replay it in the
1211 --apply-log phase. We use a dummy mtr and the familiar
1212-@@ -2617,7 +2636,7 @@
1213+@@ -2617,7 +2641,7 @@
1214
1215 mutex_exit(&fil_system->mutex);
1216
1217@@ -181,7 +200,7 @@
1218 if (success) {
1219 mtr_t mtr;
1220
1221-@@ -2807,7 +2826,7 @@
1222+@@ -2807,7 +2831,7 @@
1223
1224 fil_node_create(path, size, space_id, FALSE);
1225
1226@@ -190,7 +209,7 @@
1227 {
1228 mtr_t mtr;
1229
1230-@@ -3060,19 +3079,97 @@
1231+@@ -3060,19 +3084,97 @@
1232 "InnoDB: open the tablespace file ", stderr);
1233 ut_print_filename(stderr, filepath);
1234 fputs("!\n"
1235@@ -298,7 +317,7 @@
1236 return(FALSE);
1237 }
1238
1239-@@ -3777,7 +3874,7 @@
1240+@@ -3777,7 +3879,7 @@
1241 cannot be ok. */
1242
1243 size = (((ib_int64_t)size_high) << 32) + (ib_int64_t)size_low;
1244@@ -307,7 +326,7 @@
1245 if (size < FIL_IBD_FILE_INITIAL_SIZE * (lint)UNIV_PAGE_SIZE) {
1246 fprintf(stderr,
1247 "InnoDB: Error: the size of single-table tablespace"
1248-@@ -3918,7 +4015,7 @@
1249+@@ -3918,7 +4020,7 @@
1250 idea is to read as much good data as we can and jump over bad data.
1251 @return 0 if ok, -1 if error even after the retries, 1 if at the end
1252 of the directory */
1253@@ -316,7 +335,7 @@
1254 int
1255 fil_file_readdir_next_file(
1256 /*=======================*/
1257-@@ -4217,15 +4314,97 @@
1258+@@ -4217,15 +4319,97 @@
1259 "InnoDB: in InnoDB data dictionary"
1260 " has tablespace id %lu,\n"
1261 "InnoDB: but tablespace with that id"
1262@@ -422,7 +441,7 @@
1263 } else {
1264 ut_print_timestamp(stderr);
1265 fputs(" InnoDB: Error: table ", stderr);
1266-@@ -4614,7 +4793,7 @@
1267+@@ -4614,7 +4798,7 @@
1268 off the LRU list if it is in the LRU list. The caller must hold the fil_sys
1269 mutex. */
1270 static
1271@@ -431,7 +450,7 @@
1272 fil_node_prepare_for_io(
1273 /*====================*/
1274 fil_node_t* node, /*!< in: file node */
1275-@@ -4634,10 +4813,13 @@
1276+@@ -4634,10 +4818,13 @@
1277 }
1278
1279 if (node->open == FALSE) {
1280@@ -446,7 +465,7 @@
1281 }
1282
1283 if (node->n_pending == 0 && space->purpose == FIL_TABLESPACE
1284-@@ -4650,6 +4832,8 @@
1285+@@ -4650,6 +4837,8 @@
1286 }
1287
1288 node->n_pending++;
1289@@ -483,7 +502,6 @@
1290 node = UT_LIST_GET_FIRST(space->chain);
1291
1292 for (;;) {
1293-diff -ruN a/storage/innodb_plugin/handler/ha_innodb.cc b/storage/innodb_plugin/handler/ha_innodb.cc
1294 --- a/storage/innodb_plugin/handler/ha_innodb.cc
1295 +++ b/storage/innodb_plugin/handler/ha_innodb.cc
1296 @@ -343,12 +343,6 @@
1297@@ -525,7 +543,6 @@
1298 MYSQL_SYSVAR(enable_unsafe_group_commit),
1299 MYSQL_SYSVAR(expand_import),
1300 MYSQL_SYSVAR(extra_rsegments),
1301-diff -ruN a/storage/innodb_plugin/ibuf/ibuf0ibuf.c b/storage/innodb_plugin/ibuf/ibuf0ibuf.c
1302 --- a/storage/innodb_plugin/ibuf/ibuf0ibuf.c
1303 +++ b/storage/innodb_plugin/ibuf/ibuf0ibuf.c
1304 @@ -1064,6 +1064,9 @@
1305@@ -548,7 +565,6 @@
1306 while (sum_pages < n_pages) {
1307 n_bytes = ibuf_contract_ext(&n_pag2, sync);
1308
1309-diff -ruN a/storage/innodb_plugin/include/ha_prototypes.h b/storage/innodb_plugin/include/ha_prototypes.h
1310 --- a/storage/innodb_plugin/include/ha_prototypes.h
1311 +++ b/storage/innodb_plugin/include/ha_prototypes.h
1312 @@ -268,12 +268,4 @@
1313@@ -602,7 +618,6 @@
1314 extern long long srv_ibuf_max_size;
1315 extern ulint srv_ibuf_active_contract;
1316 extern ulint srv_ibuf_accel_rate;
1317-diff -ruN a/storage/innodb_plugin/include/srv0start.h b/storage/innodb_plugin/include/srv0start.h
1318 --- a/storage/innodb_plugin/include/srv0start.h
1319 +++ b/storage/innodb_plugin/include/srv0start.h
1320 @@ -91,6 +91,8 @@
1321@@ -614,7 +629,6 @@
1322 #ifdef __NETWARE__
1323 void set_panic_flag_for_netware(void);
1324 #endif
1325-diff -ruN a/storage/innodb_plugin/include/trx0trx.h b/storage/innodb_plugin/include/trx0trx.h
1326 --- a/storage/innodb_plugin/include/trx0trx.h
1327 +++ b/storage/innodb_plugin/include/trx0trx.h
1328 @@ -497,7 +497,6 @@
1329@@ -625,7 +639,6 @@
1330 ulint flush_log_later;/* In 2PC, we hold the
1331 prepare_commit mutex across
1332 both phases. In that case, we
1333-diff -ruN a/storage/innodb_plugin/include/ut0byte.ic b/storage/innodb_plugin/include/ut0byte.ic
1334 --- a/storage/innodb_plugin/include/ut0byte.ic
1335 +++ b/storage/innodb_plugin/include/ut0byte.ic
1336 @@ -168,6 +168,16 @@
1337@@ -673,7 +686,6 @@
1338 return(diff);
1339 }
1340
1341-diff -ruN a/storage/innodb_plugin/log/log0log.c b/storage/innodb_plugin/log/log0log.c
1342 --- a/storage/innodb_plugin/log/log0log.c
1343 +++ b/storage/innodb_plugin/log/log0log.c
1344 @@ -1370,7 +1370,7 @@
1345@@ -710,7 +722,6 @@
1346
1347 if (srv_fast_shutdown == 2) {
1348 /* In this fastest shutdown we do not flush the buffer pool:
1349-diff -ruN a/storage/innodb_plugin/log/log0recv.c b/storage/innodb_plugin/log/log0recv.c
1350 --- a/storage/innodb_plugin/log/log0recv.c
1351 +++ b/storage/innodb_plugin/log/log0recv.c
1352 @@ -42,27 +42,27 @@
1353@@ -836,7 +847,6 @@
1354 trx_rollback_or_clean_recovered(FALSE);
1355 }
1356
1357-diff -ruN a/storage/innodb_plugin/os/os0file.c b/storage/innodb_plugin/os/os0file.c
1358 --- a/storage/innodb_plugin/os/os0file.c
1359 +++ b/storage/innodb_plugin/os/os0file.c
1360 @@ -554,7 +554,7 @@
1361@@ -892,7 +902,6 @@
1362 ret = os_file_pwrite(file, buf, n, offset, offset_high);
1363
1364 if ((ulint)ret == n) {
1365-diff -ruN a/storage/innodb_plugin/os/os0thread.c b/storage/innodb_plugin/os/os0thread.c
1366 --- a/storage/innodb_plugin/os/os0thread.c
1367 +++ b/storage/innodb_plugin/os/os0thread.c
1368 @@ -287,12 +287,17 @@
1369@@ -913,7 +922,6 @@
1370 #endif
1371 }
1372
1373-diff -ruN a/storage/innodb_plugin/row/row0merge.c b/storage/innodb_plugin/row/row0merge.c
1374 --- a/storage/innodb_plugin/row/row0merge.c
1375 +++ b/storage/innodb_plugin/row/row0merge.c
1376 @@ -453,7 +453,9 @@
1377@@ -952,7 +960,6 @@
1378
1379 /* Read clustered index of the table and create files for
1380 secondary index entries for merge sort */
1381-diff -ruN a/storage/innodb_plugin/srv/srv0srv.c b/storage/innodb_plugin/srv/srv0srv.c
1382 --- a/storage/innodb_plugin/srv/srv0srv.c
1383 +++ b/storage/innodb_plugin/srv/srv0srv.c
1384 @@ -402,6 +402,10 @@
1385@@ -991,7 +998,6 @@
1386 }
1387
1388 /*********************************************************************//**
1389-diff -ruN a/storage/innodb_plugin/srv/srv0start.c b/storage/innodb_plugin/srv/srv0start.c
1390 --- a/storage/innodb_plugin/srv/srv0start.c
1391 +++ b/storage/innodb_plugin/srv/srv0start.c
1392 @@ -94,6 +94,8 @@
1393@@ -1067,7 +1073,6 @@
1394 srv_file_per_table = srv_file_per_table_original_value;
1395
1396 srv_was_started = TRUE;
1397-diff -ruN a/storage/innodb_plugin/trx/trx0purge.c b/storage/innodb_plugin/trx/trx0purge.c
1398 --- a/storage/innodb_plugin/trx/trx0purge.c
1399 +++ b/storage/innodb_plugin/trx/trx0purge.c
1400 @@ -1113,6 +1113,9 @@
1401@@ -1080,7 +1085,6 @@
1402 mutex_enter(&(purge_sys->mutex));
1403
1404 if (purge_sys->trx->n_active_thrs > 0) {
1405-diff -ruN a/storage/innodb_plugin/trx/trx0rseg.c b/storage/innodb_plugin/trx/trx0rseg.c
1406 --- a/storage/innodb_plugin/trx/trx0rseg.c
1407 +++ b/storage/innodb_plugin/trx/trx0rseg.c
1408 @@ -143,9 +143,11 @@
1409@@ -1095,7 +1099,6 @@
1410
1411 undo = UT_LIST_GET_FIRST(rseg->update_undo_cached);
1412
1413-diff -ruN a/storage/innodb_plugin/trx/trx0sys.c b/storage/innodb_plugin/trx/trx0sys.c
1414 --- a/storage/innodb_plugin/trx/trx0sys.c
1415 +++ b/storage/innodb_plugin/trx/trx0sys.c
1416 @@ -1931,10 +1931,12 @@
1417@@ -1111,7 +1114,6 @@
1418
1419 mem_free(trx_sys);
1420
1421-diff -ruN a/storage/innodb_plugin/trx/trx0trx.c b/storage/innodb_plugin/trx/trx0trx.c
1422 --- a/storage/innodb_plugin/trx/trx0trx.c
1423 +++ b/storage/innodb_plugin/trx/trx0trx.c
1424 @@ -109,8 +109,6 @@
1425
1426=== modified file 'patches/xtradb55.patch'
1427--- patches/xtradb55.patch 2011-06-26 03:06:10 +0000
1428+++ patches/xtradb55.patch 2011-09-15 04:23:22 +0000
1429@@ -1,4 +1,3 @@
1430-diff -ruN a/storage/innobase/btr/btr0btr.c b/storage/innobase/btr/btr0btr.c
1431 --- a/storage/innobase/btr/btr0btr.c
1432 +++ b/storage/innobase/btr/btr0btr.c
1433 @@ -120,7 +120,7 @@
1434@@ -19,7 +18,6 @@
1435 buf_block_t*
1436 btr_node_ptr_get_child(
1437 /*===================*/
1438-diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c
1439 --- a/storage/innobase/buf/buf0buf.c
1440 +++ b/storage/innobase/buf/buf0buf.c
1441 @@ -609,7 +609,7 @@
1442@@ -79,7 +77,6 @@
1443 ibuf_merge_or_delete_for_page(
1444 /* Delete possible entries, if bpage is_corrupt */
1445 (srv_pass_corrupt_table && bpage->is_corrupt) ? NULL :
1446-diff -ruN a/storage/innobase/fil/fil0fil.c b/storage/innobase/fil/fil0fil.c
1447 --- a/storage/innobase/fil/fil0fil.c
1448 +++ b/storage/innobase/fil/fil0fil.c
1449 @@ -305,7 +305,7 @@
1450@@ -109,7 +106,7 @@
1451 fil_node_open_file(
1452 /*===============*/
1453 fil_node_t* node, /*!< in: file node */
1454-@@ -704,7 +704,14 @@
1455+@@ -704,7 +704,17 @@
1456 OS_FILE_READ_ONLY, &success);
1457 if (!success) {
1458 /* The following call prints an error message */
1459@@ -118,14 +115,36 @@
1460 + {
1461 + ut_print_timestamp(stderr);
1462 + fprintf(stderr,
1463-+ " InnoDB: Warning: cannot open %s\n",
1464++ " InnoDB: Warning: cannot open %s\n"
1465++ "InnoDB: this can happen if the table "
1466++ "was removed or renamed during an \n"
1467++ "InnoDB: xtrabackup run and is not dangerous.\n",
1468 + node->name);
1469 + return(OS_FILE_NOT_FOUND);
1470 + }
1471
1472 ut_print_timestamp(stderr);
1473
1474-@@ -794,8 +801,8 @@
1475+@@ -765,12 +775,15 @@
1476+
1477+ if (UNIV_UNLIKELY(space_id != space->id)) {
1478+ fprintf(stderr,
1479+- "InnoDB: Error: tablespace id is %lu"
1480++ "InnoDB: Warning: tablespace id is %lu"
1481+ " in the data dictionary\n"
1482+- "InnoDB: but in file %s it is %lu!\n",
1483++ "InnoDB: but in file %s it is %lu!\n"
1484++ "InnoDB: this can happen if the table metadata "
1485++ "was modified during an xtrabackup run\n"
1486++ "InnoDB: and is not dangerous.\n",
1487+ space->id, node->name, space_id);
1488+
1489+- ut_error;
1490++ return(OS_FILE_NOT_FOUND);
1491+ }
1492+
1493+ if (UNIV_UNLIKELY(space_id == ULINT_UNDEFINED
1494+@@ -794,8 +807,8 @@
1495 }
1496
1497 if (size_bytes >= 1024 * 1024) {
1498@@ -136,7 +155,7 @@
1499 }
1500
1501 if (!(flags & DICT_TF_ZSSIZE_MASK)) {
1502-@@ -846,6 +853,8 @@
1503+@@ -846,6 +859,8 @@
1504 /* Put the node to the LRU list */
1505 UT_LIST_ADD_FIRST(LRU, system->LRU, node);
1506 }
1507@@ -145,7 +164,7 @@
1508 }
1509
1510 /**********************************************************************//**
1511-@@ -1474,7 +1483,12 @@
1512+@@ -1474,7 +1489,12 @@
1513 the file yet; the following calls will open it and update the
1514 size fields */
1515
1516@@ -159,7 +178,7 @@
1517 fil_node_complete_io(node, fil_system, OS_FILE_READ);
1518 }
1519
1520-@@ -1526,7 +1540,12 @@
1521+@@ -1526,7 +1546,12 @@
1522 the file yet; the following calls will open it and update the
1523 size fields */
1524
1525@@ -191,7 +210,7 @@
1526 }
1527 }
1528
1529-@@ -2369,7 +2388,7 @@
1530+@@ -2369,7 +2394,7 @@
1531 }
1532
1533 if (success) {
1534@@ -200,7 +219,7 @@
1535 /* Write a log record about the deletion of the .ibd
1536 file, so that ibbackup can replay it in the
1537 --apply-log phase. We use a dummy mtr and the familiar
1538-@@ -2670,7 +2689,7 @@
1539+@@ -2670,7 +2695,7 @@
1540
1541 mutex_exit(&fil_system->mutex);
1542
1543@@ -209,7 +228,7 @@
1544 if (success) {
1545 mtr_t mtr;
1546
1547-@@ -2861,7 +2880,7 @@
1548+@@ -2861,7 +2886,7 @@
1549
1550 fil_node_create(path, size, space_id, FALSE);
1551
1552@@ -218,7 +237,7 @@
1553 {
1554 mtr_t mtr;
1555
1556-@@ -3116,19 +3135,97 @@
1557+@@ -3116,19 +3141,97 @@
1558 "InnoDB: open the tablespace file ", stderr);
1559 ut_print_filename(stderr, filepath);
1560 fputs("!\n"
1561@@ -326,7 +345,7 @@
1562 return(FALSE);
1563 }
1564
1565-@@ -3836,7 +3933,7 @@
1566+@@ -3836,7 +3939,7 @@
1567 cannot be ok. */
1568
1569 size = (((ib_int64_t)size_high) << 32) + (ib_int64_t)size_low;
1570@@ -335,7 +354,7 @@
1571 if (size < FIL_IBD_FILE_INITIAL_SIZE * (lint)UNIV_PAGE_SIZE) {
1572 fprintf(stderr,
1573 "InnoDB: Error: the size of single-table tablespace"
1574-@@ -3977,7 +4074,7 @@
1575+@@ -3977,7 +4080,7 @@
1576 idea is to read as much good data as we can and jump over bad data.
1577 @return 0 if ok, -1 if error even after the retries, 1 if at the end
1578 of the directory */
1579@@ -344,7 +363,7 @@
1580 int
1581 fil_file_readdir_next_file(
1582 /*=======================*/
1583-@@ -4276,15 +4373,97 @@
1584+@@ -4276,15 +4379,97 @@
1585 "InnoDB: in InnoDB data dictionary"
1586 " has tablespace id %lu,\n"
1587 "InnoDB: but tablespace with that id"
1588@@ -450,7 +469,7 @@
1589 } else {
1590 ut_print_timestamp(stderr);
1591 fputs(" InnoDB: Error: table ", stderr);
1592-@@ -4683,7 +4862,7 @@
1593+@@ -4683,7 +4868,7 @@
1594 off the LRU list if it is in the LRU list. The caller must hold the fil_sys
1595 mutex. */
1596 static
1597@@ -459,7 +478,7 @@
1598 fil_node_prepare_for_io(
1599 /*====================*/
1600 fil_node_t* node, /*!< in: file node */
1601-@@ -4703,10 +4882,13 @@
1602+@@ -4703,10 +4888,13 @@
1603 }
1604
1605 if (node->open == FALSE) {
1606@@ -474,7 +493,7 @@
1607 }
1608
1609 if (node->n_pending == 0 && space->purpose == FIL_TABLESPACE
1610-@@ -4719,6 +4901,8 @@
1611+@@ -4719,6 +4907,8 @@
1612 }
1613
1614 node->n_pending++;
1615@@ -511,7 +530,6 @@
1616 node = UT_LIST_GET_FIRST(space->chain);
1617
1618 for (;;) {
1619-diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
1620 --- a/storage/innobase/handler/ha_innodb.cc
1621 +++ b/storage/innobase/handler/ha_innodb.cc
1622 @@ -460,13 +460,6 @@
1623@@ -597,7 +615,6 @@
1624 MYSQL_SYSVAR(flush_method),
1625 MYSQL_SYSVAR(force_recovery),
1626 MYSQL_SYSVAR(locks_unsafe_for_binlog),
1627-diff -ruN a/storage/innobase/ibuf/ibuf0ibuf.c b/storage/innobase/ibuf/ibuf0ibuf.c
1628 --- a/storage/innobase/ibuf/ibuf0ibuf.c
1629 +++ b/storage/innobase/ibuf/ibuf0ibuf.c
1630 @@ -1202,6 +1202,9 @@
1631@@ -635,7 +652,6 @@
1632 while (sum_pages < n_pages) {
1633 n_bytes = ibuf_contract_ext(&n_pag2, sync);
1634
1635-diff -ruN a/storage/innobase/include/ha_prototypes.h b/storage/innobase/include/ha_prototypes.h
1636 --- a/storage/innobase/include/ha_prototypes.h
1637 +++ b/storage/innobase/include/ha_prototypes.h
1638 @@ -275,12 +275,5 @@
1639@@ -651,7 +667,6 @@
1640 - void* thd);
1641
1642 #endif
1643-diff -ruN a/storage/innobase/include/log0recv.h b/storage/innobase/include/log0recv.h
1644 --- a/storage/innobase/include/log0recv.h
1645 +++ b/storage/innobase/include/log0recv.h
1646 @@ -444,7 +444,7 @@
1647@@ -663,7 +678,6 @@
1648 time_t stats_recv_start_time;
1649 ulint stats_recv_turns;
1650
1651-diff -ruN a/storage/innobase/include/srv0srv.h b/storage/innobase/include/srv0srv.h
1652 --- a/storage/innobase/include/srv0srv.h
1653 +++ b/storage/innobase/include/srv0srv.h
1654 @@ -148,8 +148,7 @@
1655@@ -687,7 +701,6 @@
1656 /*-------------------------------------------*/
1657
1658 extern ulint srv_n_rows_inserted;
1659-diff -ruN a/storage/innobase/include/srv0start.h b/storage/innobase/include/srv0start.h
1660 --- a/storage/innobase/include/srv0start.h
1661 +++ b/storage/innobase/include/srv0start.h
1662 @@ -91,6 +91,8 @@
1663@@ -699,7 +712,6 @@
1664 #ifdef HAVE_DARWIN_THREADS
1665 /** TRUE if the F_FULLFSYNC option is available */
1666 extern ibool srv_have_fullfsync;
1667-diff -ruN a/storage/innobase/log/log0log.c b/storage/innobase/log/log0log.c
1668 --- a/storage/innobase/log/log0log.c
1669 +++ b/storage/innobase/log/log0log.c
1670 @@ -1154,7 +1154,7 @@
1671@@ -745,7 +757,6 @@
1672
1673 if (srv_fast_shutdown == 2) {
1674 /* In this fastest shutdown we do not flush the buffer pool:
1675-diff -ruN a/storage/innobase/log/log0recv.c b/storage/innobase/log/log0recv.c
1676 --- a/storage/innobase/log/log0recv.c
1677 +++ b/storage/innobase/log/log0recv.c
1678 @@ -42,27 +42,27 @@
1679@@ -871,7 +882,6 @@
1680 trx_rollback_or_clean_recovered(FALSE);
1681 }
1682
1683-diff -ruN a/storage/innobase/os/os0file.c b/storage/innobase/os/os0file.c
1684 --- a/storage/innobase/os/os0file.c
1685 +++ b/storage/innobase/os/os0file.c
1686 @@ -660,7 +660,7 @@
1687@@ -945,7 +955,6 @@
1688 ret = os_file_pwrite(file, buf, n, offset, offset_high);
1689
1690 if ((ulint)ret == n) {
1691-diff -ruN a/storage/innobase/os/os0thread.c b/storage/innobase/os/os0thread.c
1692 --- a/storage/innobase/os/os0thread.c
1693 +++ b/storage/innobase/os/os0thread.c
1694 @@ -266,12 +266,17 @@
1695@@ -966,7 +975,6 @@
1696 #endif
1697 }
1698
1699-diff -ruN a/storage/innobase/row/row0merge.c b/storage/innobase/row/row0merge.c
1700 --- a/storage/innobase/row/row0merge.c
1701 +++ b/storage/innobase/row/row0merge.c
1702 @@ -459,7 +459,9 @@
1703@@ -1005,7 +1013,6 @@
1704
1705 /* Read clustered index of the table and create files for
1706 secondary index entries for merge sort */
1707-diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c
1708 --- a/storage/innobase/srv/srv0srv.c
1709 +++ b/storage/innobase/srv/srv0srv.c
1710 @@ -197,8 +197,7 @@
1711@@ -1063,7 +1070,6 @@
1712 }
1713
1714 if (trx->was_chosen_as_deadlock_victim) {
1715-diff -ruN a/storage/innobase/srv/srv0start.c b/storage/innobase/srv/srv0start.c
1716 --- a/storage/innobase/srv/srv0start.c
1717 +++ b/storage/innobase/srv/srv0start.c
1718 @@ -94,6 +94,8 @@
1719@@ -1138,7 +1144,6 @@
1720 srv_file_per_table = srv_file_per_table_original_value;
1721
1722 srv_was_started = TRUE;
1723-diff -ruN a/storage/innobase/trx/trx0purge.c b/storage/innobase/trx/trx0purge.c
1724 --- a/storage/innobase/trx/trx0purge.c
1725 +++ b/storage/innobase/trx/trx0purge.c
1726 @@ -1100,6 +1100,9 @@
1727@@ -1151,7 +1156,6 @@
1728 mutex_enter(&(purge_sys->mutex));
1729
1730 if (purge_sys->trx->n_active_thrs > 0) {
1731-diff -ruN a/storage/innobase/trx/trx0rseg.c b/storage/innobase/trx/trx0rseg.c
1732 --- a/storage/innobase/trx/trx0rseg.c
1733 +++ b/storage/innobase/trx/trx0rseg.c
1734 @@ -140,9 +140,11 @@
1735@@ -1166,7 +1170,6 @@
1736
1737 undo = UT_LIST_GET_FIRST(rseg->update_undo_cached);
1738
1739-diff -ruN a/storage/innobase/trx/trx0sys.c b/storage/innobase/trx/trx0sys.c
1740 --- a/storage/innobase/trx/trx0sys.c
1741 +++ b/storage/innobase/trx/trx0sys.c
1742 @@ -1938,10 +1938,12 @@
1743@@ -1182,7 +1185,6 @@
1744
1745 mem_free(trx_sys);
1746
1747-diff -ruN a/storage/innobase/trx/trx0trx.c b/storage/innobase/trx/trx0trx.c
1748 --- a/storage/innobase/trx/trx0trx.c
1749 +++ b/storage/innobase/trx/trx0trx.c
1750 @@ -505,8 +505,8 @@
1751
1752=== modified file 'test/inc/common.sh'
1753--- test/inc/common.sh 2011-06-29 05:38:02 +0000
1754+++ test/inc/common.sh 2011-09-15 04:23:22 +0000
1755@@ -230,3 +230,12 @@
1756 let "race_cycle_cnt=race_cycle_cnt+1"
1757 done
1758 }
1759+
1760+########################################################################
1761+# Prints checksum for a given table.
1762+# Expects 2 arguments: $1 is the DB name and $2 is the table to checksum
1763+########################################################################
1764+function checksum_table()
1765+{
1766+ $MYSQL $MYSQL_ARGS -Ns -e "CHECKSUM TABLE $2" $1 | awk {'print $2'}
1767+}
1768\ No newline at end of file
1769
1770=== added file 'test/t/bug722638.sh'
1771--- test/t/bug722638.sh 1970-01-01 00:00:00 +0000
1772+++ test/t/bug722638.sh 2011-09-15 04:23:22 +0000
1773@@ -0,0 +1,119 @@
1774+########################################################################
1775+# Bug #722638: xtrabackup: taking backup while tables are droped and
1776+# created breaks backup
1777+########################################################################
1778+
1779+if ! `$XB_BIN --help | grep debug-sync > /dev/null`; then
1780+ echo "Requires --debug-sync support" > $SKIPPED_REASON
1781+ exit $SKIPPED_EXIT_CODE
1782+fi
1783+
1784+. inc/common.sh
1785+
1786+init
1787+run_mysqld --innodb_file_per_table
1788+
1789+run_cmd $MYSQL $MYSQL_ARGS test <<EOF
1790+
1791+CREATE TABLE t1(a INT) ENGINE=InnoDB;
1792+INSERT INTO t1 VALUES (1), (2), (3);
1793+
1794+CREATE TABLE t2(a INT) ENGINE=InnoDB;
1795+INSERT INTO t2 VALUES (1), (2), (3);
1796+
1797+CREATE TABLE t3(a INT) ENGINE=InnoDB;
1798+INSERT INTO t3 VALUES (1), (2), (3);
1799+
1800+CREATE TABLE t4_old(a INT) ENGINE=InnoDB;
1801+INSERT INTO t4_old VALUES (1), (2), (3);
1802+
1803+EOF
1804+
1805+mkdir -p $topdir/backup
1806+
1807+# Backup
1808+xtrabackup --datadir=$mysql_datadir --backup --target-dir=$topdir/backup \
1809+ --debug-sync="data_copy_thread_func" &
1810+
1811+job_pid=$!
1812+
1813+pid_file=$topdir/backup/xtrabackup_debug_sync
1814+
1815+# Wait for xtrabackup to suspend
1816+i=0
1817+while [ ! -r "$pid_file" ]
1818+do
1819+ sleep 1
1820+ i=$((i+1))
1821+ echo "Waited $i seconds for $pid_file to be created"
1822+done
1823+
1824+xb_pid=`cat $pid_file`
1825+
1826+# Modify the original tables, then change spaces ids by running DDL
1827+
1828+run_cmd $MYSQL $MYSQL_ARGS test <<EOF
1829+
1830+INSERT INTO t1 VALUES (4), (5), (6);
1831+DROP TABLE t1;
1832+CREATE TABLE t1(a CHAR(1)) ENGINE=InnoDB;
1833+INSERT INTO t1 VALUES ("1"), ("2"), ("3");
1834+
1835+INSERT INTO t2 VALUES (4), (5), (6);
1836+ALTER TABLE t2 MODIFY a BIGINT;
1837+INSERT INTO t2 VALUES (7), (8), (9);
1838+
1839+INSERT INTO t3 VALUES (4), (5), (6);
1840+TRUNCATE t3;
1841+INSERT INTO t3 VALUES (7), (8), (9);
1842+
1843+INSERT INTO t4_old VALUES (4), (5), (6);
1844+ALTER TABLE t4_old RENAME t4;
1845+INSERT INTO t4 VALUES (7), (8), (9);
1846+
1847+EOF
1848+
1849+# Calculate checksums
1850+checksum_t1=`checksum_table test t1`
1851+checksum_t2=`checksum_table test t2`
1852+checksum_t3=`checksum_table test t3`
1853+checksum_t4=`checksum_table test t4`
1854+
1855+# Resume xtrabackup
1856+vlog "Resuming xtrabackup"
1857+kill -SIGCONT $xb_pid
1858+
1859+run_cmd wait $job_pid
1860+
1861+# Prepare
1862+xtrabackup --datadir=$mysql_datadir --prepare --target-dir=$topdir/backup
1863+
1864+stop_mysqld
1865+
1866+# Restore
1867+rm -rf $mysql_datadir/ibdata1 $mysql_datadir/ib_logfile* \
1868+ $mysql_datadir/test/*.ibd
1869+cp -r $topdir/backup/* $mysql_datadir
1870+
1871+run_mysqld --innodb_file_per_table
1872+
1873+# Verify checksums
1874+checksum_t1_new=`checksum_table test t1`
1875+checksum_t2_new=`checksum_table test t2`
1876+checksum_t3_new=`checksum_table test t3`
1877+checksum_t4_new=`checksum_table test t4`
1878+vlog "Checksums (old/new):"
1879+vlog "t1: $checksum_t1/$checksum_t1_new"
1880+vlog "t2: $checksum_t2/$checksum_t2_new"
1881+vlog "t3: $checksum_t3/$checksum_t3_new"
1882+vlog "t4: $checksum_t4/$checksum_t4_new"
1883+
1884+if [ "$checksum_t1" = "$checksum_t1_new" -a \
1885+ "$checksum_t2" = "$checksum_t2_new" -a \
1886+ "$checksum_t3" = "$checksum_t3_new" -a \
1887+ "$checksum_t4" = "$checksum_t4_new" ]; then
1888+ exit 0
1889+fi
1890+
1891+vlog "Checksums do not match"
1892+exit -1
1893
1894=== modified file 'test/t/bug723097.sh'
1895--- test/t/bug723097.sh 2011-06-12 10:16:51 +0000
1896+++ test/t/bug723097.sh 2011-09-15 04:23:22 +0000
1897@@ -7,7 +7,7 @@
1898 run_cmd ${MYSQL} ${MYSQL_ARGS} test < inc/bug723097.sql
1899
1900 vlog "Saving checksum"
1901-checksum_a=`${MYSQL} ${MYSQL_ARGS} -Ns -e "CHECKSUM TABLE messages" test | awk {'print $2'}`
1902+checksum_a=`checksum_table test messages`
1903 vlog "Checksum before is $checksum_a"
1904
1905 vlog "Creating backup directory"
1906@@ -24,7 +24,7 @@
1907 cp -r * $mysql_datadir/test
1908 cd -
1909 run_mysqld --innodb_file_per_table
1910-checksum_b=`${MYSQL} ${MYSQL_ARGS} -Ns -e "CHECKSUM TABLE messages" test | awk {'print $2'}`
1911+checksum_b=`checksum_table test messages`
1912 vlog "Checksum after is $checksum_b"
1913
1914 if [ $checksum_a -eq $checksum_b ]
1915
1916=== modified file 'test/t/bug810269.sh'
1917--- test/t/bug810269.sh 2011-08-10 01:26:20 +0000
1918+++ test/t/bug810269.sh 2011-09-15 04:23:22 +0000
1919@@ -46,8 +46,7 @@
1920
1921 vlog "Initial rows added"
1922
1923-checksum_a=`${MYSQL} ${MYSQL_ARGS} -Ns -e "checksum table test;" \
1924-incremental_sample | awk '{print $2}'`
1925+checksum_a=`checksum_table incremental_sample test`
1926
1927 vlog "Starting streaming backup"
1928
1929@@ -71,8 +70,7 @@
1930
1931 run_mysqld
1932
1933-checksum_b=`${MYSQL} ${MYSQL_ARGS} -Ns -e "checksum table test;" \
1934-incremental_sample | awk '{print $2}'`
1935+checksum_b=`checksum_table incremental_sample test`
1936
1937 if [ "$checksum_a" != "$checksum_b" ]; then
1938 vlog "Checksums do not match"
1939
1940=== modified file 'test/t/ib_csm_csv.sh'
1941--- test/t/ib_csm_csv.sh 2011-06-10 07:55:26 +0000
1942+++ test/t/ib_csm_csv.sh 2011-09-15 04:23:22 +0000
1943@@ -25,7 +25,7 @@
1944 vlog "Full backup done to directory $full_backup_dir"
1945
1946 # Saving the checksum of original table
1947-checksum_a=`${MYSQL} ${MYSQL_ARGS} -Ns -e "checksum table csm;" csv | awk '{print $2}'`
1948+checksum_a=`checksum_table csv csm`
1949 vlog "Table checksum is $checksum_a"
1950
1951 vlog "Preparing backup"
1952@@ -50,10 +50,10 @@
1953 vlog "Data restored"
1954
1955 run_mysqld --innodb_file_per_table
1956-vlog "Checking checksums"
1957-checksum_b=`${MYSQL} ${MYSQL_ARGS} -Ns -e "checksum table csm" incremental_sample | awk '{print $2}'`
1958+checksum_b=`checksum_table csv csm`
1959+vlog "Checking checksums: $checksum_a/$checksum_b"
1960
1961-if [ $checksum_a -ne $checksum_b ]
1962+if [ "$checksum_a" != "$checksum_b" ]
1963 then
1964 vlog "Checksums are not equal"
1965 exit -1
1966
1967=== modified file 'test/t/ib_incremental.sh'
1968--- test/t/ib_incremental.sh 2011-06-29 05:38:02 +0000
1969+++ test/t/ib_incremental.sh 2011-09-15 04:23:22 +0000
1970@@ -37,7 +37,7 @@
1971 vlog "Changes done"
1972
1973 # Saving the checksum of original table
1974-checksum_a=`${MYSQL} ${MYSQL_ARGS} -Ns -e "checksum table test;" incremental_sample | awk '{print $2}'`
1975+checksum_a=`checksum_table incremental_sample test`
1976 vlog "Table checksum is $checksum_a"
1977
1978 vlog "Making incremental backup"
1979@@ -87,7 +87,7 @@
1980 run_mysqld --innodb_file_per_table
1981
1982 vlog "Checking checksums"
1983-checksum_b=`${MYSQL} ${MYSQL_ARGS} -Ns -e "checksum table test;" incremental_sample | awk '{print $2}'`
1984+checksum_b=`checksum_table incremental_sample test`
1985
1986 if [ $checksum_a -ne $checksum_b ]
1987 then
1988
1989=== modified file 'test/t/xb_export.sh'
1990--- test/t/xb_export.sh 2011-06-28 09:31:12 +0000
1991+++ test/t/xb_export.sh 2011-09-15 04:23:22 +0000
1992@@ -38,7 +38,7 @@
1993 done
1994 vlog "Initial rows added"
1995
1996-checksum_1=`${MYSQL} ${MYSQL_ARGS} -Ns -e "checksum table test" incremental_sample | awk '{print $2}'`
1997+checksum_1=`checksum_table incremental_sample test`
1998 rowsnum_1=`${MYSQL} ${MYSQL_ARGS} -Ns -e "select count(*) from test" incremental_sample`
1999 vlog "rowsnum_1 is $rowsnum_1"
2000 vlog "checksum_1 is $checksum_1"
2001@@ -74,7 +74,7 @@
2002 vlog "Table has been imported"
2003
2004 vlog "Cheking checksums"
2005-checksum_2=`${MYSQL} ${MYSQL_ARGS} -Ns -e "checksum table test;" incremental_sample | awk '{print $2}'`
2006+checksum_2=`checksum_table incremental_sample test`
2007 vlog "checksum_2 is $checksum_2"
2008 rowsnum_1=`${MYSQL} ${MYSQL_ARGS} -Ns -e "select count(*) from test" incremental_sample`
2009 vlog "rowsnum_1 is $rowsnum_1"
2010@@ -120,7 +120,7 @@
2011 run_mysqld
2012
2013 vlog "Cheking checksums"
2014-checksum_3=`${MYSQL} ${MYSQL_ARGS} -Ns -e "checksum table test;" incremental_sample | awk '{print $2}'`
2015+checksum_3=`checksum_table incremental_sample test`
2016 vlog "checksum_3 is $checksum_3"
2017
2018 if [ "$checksum_3" != $checksum_2 ]
2019
2020=== modified file 'test/t/xb_incremental.sh'
2021--- test/t/xb_incremental.sh 2011-06-10 07:55:26 +0000
2022+++ test/t/xb_incremental.sh 2011-09-15 04:23:22 +0000
2023@@ -47,7 +47,7 @@
2024 vlog "Changes done"
2025
2026 # Saving the checksum of original table
2027-checksum_a=`${MYSQL} ${MYSQL_ARGS} -Ns -e "checksum table test;" incremental_sample | awk '{print $2}'`
2028+checksum_a=`checksum_table incremental_sample test`
2029
2030 vlog "Table checksum is $checksum_a"
2031 vlog "Making incremental backup"
2032@@ -83,7 +83,7 @@
2033 run_mysqld --innodb_file_per_table
2034
2035 vlog "Checking checksums"
2036-checksum_b=`${MYSQL} ${MYSQL_ARGS} -Ns -e "checksum table test;" incremental_sample | awk '{print $2}'`
2037+checksum_b=`checksum_table incremental_sample test`
2038
2039 if [ $checksum_a -ne $checksum_b ]
2040 then
2041
2042=== modified file 'test/t/xb_incremental_compressed.sh'
2043--- test/t/xb_incremental_compressed.sh 2011-06-22 17:55:52 +0000
2044+++ test/t/xb_incremental_compressed.sh 2011-09-15 04:23:22 +0000
2045@@ -103,8 +103,7 @@
2046 vlog "Changes done"
2047
2048 # Saving the checksum of original table
2049- checksum_a=`${MYSQL} ${MYSQL_ARGS} -Ns -e "checksum table test;" \
2050-incremental_sample | awk '{print $2}'`
2051+ checksum_a=`checksum_table incremental_sample test`
2052
2053 vlog "Table checksum is $checksum_a"
2054
2055@@ -148,8 +147,7 @@
2056 run_mysqld ${mysqld_additional_args}
2057
2058 vlog "Cheking checksums"
2059- checksum_b=`${MYSQL} ${MYSQL_ARGS} -Ns -e "checksum table test;" \
2060-incremental_sample | awk '{print $2}'`
2061+ checksum_b=`checksum_table incremental_sample test`
2062
2063 if [ $checksum_a -ne $checksum_b ]
2064 then
2065
2066=== modified file 'test/t/xb_part_range.sh'
2067--- test/t/xb_part_range.sh 2011-06-22 08:07:10 +0000
2068+++ test/t/xb_part_range.sh 2011-09-15 04:23:22 +0000
2069@@ -59,7 +59,7 @@
2070 vlog "Changes done"
2071
2072 # Saving the checksum of original table
2073-checksum_a=`${MYSQL} ${MYSQL_ARGS} -Ns -e "checksum table test;" test | awk '{print $2}'`
2074+checksum_a=`checksum_table test test`
2075
2076 vlog "Table checksum is $checksum_a - before backup"
2077
2078@@ -102,7 +102,7 @@
2079 run_mysqld
2080
2081 vlog "Cheking checksums"
2082-checksum_b=`${MYSQL} ${MYSQL_ARGS} -Ns -e "checksum table test;" test | awk '{print $2}'`
2083+checksum_b=`checksum_table test test`
2084
2085 if [ $checksum_a -ne $checksum_b ]
2086 then
2087
2088=== modified file 'test/t/xb_partial.sh'
2089--- test/t/xb_partial.sh 2011-06-10 07:55:26 +0000
2090+++ test/t/xb_partial.sh 2011-09-15 04:23:22 +0000
2091@@ -14,7 +14,7 @@
2092 let "count=count+1"
2093 done
2094 vlog "Initial rows added"
2095-checksum_a=`${MYSQL} ${MYSQL_ARGS} -Ns -e "checksum table test;" incremental_sample | awk '{print $2}'`
2096+checksum_a=`checksum_table incremental_sample test`
2097 vlog "Table checksum is $checksum_a"
2098
2099 # Backup directory
2100@@ -42,7 +42,7 @@
2101 vlog "Data restored"
2102 run_mysqld --innodb_file_per_table
2103 vlog "Checking checksums"
2104-checksum_b=`${MYSQL} ${MYSQL_ARGS} -Ns -e "checksum table test;" incremental_sample | awk '{print $2}'`
2105+checksum_b=`checksum_table incremental_sample test`
2106
2107 if [ $checksum_a -ne $checksum_b ]
2108 then
2109
2110=== modified file 'xtrabackup.c'
2111--- xtrabackup.c 2011-08-10 01:26:20 +0000
2112+++ xtrabackup.c 2011-09-15 04:23:22 +0000
2113@@ -812,6 +812,8 @@
2114 #define INNOBASE_WAKE_INTERVAL 32
2115 ulong innobase_active_counter = 0;
2116
2117+static char *xtrabackup_debug_sync = NULL;
2118+
2119 /* ======== Datafiles iterator ======== */
2120 typedef struct {
2121 fil_system_t *system;
2122@@ -961,7 +963,8 @@
2123 OPT_INNODB_OPEN_FILES,
2124 OPT_INNODB_SYNC_SPIN_LOOPS,
2125 OPT_INNODB_THREAD_CONCURRENCY,
2126- OPT_INNODB_THREAD_SLEEP_DELAY
2127+ OPT_INNODB_THREAD_SLEEP_DELAY,
2128+ OPT_XTRA_DEBUG_SYNC
2129 };
2130
2131 static struct my_option my_long_options[] =
2132@@ -1219,45 +1222,59 @@
2133 (G_PTR*) &innobase_doublewrite_file, (G_PTR*) &innobase_doublewrite_file,
2134 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
2135 #endif
2136-/*
2137- {"innodb_rollback_on_timeout", OPT_INNODB_ROLLBACK_ON_TIMEOUT,
2138- "Roll back the complete transaction on lock wait timeout, for 4.x compatibility (disabled by default)",
2139- (G_PTR*) &innobase_rollback_on_timeout, (G_PTR*) &innobase_rollback_on_timeout,
2140- 0, GET_BOOL, OPT_ARG, 0, 0, 0, 0, 0, 0},
2141-*/
2142-/*
2143- {"innodb_status_file", OPT_INNODB_STATUS_FILE,
2144- "Enable SHOW INNODB STATUS output in the innodb_status.<pid> file",
2145- (G_PTR*) &innobase_create_status_file, (G_PTR*) &innobase_create_status_file,
2146- 0, GET_BOOL, OPT_ARG, 0, 0, 0, 0, 0, 0},
2147-*/
2148-/*
2149- {"innodb_sync_spin_loops", OPT_INNODB_SYNC_SPIN_LOOPS,
2150- "Count of spin-loop rounds in InnoDB mutexes",
2151- (G_PTR*) &srv_n_spin_wait_rounds,
2152- (G_PTR*) &srv_n_spin_wait_rounds,
2153- 0, GET_ULONG, REQUIRED_ARG, 20L, 0L, ULONG_MAX, 0, 1L, 0},
2154-*/
2155-/*
2156- {"innodb_thread_concurrency", OPT_INNODB_THREAD_CONCURRENCY,
2157- "Helps in performance tuning in heavily concurrent environments. "
2158- "Sets the maximum number of threads allowed inside InnoDB. Value 0"
2159- " will disable the thread throttling.",
2160- (G_PTR*) &srv_thread_concurrency, (G_PTR*) &srv_thread_concurrency,
2161- 0, GET_ULONG, REQUIRED_ARG, 8, 0, 1000, 0, 1, 0},
2162-*/
2163-/*
2164- {"innodb_thread_sleep_delay", OPT_INNODB_THREAD_SLEEP_DELAY,
2165- "Time of innodb thread sleeping before joining InnoDB queue (usec). Value 0"
2166- " disable a sleep",
2167- (G_PTR*) &srv_thread_sleep_delay,
2168- (G_PTR*) &srv_thread_sleep_delay,
2169- 0, GET_ULONG, REQUIRED_ARG, 10000L, 0L, ULONG_MAX, 0, 1L, 0},
2170-*/
2171+
2172+#ifndef __WIN__
2173+ {"debug-sync", OPT_XTRA_DEBUG_SYNC,
2174+ "Debug sync point. This is only used by the xtrabackup test suite",
2175+ (G_PTR*) &xtrabackup_debug_sync,
2176+ (G_PTR*) &xtrabackup_debug_sync,
2177+ 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
2178+#endif
2179
2180 { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
2181 };
2182
2183+UNIV_INLINE
2184+void
2185+debug_sync_point(const char *name)
2186+{
2187+#ifndef __WIN__
2188+ FILE *fp;
2189+ pid_t pid;
2190+ char pid_path[FN_REFLEN];
2191+
2192+ if (xtrabackup_debug_sync == NULL) {
2193+ return;
2194+ }
2195+
2196+ if (strcmp(xtrabackup_debug_sync, name)) {
2197+ return;
2198+ }
2199+
2200+ pid = getpid();
2201+
2202+ snprintf(pid_path, sizeof(pid_path), "%s/xtrabackup_debug_sync",
2203+ xtrabackup_target_dir);
2204+ fp = fopen(pid_path, "w");
2205+ if (fp == NULL) {
2206+ fprintf(stderr, "xtrabackup: Error: cannot open %s\n",
2207+ pid_path);
2208+ exit(EXIT_FAILURE);
2209+ }
2210+ fprintf(fp, "%u\n", (uint) pid);
2211+ fclose(fp);
2212+
2213+ fprintf(stderr, "xtrabackup: DEBUG: "
2214+ "Suspending at debug sync point '%s'. "
2215+ "Resume with 'kill -SIGCONT %u'.\n", name, (uint) pid);
2216+
2217+ kill(pid, SIGSTOP);
2218+
2219+ /* On resume */
2220+ my_delete(pid_path, MYF(MY_WME));
2221+#endif
2222+}
2223+
2224 static const char *load_default_groups[]= { "mysqld","xtrabackup",0 };
2225
2226 static void print_version(void)
2227@@ -2816,11 +2833,6 @@
2228 #else
2229 zip_size = fil_space_get_zip_size(node->space->id);
2230 if (zip_size == ULINT_UNDEFINED) {
2231- fprintf(stderr, "[%02u] xtrabackup: Warning: "
2232- "Failed to determine page size for %s.\n"
2233- "[%02u] xtrabackup: Warning: We assume the table was "
2234- "dropped during xtrabackup execution and ignore the "
2235- "file.\n", thread_n, node->name, thread_n);
2236 goto skip;
2237 } else if (zip_size) {
2238 page_size = zip_size;
2239@@ -2884,8 +2896,8 @@
2240 fprintf(stderr,
2241 "[%02u] xtrabackup: Warning: cannot open %s\n"
2242 "[%02u] xtrabackup: Warning: We assume the "
2243- "table was dropped during xtrabackup execution "
2244- "and ignore the file.\n",
2245+ "table was dropped or renamed during "
2246+ "xtrabackup execution and ignore the file.\n",
2247 thread_n, node->name, thread_n);
2248 goto skip;
2249 }
2250@@ -3583,6 +3595,8 @@
2251 */
2252 my_thread_init();
2253
2254+ debug_sync_point("data_copy_thread_func");
2255+
2256 while ((node = datafiles_iter_next(ctxt->it, &space_changed)) != NULL) {
2257 space = node->space;
2258
2259@@ -3607,7 +3621,6 @@
2260 OS_THREAD_DUMMY_RETURN;
2261 }
2262
2263-/* CAUTION(?): Don't rename file_per_table during backup */
2264 static void
2265 xtrabackup_backup_func(void)
2266 {

Subscribers

People subscribed via source and target branches