Merge lp:~akopytov/percona-xtrabackup/bug1169169-2.0 into lp:percona-xtrabackup/2.0

Proposed by Alexey Kopytov
Status: Merged
Approved by: Laurynas Biveinis
Approved revision: no longer in the source branch.
Merged at revision: 544
Proposed branch: lp:~akopytov/percona-xtrabackup/bug1169169-2.0
Merge into: lp:percona-xtrabackup/2.0
Prerequisite: lp:~akopytov/percona-xtrabackup/support-separate-undo-tablespaces-2.0
Diff against target: 1246 lines (+477/-136)
20 files modified
innobackupex (+32/-3)
patches/innodb56.patch (+189/-38)
src/xtrabackup.cc (+52/-7)
test/inc/common.sh (+47/-27)
test/inc/ib_part.sh (+5/-5)
test/t/bug1062684.sh (+11/-4)
test/t/bug483827.sh (+1/-4)
test/t/bug606981.sh (+9/-5)
test/t/bug740489.sh (+22/-14)
test/t/bug759225.sh (+6/-4)
test/t/bug870119.sh (+6/-3)
test/t/bug891496.sh (+6/-8)
test/t/bug976945.sh (+4/-2)
test/t/bug977101.sh (+3/-4)
test/t/ib_doublewrite.sh (+6/-3)
test/t/ib_slave_info.sh (+2/-2)
test/t/undo_tablespaces.sh (+75/-0)
test/t/xb_basic.sh (+0/-1)
test/t/xb_version.sh (+0/-1)
test/testrun.sh (+1/-1)
To merge this branch: bzr merge lp:~akopytov/percona-xtrabackup/bug1169169-2.0
Reviewer Review Type Date Requested Status
Laurynas Biveinis (community) Approve
Review via email: mp+160272@code.launchpad.net

This proposal supersedes a proposal from 2013-04-23.

Description of the change

    Bug #1169169: xtrabackup_56 crashes when preparing a backup with
                  partitioned tables

    The problem was that xtrabackup_56 used the implementation of
    innobase_convert_identifier() provided by the InnoDB code, rather than a
    lightweight replacement provided in xtrabackup.cc for other build
    flavors. The full-blown implementation may call explain_filename() which
    requires MySQL localization subsystem to be initialized (which is
    normally initialized in init_common_variables() on server startup). In
    particular, it crashed when explain_filename() was called on a
    partitioned table.

    Since xtrabackup_56 links with ha_innodb.cc containing the full-blown
    implementation of innobase_convert_identifier(), the bug was fixed by
    replicating the lightweight version used by xtrabackup/xtrabackup_55 in
    innodb56.patch.

    An alternative approach would be to mimic localization subsystem
    initialization performed in mysqld.cc, but that pulls way too many
    dependencies.

    This revision also fixes bug #1170340 "require_partitioning in
    test/inc/ib_part.sh does not work with 5.6" (which was the reason why
    bug #1169169 have not been caught by the test suite).

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

http://jenkins.percona.com/view/XtraBackup/job/percona-xtrabackup-2.0-param/409/

The ib_part* failures on *56 configurations is a result of missing remote tablespaces support (will be fixed in followup dependent MPs).

Revision history for this message
Alexey Kopytov (akopytov) wrote :

No idea why it shows the combined diff with the separate-undo-tablespaces branch, even though it is a prerequisite.

