Merge lp:~akopytov/percona-xtrabackup/support-remote-tablespaces-2.0 into lp:percona-xtrabackup/2.0

Proposed by Alexey Kopytov on 2013-04-23
Status: Merged
Approved by: Laurynas Biveinis on 2013-04-26
Approved revision: 535
Merged at revision: 545
Proposed branch: lp:~akopytov/percona-xtrabackup/support-remote-tablespaces-2.0
Merge into: lp:percona-xtrabackup/2.0
Prerequisite: lp:~akopytov/percona-xtrabackup/bug1169169-2.0
Diff against target: 1849 lines (+769/-195)
23 files modified
innobackupex (+68/-14)
patches/innodb56.patch (+293/-38)
src/xtrabackup.cc (+147/-51)
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_part_include.sh (+2/-2)
test/t/ib_part_tf_innodb.sh (+2/-2)
test/t/ib_slave_info.sh (+2/-2)
test/t/remote_tablespaces.sh (+53/-0)
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/support-remote-tablespaces-2.0
Reviewer Review Type Date Requested Status
Laurynas Biveinis 2013-04-23 Approve on 2013-04-26
Review via email: mp+160315@code.launchpad.net

Description of the change

    Implementation of
    https://blueprints.launchpad.net/percona-xtrabackup/+spec/support-remote-tablespaces

    On backup, copy both .isl and .ibd files for remote tablespaces. Remote
    .ibd files are copied to the corresponding database directory under the
    backup root directory as if there were local tablespaces.

    On prepare, ignore .isl files and possible inconsistencies of tablespace
    locations with the data dictionary, i.e. handle all tablespaces as local
    ones.

    On restore, innobackupex checks if there's an .isl file corresponding to
    the .ibd file being copied. If so, it uses the original remote
    tablespace location instead of the default location under the data
    directory.

    Changes in the ib_part_* tests are necessery to support 2 additional SYS_*
    tables in the data dictionary (SYS_TABLESPACES and SYS_DATAFILES). To
    avoid dependency on the number of SYS_* tables, they are now excluded
    from the 'xtrabackup --stats' output, i.e. only user tables are counted.

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

To post a comment you must log in.