Revision history for this message
Laurynas Biveinis (laurynas-biveinis) :
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 2013-04-03 07:04:25 +0000
3+++ innobackupex 2013-04-23 06:09:29 +0000
4@@ -715,12 +715,15 @@
5 get_option(\%config, $option_defaults_group, 'innodb_data_file_path');
6 my $orig_iblog_dir =
7 get_option(\%config, $option_defaults_group, 'innodb_log_group_home_dir');
8+ my $orig_undo_dir = $orig_ibdata_dir;
9 my $iblog_files = 'ib_logfile.*';
10+ my $ibundo_files = 'undo[0-9]{3}';
11 my $excluded_files =
12 '\.\.?|backup-my\.cnf|xtrabackup_logfile|' .
13- 'xtrabackup_binary|xtrabackup_binlog_info|xtrabackup_checkpoints|' .
14+ 'xtrabackup_binary|xtrabackup_binlog_info|xtrabackup_checkpoints|' .
15 '.*\.qp|' .
16- $iblog_files;
17+ $iblog_files . '|'.
18+ $ibundo_files;
19 my $compressed_data_file = '.*\.ibz$';
20 my $file;
21 my $backup_innodb_data_file_path;
22@@ -732,6 +735,10 @@
23 $excluded_files = $excluded_files . '|' . $doublewrite_file;
24 }
25
26+ if (has_option(\%config, $option_defaults_group, 'innodb_undo_directory')) {
27+ $orig_undo_dir = get_option(\%config, $option_defaults_group,
28+ 'innodb_undo_directory');
29+ }
30 # check whether files should be copied or moved to dest directory
31 my $move_or_copy_file = $move_flag ? \&move_file : \&copy_file;
32 my $move_or_copy_dir = $move_flag ?
33@@ -743,6 +750,10 @@
34 if_directory_exists_and_empty($orig_datadir, "Original data");
35 if_directory_exists_and_empty($orig_ibdata_dir, "Original InnoDB data");
36 if_directory_exists_and_empty($orig_iblog_dir, "Original InnoDB log");
37+ if ($orig_undo_dir) {
38+ if_directory_exists_and_empty($orig_undo_dir,
39+ "Original undo directory");
40+ }
41
42 # check that the original options file and the backup options file have
43 # the same value for "innodb_data_file_path" option
44@@ -801,6 +812,22 @@
45 &$move_or_copy_file($src_name, $dst_name);
46 }
47
48+ # copy InnoDB undo tablespaces to innodb_undo_directory (if specified), or
49+ # to the InnoDB data directory
50+ print STDERR "\n$prefix Starting to $operation InnoDB undo tablespaces\n";
51+ print STDERR "$prefix in '$backup_dir'\n";
52+ print STDERR "$prefix back to '$orig_undo_dir'\n";
53+ opendir(DIR, $backup_dir)
54+ || Die "Can't open directory '$backup_dir': $!\n";
55+ while (defined($file = readdir(DIR))) {
56+ if ($file =~ /^$ibundo_files$/ && -f "$backup_dir/$file") {
57+ $src_name = escape_path("$backup_dir/$file");
58+ $dst_name = escape_path("$orig_undo_dir");
59+ &$move_or_copy_file($src_name, $dst_name);
60+ }
61+ }
62+ closedir(DIR);
63+
64 # copy InnoDB log files to original InnoDB log directory
65 opendir(DIR, $backup_dir)
66 || Die "Can't open directory '$backup_dir': $!\n";
67@@ -1810,7 +1837,9 @@
68 "innodb_log_file_size",
69 "innodb_fast_checksum",
70 "innodb_page_size",
71- "innodb_log_block_size"
72+ "innodb_log_block_size",
73+ "innodb_undo_directory",
74+ "innodb_undo_tablespaces"
75 );
76
77 my $options_dump = "# This MySQL options file was generated by $innobackup_script.\n\n" .
78
79=== modified file 'patches/innodb56.patch'
80--- patches/innodb56.patch 2013-04-09 13:44:38 +0000
81+++ patches/innodb56.patch 2013-04-23 06:09:29 +0000
82@@ -47,16 +47,19 @@
83 #include "trx0sys.h"
84 #include "row0mysql.h"
85 #ifndef UNIV_HOTBACKUP
86-@@ -311,7 +313,7 @@
87+@@ -311,10 +313,7 @@
88
89 /** The tablespace memory cache. This variable is NULL before the module is
90 initialized. */
91 -static fil_system_t* fil_system = NULL;
92+-
93+-/** Determine if (i) is a user tablespace id or not. */
94+-# define fil_is_user_tablespace_id(i) ((i) > srv_undo_tablespaces_open)
95 +fil_system_t* fil_system = NULL;
96
97- /** Determine if (i) is a user tablespace id or not. */
98- # define fil_is_user_tablespace_id(i) ((i) > srv_undo_tablespaces_open)
99-@@ -376,7 +378,7 @@
100+ /** Determine if user has explicitly disabled fsync(). */
101+ #ifndef __WIN__
102+@@ -376,7 +375,7 @@
103 off the LRU list if it is in the LRU list. The caller must hold the fil_sys
104 mutex. */
105 static
106@@ -65,7 +68,7 @@
107 fil_node_prepare_for_io(
108 /*====================*/
109 fil_node_t* node, /*!< in: file node */
110-@@ -691,7 +693,7 @@
111+@@ -691,7 +690,7 @@
112 Opens a file of a node of a tablespace. The caller must own the fil_system
113 mutex. */
114 static
115@@ -74,7 +77,7 @@
116 fil_node_open_file(
117 /*===============*/
118 fil_node_t* node, /*!< in: file node */
119-@@ -725,6 +727,18 @@
120+@@ -725,6 +724,18 @@
121 OS_FILE_READ_ONLY, &success);
122 if (!success) {
123 /* The following call prints an error message */
124@@ -93,7 +96,7 @@
125 os_file_get_last_error(true);
126
127 ut_print_timestamp(stderr);
128-@@ -783,12 +797,17 @@
129+@@ -783,12 +794,17 @@
130
131 if (UNIV_UNLIKELY(space_id != space->id)) {
132 fprintf(stderr,
133@@ -114,7 +117,7 @@
134 }
135
136 if (UNIV_UNLIKELY(space_id == ULINT_UNDEFINED
137-@@ -825,8 +844,9 @@
138+@@ -825,8 +841,9 @@
139 }
140
141 if (size_bytes >= 1024 * 1024) {
142@@ -126,7 +129,7 @@
143 }
144
145 if (!fsp_flags_is_compressed(flags)) {
146-@@ -879,6 +899,8 @@
147+@@ -879,6 +896,8 @@
148 /* Put the node to the LRU list */
149 UT_LIST_ADD_FIRST(LRU, system->LRU, node);
150 }
151@@ -135,7 +138,7 @@
152 }
153
154 /**********************************************************************//**
155-@@ -1491,7 +1513,12 @@
156+@@ -1491,7 +1510,12 @@
157 the file yet; the following calls will open it and update the
158 size fields */
159
160@@ -149,7 +152,7 @@
161 fil_node_complete_io(node, fil_system, OS_FILE_READ);
162 }
163
164-@@ -2095,7 +2122,7 @@
165+@@ -2095,7 +2119,7 @@
166 mem_free(path);
167 }
168
169@@ -158,7 +161,7 @@
170 /********************************************************//**
171 Writes a log record about an .ibd file create/rename/delete. */
172 static
173-@@ -2329,7 +2356,7 @@
174+@@ -2329,7 +2353,7 @@
175 space_id, name, path, flags,
176 DICT_TF2_USE_TABLESPACE,
177 FIL_IBD_FILE_INITIAL_SIZE) != DB_SUCCESS) {
178@@ -167,7 +170,7 @@
179 }
180 }
181
182-@@ -2687,7 +2714,7 @@
183+@@ -2687,7 +2711,7 @@
184 }
185
186 if (err == DB_SUCCESS) {
187@@ -176,7 +179,7 @@
188 /* Write a log record about the deletion of the .ibd
189 file, so that ibbackup can replay it in the
190 --apply-log phase. We use a dummy mtr and the familiar
191-@@ -3042,7 +3069,7 @@
192+@@ -3042,7 +3066,7 @@
193
194 mutex_exit(&fil_system->mutex);
195
196@@ -185,7 +188,7 @@
197 if (success && !recv_recovery_on) {
198 mtr_t mtr;
199
200-@@ -3426,7 +3453,7 @@
201+@@ -3426,7 +3450,7 @@
202 goto error_exit_1;
203 }
204
205@@ -194,7 +197,7 @@
206 {
207 mtr_t mtr;
208 ulint mlog_file_flag = 0;
209-@@ -3504,6 +3531,97 @@
210+@@ -3504,6 +3528,97 @@
211 #endif /* UNIV_LOG_ARCHIVE */
212 };
213
214@@ -292,7 +295,7 @@
215 /********************************************************************//**
216 Tries to open a single-table tablespace and optionally checks that the
217 space id in it is correct. If this does not succeed, print an error message
218-@@ -3712,11 +3830,15 @@
219+@@ -3712,11 +3827,15 @@
220 /* The following call prints an error message */
221 os_file_get_last_error(true);
222
223@@ -309,7 +312,7 @@
224
225 err = DB_CORRUPTION;
226
227-@@ -4135,7 +4257,7 @@
228+@@ -4135,7 +4254,7 @@
229 cannot be ok. */
230 ulong minimum_size = FIL_IBD_FILE_INITIAL_SIZE * UNIV_PAGE_SIZE;
231 if (size < minimum_size) {
232@@ -318,7 +321,7 @@
233 ib_logf(IB_LOG_LEVEL_ERROR,
234 "The size of single-table tablespace file %s "
235 "is only " UINT64PF ", should be at least %lu!",
236-@@ -4263,7 +4385,7 @@
237+@@ -4263,7 +4382,7 @@
238 idea is to read as much good data as we can and jump over bad data.
239 @return 0 if ok, -1 if error even after the retries, 1 if at the end
240 of the directory */
241@@ -327,7 +330,7 @@
242 int
243 fil_file_readdir_next_file(
244 /*=======================*/
245-@@ -4359,7 +4481,9 @@
246+@@ -4359,7 +4478,9 @@
247 "%s/%s", fil_path_to_mysql_datadir, dbinfo.name);
248 srv_normalize_path_for_win(dbpath);
249
250@@ -338,7 +341,7 @@
251
252 if (dbdir != NULL) {
253
254-@@ -4538,6 +4662,7 @@
255+@@ -4538,6 +4659,7 @@
256 {
257 fil_space_t* fnamespace;
258 fil_space_t* space;
259@@ -346,7 +349,7 @@
260
261 ut_ad(fil_system);
262
263-@@ -4615,6 +4740,10 @@
264+@@ -4615,6 +4737,10 @@
265 if (fnamespace == NULL) {
266 if (print_error_if_does_not_exist) {
267 fil_report_missing_tablespace(name, id);
268@@ -357,7 +360,7 @@
269 }
270 } else {
271 ut_print_timestamp(stderr);
272-@@ -4638,6 +4767,10 @@
273+@@ -4638,6 +4764,10 @@
274
275 mutex_exit(&fil_system->mutex);
276
277@@ -368,7 +371,7 @@
278 return(FALSE);
279 }
280
281-@@ -4728,6 +4861,7 @@
282+@@ -4728,6 +4858,7 @@
283 ulint page_size;
284 ulint pages_added;
285 ibool success;
286@@ -376,7 +379,7 @@
287
288 ut_ad(!srv_read_only_mode);
289
290-@@ -4772,13 +4906,17 @@
291+@@ -4772,13 +4903,17 @@
292 goto retry;
293 }
294
295@@ -395,7 +398,7 @@
296 start_page_no = space->size;
297 file_start_page_no = space->size - node->size;
298
299-@@ -5024,7 +5162,7 @@
300+@@ -5024,7 +5159,7 @@
301 off the LRU list if it is in the LRU list. The caller must hold the fil_sys
302 mutex. */
303 static
304@@ -404,7 +407,7 @@
305 fil_node_prepare_for_io(
306 /*====================*/
307 fil_node_t* node, /*!< in: file node */
308-@@ -5044,9 +5182,12 @@
309+@@ -5044,9 +5179,12 @@
310 }
311
312 if (node->open == FALSE) {
313@@ -418,7 +421,7 @@
314 }
315
316 if (node->n_pending == 0 && fil_space_belongs_in_lru(space)) {
317-@@ -5058,6 +5199,8 @@
318+@@ -5058,6 +5196,8 @@
319 }
320
321 node->n_pending++;
322@@ -427,7 +430,7 @@
323 }
324
325 /********************************************************************//**
326-@@ -5259,6 +5402,16 @@
327+@@ -5259,6 +5399,16 @@
328
329 ut_ad(mode != OS_AIO_IBUF || space->purpose == FIL_TABLESPACE);
330
331@@ -444,7 +447,7 @@
332 node = UT_LIST_GET_FIRST(space->chain);
333
334 for (;;) {
335-@@ -5290,7 +5443,11 @@
336+@@ -5290,7 +5440,11 @@
337 }
338
339 /* Open file if closed */
340@@ -457,7 +460,7 @@
341
342 /* Check that at least the start offset is within the bounds of a
343 single-table tablespace, including rollback tablespaces. */
344-@@ -6164,6 +6321,7 @@
345+@@ -6164,6 +6318,7 @@
346 return(err);
347 }
348
349@@ -465,7 +468,7 @@
350 /****************************************************************//**
351 Generate redo logs for swapping two .ibd files */
352 UNIV_INTERN
353-@@ -6187,4 +6345,4 @@
354+@@ -6187,4 +6342,4 @@
355 0, 0, new_name, old_name, &mtr);
356 mtr_commit(&mtr);
357 }
358@@ -482,6 +485,55 @@
359
360 if (thd && thd_sql_command(thd) == SQLCOM_DROP_TABLE) {
361
362+@@ -2423,43 +2423,19 @@
363+ ulint buflen, /*!< in: length of buf, in bytes */
364+ const char* id, /*!< in: identifier to convert */
365+ ulint idlen, /*!< in: length of id, in bytes */
366+- THD* thd, /*!< in: MySQL connection thread, or NULL */
367+- ibool file_id)/*!< in: TRUE=id is a table or database name;
368++ THD* thd __attribute__((unused)),
369++ /*!< in: MySQL connection thread, or NULL */
370++ ibool file_id __attribute__((unused)))
371++ /*!< in: TRUE=id is a table or database name;
372+ FALSE=id is an UTF-8 string */
373+ {
374+- char nz[NAME_LEN + 1];
375+- char nz2[NAME_LEN + 1 + EXPLAIN_FILENAME_MAX_EXTRA_LENGTH];
376+-
377+ const char* s = id;
378+ int q;
379+
380+- if (file_id) {
381+- /* Decode the table name. The MySQL function expects
382+- a NUL-terminated string. The input and output strings
383+- buffers must not be shared. */
384+-
385+- if (UNIV_UNLIKELY(idlen > (sizeof nz) - 1)) {
386+- idlen = (sizeof nz) - 1;
387+- }
388+-
389+- memcpy(nz, id, idlen);
390+- nz[idlen] = 0;
391+-
392+- s = nz2;
393+- idlen = explain_filename(thd, nz, nz2, sizeof nz2,
394+- EXPLAIN_PARTITIONS_AS_COMMENT);
395+- goto no_quote;
396+- }
397+-
398+ /* See if the identifier needs to be quoted. */
399+- if (UNIV_UNLIKELY(!thd)) {
400+- q = '"';
401+- } else {
402+- q = get_quote_char_for_identifier(thd, s, (int) idlen);
403+- }
404++ q = '"';
405+
406+ if (q == EOF) {
407+-no_quote:
408+ if (UNIV_UNLIKELY(idlen > buflen)) {
409+ idlen = buflen;
410+ }
411 --- a/storage/innobase/include/srv0srv.h
412 +++ b/storage/innobase/include/srv0srv.h
413 @@ -353,6 +353,9 @@
414@@ -676,7 +728,60 @@
415 dberr_t
416 open_or_create_data_files(
417 /*======================*/
418-@@ -2065,11 +2065,13 @@
419+@@ -1204,12 +1204,16 @@
420+ /********************************************************************
421+ Opens the configured number of undo tablespaces.
422+ @return DB_SUCCESS or error code */
423+-static
424++UNIV_INTERN
425+ dberr_t
426+ srv_undo_tablespaces_init(
427+ /*======================*/
428+ ibool create_new_db, /*!< in: TRUE if new db being
429+ created */
430++ ibool backup_mode, /*!< in: TRUE disables reading
431++ the system tablespace (used in
432++ XtraBackup), FALSE is passed on
433++ recovery. */
434+ const ulint n_conf_tablespaces, /*!< in: configured undo
435+ tablespaces */
436+ ulint* n_opened) /*!< out: number of UNDO
437+@@ -1225,6 +1229,7 @@
438+ *n_opened = 0;
439+
440+ ut_a(n_conf_tablespaces <= TRX_SYS_N_RSEGS);
441++ ut_a(!create_new_db || !backup_mode);
442+
443+ memset(undo_tablespace_ids, 0x0, sizeof(undo_tablespace_ids));
444+
445+@@ -1258,12 +1263,13 @@
446+ }
447+ }
448+
449+- /* Get the tablespace ids of all the undo segments excluding
450+- the system tablespace (0). If we are creating a new instance then
451++ /* Get the tablespace ids of all the undo segments excluding the system
452++ tablespace (0). If we are creating a new instance then
453+ we build the undo_tablespace_ids ourselves since they don't
454+- already exist. */
455++ already exist. If we are in the backup mode, don't read the trx header,
456++ we just need to add all available undo tablespaces to fil_system. */
457+
458+- if (!create_new_db) {
459++ if (!create_new_db && !backup_mode) {
460+ n_undo_tablespaces = trx_rseg_get_n_undo_tablespaces(
461+ undo_tablespace_ids);
462+ } else {
463+@@ -1369,7 +1375,7 @@
464+ ib_logf(IB_LOG_LEVEL_INFO, "Opened %lu undo tablespaces",
465+ n_undo_tablespaces);
466+
467+- if (n_conf_tablespaces == 0) {
468++ if (n_conf_tablespaces == 0 && !backup_mode) {
469+ ib_logf(IB_LOG_LEVEL_WARN,
470+ "Using the system tablespace for all UNDO "
471+ "logging because innodb_undo_tablespaces=0");
472+@@ -2065,11 +2071,13 @@
473 max_flushed_lsn = min_flushed_lsn
474 = log_get_lsn();
475 goto files_checked;
476@@ -690,7 +795,15 @@
477 }
478
479 /* opened all files */
480-@@ -2326,6 +2328,10 @@
481+@@ -2162,6 +2170,7 @@
482+
483+ err = srv_undo_tablespaces_init(
484+ create_new_db,
485++ FALSE,
486+ srv_undo_tablespaces,
487+ &srv_undo_tablespaces_open);
488+
489+@@ -2326,6 +2335,10 @@
490
491 recv_recovery_from_checkpoint_finish();
492
493@@ -701,7 +814,7 @@
494 if (srv_force_recovery < SRV_FORCE_NO_IBUF_MERGE) {
495 /* The following call is necessary for the insert
496 buffer to work with multiple tablespaces. We must
497-@@ -2647,6 +2653,7 @@
498+@@ -2647,6 +2660,7 @@
499 && srv_auto_extend_last_data_file
500 && sum_of_data_file_sizes < tablespace_size_in_header) {
501
502@@ -709,7 +822,7 @@
503 ut_print_timestamp(stderr);
504 fprintf(stderr,
505 " InnoDB: Error: tablespace size stored in header"
506-@@ -2683,6 +2690,7 @@
507+@@ -2683,6 +2697,7 @@
508
509 return(DB_ERROR);
510 }
511@@ -717,7 +830,7 @@
512 }
513
514 /* Check that os_fast_mutexes work as expected */
515-@@ -2739,6 +2747,7 @@
516+@@ -2739,6 +2754,7 @@
517 fts_optimize_init();
518 }
519
520@@ -725,7 +838,7 @@
521 srv_was_started = TRUE;
522
523 return(DB_SUCCESS);
524-@@ -2794,7 +2803,7 @@
525+@@ -2794,7 +2810,7 @@
526 return(DB_SUCCESS);
527 }
528
529@@ -844,3 +957,41 @@
530
531 UNIV_MEM_FREE(buf, n);
532 }
533+--- a/storage/innobase/include/fil0fil.h
534++++ b/storage/innobase/include/fil0fil.h
535+@@ -163,6 +163,9 @@
536+ #define FIL_LOG 502 /*!< redo log */
537+ /* @} */
538+
539++/** Determine if (i) is a user tablespace id or not. */
540++#define fil_is_user_tablespace_id(i) ((i) > srv_undo_tablespaces_open)
541++
542+ /** The number of fsyncs done to the log */
543+ extern ulint fil_n_log_flushes;
544+
545+--- a/storage/innobase/include/srv0start.h
546++++ b/storage/innobase/include/srv0start.h
547+@@ -77,6 +77,23 @@
548+ srv_add_path_separator_if_needed(
549+ /*=============================*/
550+ char* str); /*!< in: null-terminated character string */
551++/********************************************************************
552++Opens the configured number of undo tablespaces.
553++@return DB_SUCCESS or error code */
554++UNIV_INTERN
555++dberr_t
556++srv_undo_tablespaces_init(
557++/*======================*/
558++ ibool create_new_db, /*!< in: TRUE if new db being
559++ created */
560++ ibool backup_mode, /*!< in: TRUE disables reading
561++ the system tablespace (used in
562++ XtraBackup), FALSE is passed on
563++ recovery. */
564++ const ulint n_conf_tablespaces, /*!< in: configured undo
565++ tablespaces */
566++ ulint* n_opened); /*!< out: number of UNDO
567++ tablespaces successfully */
568+ #ifndef UNIV_HOTBACKUP
569+ /****************************************************************//**
570+ Starts Innobase and creates a new database if database files
571
572=== modified file 'src/xtrabackup.cc'
573--- src/xtrabackup.cc 2013-04-17 07:50:37 +0000
574+++ src/xtrabackup.cc 2013-04-23 06:09:29 +0000
575@@ -1643,6 +1643,7 @@
576 OPT_XTRA_DEBUG_SYNC,
577 #if MYSQL_VERSION_ID >= 50600
578 OPT_INNODB_CHECKSUM_ALGORITHM,
579+ OPT_INNODB_UNDO_DIRECTORY,
580 OPT_UNDO_TABLESPACES,
581 #endif
582 OPT_DEFAULTS_GROUP
583@@ -1962,14 +1963,17 @@
584 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
585 #endif
586 #if MYSQL_VERSION_ID >= 50600
587- {"checksum-algorithm", OPT_INNODB_CHECKSUM_ALGORITHM,
588+ {"innodb_checksum_algorithm", OPT_INNODB_CHECKSUM_ALGORITHM,
589 "The algorithm InnoDB uses for page checksumming. [CRC32, STRICT_CRC32, "
590 "INNODB, STRICT_INNODB, NONE, STRICT_NONE]", &srv_checksum_algorithm,
591 &srv_checksum_algorithm, &innodb_checksum_algorithm_typelib, GET_ENUM,
592 REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
593- {"undo-tablespaces", OPT_UNDO_TABLESPACES,
594- "Number of undo tablespaces to use. NON-ZERO VALUES ARE NOT "
595- "CURRENTLY SUPPORTED",
596+ {"innodb_undo_directory", OPT_INNODB_UNDO_DIRECTORY,
597+ "Directory where undo tablespace files live, this path can be absolute.",
598+ (G_PTR*) &srv_undo_dir, (G_PTR*) &srv_undo_dir,
599+ 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
600+ {"innodb_undo_tablespaces", OPT_UNDO_TABLESPACES,
601+ "Number of undo tablespaces to use.",
602 (G_PTR*)&srv_undo_tablespaces, (G_PTR*)&srv_undo_tablespaces,
603 0, GET_ULONG, REQUIRED_ARG, 0, 0, 126, 0, 1, 0},
604 #endif
605@@ -3152,7 +3156,7 @@
606 srv_log_file_size = (ulint) innobase_log_file_size;
607 msg("xtrabackup: innodb_log_files_in_group = %ld\n",
608 srv_n_log_files);
609- msg("xtrabackup: innodb_log_file_size = %ld\n",
610+ msg("xtrabackup: innodb_log_file_size = %lld\n",
611 srv_log_file_size);
612
613 #ifdef UNIV_LOG_ARCHIVE
614@@ -3308,6 +3312,18 @@
615 #endif
616 #endif /* MYSQL_VERSION_ID */
617
618+#if MYSQL_VERSION_ID >= 50600
619+ /* Assign the default value to srv_undo_dir if it's not specified, as
620+ my_getopt does not support default values for string options. We also
621+ ignore the option and override innodb_undo_directory on --prepare,
622+ because separate undo tablespaces are copied to the root backup
623+ directory. */
624+
625+ if (!srv_undo_dir || !xtrabackup_backup) {
626+ srv_undo_dir = (char *) ".";
627+ }
628+#endif
629+
630 return(FALSE);
631
632 error:
633@@ -3747,7 +3763,11 @@
634 }
635
636 #ifndef XTRADB_BASED
637-#define trx_sys_sys_space(id) (id == 0)
638+# if MYSQL_VERSION_ID >= 50600
639+# define trx_sys_sys_space(id) (!fil_is_user_tablespace_id(id))
640+# else
641+# define trx_sys_sys_space(id) (id == 0)
642+# endif
643 #endif
644
645 /****************************************************************//**
646@@ -4691,7 +4711,24 @@
647 return(DB_ERROR);
648 }
649
650- return(fil_load_single_table_tablespaces());
651+ err = fil_load_single_table_tablespaces();
652+ if (err != DB_SUCCESS) {
653+ return(err);
654+ }
655+
656+#if MYSQL_VERSION_ID >= 50600
657+ /* Add separate undo tablespaces to fil_system */
658+
659+ err = srv_undo_tablespaces_init(FALSE,
660+ TRUE,
661+ srv_undo_tablespaces,
662+ &srv_undo_tablespaces_open);
663+ if (err != DB_SUCCESS) {
664+ return(err);
665+ }
666+#endif
667+
668+ return(DB_SUCCESS);
669 }
670
671 /*********************************************************************//**
672@@ -7895,6 +7932,14 @@
673 printf("innodb_file_per_table = %d\n",
674 (int) innobase_file_per_table);
675 #endif
676+#if MYSQL_VERSION_ID >= 50600
677+ if (srv_undo_dir) {
678+
679+ printf("innodb_undo_directory = \"%s\"\n",
680+ srv_undo_dir);
681+ }
682+ printf("innodb_undo_tablespaces = %lu\n", srv_undo_tablespaces);
683+#endif
684 exit(EXIT_SUCCESS);
685 }
686
687
688=== modified file 'test/inc/common.sh'
689--- test/inc/common.sh 2013-03-08 04:37:16 +0000
690+++ test/inc/common.sh 2013-04-23 06:09:29 +0000
691@@ -27,25 +27,12 @@
692 exit 1
693 }
694
695-function init_mysql_dir()
696+function call_mysql_install_db()
697 {
698- if [ ! -d "$MYSQLD_VARDIR" ]
699- then
700- vlog "Creating server root directory: $MYSQLD_VARDIR"
701- mkdir "$MYSQLD_VARDIR"
702- fi
703- if [ ! -d "$MYSQLD_TMPDIR" ]
704- then
705- vlog "Creating server temporary directory: $MYSQLD_TMPDIR"
706- mkdir "$MYSQLD_TMPDIR"
707- fi
708- if [ ! -d "$MYSQLD_DATADIR" ]
709- then
710- vlog "Creating server data directory: $MYSQLD_DATADIR"
711- mkdir -p "$MYSQLD_DATADIR"
712 vlog "Calling mysql_install_db"
713- $MYSQL_INSTALL_DB --no-defaults --basedir=$MYSQL_BASEDIR --datadir="$MYSQLD_DATADIR" --tmpdir="$MYSQLD_TMPDIR" ${MYSQLD_EXTRA_ARGS}
714- fi
715+ cd $MYSQL_BASEDIR
716+ $MYSQL_INSTALL_DB --defaults-file=${MYSQLD_VARDIR}/my.cnf ${MYSQLD_EXTRA_ARGS}
717+ cd -
718 }
719
720 ########################################################################
721@@ -230,20 +217,15 @@
722 MYSQLD_PORT="${SRV_MYSQLD_PORT[$id]}"
723 MYSQLD_SOCKET="${SRV_MYSQLD_SOCKET[$id]}"
724
725- MYSQL_ARGS="--no-defaults --socket=${MYSQLD_SOCKET} --user=root"
726- MYSQLD_ARGS="--no-defaults --basedir=${MYSQL_BASEDIR} \
727---socket=${MYSQLD_SOCKET} --port=${MYSQLD_PORT} --server-id=$id \
728---datadir=${MYSQLD_DATADIR} --tmpdir=${MYSQLD_TMPDIR} --log-bin=mysql-bin \
729---relay-log=mysql-relay-bin --pid-file=${MYSQLD_PIDFILE} ${MYSQLD_EXTRA_ARGS}"
730+ MYSQL_ARGS="--defaults-file=$MYSQLD_VARDIR/my.cnf "
731+ MYSQLD_ARGS="--defaults-file=$MYSQLD_VARDIR/my.cnf ${MYSQLD_EXTRA_ARGS}"
732 if [ "`whoami`" = "root" ]
733 then
734 MYSQLD_ARGS="$MYSQLD_ARGS --user=root"
735 fi
736
737- export MYSQL_HOME=$MYSQLD_VARDIR
738-
739- IB_ARGS="--user=root --socket=${MYSQLD_SOCKET} --ibbackup=$XB_BIN"
740- XB_ARGS="--no-defaults"
741+ IB_ARGS="--defaults-file=$MYSQLD_VARDIR/my.cnf --ibbackup=$XB_BIN"
742+ XB_ARGS="--defaults-file=$MYSQLD_VARDIR/my.cnf"
743
744 # Some aliases for compatibility, as tests use the following names
745 topdir="$MYSQLD_VARDIR"
746@@ -265,14 +247,48 @@
747 init_server_variables $id
748 switch_server $id
749
750- init_mysql_dir
751+ if [ ! -d "$MYSQLD_VARDIR" ]
752+ then
753+ vlog "Creating server root directory: $MYSQLD_VARDIR"
754+ mkdir "$MYSQLD_VARDIR"
755+ fi
756+ if [ ! -d "$MYSQLD_TMPDIR" ]
757+ then
758+ vlog "Creating server temporary directory: $MYSQLD_TMPDIR"
759+ mkdir "$MYSQLD_TMPDIR"
760+ fi
761+
762+ # Create the configuration file used by mysql_install_db, the server
763+ # and the xtrabackup binary
764 cat > ${MYSQLD_VARDIR}/my.cnf <<EOF
765 [mysqld]
766+socket=${MYSQLD_SOCKET}
767+port=${MYSQLD_PORT}
768+server-id=$id
769+basedir=${MYSQL_BASEDIR}
770 datadir=${MYSQLD_DATADIR}
771 tmpdir=${MYSQLD_TMPDIR}
772+log-bin=mysql-bin
773+relay-log=mysql-relay-bin
774+pid-file=${MYSQLD_PIDFILE}
775+replicate-ignore-db=mysql
776+${MYSQLD_EXTRA_MY_CNF_OPTS:-}
777+
778+[client]
779+socket=${MYSQLD_SOCKET}
780+user=root
781 EOF
782
783+ # Create datadir and call mysql_install_db if it doesn't exist
784+ if [ ! -d "$MYSQLD_DATADIR" ]
785+ then
786+ vlog "Creating server data directory: $MYSQLD_DATADIR"
787+ mkdir -p "$MYSQLD_DATADIR"
788+ call_mysql_install_db
789+ fi
790+
791 # Start the server
792+ echo "Starting ${MYSQLD} ${MYSQLD_ARGS} $* "
793 ${MYSQLD} ${MYSQLD_ARGS} $* &
794 if ! mysql_ping
795 then
796@@ -301,6 +317,10 @@
797 vlog "Server PID file '${MYSQLD_PIDFILE}' doesn't exist!"
798 fi
799
800+ # Reset XB_ARGS so we can call xtrabackup in tests even without starting the
801+ # server
802+ XB_ARGS="--no-defaults"
803+
804 # unlock the port number
805 free_reserved_port $MYSQLD_PORT
806
807
808=== modified file 'test/inc/ib_part.sh'
809--- test/inc/ib_part.sh 2013-03-07 11:38:14 +0000
810+++ test/inc/ib_part.sh 2013-04-23 06:09:29 +0000
811@@ -2,15 +2,15 @@
812
813 function check_partitioning()
814 {
815- $MYSQL $MYSQL_ARGS -Ns -e "show variables like 'have_partitioning'"
816+ $MYSQL $MYSQL_ARGS -Ns -e "SHOW PLUGINS" 2> /dev/null |
817+ egrep -q "^partition"
818 }
819
820 function require_partitioning()
821 {
822- PARTITION_CHECK=`check_partitioning`
823-
824- if [ -z "$PARTITION_CHECK" ]; then
825- echo "Requires Partitioning." > $SKIPPED_REASON
826+ if ! check_partitioning
827+ then
828+ echo "Requires support for partitioning." > $SKIPPED_REASON
829 exit $SKIPPED_EXIT_CODE
830 fi
831 }
832
833=== modified file 'test/t/bug1062684.sh'
834--- test/t/bug1062684.sh 2013-03-08 04:37:16 +0000
835+++ test/t/bug1062684.sh 2013-04-23 06:09:29 +0000
836@@ -1,11 +1,18 @@
837-MYSQLD_EXTRA_ARGS=--innodb-data-file-path="ibdata1:${DEFAULT_IBDATA_SIZE};ibdata2:5M:autoextend"
838+################################################################################
839+# Bug #1062684: Applying incremental backup using xtrabackup 2.0.3 fails when
840+# innodb_data_file_path = ibdata1:2000M;ibdata2:10M:autoextend is
841+# set in [mysqld]
842+################################################################################
843+
844 . inc/common.sh
845
846-start_server --innodb-data-file-path="ibdata1:${DEFAULT_IBDATA_SIZE};ibdata2:5M:autoextend"
847+MYSQLD_EXTRA_MY_CNF_OPTS="
848+innodb-data-file-path=ibdata1:${DEFAULT_IBDATA_SIZE};ibdata2:5M:autoextend
849+"
850+
851+start_server
852 load_dbase_schema incremental_sample
853
854-echo "innodb-data-file-path=ibdata1:${DEFAULT_IBDATA_SIZE};ibdata2:5M:autoextend" >>$topdir/my.cnf
855-
856 # Adding initial rows
857 vlog "Adding initial rows to database..."
858 ${MYSQL} ${MYSQL_ARGS} -e "insert into test values (1, 1);" incremental_sample
859
860=== modified file 'test/t/bug483827.sh'
861--- test/t/bug483827.sh 2012-06-05 12:35:33 +0000
862+++ test/t/bug483827.sh 2013-04-23 06:09:29 +0000
863@@ -18,10 +18,7 @@
864 modify_args
865
866 # make my_multi.cnf
867-echo "
868-[mysqld1]
869-datadir=${mysql_datadir}
870-tmpdir=$mysql_tmpdir" > $topdir/my_multi.cnf
871+sed -e 's/\[mysqld\]/[mysqld1]/' $topdir/my.cnf > $topdir/my_multi.cnf
872
873 # Backup
874 innobackupex --no-timestamp --defaults-group=mysqld1 $backup_dir
875
876=== modified file 'test/t/bug606981.sh'
877--- test/t/bug606981.sh 2012-06-19 06:00:44 +0000
878+++ test/t/bug606981.sh 2013-04-23 06:09:29 +0000
879@@ -6,12 +6,16 @@
880 exit $SKIPPED_EXIT_CODE
881 fi
882
883-start_server --innodb_file_per_table
884+MYSQLD_EXTRA_MY_CNF_OPTS="
885+innodb_file_per_table=1
886+innodb_flush_method=O_DIRECT
887+"
888+
889+start_server
890
891 load_sakila
892
893 # Take backup
894-echo "innodb_flush_method=O_DIRECT" >> $topdir/my.cnf
895 mkdir -p $topdir/backup
896 innobackupex --stream=tar $topdir/backup > $topdir/backup/out.tar
897 stop_server
898@@ -30,11 +34,11 @@
899 backup_dir=$topdir/backup
900 cd $backup_dir
901 $TAR -ixvf out.tar
902-cd - >/dev/null 2>&1
903-innobackupex --apply-log --defaults-file=$topdir/my.cnf $backup_dir
904+cd - >/dev/null 2>&1
905+innobackupex --apply-log $backup_dir
906 vlog "Restoring MySQL datadir"
907 mkdir -p $mysql_datadir
908-innobackupex --copy-back --defaults-file=$topdir/my.cnf $backup_dir
909+innobackupex --copy-back $backup_dir
910
911 start_server
912 # Check sakila
913
914=== modified file 'test/t/bug740489.sh'
915--- test/t/bug740489.sh 2013-01-07 19:14:19 +0000
916+++ test/t/bug740489.sh 2013-04-23 06:09:29 +0000
917@@ -6,26 +6,34 @@
918 start_server --innodb_file_per_table
919 load_sakila
920
921-run_cmd ${MYSQL} ${MYSQL_ARGS} -e "UPDATE mysql.user SET Password=PASSWORD('password') WHERE User='root'; FLUSH PRIVILEGES;"
922-
923-defaults_extra_file=${TEST_BASEDIR}/740489.cnf
924-
925-echo "[client]" > $defaults_extra_file
926-echo "user=root" >> $defaults_extra_file
927-echo "password=password" >> $defaults_extra_file
928-
929-mkdir -p $topdir/backup
930-cat ${MYSQLD_VARDIR}/my.cnf
931-run_cmd $IB_BIN --defaults-extra-file=$defaults_extra_file --socket=${MYSQLD_SOCKET} --ibbackup=$XB_BIN $topdir/backup
932-backup_dir=`grep "innobackupex: Backup created in directory" $OUTFILE | awk -F\' '{ print $2}'`
933+run_cmd ${MYSQL} ${MYSQL_ARGS} <<EOF
934+SET PASSWORD FOR 'root'@'localhost' = PASSWORD('password');
935+EOF
936+
937+defaults_extra_file=$topdir/740489.cnf
938+
939+cat > $defaults_extra_file <<EOF
940+[mysqld]
941+datadir=${MYSQLD_DATADIR}
942+
943+[client]
944+user=root
945+password=password
946+EOF
947+
948+backup_dir=$topdir/backup
949+run_cmd $IB_BIN \
950+ --defaults-extra-file=$defaults_extra_file --socket=${MYSQLD_SOCKET} \
951+ --ibbackup=$XB_BIN --no-timestamp $backup_dir
952 vlog "Backup created in directory $backup_dir"
953
954-run_cmd ${MYSQL} ${MYSQL_ARGS} --password=password -e "UPDATE mysql.user SET Password=PASSWORD('') WHERE User='root'; FLUSH PRIVILEGES;"
955+run_cmd ${MYSQL} ${MYSQL_ARGS} --password=password <<EOF
956+SET PASSWORD FOR 'root'@'localhost' = PASSWORD('');
957+EOF
958
959 stop_server
960 # Remove datadir
961 rm -r $mysql_datadir
962-#init_mysql_dir
963 # Restore sakila
964 vlog "Applying log"
965 vlog "###########"
966
967=== modified file 'test/t/bug759225.sh'
968--- test/t/bug759225.sh 2012-06-19 06:00:44 +0000
969+++ test/t/bug759225.sh 2013-04-23 06:09:29 +0000
970@@ -16,11 +16,13 @@
971 exit $SKIPPED_EXIT_CODE
972 fi
973
974+MYSQLD_EXTRA_MY_CNF_OPTS="
975+innodb_flush_method=ALL_O_DIRECT
976+"
977 start_server
978 load_sakila
979
980 # Take backup
981-echo "innodb_flush_method=ALL_O_DIRECT" >> $topdir/my.cnf
982 mkdir -p $topdir/backup
983 innobackupex --stream=tar $topdir/backup > $topdir/backup/out.tar
984 stop_server
985@@ -39,11 +41,11 @@
986 backup_dir=$topdir/backup
987 cd $backup_dir
988 $TAR -ixvf out.tar
989-cd - >/dev/null 2>&1
990-innobackupex --apply-log --defaults-file=$topdir/my.cnf $backup_dir
991+cd - >/dev/null 2>&1
992+innobackupex --apply-log $backup_dir
993 vlog "Restoring MySQL datadir"
994 mkdir -p $mysql_datadir
995-innobackupex --copy-back --defaults-file=$topdir/my.cnf $backup_dir
996+innobackupex --copy-back $backup_dir
997
998 start_server
999 # Check sakila
1000
1001=== modified file 'test/t/bug870119.sh'
1002--- test/t/bug870119.sh 2013-03-05 13:07:11 +0000
1003+++ test/t/bug870119.sh 2013-04-23 06:09:29 +0000
1004@@ -4,10 +4,13 @@
1005
1006 . inc/common.sh
1007
1008-start_server --innodb_file_per_table
1009-
1010 # Set the minimum value for innodb_open_files to be used by xtrabackup
1011-echo "innodb_open_files=10" >>$topdir/my.cnf
1012+MYSQLD_EXTRA_MY_CNF_OPTS="
1013+innodb_file_per_table=1
1014+innodb_open_files=10
1015+"
1016+
1017+start_server
1018
1019 load_dbase_schema sakila
1020 load_dbase_data sakila
1021
1022=== modified file 'test/t/bug891496.sh'
1023--- test/t/bug891496.sh 2013-03-08 04:37:16 +0000
1024+++ test/t/bug891496.sh 2013-04-23 06:09:29 +0000
1025@@ -5,13 +5,11 @@
1026
1027 . inc/common.sh
1028
1029-innodb_data_file_path="ibdata1:3M;ibdata2:10M:autoextend"
1030-
1031-start_server --innodb_data_file_path=$innodb_data_file_path
1032-
1033-cat >> $topdir/my.cnf <<EOF
1034-innodb_data_file_path=$innodb_data_file_path
1035-EOF
1036+MYSQLD_EXTRA_MY_CNF_OPTS="
1037+innodb_data_file_path=ibdata1:3M;ibdata2:10M:autoextend
1038+"
1039+
1040+start_server
1041
1042 load_dbase_schema sakila
1043 load_dbase_data sakila
1044@@ -40,6 +38,6 @@
1045 vlog "###########"
1046 innobackupex --copy-back $backup_dir
1047
1048-start_server --innodb_data_file_path=$innodb_data_file_path
1049+start_server
1050 # Check sakila
1051 run_cmd ${MYSQL} ${MYSQL_ARGS} -e "SELECT count(*) from actor" sakila
1052
1053=== modified file 'test/t/bug976945.sh'
1054--- test/t/bug976945.sh 2012-06-18 03:38:41 +0000
1055+++ test/t/bug976945.sh 2013-04-23 06:09:29 +0000
1056@@ -8,8 +8,10 @@
1057 exit $SKIPPED_EXIT_CODE
1058 fi
1059
1060-start_server --innodb_log_block_size=4096
1061-echo innodb_log_block_size=4096 >> ${MYSQLD_VARDIR}/my.cnf
1062+MYSQLD_EXTRA_MY_CNF_OPTS="
1063+innodb_log_block_size=4096
1064+"
1065+start_server
1066 load_sakila
1067
1068 # Full backup
1069
1070=== modified file 'test/t/bug977101.sh'
1071--- test/t/bug977101.sh 2012-06-08 18:46:19 +0000
1072+++ test/t/bug977101.sh 2013-04-23 06:09:29 +0000
1073@@ -17,15 +17,14 @@
1074
1075 # Check that binlog info is correct with --safe-slave-backup
1076 innobackupex --no-timestamp --safe-slave-backup $topdir/backup
1077-egrep -q '^mysql-bin.000001[[:space:]]+[0-9]+[[:space:]]+$' \
1078+egrep -q '^mysql-bin.[0-9]+[[:space:]]+[0-9]+[[:space:]]+$' \
1079 $topdir/backup/xtrabackup_binlog_info
1080
1081 # Check that both binlog info and slave info are correct with
1082 # --safe-slave-backup
1083 rm -rf $topdir/backup
1084 innobackupex --no-timestamp --slave-info --safe-slave-backup $topdir/backup
1085-egrep -q '^mysql-bin.000001[[:space:]]+[0-9]+[[:space:]]+$' \
1086+egrep -q '^mysql-bin.[0-9]+[[:space:]]+[0-9]+[[:space:]]+$' \
1087 $topdir/backup/xtrabackup_binlog_info
1088-egrep -q '^CHANGE MASTER TO MASTER_LOG_FILE='\''mysql-bin.000001'\'', MASTER_LOG_POS=[0-9]+$' \
1089+egrep -q '^CHANGE MASTER TO MASTER_LOG_FILE='\''mysql-bin.[0-9]+'\'', MASTER_LOG_POS=[0-9]+$' \
1090 $topdir/backup/xtrabackup_slave_info
1091-
1092
1093=== modified file 'test/t/ib_doublewrite.sh'
1094--- test/t/ib_doublewrite.sh 2012-11-15 15:27:58 +0000
1095+++ test/t/ib_doublewrite.sh 2013-04-23 06:09:29 +0000
1096@@ -15,7 +15,12 @@
1097 fi
1098
1099 DBLWR=dblwr.ibd
1100-start_server --innodb_file_per_table --innodb_doublewrite_file=${DBLWR}
1101+
1102+MYSQLD_EXTRA_MY_CNF_OPTS="
1103+innodb_file_per_table=1
1104+innodb_doublewrite_file=$DBLWR
1105+"
1106+start_server
1107 load_dbase_schema incremental_sample
1108
1109 # Workaround for bug #1072695
1110@@ -25,8 +30,6 @@
1111 run_cmd $IB_BIN $IB_ARGS_NO_DEFAULTS_FILE $*
1112 }
1113
1114-echo "innodb_doublewrite_file=${DBLWR}" >>$topdir/my.cnf
1115-
1116 # Adding initial rows
1117 vlog "Adding initial rows to database..."
1118 ${MYSQL} ${MYSQL_ARGS} -e "insert into test values (1, 1);" incremental_sample
1119
1120=== modified file 'test/t/ib_slave_info.sh'
1121--- test/t/ib_slave_info.sh 2012-06-05 12:35:33 +0000
1122+++ test/t/ib_slave_info.sh 2013-04-23 06:09:29 +0000
1123@@ -30,7 +30,7 @@
1124 $topdir/backup
1125
1126 innobackupex --no-timestamp --slave-info $topdir/backup
1127-egrep -q '^mysql-bin.000001[[:space:]]+[0-9]+[[:space:]]+$' \
1128+egrep -q '^mysql-bin.[0-9]+[[:space:]]+[0-9]+[[:space:]]+$' \
1129 $topdir/backup/xtrabackup_binlog_info
1130-egrep -q '^CHANGE MASTER TO MASTER_LOG_FILE='\''mysql-bin.000001'\'', MASTER_LOG_POS=[0-9]+$' \
1131+egrep -q '^CHANGE MASTER TO MASTER_LOG_FILE='\''mysql-bin.[0-9]+'\'', MASTER_LOG_POS=[0-9]+$' \
1132 $topdir/backup/xtrabackup_slave_info
1133
1134=== added file 'test/t/undo_tablespaces.sh'
1135--- test/t/undo_tablespaces.sh 1970-01-01 00:00:00 +0000
1136+++ test/t/undo_tablespaces.sh 2013-04-23 06:09:29 +0000
1137@@ -0,0 +1,75 @@
1138+########################################################################
1139+# Test support for separate UNDO tablespace
1140+########################################################################
1141+
1142+. inc/common.sh
1143+
1144+if [ ${MYSQL_VERSION:0:3} != "5.6" ]
1145+then
1146+ echo "Requires a 5.6 server" > $SKIPPED_REASON
1147+ exit $SKIPPED_EXIT_CODE
1148+fi
1149+
1150+################################################################################
1151+# Start an uncommitted transaction pause "indefinitely" to keep the connection
1152+# open
1153+################################################################################
1154+function start_uncomitted_transaction()
1155+{
1156+ run_cmd $MYSQL $MYSQL_ARGS sakila <<EOF
1157+START TRANSACTION;
1158+DELETE FROM payment;
1159+SELECT SLEEP(10000);
1160+EOF
1161+}
1162+
1163+undo_directory=$TEST_BASEDIR/var1/undo_dir
1164+
1165+MYSQLD_EXTRA_MY_CNF_OPTS="
1166+innodb_file_per_table=1
1167+innodb_undo_directory=$undo_directory
1168+innodb_undo_tablespaces=4
1169+"
1170+
1171+start_server
1172+load_sakila
1173+
1174+checksum1=`checksum_table sakila payment`
1175+test -n "$checksum1" || die "Failed to checksum table sakila.payment"
1176+
1177+# Start a transaction, modify some data and keep it uncommitted for the backup
1178+# stage. InnoDB avoids using the rollback segment in the system tablespace, if
1179+# separate undo tablespaces are used, so the test would fail if we did not
1180+# handle separate undo tablespaces correctly.
1181+start_uncomitted_transaction &
1182+job_master=$!
1183+
1184+innobackupex --no-timestamp $topdir/backup
1185+
1186+kill -SIGKILL $job_master
1187+stop_server
1188+
1189+rm -rf $MYSQLD_DATADIR/*
1190+rm -rf $undo_directory/*
1191+
1192+innobackupex --apply-log $topdir/backup
1193+
1194+innobackupex --copy-back $topdir/backup
1195+
1196+
1197+
1198+start_server
1199+
1200+# Check that the uncommitted transaction has been rolled back
1201+
1202+checksum2=`checksum_table sakila payment`
1203+test -n "$checksum2" || die "Failed to checksum table sakila.payment"
1204+
1205+vlog "Old checksum: $checksum1"
1206+vlog "New checksum: $checksum2"
1207+
1208+if [ "$checksum1" != "$checksum2" ]
1209+then
1210+ vlog "Checksums do not match"
1211+ exit -1
1212+fi
1213
1214=== modified file 'test/t/xb_basic.sh'
1215--- test/t/xb_basic.sh 2012-10-15 16:14:59 +0000
1216+++ test/t/xb_basic.sh 2013-04-23 06:09:29 +0000
1217@@ -13,7 +13,6 @@
1218 stop_server
1219 # Remove datadir
1220 rm -r $mysql_datadir
1221-#init_mysql_dir
1222 # Restore sakila
1223 vlog "Applying log"
1224 vlog "###########"
1225
1226=== modified file 'test/t/xb_version.sh'
1227--- test/t/xb_version.sh 2011-06-14 14:34:23 +0000
1228+++ test/t/xb_version.sh 2013-04-23 06:09:29 +0000
1229@@ -1,4 +1,3 @@
1230 . inc/common.sh
1231
1232 xtrabackup --version
1233-
1234
1235=== modified file 'test/testrun.sh'
1236--- test/testrun.sh 2013-03-13 05:05:16 +0000
1237+++ test/testrun.sh 2013-04-23 06:09:29 +0000
1238@@ -176,7 +176,7 @@
1239 then
1240 INNODB_FLAVOR="XtraDB"
1241 else
1242- INNODB_FLAVOR="innoDB"
1243+ INNODB_FLAVOR="InnoDB"
1244 fi
1245
1246 if [ "$XB_BUILD" = "autodetect" ]

Subscribers

People subscribed via source and target branches