I assume rev 534 is not a part of this MP, and only reviewed rev 535.

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 10:01:01 +0000
4@@ -230,6 +230,7 @@
5 my $copy_dir_dst;
6 my $copy_dir_exclude_regexp;
7 my $copy_dir_overwrite;
8+my $copy_dir_resolve_isl;
9
10 ######################################################################
11 # program execution begins here
12@@ -618,11 +619,31 @@
13 #
14 sub process_file {
15 my $process_func = shift;
16+ my $dst_path;
17
18 if (/$copy_dir_exclude_regexp/) {
19 return;
20 }
21- (my $dst_path = $File::Find::name) =~ s/^$copy_dir_src/$copy_dir_dst/;
22+
23+ # If requested, check if there is a "link" in the .isl file for an InnoDB
24+ # tablespace and use it as a destination path.
25+ if ($copy_dir_resolve_isl && $File::Find::name =~ m/\.ibd$/) {
26+ my $isl_path;
27+
28+ ($isl_path = $File::Find::name) =~ s/\.ibd$/.isl/;
29+ if (-e "$isl_path") {
30+ my @lines;
31+ print STDERR "Found an .isl file for $File::Find::name\n";
32+ file_to_array($isl_path, \@lines);
33+ $dst_path = $lines[0];
34+ print STDERR "Using $dst_path as the destination path\n";
35+ }
36+ }
37+
38+ if (! defined $dst_path) {
39+ ($dst_path = $File::Find::name) =~ s/^$copy_dir_src/$copy_dir_dst/;
40+ }
41+
42 if (-d "$File::Find::name") {
43 # Create the directory in the destination if necessary
44 if (! -e "$dst_path") {
45@@ -657,14 +678,16 @@
46 }
47
48 #
49-# copy_dir_recursively subroutine does a recursive copy of a specified
50-# directory excluding files matching a specifies regexp. If $overwrite
51-# is 1, it overwrites the existing files.
52+# copy_dir_recursively subroutine does a recursive copy of a specified directory
53+# excluding files matching a specifies regexp. If $overwrite is 1, it overwrites
54+# the existing files. If $resolve_isl is 1, it also resolves InnoDB .isl files,
55+# i.e. copies to the absolute path specified in the corresponding .isl file
56+# rather than the default location
57 #
58 # SYNOPSIS
59 #
60 # copy_dir_recursively($src_dir, $dst_dir, $exclude_regexp,
61-# $overwrite);
62+# $overwrite, $resolve_isl);
63 #
64 # TODO
65 #
66@@ -676,6 +699,7 @@
67 $copy_dir_dst = File::Spec->canonpath(shift);
68 $copy_dir_exclude_regexp = shift;
69 $copy_dir_overwrite = shift;
70+ $copy_dir_resolve_isl = shift;
71
72 find(\&copy_file_callback, $copy_dir_src);
73 }
74@@ -686,7 +710,7 @@
75 # SYNOPSIS
76 #
77 # move_dir_recursively($src_dir, $dst_dir, $exclude_regexp,
78-# $overwrite);
79+# $overwrite, $resolve_isl);
80 #
81 # TODO
82 #
83@@ -698,6 +722,7 @@
84 $copy_dir_dst = File::Spec->canonpath(shift);
85 $copy_dir_exclude_regexp = shift;
86 $copy_dir_overwrite = shift;
87+ $copy_dir_resolve_isl = shift;
88
89 find(\&move_file_callback, $copy_dir_src);
90 }
91@@ -715,12 +740,15 @@
92 get_option(\%config, $option_defaults_group, 'innodb_data_file_path');
93 my $orig_iblog_dir =
94 get_option(\%config, $option_defaults_group, 'innodb_log_group_home_dir');
95+ my $orig_undo_dir = $orig_ibdata_dir;
96 my $iblog_files = 'ib_logfile.*';
97+ my $ibundo_files = 'undo[0-9]{3}';
98 my $excluded_files =
99 '\.\.?|backup-my\.cnf|xtrabackup_logfile|' .
100- 'xtrabackup_binary|xtrabackup_binlog_info|xtrabackup_checkpoints|' .
101+ 'xtrabackup_binary|xtrabackup_binlog_info|xtrabackup_checkpoints|' .
102 '.*\.qp|' .
103- $iblog_files;
104+ $iblog_files . '|'.
105+ $ibundo_files;
106 my $compressed_data_file = '.*\.ibz$';
107 my $file;
108 my $backup_innodb_data_file_path;
109@@ -732,6 +760,10 @@
110 $excluded_files = $excluded_files . '|' . $doublewrite_file;
111 }
112
113+ if (has_option(\%config, $option_defaults_group, 'innodb_undo_directory')) {
114+ $orig_undo_dir = get_option(\%config, $option_defaults_group,
115+ 'innodb_undo_directory');
116+ }
117 # check whether files should be copied or moved to dest directory
118 my $move_or_copy_file = $move_flag ? \&move_file : \&copy_file;
119 my $move_or_copy_dir = $move_flag ?
120@@ -743,6 +775,10 @@
121 if_directory_exists_and_empty($orig_datadir, "Original data");
122 if_directory_exists_and_empty($orig_ibdata_dir, "Original InnoDB data");
123 if_directory_exists_and_empty($orig_iblog_dir, "Original InnoDB log");
124+ if ($orig_undo_dir) {
125+ if_directory_exists_and_empty($orig_undo_dir,
126+ "Original undo directory");
127+ }
128
129 # check that the original options file and the backup options file have
130 # the same value for "innodb_data_file_path" option
131@@ -786,7 +822,7 @@
132 my $excluded_regexp = '^(' . $excluded_files . ')$';
133 print STDERR "$prefix Starting to $operation files in '$backup_dir'\n";
134 print STDERR "$prefix back to original data directory '$orig_datadir'\n";
135- &$move_or_copy_dir($backup_dir, $orig_datadir, $excluded_regexp, 0);
136+ &$move_or_copy_dir($backup_dir, $orig_datadir, $excluded_regexp, 0, 1);
137
138 # copy InnoDB data files to original InnoDB data directory
139 print STDERR "\n$prefix Starting to $operation InnoDB system tablespace\n";
140@@ -801,6 +837,22 @@
141 &$move_or_copy_file($src_name, $dst_name);
142 }
143
144+ # copy InnoDB undo tablespaces to innodb_undo_directory (if specified), or
145+ # to the InnoDB data directory
146+ print STDERR "\n$prefix Starting to $operation InnoDB undo tablespaces\n";
147+ print STDERR "$prefix in '$backup_dir'\n";
148+ print STDERR "$prefix back to '$orig_undo_dir'\n";
149+ opendir(DIR, $backup_dir)
150+ || Die "Can't open directory '$backup_dir': $!\n";
151+ while (defined($file = readdir(DIR))) {
152+ if ($file =~ /^$ibundo_files$/ && -f "$backup_dir/$file") {
153+ $src_name = escape_path("$backup_dir/$file");
154+ $dst_name = escape_path("$orig_undo_dir");
155+ &$move_or_copy_file($src_name, $dst_name);
156+ }
157+ }
158+ closedir(DIR);
159+
160 # copy InnoDB log files to original InnoDB log directory
161 opendir(DIR, $backup_dir)
162 || Die "Can't open directory '$backup_dir': $!\n";
163@@ -897,7 +949,7 @@
164 copy_dir_recursively($option_incremental_dir, $backup_dir,
165 '^(\.\.?|backup-my\.cnf|xtrabackup_logfile|' .
166 'xtrabackup_binary|xtrabackup_checkpoints|' .
167- '.*\.delta|.*\.meta|ib_logfile.*)$', 1);
168+ '.*\.delta|.*\.meta|ib_logfile.*)$', 1, 0);
169 # If the latest backup has no file, we need to remove the old
170 # xtrabackup_slave_info file, because it is out of date
171 # TODO: this will not be needed when bug #856400 is fixed.
172@@ -1810,7 +1862,9 @@
173 "innodb_log_file_size",
174 "innodb_fast_checksum",
175 "innodb_page_size",
176- "innodb_log_block_size"
177+ "innodb_log_block_size",
178+ "innodb_undo_directory",
179+ "innodb_undo_tablespaces"
180 );
181
182 my $options_dump = "# This MySQL options file was generated by $innobackup_script.\n\n" .
183@@ -2105,7 +2159,7 @@
184
185
186 #
187-# backup_files subroutine copies .frm, .MRG, .MYD and .MYI files to
188+# backup_files subroutine copies .frm, .isl, .MRG, .MYD and .MYI files to
189 # backup directory.
190 #
191 sub backup_files {
192@@ -2114,7 +2168,7 @@
193 my @list;
194 my $file;
195 my $database;
196- my $wildcard = '*.{frm,MYD,MYI,MAD,MAI,MRG,TRG,TRN,ARM,ARZ,CSM,CSV,opt,par}';
197+ my $wildcard = '*.{frm,isl,MYD,MYI,MAD,MAI,MRG,TRG,TRN,ARM,ARZ,CSM,CSV,opt,par}';
198 my $rsync_file_list;
199 my $operation;
200 my $rsync_tmpfile_pass1 = "$option_tmpdir/xtrabackup_rsyncfiles_pass1";
201@@ -2172,7 +2226,7 @@
202
203 # copy files of this database
204 opendir(DBDIR, "$source_dir/$database");
205- @list = grep(/\.(frm|MYD|MYI|MAD|MAI|MRG|TRG|TRN|ARM|ARZ|CSM|CSV|opt|par)$/, readdir(DBDIR));
206+ @list = grep(/\.(frm|isl|MYD|MYI|MAD|MAI|MRG|TRG|TRN|ARM|ARZ|CSM|CSV|opt|par)$/, readdir(DBDIR));
207 closedir DBDIR;
208 $file_c = @list;
209 if ($file_c <= $backup_file_print_limit) {
210
211=== modified file 'patches/innodb56.patch'
212--- patches/innodb56.patch 2013-04-09 13:44:38 +0000
213+++ patches/innodb56.patch 2013-04-23 10:01:01 +0000
214@@ -47,16 +47,19 @@
215 #include "trx0sys.h"
216 #include "row0mysql.h"
217 #ifndef UNIV_HOTBACKUP
218-@@ -311,7 +313,7 @@
219+@@ -311,10 +313,7 @@
220
221 /** The tablespace memory cache. This variable is NULL before the module is
222 initialized. */
223 -static fil_system_t* fil_system = NULL;
224+-
225+-/** Determine if (i) is a user tablespace id or not. */
226+-# define fil_is_user_tablespace_id(i) ((i) > srv_undo_tablespaces_open)
227 +fil_system_t* fil_system = NULL;
228
229- /** Determine if (i) is a user tablespace id or not. */
230- # define fil_is_user_tablespace_id(i) ((i) > srv_undo_tablespaces_open)
231-@@ -376,7 +378,7 @@
232+ /** Determine if user has explicitly disabled fsync(). */
233+ #ifndef __WIN__
234+@@ -376,7 +375,7 @@
235 off the LRU list if it is in the LRU list. The caller must hold the fil_sys
236 mutex. */
237 static
238@@ -65,7 +68,7 @@
239 fil_node_prepare_for_io(
240 /*====================*/
241 fil_node_t* node, /*!< in: file node */
242-@@ -691,7 +693,7 @@
243+@@ -691,7 +690,7 @@
244 Opens a file of a node of a tablespace. The caller must own the fil_system
245 mutex. */
246 static
247@@ -74,7 +77,7 @@
248 fil_node_open_file(
249 /*===============*/
250 fil_node_t* node, /*!< in: file node */
251-@@ -725,6 +727,18 @@
252+@@ -725,6 +724,18 @@
253 OS_FILE_READ_ONLY, &success);
254 if (!success) {
255 /* The following call prints an error message */
256@@ -93,7 +96,7 @@
257 os_file_get_last_error(true);
258
259 ut_print_timestamp(stderr);
260-@@ -783,12 +797,17 @@
261+@@ -783,12 +794,17 @@
262
263 if (UNIV_UNLIKELY(space_id != space->id)) {
264 fprintf(stderr,
265@@ -114,7 +117,7 @@
266 }
267
268 if (UNIV_UNLIKELY(space_id == ULINT_UNDEFINED
269-@@ -825,8 +844,9 @@
270+@@ -825,8 +841,9 @@
271 }
272
273 if (size_bytes >= 1024 * 1024) {
274@@ -126,7 +129,7 @@
275 }
276
277 if (!fsp_flags_is_compressed(flags)) {
278-@@ -879,6 +899,8 @@
279+@@ -879,6 +896,8 @@
280 /* Put the node to the LRU list */
281 UT_LIST_ADD_FIRST(LRU, system->LRU, node);
282 }
283@@ -135,7 +138,7 @@
284 }
285
286 /**********************************************************************//**
287-@@ -1491,7 +1513,12 @@
288+@@ -1491,7 +1510,12 @@
289 the file yet; the following calls will open it and update the
290 size fields */
291
292@@ -149,7 +152,7 @@
293 fil_node_complete_io(node, fil_system, OS_FILE_READ);
294 }
295
296-@@ -2095,7 +2122,7 @@
297+@@ -2095,7 +2119,7 @@
298 mem_free(path);
299 }
300
301@@ -158,7 +161,7 @@
302 /********************************************************//**
303 Writes a log record about an .ibd file create/rename/delete. */
304 static
305-@@ -2329,7 +2356,7 @@
306+@@ -2329,7 +2353,7 @@
307 space_id, name, path, flags,
308 DICT_TF2_USE_TABLESPACE,
309 FIL_IBD_FILE_INITIAL_SIZE) != DB_SUCCESS) {
310@@ -167,7 +170,7 @@
311 }
312 }
313
314-@@ -2687,7 +2714,7 @@
315+@@ -2687,7 +2711,7 @@
316 }
317
318 if (err == DB_SUCCESS) {
319@@ -176,7 +179,7 @@
320 /* Write a log record about the deletion of the .ibd
321 file, so that ibbackup can replay it in the
322 --apply-log phase. We use a dummy mtr and the familiar
323-@@ -3042,7 +3069,7 @@
324+@@ -3042,7 +3066,7 @@
325
326 mutex_exit(&fil_system->mutex);
327
328@@ -185,7 +188,7 @@
329 if (success && !recv_recovery_on) {
330 mtr_t mtr;
331
332-@@ -3426,7 +3453,7 @@
333+@@ -3426,7 +3450,7 @@
334 goto error_exit_1;
335 }
336
337@@ -194,7 +197,7 @@
338 {
339 mtr_t mtr;
340 ulint mlog_file_flag = 0;
341-@@ -3504,6 +3531,97 @@
342+@@ -3504,6 +3528,97 @@
343 #endif /* UNIV_LOG_ARCHIVE */
344 };
345
346@@ -292,7 +295,25 @@
347 /********************************************************************//**
348 Tries to open a single-table tablespace and optionally checks that the
349 space id in it is correct. If this does not succeed, print an error message
350-@@ -3712,11 +3830,15 @@
351+@@ -3569,6 +3684,9 @@
352+ in the default location. If it is remote, it should not be here. */
353+ def.filepath = fil_make_ibd_name(tablename, false);
354+
355++ /* We skip SYS_DATAFILES validation and remote tablespaces discovery for
356++ XtraBackup, as all tablespaces are local for XtraBackup recovery. */
357++#if 0
358+ /* The path_in was read from SYS_DATAFILES. */
359+ if (path_in) {
360+ if (strcmp(def.filepath, path_in)) {
361+@@ -3616,6 +3734,7 @@
362+ tablespaces_found++;
363+ }
364+ }
365++#endif
366+
367+ /* Always look for a file at the default location. */
368+ ut_a(def.filepath);
369+@@ -3712,11 +3831,15 @@
370 /* The following call prints an error message */
371 os_file_get_last_error(true);
372
373@@ -309,7 +330,25 @@
374
375 err = DB_CORRUPTION;
376
377-@@ -4135,7 +4257,7 @@
378+@@ -4018,6 +4141,9 @@
379+ # endif /* !UNIV_HOTBACKUP */
380+ #endif
381+
382++ /* Ignore .isl files on XtraBackup recovery. All tablespaces must be
383++ local. */
384++ if (!recv_recovery_on) {
385+ /* Check for a link file which locates a remote tablespace. */
386+ remote.success = fil_open_linked_file(
387+ tablename, &remote.filepath, &remote.file);
388+@@ -4030,6 +4156,7 @@
389+ mem_free(remote.filepath);
390+ }
391+ }
392++ }
393+
394+
395+ /* Try to open the tablespace in the datadir. */
396+@@ -4135,7 +4262,7 @@
397 cannot be ok. */
398 ulong minimum_size = FIL_IBD_FILE_INITIAL_SIZE * UNIV_PAGE_SIZE;
399 if (size < minimum_size) {
400@@ -318,7 +357,7 @@
401 ib_logf(IB_LOG_LEVEL_ERROR,
402 "The size of single-table tablespace file %s "
403 "is only " UINT64PF ", should be at least %lu!",
404-@@ -4263,7 +4385,7 @@
405+@@ -4263,7 +4390,7 @@
406 idea is to read as much good data as we can and jump over bad data.
407 @return 0 if ok, -1 if error even after the retries, 1 if at the end
408 of the directory */
409@@ -327,7 +366,7 @@
410 int
411 fil_file_readdir_next_file(
412 /*=======================*/
413-@@ -4359,7 +4481,9 @@
414+@@ -4359,7 +4486,9 @@
415 "%s/%s", fil_path_to_mysql_datadir, dbinfo.name);
416 srv_normalize_path_for_win(dbpath);
417
418@@ -338,7 +377,23 @@
419
420 if (dbdir != NULL) {
421
422-@@ -4538,6 +4662,7 @@
423+@@ -4380,9 +4509,13 @@
424+ && (0 == strcmp(fileinfo.name
425+ + strlen(fileinfo.name) - 4,
426+ ".ibd")
427+- || 0 == strcmp(fileinfo.name
428++ /* Ignore .isl files on XtraBackup
429++ recovery, all tablespaces must be
430++ local. */
431++ || (!recv_recovery_on &&
432++ 0 == strcmp(fileinfo.name
433+ + strlen(fileinfo.name) - 4,
434+- ".isl"))) {
435++ ".isl")))) {
436+ /* The name ends in .ibd or .isl;
437+ try opening the file */
438+ fil_load_single_table_tablespace(
439+@@ -4538,6 +4671,7 @@
440 {
441 fil_space_t* fnamespace;
442 fil_space_t* space;
443@@ -346,7 +401,7 @@
444
445 ut_ad(fil_system);
446
447-@@ -4615,6 +4740,10 @@
448+@@ -4615,6 +4749,10 @@
449 if (fnamespace == NULL) {
450 if (print_error_if_does_not_exist) {
451 fil_report_missing_tablespace(name, id);
452@@ -357,7 +412,7 @@
453 }
454 } else {
455 ut_print_timestamp(stderr);
456-@@ -4638,6 +4767,10 @@
457+@@ -4638,6 +4776,10 @@
458
459 mutex_exit(&fil_system->mutex);
460
461@@ -368,7 +423,7 @@
462 return(FALSE);
463 }
464
465-@@ -4728,6 +4861,7 @@
466+@@ -4728,6 +4870,7 @@
467 ulint page_size;
468 ulint pages_added;
469 ibool success;
470@@ -376,7 +431,7 @@
471
472 ut_ad(!srv_read_only_mode);
473
474-@@ -4772,13 +4906,17 @@
475+@@ -4772,13 +4915,17 @@
476 goto retry;
477 }
478
479@@ -395,7 +450,7 @@
480 start_page_no = space->size;
481 file_start_page_no = space->size - node->size;
482
483-@@ -5024,7 +5162,7 @@
484+@@ -5024,7 +5171,7 @@
485 off the LRU list if it is in the LRU list. The caller must hold the fil_sys
486 mutex. */
487 static
488@@ -404,7 +459,7 @@
489 fil_node_prepare_for_io(
490 /*====================*/
491 fil_node_t* node, /*!< in: file node */
492-@@ -5044,9 +5182,12 @@
493+@@ -5044,9 +5191,12 @@
494 }
495
496 if (node->open == FALSE) {
497@@ -418,7 +473,7 @@
498 }
499
500 if (node->n_pending == 0 && fil_space_belongs_in_lru(space)) {
501-@@ -5058,6 +5199,8 @@
502+@@ -5058,6 +5208,8 @@
503 }
504
505 node->n_pending++;
506@@ -427,7 +482,7 @@
507 }
508
509 /********************************************************************//**
510-@@ -5259,6 +5402,16 @@
511+@@ -5259,6 +5411,16 @@
512
513 ut_ad(mode != OS_AIO_IBUF || space->purpose == FIL_TABLESPACE);
514
515@@ -444,7 +499,7 @@
516 node = UT_LIST_GET_FIRST(space->chain);
517
518 for (;;) {
519-@@ -5290,7 +5443,11 @@
520+@@ -5290,7 +5452,11 @@
521 }
522
523 /* Open file if closed */
524@@ -457,7 +512,7 @@
525
526 /* Check that at least the start offset is within the bounds of a
527 single-table tablespace, including rollback tablespaces. */
528-@@ -6164,6 +6321,7 @@
529+@@ -6164,6 +6330,7 @@
530 return(err);
531 }
532
533@@ -465,7 +520,7 @@
534 /****************************************************************//**
535 Generate redo logs for swapping two .ibd files */
536 UNIV_INTERN
537-@@ -6187,4 +6345,4 @@
538+@@ -6187,4 +6354,4 @@
539 0, 0, new_name, old_name, &mtr);
540 mtr_commit(&mtr);
541 }
542@@ -482,6 +537,107 @@
543
544 if (thd && thd_sql_command(thd) == SQLCOM_DROP_TABLE) {
545
546+@@ -2423,43 +2423,19 @@
547+ ulint buflen, /*!< in: length of buf, in bytes */
548+ const char* id, /*!< in: identifier to convert */
549+ ulint idlen, /*!< in: length of id, in bytes */
550+- THD* thd, /*!< in: MySQL connection thread, or NULL */
551+- ibool file_id)/*!< in: TRUE=id is a table or database name;
552++ THD* thd __attribute__((unused)),
553++ /*!< in: MySQL connection thread, or NULL */
554++ ibool file_id __attribute__((unused)))
555++ /*!< in: TRUE=id is a table or database name;
556+ FALSE=id is an UTF-8 string */
557+ {
558+- char nz[NAME_LEN + 1];
559+- char nz2[NAME_LEN + 1 + EXPLAIN_FILENAME_MAX_EXTRA_LENGTH];
560+-
561+ const char* s = id;
562+ int q;
563+
564+- if (file_id) {
565+- /* Decode the table name. The MySQL function expects
566+- a NUL-terminated string. The input and output strings
567+- buffers must not be shared. */
568+-
569+- if (UNIV_UNLIKELY(idlen > (sizeof nz) - 1)) {
570+- idlen = (sizeof nz) - 1;
571+- }
572+-
573+- memcpy(nz, id, idlen);
574+- nz[idlen] = 0;
575+-
576+- s = nz2;
577+- idlen = explain_filename(thd, nz, nz2, sizeof nz2,
578+- EXPLAIN_PARTITIONS_AS_COMMENT);
579+- goto no_quote;
580+- }
581+-
582+ /* See if the identifier needs to be quoted. */
583+- if (UNIV_UNLIKELY(!thd)) {
584+- q = '"';
585+- } else {
586+- q = get_quote_char_for_identifier(thd, s, (int) idlen);
587+- }
588++ q = '"';
589+
590+ if (q == EOF) {
591+-no_quote:
592+ if (UNIV_UNLIKELY(idlen > buflen)) {
593+ idlen = buflen;
594+ }
595+@@ -16642,45 +16618,21 @@
596+ void
597+ ib_logf(
598+ /*====*/
599+- ib_log_level_t level, /*!< in: warning level */
600++ ib_log_level_t level __attribute__((unused)),
601++ /*!< in: warning level */
602+ const char* format, /*!< printf format */
603+ ...) /*!< Args */
604+ {
605+- char* str;
606+ va_list args;
607+
608+ va_start(args, format);
609+
610+-#ifdef __WIN__
611+- int size = _vscprintf(format, args) + 1;
612+- str = static_cast<char*>(malloc(size));
613+- str[size - 1] = 0x0;
614+- vsnprintf(str, size, format, args);
615+-#elif HAVE_VASPRINTF
616+- (void) vasprintf(&str, format, args);
617+-#else
618+- /* Use a fixed length string. */
619+- str = static_cast<char*>(malloc(BUFSIZ));
620+- my_vsnprintf(str, BUFSIZ, format, args);
621+-#endif /* __WIN__ */
622+-
623+- switch(level) {
624+- case IB_LOG_LEVEL_INFO:
625+- sql_print_information("InnoDB: %s", str);
626+- break;
627+- case IB_LOG_LEVEL_WARN:
628+- sql_print_warning("InnoDB: %s", str);
629+- break;
630+- case IB_LOG_LEVEL_ERROR:
631+- sql_print_error("InnoDB: %s", str);
632+- break;
633+- case IB_LOG_LEVEL_FATAL:
634+- sql_print_error("InnoDB: %s", str);
635+- break;
636+- }
637++ /* Don't use server logger for XtraBackup, just print to stderr. */
638++ vfprintf(stderr, format, args);
639+
640+ va_end(args);
641+- free(str);
642++
643++ fputc('\n', stderr);
644+
645+ if (level == IB_LOG_LEVEL_FATAL) {
646+ ut_error;
647 --- a/storage/innobase/include/srv0srv.h
648 +++ b/storage/innobase/include/srv0srv.h
649 @@ -353,6 +353,9 @@
650@@ -676,7 +832,60 @@
651 dberr_t
652 open_or_create_data_files(
653 /*======================*/
654-@@ -2065,11 +2065,13 @@
655+@@ -1204,12 +1204,16 @@
656+ /********************************************************************
657+ Opens the configured number of undo tablespaces.
658+ @return DB_SUCCESS or error code */
659+-static
660++UNIV_INTERN
661+ dberr_t
662+ srv_undo_tablespaces_init(
663+ /*======================*/
664+ ibool create_new_db, /*!< in: TRUE if new db being
665+ created */
666++ ibool backup_mode, /*!< in: TRUE disables reading
667++ the system tablespace (used in
668++ XtraBackup), FALSE is passed on
669++ recovery. */
670+ const ulint n_conf_tablespaces, /*!< in: configured undo
671+ tablespaces */
672+ ulint* n_opened) /*!< out: number of UNDO
673+@@ -1225,6 +1229,7 @@
674+ *n_opened = 0;
675+
676+ ut_a(n_conf_tablespaces <= TRX_SYS_N_RSEGS);
677++ ut_a(!create_new_db || !backup_mode);
678+
679+ memset(undo_tablespace_ids, 0x0, sizeof(undo_tablespace_ids));
680+
681+@@ -1258,12 +1263,13 @@
682+ }
683+ }
684+
685+- /* Get the tablespace ids of all the undo segments excluding
686+- the system tablespace (0). If we are creating a new instance then
687++ /* Get the tablespace ids of all the undo segments excluding the system
688++ tablespace (0). If we are creating a new instance then
689+ we build the undo_tablespace_ids ourselves since they don't
690+- already exist. */
691++ already exist. If we are in the backup mode, don't read the trx header,
692++ we just need to add all available undo tablespaces to fil_system. */
693+
694+- if (!create_new_db) {
695++ if (!create_new_db && !backup_mode) {
696+ n_undo_tablespaces = trx_rseg_get_n_undo_tablespaces(
697+ undo_tablespace_ids);
698+ } else {
699+@@ -1369,7 +1375,7 @@
700+ ib_logf(IB_LOG_LEVEL_INFO, "Opened %lu undo tablespaces",
701+ n_undo_tablespaces);
702+
703+- if (n_conf_tablespaces == 0) {
704++ if (n_conf_tablespaces == 0 && !backup_mode) {
705+ ib_logf(IB_LOG_LEVEL_WARN,
706+ "Using the system tablespace for all UNDO "
707+ "logging because innodb_undo_tablespaces=0");
708+@@ -2065,11 +2071,13 @@
709 max_flushed_lsn = min_flushed_lsn
710 = log_get_lsn();
711 goto files_checked;
712@@ -690,7 +899,15 @@
713 }
714
715 /* opened all files */
716-@@ -2326,6 +2328,10 @@
717+@@ -2162,6 +2170,7 @@
718+
719+ err = srv_undo_tablespaces_init(
720+ create_new_db,
721++ FALSE,
722+ srv_undo_tablespaces,
723+ &srv_undo_tablespaces_open);
724+
725+@@ -2326,6 +2335,10 @@
726
727 recv_recovery_from_checkpoint_finish();
728
729@@ -701,7 +918,7 @@
730 if (srv_force_recovery < SRV_FORCE_NO_IBUF_MERGE) {
731 /* The following call is necessary for the insert
732 buffer to work with multiple tablespaces. We must
733-@@ -2647,6 +2653,7 @@
734+@@ -2647,6 +2660,7 @@
735 && srv_auto_extend_last_data_file
736 && sum_of_data_file_sizes < tablespace_size_in_header) {
737
738@@ -709,7 +926,7 @@
739 ut_print_timestamp(stderr);
740 fprintf(stderr,
741 " InnoDB: Error: tablespace size stored in header"
742-@@ -2683,6 +2690,7 @@
743+@@ -2683,6 +2697,7 @@
744
745 return(DB_ERROR);
746 }
747@@ -717,7 +934,7 @@
748 }
749
750 /* Check that os_fast_mutexes work as expected */
751-@@ -2739,6 +2747,7 @@
752+@@ -2739,6 +2754,7 @@
753 fts_optimize_init();
754 }
755
756@@ -725,7 +942,7 @@
757 srv_was_started = TRUE;
758
759 return(DB_SUCCESS);
760-@@ -2794,7 +2803,7 @@
761+@@ -2794,7 +2810,7 @@
762 return(DB_SUCCESS);
763 }
764
765@@ -844,3 +1061,41 @@
766
767 UNIV_MEM_FREE(buf, n);
768 }
769+--- a/storage/innobase/include/fil0fil.h
770++++ b/storage/innobase/include/fil0fil.h
771+@@ -163,6 +163,9 @@
772+ #define FIL_LOG 502 /*!< redo log */
773+ /* @} */
774+
775++/** Determine if (i) is a user tablespace id or not. */
776++#define fil_is_user_tablespace_id(i) ((i) > srv_undo_tablespaces_open)
777++
778+ /** The number of fsyncs done to the log */
779+ extern ulint fil_n_log_flushes;
780+
781+--- a/storage/innobase/include/srv0start.h
782++++ b/storage/innobase/include/srv0start.h
783+@@ -77,6 +77,23 @@
784+ srv_add_path_separator_if_needed(
785+ /*=============================*/
786+ char* str); /*!< in: null-terminated character string */
787++/********************************************************************
788++Opens the configured number of undo tablespaces.
789++@return DB_SUCCESS or error code */
790++UNIV_INTERN
791++dberr_t
792++srv_undo_tablespaces_init(
793++/*======================*/
794++ ibool create_new_db, /*!< in: TRUE if new db being
795++ created */
796++ ibool backup_mode, /*!< in: TRUE disables reading
797++ the system tablespace (used in
798++ XtraBackup), FALSE is passed on
799++ recovery. */
800++ const ulint n_conf_tablespaces, /*!< in: configured undo
801++ tablespaces */
802++ ulint* n_opened); /*!< out: number of UNDO
803++ tablespaces successfully */
804+ #ifndef UNIV_HOTBACKUP
805+ /****************************************************************//**
806+ Starts Innobase and creates a new database if database files
807
808=== modified file 'src/xtrabackup.cc'
809--- src/xtrabackup.cc 2013-04-17 07:50:37 +0000
810+++ src/xtrabackup.cc 2013-04-23 10:01:01 +0000
811@@ -286,10 +286,8 @@
812
813 #ifdef __WIN__
814 #define SRV_PATH_SEPARATOR '\\'
815-#define SRV_PATH_SEPARATOR_STR "\\"
816 #else
817 #define SRV_PATH_SEPARATOR '/'
818-#define SRV_PATH_SEPARATOR_STR "/"
819 #endif
820
821 #ifndef UNIV_PAGE_SIZE_MAX
822@@ -1643,6 +1641,7 @@
823 OPT_XTRA_DEBUG_SYNC,
824 #if MYSQL_VERSION_ID >= 50600
825 OPT_INNODB_CHECKSUM_ALGORITHM,
826+ OPT_INNODB_UNDO_DIRECTORY,
827 OPT_UNDO_TABLESPACES,
828 #endif
829 OPT_DEFAULTS_GROUP
830@@ -1962,14 +1961,17 @@
831 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
832 #endif
833 #if MYSQL_VERSION_ID >= 50600
834- {"checksum-algorithm", OPT_INNODB_CHECKSUM_ALGORITHM,
835+ {"innodb_checksum_algorithm", OPT_INNODB_CHECKSUM_ALGORITHM,
836 "The algorithm InnoDB uses for page checksumming. [CRC32, STRICT_CRC32, "
837 "INNODB, STRICT_INNODB, NONE, STRICT_NONE]", &srv_checksum_algorithm,
838 &srv_checksum_algorithm, &innodb_checksum_algorithm_typelib, GET_ENUM,
839 REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
840- {"undo-tablespaces", OPT_UNDO_TABLESPACES,
841- "Number of undo tablespaces to use. NON-ZERO VALUES ARE NOT "
842- "CURRENTLY SUPPORTED",
843+ {"innodb_undo_directory", OPT_INNODB_UNDO_DIRECTORY,
844+ "Directory where undo tablespace files live, this path can be absolute.",
845+ (G_PTR*) &srv_undo_dir, (G_PTR*) &srv_undo_dir,
846+ 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
847+ {"innodb_undo_tablespaces", OPT_UNDO_TABLESPACES,
848+ "Number of undo tablespaces to use.",
849 (G_PTR*)&srv_undo_tablespaces, (G_PTR*)&srv_undo_tablespaces,
850 0, GET_ULONG, REQUIRED_ARG, 0, 0, 126, 0, 1, 0},
851 #endif
852@@ -3066,7 +3068,7 @@
853 char *p;
854
855 p = srv_data_file_names[i];
856- while ((p = strstr(p, SRV_PATH_SEPARATOR_STR)) != NULL)
857+ while ((p = strchr(p, SRV_PATH_SEPARATOR)) != NULL)
858 {
859 p++;
860 srv_data_file_names[i] = p;
861@@ -3152,7 +3154,7 @@
862 srv_log_file_size = (ulint) innobase_log_file_size;
863 msg("xtrabackup: innodb_log_files_in_group = %ld\n",
864 srv_n_log_files);
865- msg("xtrabackup: innodb_log_file_size = %ld\n",
866+ msg("xtrabackup: innodb_log_file_size = %lld\n",
867 srv_log_file_size);
868
869 #ifdef UNIV_LOG_ARCHIVE
870@@ -3308,6 +3310,18 @@
871 #endif
872 #endif /* MYSQL_VERSION_ID */
873
874+#if MYSQL_VERSION_ID >= 50600
875+ /* Assign the default value to srv_undo_dir if it's not specified, as
876+ my_getopt does not support default values for string options. We also
877+ ignore the option and override innodb_undo_directory on --prepare,
878+ because separate undo tablespaces are copied to the root backup
879+ directory. */
880+
881+ if (!srv_undo_dir || !xtrabackup_backup) {
882+ srv_undo_dir = (char *) ".";
883+ }
884+#endif
885+
886 return(FALSE);
887
888 error:
889@@ -3590,26 +3604,26 @@
890 }
891
892 /************************************************************************
893-Checks if a table specified as a path should be skipped from backup
894-based on the --tables or --tables-file options.
895+Checks if a table specified as a name in the form "database/name" (InnoDB 5.6)
896+or "./database/name.ibd" (InnoDB 5.5-) should be skipped from backup based on
897+the --tables or --tables-file options.
898
899 @return TRUE if the table should be skipped. */
900 static my_bool
901-check_if_skip_table(const char *path, const char *suffix)
902+check_if_skip_table(const char *name)
903 {
904 char buf[FN_REFLEN];
905 const char *dbname, *tbname;
906 const char *ptr;
907 char *eptr;
908- int dbname_len;
909
910 if (xtrabackup_tables == NULL && xtrabackup_tables_file == NULL) {
911 return(FALSE);
912 }
913
914 dbname = NULL;
915- tbname = path;
916- while ((ptr = strstr(tbname, SRV_PATH_SEPARATOR_STR)) != NULL) {
917+ tbname = name;
918+ while ((ptr = strchr(tbname, SRV_PATH_SEPARATOR)) != NULL) {
919 dbname = tbname;
920 tbname = ptr + 1;
921 }
922@@ -3619,14 +3633,16 @@
923 }
924
925 strncpy(buf, dbname, FN_REFLEN);
926- buf[FN_REFLEN - 1] = 0;
927+ buf[FN_REFLEN - 1] = '\0';
928 buf[tbname - 1 - dbname] = '.';
929
930- dbname_len = strlen(dbname) - strlen(suffix);
931- if (dbname_len < 1) {
932- return(FALSE);
933+ /* Check if there's a suffix in the table name. If so, truncate it. We
934+ rely on the fact that a dot cannot be a part of a table name (it is
935+ encoded by the server with the @NNNN syntax). */
936+ if ((eptr = strchr(&buf[tbname - dbname], '.')) != NULL) {
937+
938+ *eptr = '\0';
939 }
940- buf[dbname_len - 1] = 0;
941
942 /* For partitioned tables first try to match against the regexp
943 without truncating the #P#... suffix so we can backup individual
944@@ -3747,7 +3763,11 @@
945 }
946
947 #ifndef XTRADB_BASED
948-#define trx_sys_sys_space(id) (id == 0)
949+# if MYSQL_VERSION_ID >= 50600
950+# define trx_sys_sys_space(id) (!fil_is_user_tablespace_id(id))
951+# else
952+# define trx_sys_sys_space(id) (id == 0)
953+# endif
954 #endif
955
956 /****************************************************************//**
957@@ -3897,6 +3917,48 @@
958 }
959 #endif
960
961+/***********************************************************************
962+Extracts the relative path ("database/table.ibd") of a tablespace from a
963+specified possibly absolute path.
964+
965+For user tablespaces both "./database/table.ibd" and
966+"/remote/dir/database/table.ibd" result in "database/table.ibd".
967+
968+For system tablepsaces (i.e. When is_system is TRUE) both "/remote/dir/ibdata1"
969+and "./ibdata1" yield "ibdata1" in the output. */
970+static
971+const char *
972+xb_get_relative_path(
973+/*=================*/
974+ const char* path, /*!< in: tablespace path (either
975+ relative or absolute) */
976+ ibool is_system) /*!< in: TRUE for system tablespaces,
977+ i.e. when only the filename must be
978+ returned. */
979+{
980+ const char *next;
981+ const char *cur;
982+ const char *prev;
983+
984+ prev = NULL;
985+ cur = path;
986+
987+ while ((next = strchr(cur, SRV_PATH_SEPARATOR)) != NULL) {
988+
989+ prev = cur;
990+ cur = next + 1;
991+ }
992+
993+ if (is_system) {
994+
995+ return(cur);
996+ } else {
997+
998+ return((prev == NULL) ? cur : prev);
999+ }
1000+
1001+}
1002+
1003 /* TODO: We may tune the behavior (e.g. by fil_aio)*/
1004 #define COPY_CHUNK 64
1005
1006@@ -3922,34 +3984,41 @@
1007 xb_delta_info_t info;
1008 datasink_t *ds = ds_ctxt->datasink;
1009 ds_file_t *dstfile = NULL;
1010+ ibool is_system;
1011+
1012+ /* Get the name and the path for the tablespace. node->name always
1013+ contains the path (which may be absolute for remote tablespaces in
1014+ 5.6+). space->name contains the tablespace name in the form
1015+ "./database/table.ibd" (in 5.5-) or "database/table" (in 5.6+). For a
1016+ multi-node shared tablespace, space->name contains the name of the first
1017+ node, but that's irrelevant, since we only need node_name to match them
1018+ against filters, and the shared tablespace is always copied regardless
1019+ of the filters value. */
1020+
1021+ const char* const node_name = node->space->name;
1022+ const char* const node_path = node->name;
1023
1024 info.page_size = 0;
1025 info.zip_size = 0;
1026 info.space_id = 0;
1027
1028- if ((!trx_sys_sys_space(node->space->id))
1029- && check_if_skip_table(node->name, "ibd")) {
1030- msg("[%02u] Skipping %s.\n", thread_n, node->name);
1031+ is_system = trx_sys_sys_space(node->space->id);
1032+
1033+ if (!is_system && check_if_skip_table(node_name)) {
1034+ msg("[%02u] Skipping %s.\n", thread_n, node_name);
1035 return(FALSE);
1036 }
1037
1038- if (trx_sys_sys_space(node->space->id))
1039- {
1040- char *next, *p;
1041- /* system datafile "/fullpath/datafilename.ibd" or "./datafilename.ibd" */
1042- p = node->name;
1043- while ((next = strstr(p, SRV_PATH_SEPARATOR_STR)) != NULL)
1044- {
1045- p = next + 1;
1046- }
1047- strncpy(dst_name, p, sizeof(dst_name));
1048- } else {
1049- /* file per table style "./database/table.ibd" */
1050- strncpy(dst_name, node->name, sizeof(dst_name));
1051- }
1052+ /* Get the relative path for the destination tablespace name. Non-system
1053+ tablespaces may have absolute paths for remote tablespaces in MySQL
1054+ 5.6+. We want to make "local" copies for the backup. We don't use
1055+ node_name here, because in MySQL 5.6+ it doesn't contain the .ibd
1056+ suffix */
1057+ strncpy(dst_name, xb_get_relative_path(node_path, is_system),
1058+ sizeof(dst_name));
1059
1060 /* open src_file*/
1061- src_file = xb_file_create_no_error_handling(node->name,
1062+ src_file = xb_file_create_no_error_handling(node_path,
1063 OS_FILE_OPEN,
1064 OS_FILE_READ_ONLY,
1065 &success);
1066@@ -3961,11 +4030,11 @@
1067 "[%02u] xtrabackup: Warning: We assume the "
1068 "table was dropped or renamed during "
1069 "xtrabackup execution and ignore the file.\n",
1070- thread_n, node->name, thread_n);
1071+ thread_n, node_path, thread_n);
1072 goto skip;
1073 }
1074
1075- xb_file_set_nocache(src_file, node->name, "OPEN");
1076+ xb_file_set_nocache(src_file, node_path, "OPEN");
1077
1078 #ifdef USE_POSIX_FADVISE
1079 posix_fadvise(src_file, 0, 0, POSIX_FADV_SEQUENTIAL);
1080@@ -3982,7 +4051,7 @@
1081 page_size = info.zip_size;
1082 page_size_shift = get_bit_shift(page_size);
1083 msg("[%02u] %s is compressed with page size = "
1084- "%lu bytes\n", thread_n, node->name, page_size);
1085+ "%lu bytes\n", thread_n, node_name, page_size);
1086 if (page_size_shift < 10 || page_size_shift > 14) {
1087 msg("[%02u] xtrabackup: Error: Invalid "
1088 "page size: %lu.\n", thread_n, page_size);
1089@@ -4019,9 +4088,9 @@
1090 } else
1091 info.page_size = 0;
1092
1093- if (my_stat(node->name, &src_stat, MYF(MY_WME)) == NULL) {
1094+ if (my_stat(node_path, &src_stat, MYF(MY_WME)) == NULL) {
1095 msg("[%02u] xtrabackup: Warning: cannot stat %s\n",
1096- thread_n, node->name);
1097+ thread_n, node_path);
1098 goto skip;
1099 }
1100 dstfile = ds->open(ds_ctxt, dst_name, &src_stat);
1101@@ -4035,7 +4104,7 @@
1102 if (xtrabackup_stream) {
1103 const char *action = xtrabackup_compress ?
1104 "Compressing and streaming" : "Streaming";
1105- msg("[%02u] %s %s\n", thread_n, action, node->name);
1106+ msg("[%02u] %s %s\n", thread_n, action, node_path);
1107 } else {
1108 const char *action;
1109
1110@@ -4045,7 +4114,7 @@
1111 action = "Copying";
1112 }
1113 msg("[%02u] %s %s to %s\n", thread_n, action,
1114- node->name, dstfile->path);
1115+ node_path, dstfile->path);
1116 }
1117
1118 buf2 = static_cast<byte *>(ut_malloc(COPY_CHUNK
1119@@ -4112,7 +4181,7 @@
1120 "resulted in fail. File "
1121 "%s seems to be "
1122 "corrupted.\n",
1123- thread_n, node->name);
1124+ thread_n, node_path);
1125 goto error;
1126 }
1127 msg("[%02u] xtrabackup: "
1128@@ -4237,8 +4306,8 @@
1129 msg("[%02u] xtrabackup: Warning: We assume the "
1130 "table was dropped during xtrabackup execution "
1131 "and ignore the file.\n", thread_n);
1132- msg("[%02u] xtrabackup: Warning: skipping file %s.\n",
1133- thread_n, node->name);
1134+ msg("[%02u] xtrabackup: Warning: skipping tablespace %s.\n",
1135+ thread_n, node_name);
1136 return(FALSE);
1137 }
1138
1139@@ -4691,7 +4760,24 @@
1140 return(DB_ERROR);
1141 }
1142
1143- return(fil_load_single_table_tablespaces());
1144+ err = fil_load_single_table_tablespaces();
1145+ if (err != DB_SUCCESS) {
1146+ return(err);
1147+ }
1148+
1149+#if MYSQL_VERSION_ID >= 50600
1150+ /* Add separate undo tablespaces to fil_system */
1151+
1152+ err = srv_undo_tablespaces_init(FALSE,
1153+ TRUE,
1154+ srv_undo_tablespaces,
1155+ &srv_undo_tablespaces_open);
1156+ if (err != DB_SUCCESS) {
1157+ return(err);
1158+ }
1159+#endif
1160+
1161+ return(DB_SUCCESS);
1162 }
1163
1164 /*********************************************************************//**
1165@@ -6056,7 +6142,7 @@
1166 table = dict_table_get_low(table_name);
1167 mem_free(table_name);
1168
1169- if (table && check_if_skip_table(table->name, ""))
1170+ if (table && check_if_skip_table(table->name))
1171 goto skip;
1172
1173 if (table == NULL) {
1174@@ -7454,7 +7540,9 @@
1175
1176 p = info_file_path;
1177 prev = NULL;
1178- while ((next = strstr(p, SRV_PATH_SEPARATOR_STR)) != NULL)
1179+ while ((next =
1180+ strchr(p, SRV_PATH_SEPARATOR))
1181+ != NULL)
1182 {
1183 prev = p;
1184 p = next + 1;
1185@@ -7895,6 +7983,14 @@
1186 printf("innodb_file_per_table = %d\n",
1187 (int) innobase_file_per_table);
1188 #endif
1189+#if MYSQL_VERSION_ID >= 50600
1190+ if (srv_undo_dir) {
1191+
1192+ printf("innodb_undo_directory = \"%s\"\n",
1193+ srv_undo_dir);
1194+ }
1195+ printf("innodb_undo_tablespaces = %lu\n", srv_undo_tablespaces);
1196+#endif
1197 exit(EXIT_SUCCESS);
1198 }
1199
1200
1201=== modified file 'test/inc/common.sh'
1202--- test/inc/common.sh 2013-03-08 04:37:16 +0000
1203+++ test/inc/common.sh 2013-04-23 10:01:01 +0000
1204@@ -27,25 +27,12 @@
1205 exit 1
1206 }
1207
1208-function init_mysql_dir()
1209+function call_mysql_install_db()
1210 {
1211- if [ ! -d "$MYSQLD_VARDIR" ]
1212- then
1213- vlog "Creating server root directory: $MYSQLD_VARDIR"
1214- mkdir "$MYSQLD_VARDIR"
1215- fi
1216- if [ ! -d "$MYSQLD_TMPDIR" ]
1217- then
1218- vlog "Creating server temporary directory: $MYSQLD_TMPDIR"
1219- mkdir "$MYSQLD_TMPDIR"
1220- fi
1221- if [ ! -d "$MYSQLD_DATADIR" ]
1222- then
1223- vlog "Creating server data directory: $MYSQLD_DATADIR"
1224- mkdir -p "$MYSQLD_DATADIR"
1225 vlog "Calling mysql_install_db"
1226- $MYSQL_INSTALL_DB --no-defaults --basedir=$MYSQL_BASEDIR --datadir="$MYSQLD_DATADIR" --tmpdir="$MYSQLD_TMPDIR" ${MYSQLD_EXTRA_ARGS}
1227- fi
1228+ cd $MYSQL_BASEDIR
1229+ $MYSQL_INSTALL_DB --defaults-file=${MYSQLD_VARDIR}/my.cnf ${MYSQLD_EXTRA_ARGS}
1230+ cd -
1231 }
1232
1233 ########################################################################
1234@@ -230,20 +217,15 @@
1235 MYSQLD_PORT="${SRV_MYSQLD_PORT[$id]}"
1236 MYSQLD_SOCKET="${SRV_MYSQLD_SOCKET[$id]}"
1237
1238- MYSQL_ARGS="--no-defaults --socket=${MYSQLD_SOCKET} --user=root"
1239- MYSQLD_ARGS="--no-defaults --basedir=${MYSQL_BASEDIR} \
1240---socket=${MYSQLD_SOCKET} --port=${MYSQLD_PORT} --server-id=$id \
1241---datadir=${MYSQLD_DATADIR} --tmpdir=${MYSQLD_TMPDIR} --log-bin=mysql-bin \
1242---relay-log=mysql-relay-bin --pid-file=${MYSQLD_PIDFILE} ${MYSQLD_EXTRA_ARGS}"
1243+ MYSQL_ARGS="--defaults-file=$MYSQLD_VARDIR/my.cnf "
1244+ MYSQLD_ARGS="--defaults-file=$MYSQLD_VARDIR/my.cnf ${MYSQLD_EXTRA_ARGS}"
1245 if [ "`whoami`" = "root" ]
1246 then
1247 MYSQLD_ARGS="$MYSQLD_ARGS --user=root"
1248 fi
1249
1250- export MYSQL_HOME=$MYSQLD_VARDIR
1251-
1252- IB_ARGS="--user=root --socket=${MYSQLD_SOCKET} --ibbackup=$XB_BIN"
1253- XB_ARGS="--no-defaults"
1254+ IB_ARGS="--defaults-file=$MYSQLD_VARDIR/my.cnf --ibbackup=$XB_BIN"
1255+ XB_ARGS="--defaults-file=$MYSQLD_VARDIR/my.cnf"
1256
1257 # Some aliases for compatibility, as tests use the following names
1258 topdir="$MYSQLD_VARDIR"
1259@@ -265,14 +247,48 @@
1260 init_server_variables $id
1261 switch_server $id
1262
1263- init_mysql_dir
1264+ if [ ! -d "$MYSQLD_VARDIR" ]
1265+ then
1266+ vlog "Creating server root directory: $MYSQLD_VARDIR"
1267+ mkdir "$MYSQLD_VARDIR"
1268+ fi
1269+ if [ ! -d "$MYSQLD_TMPDIR" ]
1270+ then
1271+ vlog "Creating server temporary directory: $MYSQLD_TMPDIR"
1272+ mkdir "$MYSQLD_TMPDIR"
1273+ fi
1274+
1275+ # Create the configuration file used by mysql_install_db, the server
1276+ # and the xtrabackup binary
1277 cat > ${MYSQLD_VARDIR}/my.cnf <<EOF
1278 [mysqld]
1279+socket=${MYSQLD_SOCKET}
1280+port=${MYSQLD_PORT}
1281+server-id=$id
1282+basedir=${MYSQL_BASEDIR}
1283 datadir=${MYSQLD_DATADIR}
1284 tmpdir=${MYSQLD_TMPDIR}
1285+log-bin=mysql-bin
1286+relay-log=mysql-relay-bin
1287+pid-file=${MYSQLD_PIDFILE}
1288+replicate-ignore-db=mysql
1289+${MYSQLD_EXTRA_MY_CNF_OPTS:-}
1290+
1291+[client]
1292+socket=${MYSQLD_SOCKET}
1293+user=root
1294 EOF
1295
1296+ # Create datadir and call mysql_install_db if it doesn't exist
1297+ if [ ! -d "$MYSQLD_DATADIR" ]
1298+ then
1299+ vlog "Creating server data directory: $MYSQLD_DATADIR"
1300+ mkdir -p "$MYSQLD_DATADIR"
1301+ call_mysql_install_db
1302+ fi
1303+
1304 # Start the server
1305+ echo "Starting ${MYSQLD} ${MYSQLD_ARGS} $* "
1306 ${MYSQLD} ${MYSQLD_ARGS} $* &
1307 if ! mysql_ping
1308 then
1309@@ -301,6 +317,10 @@
1310 vlog "Server PID file '${MYSQLD_PIDFILE}' doesn't exist!"
1311 fi
1312
1313+ # Reset XB_ARGS so we can call xtrabackup in tests even without starting the
1314+ # server
1315+ XB_ARGS="--no-defaults"
1316+
1317 # unlock the port number
1318 free_reserved_port $MYSQLD_PORT
1319
1320
1321=== modified file 'test/inc/ib_part.sh'
1322--- test/inc/ib_part.sh 2013-03-07 11:38:14 +0000
1323+++ test/inc/ib_part.sh 2013-04-23 10:01:01 +0000
1324@@ -2,15 +2,15 @@
1325
1326 function check_partitioning()
1327 {
1328- $MYSQL $MYSQL_ARGS -Ns -e "show variables like 'have_partitioning'"
1329+ $MYSQL $MYSQL_ARGS -Ns -e "SHOW PLUGINS" 2> /dev/null |
1330+ egrep -q "^partition"
1331 }
1332
1333 function require_partitioning()
1334 {
1335- PARTITION_CHECK=`check_partitioning`
1336-
1337- if [ -z "$PARTITION_CHECK" ]; then
1338- echo "Requires Partitioning." > $SKIPPED_REASON
1339+ if ! check_partitioning
1340+ then
1341+ echo "Requires support for partitioning." > $SKIPPED_REASON
1342 exit $SKIPPED_EXIT_CODE
1343 fi
1344 }
1345
1346=== modified file 'test/t/bug1062684.sh'
1347--- test/t/bug1062684.sh 2013-03-08 04:37:16 +0000
1348+++ test/t/bug1062684.sh 2013-04-23 10:01:01 +0000
1349@@ -1,11 +1,18 @@
1350-MYSQLD_EXTRA_ARGS=--innodb-data-file-path="ibdata1:${DEFAULT_IBDATA_SIZE};ibdata2:5M:autoextend"
1351+################################################################################
1352+# Bug #1062684: Applying incremental backup using xtrabackup 2.0.3 fails when
1353+# innodb_data_file_path = ibdata1:2000M;ibdata2:10M:autoextend is
1354+# set in [mysqld]
1355+################################################################################
1356+
1357 . inc/common.sh
1358
1359-start_server --innodb-data-file-path="ibdata1:${DEFAULT_IBDATA_SIZE};ibdata2:5M:autoextend"
1360+MYSQLD_EXTRA_MY_CNF_OPTS="
1361+innodb-data-file-path=ibdata1:${DEFAULT_IBDATA_SIZE};ibdata2:5M:autoextend
1362+"
1363+
1364+start_server
1365 load_dbase_schema incremental_sample
1366
1367-echo "innodb-data-file-path=ibdata1:${DEFAULT_IBDATA_SIZE};ibdata2:5M:autoextend" >>$topdir/my.cnf
1368-
1369 # Adding initial rows
1370 vlog "Adding initial rows to database..."
1371 ${MYSQL} ${MYSQL_ARGS} -e "insert into test values (1, 1);" incremental_sample
1372
1373=== modified file 'test/t/bug483827.sh'
1374--- test/t/bug483827.sh 2012-06-05 12:35:33 +0000
1375+++ test/t/bug483827.sh 2013-04-23 10:01:01 +0000
1376@@ -18,10 +18,7 @@
1377 modify_args
1378
1379 # make my_multi.cnf
1380-echo "
1381-[mysqld1]
1382-datadir=${mysql_datadir}
1383-tmpdir=$mysql_tmpdir" > $topdir/my_multi.cnf
1384+sed -e 's/\[mysqld\]/[mysqld1]/' $topdir/my.cnf > $topdir/my_multi.cnf
1385
1386 # Backup
1387 innobackupex --no-timestamp --defaults-group=mysqld1 $backup_dir
1388
1389=== modified file 'test/t/bug606981.sh'
1390--- test/t/bug606981.sh 2012-06-19 06:00:44 +0000
1391+++ test/t/bug606981.sh 2013-04-23 10:01:01 +0000
1392@@ -6,12 +6,16 @@
1393 exit $SKIPPED_EXIT_CODE
1394 fi
1395
1396-start_server --innodb_file_per_table
1397+MYSQLD_EXTRA_MY_CNF_OPTS="
1398+innodb_file_per_table=1
1399+innodb_flush_method=O_DIRECT
1400+"
1401+
1402+start_server
1403
1404 load_sakila
1405
1406 # Take backup
1407-echo "innodb_flush_method=O_DIRECT" >> $topdir/my.cnf
1408 mkdir -p $topdir/backup
1409 innobackupex --stream=tar $topdir/backup > $topdir/backup/out.tar
1410 stop_server
1411@@ -30,11 +34,11 @@
1412 backup_dir=$topdir/backup
1413 cd $backup_dir
1414 $TAR -ixvf out.tar
1415-cd - >/dev/null 2>&1
1416-innobackupex --apply-log --defaults-file=$topdir/my.cnf $backup_dir
1417+cd - >/dev/null 2>&1
1418+innobackupex --apply-log $backup_dir
1419 vlog "Restoring MySQL datadir"
1420 mkdir -p $mysql_datadir
1421-innobackupex --copy-back --defaults-file=$topdir/my.cnf $backup_dir
1422+innobackupex --copy-back $backup_dir
1423
1424 start_server
1425 # Check sakila
1426
1427=== modified file 'test/t/bug740489.sh'
1428--- test/t/bug740489.sh 2013-01-07 19:14:19 +0000
1429+++ test/t/bug740489.sh 2013-04-23 10:01:01 +0000
1430@@ -6,26 +6,34 @@
1431 start_server --innodb_file_per_table
1432 load_sakila
1433
1434-run_cmd ${MYSQL} ${MYSQL_ARGS} -e "UPDATE mysql.user SET Password=PASSWORD('password') WHERE User='root'; FLUSH PRIVILEGES;"
1435-
1436-defaults_extra_file=${TEST_BASEDIR}/740489.cnf
1437-
1438-echo "[client]" > $defaults_extra_file
1439-echo "user=root" >> $defaults_extra_file
1440-echo "password=password" >> $defaults_extra_file
1441-
1442-mkdir -p $topdir/backup
1443-cat ${MYSQLD_VARDIR}/my.cnf
1444-run_cmd $IB_BIN --defaults-extra-file=$defaults_extra_file --socket=${MYSQLD_SOCKET} --ibbackup=$XB_BIN $topdir/backup
1445-backup_dir=`grep "innobackupex: Backup created in directory" $OUTFILE | awk -F\' '{ print $2}'`
1446+run_cmd ${MYSQL} ${MYSQL_ARGS} <<EOF
1447+SET PASSWORD FOR 'root'@'localhost' = PASSWORD('password');
1448+EOF
1449+
1450+defaults_extra_file=$topdir/740489.cnf
1451+
1452+cat > $defaults_extra_file <<EOF
1453+[mysqld]
1454+datadir=${MYSQLD_DATADIR}
1455+
1456+[client]
1457+user=root
1458+password=password
1459+EOF
1460+
1461+backup_dir=$topdir/backup
1462+run_cmd $IB_BIN \
1463+ --defaults-extra-file=$defaults_extra_file --socket=${MYSQLD_SOCKET} \
1464+ --ibbackup=$XB_BIN --no-timestamp $backup_dir
1465 vlog "Backup created in directory $backup_dir"
1466
1467-run_cmd ${MYSQL} ${MYSQL_ARGS} --password=password -e "UPDATE mysql.user SET Password=PASSWORD('') WHERE User='root'; FLUSH PRIVILEGES;"
1468+run_cmd ${MYSQL} ${MYSQL_ARGS} --password=password <<EOF
1469+SET PASSWORD FOR 'root'@'localhost' = PASSWORD('');
1470+EOF
1471
1472 stop_server
1473 # Remove datadir
1474 rm -r $mysql_datadir
1475-#init_mysql_dir
1476 # Restore sakila
1477 vlog "Applying log"
1478 vlog "###########"
1479
1480=== modified file 'test/t/bug759225.sh'
1481--- test/t/bug759225.sh 2012-06-19 06:00:44 +0000
1482+++ test/t/bug759225.sh 2013-04-23 10:01:01 +0000
1483@@ -16,11 +16,13 @@
1484 exit $SKIPPED_EXIT_CODE
1485 fi
1486
1487+MYSQLD_EXTRA_MY_CNF_OPTS="
1488+innodb_flush_method=ALL_O_DIRECT
1489+"
1490 start_server
1491 load_sakila
1492
1493 # Take backup
1494-echo "innodb_flush_method=ALL_O_DIRECT" >> $topdir/my.cnf
1495 mkdir -p $topdir/backup
1496 innobackupex --stream=tar $topdir/backup > $topdir/backup/out.tar
1497 stop_server
1498@@ -39,11 +41,11 @@
1499 backup_dir=$topdir/backup
1500 cd $backup_dir
1501 $TAR -ixvf out.tar
1502-cd - >/dev/null 2>&1
1503-innobackupex --apply-log --defaults-file=$topdir/my.cnf $backup_dir
1504+cd - >/dev/null 2>&1
1505+innobackupex --apply-log $backup_dir
1506 vlog "Restoring MySQL datadir"
1507 mkdir -p $mysql_datadir
1508-innobackupex --copy-back --defaults-file=$topdir/my.cnf $backup_dir
1509+innobackupex --copy-back $backup_dir
1510
1511 start_server
1512 # Check sakila
1513
1514=== modified file 'test/t/bug870119.sh'
1515--- test/t/bug870119.sh 2013-03-05 13:07:11 +0000
1516+++ test/t/bug870119.sh 2013-04-23 10:01:01 +0000
1517@@ -4,10 +4,13 @@
1518
1519 . inc/common.sh
1520
1521-start_server --innodb_file_per_table
1522-
1523 # Set the minimum value for innodb_open_files to be used by xtrabackup
1524-echo "innodb_open_files=10" >>$topdir/my.cnf
1525+MYSQLD_EXTRA_MY_CNF_OPTS="
1526+innodb_file_per_table=1
1527+innodb_open_files=10
1528+"
1529+
1530+start_server
1531
1532 load_dbase_schema sakila
1533 load_dbase_data sakila
1534
1535=== modified file 'test/t/bug891496.sh'
1536--- test/t/bug891496.sh 2013-03-08 04:37:16 +0000
1537+++ test/t/bug891496.sh 2013-04-23 10:01:01 +0000
1538@@ -5,13 +5,11 @@
1539
1540 . inc/common.sh
1541
1542-innodb_data_file_path="ibdata1:3M;ibdata2:10M:autoextend"
1543-
1544-start_server --innodb_data_file_path=$innodb_data_file_path
1545-
1546-cat >> $topdir/my.cnf <<EOF
1547-innodb_data_file_path=$innodb_data_file_path
1548-EOF
1549+MYSQLD_EXTRA_MY_CNF_OPTS="
1550+innodb_data_file_path=ibdata1:3M;ibdata2:10M:autoextend
1551+"
1552+
1553+start_server
1554
1555 load_dbase_schema sakila
1556 load_dbase_data sakila
1557@@ -40,6 +38,6 @@
1558 vlog "###########"
1559 innobackupex --copy-back $backup_dir
1560
1561-start_server --innodb_data_file_path=$innodb_data_file_path
1562+start_server
1563 # Check sakila
1564 run_cmd ${MYSQL} ${MYSQL_ARGS} -e "SELECT count(*) from actor" sakila
1565
1566=== modified file 'test/t/bug976945.sh'
1567--- test/t/bug976945.sh 2012-06-18 03:38:41 +0000
1568+++ test/t/bug976945.sh 2013-04-23 10:01:01 +0000
1569@@ -8,8 +8,10 @@
1570 exit $SKIPPED_EXIT_CODE
1571 fi
1572
1573-start_server --innodb_log_block_size=4096
1574-echo innodb_log_block_size=4096 >> ${MYSQLD_VARDIR}/my.cnf
1575+MYSQLD_EXTRA_MY_CNF_OPTS="
1576+innodb_log_block_size=4096
1577+"
1578+start_server
1579 load_sakila
1580
1581 # Full backup
1582
1583=== modified file 'test/t/bug977101.sh'
1584--- test/t/bug977101.sh 2012-06-08 18:46:19 +0000
1585+++ test/t/bug977101.sh 2013-04-23 10:01:01 +0000
1586@@ -17,15 +17,14 @@
1587
1588 # Check that binlog info is correct with --safe-slave-backup
1589 innobackupex --no-timestamp --safe-slave-backup $topdir/backup
1590-egrep -q '^mysql-bin.000001[[:space:]]+[0-9]+[[:space:]]+$' \
1591+egrep -q '^mysql-bin.[0-9]+[[:space:]]+[0-9]+[[:space:]]+$' \
1592 $topdir/backup/xtrabackup_binlog_info
1593
1594 # Check that both binlog info and slave info are correct with
1595 # --safe-slave-backup
1596 rm -rf $topdir/backup
1597 innobackupex --no-timestamp --slave-info --safe-slave-backup $topdir/backup
1598-egrep -q '^mysql-bin.000001[[:space:]]+[0-9]+[[:space:]]+$' \
1599+egrep -q '^mysql-bin.[0-9]+[[:space:]]+[0-9]+[[:space:]]+$' \
1600 $topdir/backup/xtrabackup_binlog_info
1601-egrep -q '^CHANGE MASTER TO MASTER_LOG_FILE='\''mysql-bin.000001'\'', MASTER_LOG_POS=[0-9]+$' \
1602+egrep -q '^CHANGE MASTER TO MASTER_LOG_FILE='\''mysql-bin.[0-9]+'\'', MASTER_LOG_POS=[0-9]+$' \
1603 $topdir/backup/xtrabackup_slave_info
1604-
1605
1606=== modified file 'test/t/ib_doublewrite.sh'
1607--- test/t/ib_doublewrite.sh 2012-11-15 15:27:58 +0000
1608+++ test/t/ib_doublewrite.sh 2013-04-23 10:01:01 +0000
1609@@ -15,7 +15,12 @@
1610 fi
1611
1612 DBLWR=dblwr.ibd
1613-start_server --innodb_file_per_table --innodb_doublewrite_file=${DBLWR}
1614+
1615+MYSQLD_EXTRA_MY_CNF_OPTS="
1616+innodb_file_per_table=1
1617+innodb_doublewrite_file=$DBLWR
1618+"
1619+start_server
1620 load_dbase_schema incremental_sample
1621
1622 # Workaround for bug #1072695
1623@@ -25,8 +30,6 @@
1624 run_cmd $IB_BIN $IB_ARGS_NO_DEFAULTS_FILE $*
1625 }
1626
1627-echo "innodb_doublewrite_file=${DBLWR}" >>$topdir/my.cnf
1628-
1629 # Adding initial rows
1630 vlog "Adding initial rows to database..."
1631 ${MYSQL} ${MYSQL_ARGS} -e "insert into test values (1, 1);" incremental_sample
1632
1633=== modified file 'test/t/ib_part_include.sh'
1634--- test/t/ib_part_include.sh 2013-03-07 11:38:14 +0000
1635+++ test/t/ib_part_include.sh 2013-04-23 10:01:01 +0000
1636@@ -27,9 +27,9 @@
1637
1638 # also test xtrabackup --stats work with --tables-file
1639 COUNT=`xtrabackup --stats --tables='test.test$' --datadir=$topdir/backup \
1640- | grep table: | awk '{print $2}' | sort -u | wc -l`
1641+ | grep table: | grep -v SYS_ | awk '{print $2}' | sort -u | wc -l`
1642
1643-if [ $COUNT != 7 ] ; then
1644+if [ $COUNT != 5 ] ; then
1645 vlog "xtrabackup --stats does not work"
1646 exit -1
1647 fi
1648
1649=== modified file 'test/t/ib_part_tf_innodb.sh'
1650--- test/t/ib_part_tf_innodb.sh 2013-03-07 11:38:14 +0000
1651+++ test/t/ib_part_tf_innodb.sh 2013-04-23 10:01:01 +0000
1652@@ -30,9 +30,9 @@
1653 vlog "Backup taken"
1654
1655 COUNT=`xtrabackup --stats --tables-file=$topdir/tables --datadir=$topdir/backup \
1656- | grep table: | awk '{print $2}' | sort -u | wc -l`
1657+ | grep table: | grep -v SYS_ | awk '{print $2}' | sort -u | wc -l`
1658 echo "COUNT = $COUNT"
1659-if [ $COUNT != 7 ] ; then
1660+if [ $COUNT != 5 ] ; then
1661 vlog "xtrabackup --stats does not work"
1662 exit -1
1663 fi
1664
1665=== modified file 'test/t/ib_slave_info.sh'
1666--- test/t/ib_slave_info.sh 2012-06-05 12:35:33 +0000
1667+++ test/t/ib_slave_info.sh 2013-04-23 10:01:01 +0000
1668@@ -30,7 +30,7 @@
1669 $topdir/backup
1670
1671 innobackupex --no-timestamp --slave-info $topdir/backup
1672-egrep -q '^mysql-bin.000001[[:space:]]+[0-9]+[[:space:]]+$' \
1673+egrep -q '^mysql-bin.[0-9]+[[:space:]]+[0-9]+[[:space:]]+$' \
1674 $topdir/backup/xtrabackup_binlog_info
1675-egrep -q '^CHANGE MASTER TO MASTER_LOG_FILE='\''mysql-bin.000001'\'', MASTER_LOG_POS=[0-9]+$' \
1676+egrep -q '^CHANGE MASTER TO MASTER_LOG_FILE='\''mysql-bin.[0-9]+'\'', MASTER_LOG_POS=[0-9]+$' \
1677 $topdir/backup/xtrabackup_slave_info
1678
1679=== added file 'test/t/remote_tablespaces.sh'
1680--- test/t/remote_tablespaces.sh 1970-01-01 00:00:00 +0000
1681+++ test/t/remote_tablespaces.sh 2013-04-23 10:01:01 +0000
1682@@ -0,0 +1,53 @@
1683+########################################################################
1684+# Test remote tablespaces in InnoDB 5.6
1685+########################################################################
1686+
1687+. inc/common.sh
1688+
1689+if [ ${MYSQL_VERSION:0:3} != "5.6" ]
1690+then
1691+ echo "Requires a 5.6 server" > $SKIPPED_REASON
1692+ exit $SKIPPED_EXIT_CODE
1693+fi
1694+
1695+start_server --innodb_file_per_table
1696+
1697+remote_dir=$TEST_BASEDIR/var1/remote_dir
1698+
1699+$MYSQL $MYSQL_ARGS test <<EOF
1700+CREATE TABLE t(id INT AUTO_INCREMENT PRIMARY KEY, c INT)
1701+ DATA DIRECTORY = '$remote_dir' ENGINE=InnoDB;
1702+INSERT INTO t(c) VALUES (1), (2), (3), (4), (5), (6), (7), (8);
1703+EOF
1704+
1705+# Generate some log data, as we also want to test recovery of remote tablespaces
1706+for ((i=0; i<12; i++))
1707+do
1708+ $MYSQL $MYSQL_ARGS test <<EOF
1709+ INSERT INTO t(c) SELECT c FROM t;
1710+EOF
1711+done
1712+
1713+checksum_a=`checksum_table test t`
1714+
1715+innobackupex --no-timestamp $topdir/backup
1716+
1717+stop_server
1718+
1719+rm -rf $mysql_datadir/*
1720+
1721+innobackupex --apply-log $topdir/backup
1722+innobackupex --copy-back $topdir/backup
1723+
1724+start_server
1725+
1726+checksum_b=`checksum_table test t`
1727+
1728+vlog "Old checksum: $checksum_a"
1729+vlog "New checksum: $checksum_b"
1730+
1731+if [ "$checksum_a" != "$checksum_b" ]
1732+then
1733+ vlog "Checksums do not match"
1734+ exit -1
1735+fi
1736
1737=== added file 'test/t/undo_tablespaces.sh'
1738--- test/t/undo_tablespaces.sh 1970-01-01 00:00:00 +0000
1739+++ test/t/undo_tablespaces.sh 2013-04-23 10:01:01 +0000
1740@@ -0,0 +1,75 @@
1741+########################################################################
1742+# Test support for separate UNDO tablespace
1743+########################################################################
1744+
1745+. inc/common.sh
1746+
1747+if [ ${MYSQL_VERSION:0:3} != "5.6" ]
1748+then
1749+ echo "Requires a 5.6 server" > $SKIPPED_REASON
1750+ exit $SKIPPED_EXIT_CODE
1751+fi
1752+
1753+################################################################################
1754+# Start an uncommitted transaction pause "indefinitely" to keep the connection
1755+# open
1756+################################################################################
1757+function start_uncomitted_transaction()
1758+{
1759+ run_cmd $MYSQL $MYSQL_ARGS sakila <<EOF
1760+START TRANSACTION;
1761+DELETE FROM payment;
1762+SELECT SLEEP(10000);
1763+EOF
1764+}
1765+
1766+undo_directory=$TEST_BASEDIR/var1/undo_dir
1767+
1768+MYSQLD_EXTRA_MY_CNF_OPTS="
1769+innodb_file_per_table=1
1770+innodb_undo_directory=$undo_directory
1771+innodb_undo_tablespaces=4
1772+"
1773+
1774+start_server
1775+load_sakila
1776+
1777+checksum1=`checksum_table sakila payment`
1778+test -n "$checksum1" || die "Failed to checksum table sakila.payment"
1779+
1780+# Start a transaction, modify some data and keep it uncommitted for the backup
1781+# stage. InnoDB avoids using the rollback segment in the system tablespace, if
1782+# separate undo tablespaces are used, so the test would fail if we did not
1783+# handle separate undo tablespaces correctly.
1784+start_uncomitted_transaction &
1785+job_master=$!
1786+
1787+innobackupex --no-timestamp $topdir/backup
1788+
1789+kill -SIGKILL $job_master
1790+stop_server
1791+
1792+rm -rf $MYSQLD_DATADIR/*
1793+rm -rf $undo_directory/*
1794+
1795+innobackupex --apply-log $topdir/backup
1796+
1797+innobackupex --copy-back $topdir/backup
1798+
1799+
1800+
1801+start_server
1802+
1803+# Check that the uncommitted transaction has been rolled back
1804+
1805+checksum2=`checksum_table sakila payment`
1806+test -n "$checksum2" || die "Failed to checksum table sakila.payment"
1807+
1808+vlog "Old checksum: $checksum1"
1809+vlog "New checksum: $checksum2"
1810+
1811+if [ "$checksum1" != "$checksum2" ]
1812+then
1813+ vlog "Checksums do not match"
1814+ exit -1
1815+fi
1816
1817=== modified file 'test/t/xb_basic.sh'
1818--- test/t/xb_basic.sh 2012-10-15 16:14:59 +0000
1819+++ test/t/xb_basic.sh 2013-04-23 10:01:01 +0000
1820@@ -13,7 +13,6 @@
1821 stop_server
1822 # Remove datadir
1823 rm -r $mysql_datadir
1824-#init_mysql_dir
1825 # Restore sakila
1826 vlog "Applying log"
1827 vlog "###########"
1828
1829=== modified file 'test/t/xb_version.sh'
1830--- test/t/xb_version.sh 2011-06-14 14:34:23 +0000
1831+++ test/t/xb_version.sh 2013-04-23 10:01:01 +0000
1832@@ -1,4 +1,3 @@
1833 . inc/common.sh
1834
1835 xtrabackup --version
1836-
1837
1838=== modified file 'test/testrun.sh'
1839--- test/testrun.sh 2013-03-13 05:05:16 +0000
1840+++ test/testrun.sh 2013-04-23 10:01:01 +0000
1841@@ -176,7 +176,7 @@
1842 then
1843 INNODB_FLAVOR="XtraDB"
1844 else
1845- INNODB_FLAVOR="innoDB"
1846+ INNODB_FLAVOR="InnoDB"
1847 fi
1848
1849 if [ "$XB_BUILD" = "autodetect" ]

Subscribers

People subscribed via source and target branches