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

Proposed by Alexey Kopytov
Status: Merged
Approved by: Laurynas Biveinis
Approved revision: no longer in the source branch.
Merged at revision: 570
Proposed branch: lp:~akopytov/percona-xtrabackup/support-remote-tablespaces-2.1
Merge into: lp:percona-xtrabackup/2.1
Prerequisite: lp:~akopytov/percona-xtrabackup/bug1169169-2.1
Diff against target: 1256 lines (+278/-407)
15 files modified
innobackupex (+36/-15)
patches/innodb56.patch (+80/-52)
src/compact.cc (+1/-1)
src/fil_cur.cc (+51/-15)
src/fil_cur.h (+4/-1)
src/innodb_int.h (+5/-4)
src/write_filt.cc (+1/-1)
src/xtrabackup.cc (+39/-250)
test/inc/common.sh (+1/-9)
test/t/bug977101.sh (+3/-16)
test/t/ib_doublewrite.sh (+0/-5)
test/t/ib_part_include.sh (+2/-2)
test/t/ib_part_tf_innodb.sh (+2/-2)
test/t/remote_tablespaces.sh (+53/-0)
test/t/xb_basic.sh (+0/-34)
To merge this branch: bzr merge lp:~akopytov/percona-xtrabackup/support-remote-tablespaces-2.1
Reviewer Review Type Date Requested Status
Laurynas Biveinis (community) Approve
Review via email: mp+160317@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.1-param/267/

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

Approving as automerge

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-23 10:01:10 +0000
3+++ innobackupex 2013-04-23 10:01:10 +0000
4@@ -236,6 +236,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@@ -607,11 +608,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@@ -646,14 +667,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@@ -665,6 +688,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@@ -675,7 +699,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@@ -687,6 +711,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@@ -711,13 +736,9 @@
92 '\.\.?|backup-my\.cnf|xtrabackup_logfile|' .
93 'xtrabackup_binary|xtrabackup_binlog_info|xtrabackup_checkpoints|' .
94 '.*\.qp|' .
95-<<<<<<< TREE
96 '.*\.pmap|.*\.tmp|' .
97- $iblog_files;
98-=======
99 $iblog_files . '|'.
100 $ibundo_files;
101->>>>>>> MERGE-SOURCE
102 my $compressed_data_file = '.*\.ibz$';
103 my $file;
104 my $backup_innodb_data_file_path;
105@@ -791,7 +812,7 @@
106 my $excluded_regexp = '^(' . $excluded_files . ')$';
107 print STDERR "$prefix Starting to $operation files in '$backup_dir'\n";
108 print STDERR "$prefix back to original data directory '$orig_datadir'\n";
109- &$move_or_copy_dir($backup_dir, $orig_datadir, $excluded_regexp, 0);
110+ &$move_or_copy_dir($backup_dir, $orig_datadir, $excluded_regexp, 0, 1);
111
112 # copy InnoDB data files to original InnoDB data directory
113 print STDERR "\n$prefix Starting to $operation InnoDB system tablespace\n";
114@@ -927,7 +948,7 @@
115 copy_dir_recursively($option_incremental_dir, $backup_dir,
116 '^(\.\.?|backup-my\.cnf|xtrabackup_logfile|' .
117 'xtrabackup_binary|xtrabackup_checkpoints|' .
118- '.*\.delta|.*\.meta|ib_logfile.*)$', 1);
119+ '.*\.delta|.*\.meta|ib_logfile.*)$', 1, 0);
120 # If the latest backup has no file, we need to remove the old
121 # xtrabackup_slave_info file, because it is out of date
122 # TODO: this will not be needed when bug #856400 is fixed.
123@@ -2061,7 +2082,7 @@
124
125
126 #
127-# backup_files subroutine copies .frm, .MRG, .MYD and .MYI files to
128+# backup_files subroutine copies .frm, .isl, .MRG, .MYD and .MYI files to
129 # backup directory.
130 #
131 sub backup_files {
132@@ -2070,7 +2091,7 @@
133 my @list;
134 my $file;
135 my $database;
136- my $wildcard = '*.{frm,MYD,MYI,MAD,MAI,MRG,TRG,TRN,ARM,ARZ,CSM,CSV,opt,par}';
137+ my $wildcard = '*.{frm,isl,MYD,MYI,MAD,MAI,MRG,TRG,TRN,ARM,ARZ,CSM,CSV,opt,par}';
138 my $rsync_file_list;
139 my $operation;
140 my $rsync_tmpfile_pass1 = "$option_tmpdir/xtrabackup_rsyncfiles_pass1";
141@@ -2123,7 +2144,7 @@
142
143 # copy files of this database
144 opendir(DBDIR, "$source_dir/$database");
145- @list = grep(/\.(frm|MYD|MYI|MAD|MAI|MRG|TRG|TRN|ARM|ARZ|CSM|CSV|opt|par)$/, readdir(DBDIR));
146+ @list = grep(/\.(frm|isl|MYD|MYI|MAD|MAI|MRG|TRG|TRN|ARM|ARZ|CSM|CSV|opt|par)$/, readdir(DBDIR));
147 closedir DBDIR;
148 $file_c = @list;
149 if ($file_c <= $backup_file_print_limit) {
150
151=== modified file 'patches/innodb56.patch'
152--- patches/innodb56.patch 2013-04-23 10:01:10 +0000
153+++ patches/innodb56.patch 2013-04-23 10:01:10 +0000
154@@ -334,7 +334,25 @@
155 /********************************************************************//**
156 Tries to open a single-table tablespace and optionally checks that the
157 space id in it is correct. If this does not succeed, print an error message
158-@@ -3712,11 +3827,15 @@
159+@@ -3569,6 +3684,9 @@
160+ in the default location. If it is remote, it should not be here. */
161+ def.filepath = fil_make_ibd_name(tablename, false);
162+
163++ /* We skip SYS_DATAFILES validation and remote tablespaces discovery for
164++ XtraBackup, as all tablespaces are local for XtraBackup recovery. */
165++#if 0
166+ /* The path_in was read from SYS_DATAFILES. */
167+ if (path_in) {
168+ if (strcmp(def.filepath, path_in)) {
169+@@ -3616,6 +3734,7 @@
170+ tablespaces_found++;
171+ }
172+ }
173++#endif
174+
175+ /* Always look for a file at the default location. */
176+ ut_a(def.filepath);
177+@@ -3712,11 +3831,15 @@
178 /* The following call prints an error message */
179 os_file_get_last_error(true);
180
181@@ -351,7 +369,25 @@
182
183 err = DB_CORRUPTION;
184
185-@@ -4135,7 +4254,7 @@
186+@@ -4018,6 +4141,9 @@
187+ # endif /* !UNIV_HOTBACKUP */
188+ #endif
189+
190++ /* Ignore .isl files on XtraBackup recovery. All tablespaces must be
191++ local. */
192++ if (!recv_recovery_on) {
193+ /* Check for a link file which locates a remote tablespace. */
194+ remote.success = fil_open_linked_file(
195+ tablename, &remote.filepath, &remote.file);
196+@@ -4030,6 +4156,7 @@
197+ mem_free(remote.filepath);
198+ }
199+ }
200++ }
201+
202+
203+ /* Try to open the tablespace in the datadir. */
204+@@ -4135,7 +4262,7 @@
205 cannot be ok. */
206 ulong minimum_size = FIL_IBD_FILE_INITIAL_SIZE * UNIV_PAGE_SIZE;
207 if (size < minimum_size) {
208@@ -360,7 +396,7 @@
209 ib_logf(IB_LOG_LEVEL_ERROR,
210 "The size of single-table tablespace file %s "
211 "is only " UINT64PF ", should be at least %lu!",
212-@@ -4263,7 +4382,7 @@
213+@@ -4263,7 +4390,7 @@
214 idea is to read as much good data as we can and jump over bad data.
215 @return 0 if ok, -1 if error even after the retries, 1 if at the end
216 of the directory */
217@@ -369,7 +405,7 @@
218 int
219 fil_file_readdir_next_file(
220 /*=======================*/
221-@@ -4359,7 +4478,9 @@
222+@@ -4359,7 +4486,9 @@
223 "%s/%s", fil_path_to_mysql_datadir, dbinfo.name);
224 srv_normalize_path_for_win(dbpath);
225
226@@ -380,7 +416,23 @@
227
228 if (dbdir != NULL) {
229
230-@@ -4538,6 +4659,7 @@
231+@@ -4380,9 +4509,13 @@
232+ && (0 == strcmp(fileinfo.name
233+ + strlen(fileinfo.name) - 4,
234+ ".ibd")
235+- || 0 == strcmp(fileinfo.name
236++ /* Ignore .isl files on XtraBackup
237++ recovery, all tablespaces must be
238++ local. */
239++ || (!recv_recovery_on &&
240++ 0 == strcmp(fileinfo.name
241+ + strlen(fileinfo.name) - 4,
242+- ".isl"))) {
243++ ".isl")))) {
244+ /* The name ends in .ibd or .isl;
245+ try opening the file */
246+ fil_load_single_table_tablespace(
247+@@ -4538,6 +4671,7 @@
248 {
249 fil_space_t* fnamespace;
250 fil_space_t* space;
251@@ -388,7 +440,7 @@
252
253 ut_ad(fil_system);
254
255-@@ -4615,6 +4737,10 @@
256+@@ -4615,6 +4749,10 @@
257 if (fnamespace == NULL) {
258 if (print_error_if_does_not_exist) {
259 fil_report_missing_tablespace(name, id);
260@@ -399,7 +451,7 @@
261 }
262 } else {
263 ut_print_timestamp(stderr);
264-@@ -4638,6 +4764,10 @@
265+@@ -4638,6 +4776,10 @@
266
267 mutex_exit(&fil_system->mutex);
268
269@@ -410,7 +462,7 @@
270 return(FALSE);
271 }
272
273-@@ -4728,6 +4858,7 @@
274+@@ -4728,6 +4870,7 @@
275 ulint page_size;
276 ulint pages_added;
277 ibool success;
278@@ -418,7 +470,7 @@
279
280 ut_ad(!srv_read_only_mode);
281
282-@@ -4772,13 +4903,17 @@
283+@@ -4772,13 +4915,17 @@
284 goto retry;
285 }
286
287@@ -437,7 +489,7 @@
288 start_page_no = space->size;
289 file_start_page_no = space->size - node->size;
290
291-@@ -5024,7 +5159,7 @@
292+@@ -5024,7 +5171,7 @@
293 off the LRU list if it is in the LRU list. The caller must hold the fil_sys
294 mutex. */
295 static
296@@ -446,7 +498,7 @@
297 fil_node_prepare_for_io(
298 /*====================*/
299 fil_node_t* node, /*!< in: file node */
300-@@ -5044,9 +5179,12 @@
301+@@ -5044,9 +5191,12 @@
302 }
303
304 if (node->open == FALSE) {
305@@ -460,7 +512,7 @@
306 }
307
308 if (node->n_pending == 0 && fil_space_belongs_in_lru(space)) {
309-@@ -5058,6 +5196,8 @@
310+@@ -5058,6 +5208,8 @@
311 }
312
313 node->n_pending++;
314@@ -469,7 +521,7 @@
315 }
316
317 /********************************************************************//**
318-@@ -5259,6 +5399,16 @@
319+@@ -5259,6 +5411,16 @@
320
321 ut_ad(mode != OS_AIO_IBUF || space->purpose == FIL_TABLESPACE);
322
323@@ -486,7 +538,7 @@
324 node = UT_LIST_GET_FIRST(space->chain);
325
326 for (;;) {
327-@@ -5290,7 +5440,11 @@
328+@@ -5290,7 +5452,11 @@
329 }
330
331 /* Open file if closed */
332@@ -499,7 +551,7 @@
333
334 /* Check that at least the start offset is within the bounds of a
335 single-table tablespace, including rollback tablespaces. */
336-@@ -6164,6 +6318,7 @@
337+@@ -6164,6 +6330,7 @@
338 return(err);
339 }
340
341@@ -507,7 +559,7 @@
342 /****************************************************************//**
343 Generate redo logs for swapping two .ibd files */
344 UNIV_INTERN
345-@@ -6187,4 +6342,4 @@
346+@@ -6187,4 +6354,4 @@
347 0, 0, new_name, old_name, &mtr);
348 mtr_commit(&mtr);
349 }
350@@ -847,10 +899,7 @@
351 dberr_t
352 open_or_create_data_files(
353 /*======================*/
354-<<<<<<< TREE
355-@@ -2065,11 +2066,13 @@
356-=======
357-@@ -1204,12 +1204,16 @@
358+@@ -1204,12 +1205,16 @@
359 /********************************************************************
360 Opens the configured number of undo tablespaces.
361 @return DB_SUCCESS or error code */
362@@ -868,7 +917,7 @@
363 const ulint n_conf_tablespaces, /*!< in: configured undo
364 tablespaces */
365 ulint* n_opened) /*!< out: number of UNDO
366-@@ -1225,6 +1229,7 @@
367+@@ -1225,6 +1230,7 @@
368 *n_opened = 0;
369
370 ut_a(n_conf_tablespaces <= TRX_SYS_N_RSEGS);
371@@ -876,7 +925,7 @@
372
373 memset(undo_tablespace_ids, 0x0, sizeof(undo_tablespace_ids));
374
375-@@ -1258,12 +1263,13 @@
376+@@ -1258,12 +1264,13 @@
377 }
378 }
379
380@@ -894,7 +943,7 @@
381 n_undo_tablespaces = trx_rseg_get_n_undo_tablespaces(
382 undo_tablespace_ids);
383 } else {
384-@@ -1369,7 +1375,7 @@
385+@@ -1369,7 +1376,7 @@
386 ib_logf(IB_LOG_LEVEL_INFO, "Opened %lu undo tablespaces",
387 n_undo_tablespaces);
388
389@@ -903,8 +952,7 @@
390 ib_logf(IB_LOG_LEVEL_WARN,
391 "Using the system tablespace for all UNDO "
392 "logging because innodb_undo_tablespaces=0");
393-@@ -2065,11 +2071,13 @@
394->>>>>>> MERGE-SOURCE
395+@@ -2065,11 +2072,13 @@
396 max_flushed_lsn = min_flushed_lsn
397 = log_get_lsn();
398 goto files_checked;
399@@ -918,10 +966,7 @@
400 }
401
402 /* opened all files */
403-<<<<<<< TREE
404-@@ -2326,6 +2329,10 @@
405-=======
406-@@ -2162,6 +2170,7 @@
407+@@ -2162,6 +2171,7 @@
408
409 err = srv_undo_tablespaces_init(
410 create_new_db,
411@@ -929,8 +974,7 @@
412 srv_undo_tablespaces,
413 &srv_undo_tablespaces_open);
414
415-@@ -2326,6 +2335,10 @@
416->>>>>>> MERGE-SOURCE
417+@@ -2326,6 +2336,10 @@
418
419 recv_recovery_from_checkpoint_finish();
420
421@@ -941,11 +985,7 @@
422 if (srv_force_recovery < SRV_FORCE_NO_IBUF_MERGE) {
423 /* The following call is necessary for the insert
424 buffer to work with multiple tablespaces. We must
425-<<<<<<< TREE
426-@@ -2647,6 +2654,7 @@
427-=======
428-@@ -2647,6 +2660,7 @@
429->>>>>>> MERGE-SOURCE
430+@@ -2647,6 +2661,7 @@
431 && srv_auto_extend_last_data_file
432 && sum_of_data_file_sizes < tablespace_size_in_header) {
433
434@@ -953,11 +993,7 @@
435 ut_print_timestamp(stderr);
436 fprintf(stderr,
437 " InnoDB: Error: tablespace size stored in header"
438-<<<<<<< TREE
439-@@ -2683,6 +2691,7 @@
440-=======
441-@@ -2683,6 +2697,7 @@
442->>>>>>> MERGE-SOURCE
443+@@ -2683,6 +2698,7 @@
444
445 return(DB_ERROR);
446 }
447@@ -965,8 +1001,7 @@
448 }
449
450 /* Check that os_fast_mutexes work as expected */
451-<<<<<<< TREE
452-@@ -2707,6 +2716,10 @@
453+@@ -2707,6 +2723,10 @@
454
455 os_fast_mutex_free(&srv_os_test_mutex);
456
457@@ -977,10 +1012,7 @@
458 if (srv_print_verbose_log) {
459 ib_logf(IB_LOG_LEVEL_INFO,
460 "%s started; log sequence number " LSN_PF "",
461-@@ -2739,6 +2752,7 @@
462-=======
463-@@ -2739,6 +2754,7 @@
464->>>>>>> MERGE-SOURCE
465+@@ -2739,6 +2759,7 @@
466 fts_optimize_init();
467 }
468
469@@ -988,11 +1020,7 @@
470 srv_was_started = TRUE;
471
472 return(DB_SUCCESS);
473-<<<<<<< TREE
474-@@ -2794,7 +2808,7 @@
475-=======
476-@@ -2794,7 +2810,7 @@
477->>>>>>> MERGE-SOURCE
478+@@ -2794,7 +2815,7 @@
479 return(DB_SUCCESS);
480 }
481
482
483=== modified file 'src/compact.cc'
484--- src/compact.cc 2013-04-16 10:35:58 +0000
485+++ src/compact.cc 2013-04-23 10:01:10 +0000
486@@ -157,7 +157,7 @@
487 "clustered index root page of tablespace %s. "
488 "Will not be compacted.\n",
489 cursor->thread_n,
490- page_type, cursor->path);
491+ page_type, cursor->rel_path);
492
493 cp->skip = TRUE;
494
495
496=== modified file 'src/fil_cur.cc'
497--- src/fil_cur.cc 2013-04-16 10:35:58 +0000
498+++ src/fil_cur.cc 2013-04-23 10:01:10 +0000
499@@ -32,6 +32,48 @@
500 /* Size of read buffer in pages */
501 #define XB_FIL_CUR_PAGES 64
502
503+/***********************************************************************
504+Extracts the relative path ("database/table.ibd") of a tablespace from a
505+specified possibly absolute path.
506+
507+For user tablespaces both "./database/table.ibd" and
508+"/remote/dir/database/table.ibd" result in "database/table.ibd".
509+
510+For system tablepsaces (i.e. When is_system is TRUE) both "/remote/dir/ibdata1"
511+and "./ibdata1" yield "ibdata1" in the output. */
512+static
513+const char *
514+xb_get_relative_path(
515+/*=================*/
516+ const char* path, /*!< in: tablespace path (either
517+ relative or absolute) */
518+ ibool is_system) /*!< in: TRUE for system tablespaces,
519+ i.e. when only the filename must be
520+ returned. */
521+{
522+ const char *next;
523+ const char *cur;
524+ const char *prev;
525+
526+ prev = NULL;
527+ cur = path;
528+
529+ while ((next = strchr(cur, SRV_PATH_SEPARATOR)) != NULL) {
530+
531+ prev = cur;
532+ cur = next + 1;
533+ }
534+
535+ if (is_system) {
536+
537+ return(cur);
538+ } else {
539+
540+ return((prev == NULL) ? cur : prev);
541+ }
542+
543+}
544+
545 /************************************************************************
546 Open a source file cursor and initialize the associated read filter.
547
548@@ -57,21 +99,15 @@
549 cursor->space_id = node->space->id;
550 cursor->is_system = trx_sys_sys_space(node->space->id);
551
552- /* Make the file path relative to the backup root,
553- i.e. "ibdata1" for system tablespace or database/table.ibd for
554- per-table spaces. */
555- if (cursor->is_system) {
556- char *next, *p;
557+ strncpy(cursor->abs_path, node->space->name, sizeof(cursor->abs_path));
558
559- p = node->name;
560- while ((next = strstr(p, SRV_PATH_SEPARATOR_STR)) != NULL) {
561- p = next + 1;
562- }
563- strncpy(cursor->path, p, sizeof(cursor->path));
564- } else {
565- /* file per table style "./database/table.ibd" */
566- strncpy(cursor->path, node->name, sizeof(cursor->path));
567- }
568+ /* Get the relative path for the destination tablespace name, i.e. the
569+ one that can be appended to the backup root directory. Non-system
570+ tablespaces may have absolute paths for remote tablespaces in MySQL
571+ 5.6+. We want to make "local" copies for the backup. */
572+ strncpy(cursor->rel_path,
573+ xb_get_relative_path(node->name, cursor->is_system),
574+ sizeof(cursor->rel_path));
575
576 /* Open the file */
577
578@@ -222,7 +258,7 @@
579 "Error: failed to read page after "
580 "10 retries. File %s seems to be "
581 "corrupted.\n", cursor->thread_n,
582- cursor->path);
583+ cursor->abs_path);
584 ret = XB_FIL_CUR_ERROR;
585 break;
586 }
587
588=== modified file 'src/fil_cur.h'
589--- src/fil_cur.h 2013-04-16 10:35:58 +0000
590+++ src/fil_cur.h 2013-04-23 10:01:10 +0000
591@@ -31,7 +31,10 @@
592
593 struct xb_fil_cur_t {
594 os_file_t file; /*!< source file handle */
595- char path[FN_REFLEN];/*!< normalized file path */
596+ char rel_path[FN_REFLEN];
597+ /*!< normalized file path */
598+ char abs_path[FN_REFLEN];
599+ /*!< absolute file path */
600 MY_STAT statinfo; /*!< information about the file */
601 ulint zip_size; /*!< compressed page size in bytes or 0
602 for uncompressed pages */
603
604=== modified file 'src/innodb_int.h'
605--- src/innodb_int.h 2013-04-16 10:35:58 +0000
606+++ src/innodb_int.h 2013-04-23 10:01:10 +0000
607@@ -212,8 +212,11 @@
608 # define ut_dulint_align_up(A, B) ((A + B - 1) & ~((ib_int64_t)B - 1))
609
610 #ifndef XTRADB_BASED
611-/* MySQL 5.1 - 5.6 */
612-#define trx_sys_sys_space(id) (id == 0)
613+# if MYSQL_VERSION_ID >= 50600
614+# define trx_sys_sys_space(id) (!fil_is_user_tablespace_id(id))
615+# else
616+# define trx_sys_sys_space(id) (id == 0)
617+# endif
618 #endif /* XTRADB_BASED */
619
620 #if (MYSQL_VERSION_ID >= 50500) && (MYSQL_VERSION_ID < 50600)
621@@ -242,10 +245,8 @@
622
623 #ifdef __WIN__
624 #define SRV_PATH_SEPARATOR '\\'
625-#define SRV_PATH_SEPARATOR_STR "\\"
626 #else
627 #define SRV_PATH_SEPARATOR '/'
628-#define SRV_PATH_SEPARATOR_STR "/"
629 #endif
630
631 #ifndef UNIV_PAGE_SIZE_MAX
632
633=== modified file 'src/write_filt.cc'
634--- src/write_filt.cc 2013-03-22 09:14:31 +0000
635+++ src/write_filt.cc 2013-04-23 10:01:10 +0000
636@@ -91,7 +91,7 @@
637 if (!xb_write_delta_metadata(meta_name, &info)) {
638 msg("[%02u] xtrabackup: Error: "
639 "failed to write meta info for %s\n",
640- cursor->thread_n, cursor->path);
641+ cursor->thread_n, cursor->rel_path);
642 return(FALSE);
643 }
644
645
646=== modified file 'src/xtrabackup.cc'
647--- src/xtrabackup.cc 2013-04-23 10:01:10 +0000
648+++ src/xtrabackup.cc 2013-04-23 10:01:10 +0000
649@@ -1160,7 +1160,7 @@
650 char *p;
651
652 p = srv_data_file_names[i];
653- while ((p = strstr(p, SRV_PATH_SEPARATOR_STR)) != NULL)
654+ while ((p = strchr(p, SRV_PATH_SEPARATOR)) != NULL)
655 {
656 p++;
657 srv_data_file_names[i] = p;
658@@ -1691,30 +1691,29 @@
659 }
660
661 /************************************************************************
662-Checks if a table specified as a path should be skipped from backup
663-based on the --tables or --tables-file options.
664+Checks if a table specified as a name in the form "database/name" (InnoDB 5.6)
665+or "./database/name.ibd" (InnoDB 5.5-) should be skipped from backup based on
666+the --tables or --tables-file options.
667
668 @return TRUE if the table should be skipped. */
669 static
670 my_bool
671 check_if_skip_table(
672 /******************/
673- const char* path, /*!< in: path to the table */
674- const char* suffix) /*!< in: suffix */
675+ const char* name) /*!< in: path to the table */
676 {
677 char buf[FN_REFLEN];
678 const char *dbname, *tbname;
679 const char *ptr;
680 char *eptr;
681- int dbname_len;
682
683 if (xtrabackup_tables == NULL && xtrabackup_tables_file == NULL) {
684 return(FALSE);
685 }
686
687 dbname = NULL;
688- tbname = path;
689- while ((ptr = strstr(tbname, SRV_PATH_SEPARATOR_STR)) != NULL) {
690+ tbname = name;
691+ while ((ptr = strchr(tbname, SRV_PATH_SEPARATOR)) != NULL) {
692 dbname = tbname;
693 tbname = ptr + 1;
694 }
695@@ -1724,14 +1723,16 @@
696 }
697
698 strncpy(buf, dbname, FN_REFLEN);
699- buf[FN_REFLEN - 1] = 0;
700+ buf[FN_REFLEN - 1] = '\0';
701 buf[tbname - 1 - dbname] = '.';
702
703- dbname_len = strlen(dbname) - strlen(suffix);
704- if (dbname_len < 1) {
705- return(FALSE);
706+ /* Check if there's a suffix in the table name. If so, truncate it. We
707+ rely on the fact that a dot cannot be a part of a table name (it is
708+ encoded by the server with the @NNNN syntax). */
709+ if ((eptr = strchr(&buf[tbname - dbname], '.')) != NULL) {
710+
711+ *eptr = '\0';
712 }
713- buf[dbname_len - 1] = 0;
714
715 /* For partitioned tables first try to match against the regexp
716 without truncating the #P#... suffix so we can backup individual
717@@ -1754,231 +1755,6 @@
718 }
719
720 /***********************************************************************
721-<<<<<<< TREE
722-=======
723-Read meta info for an incremental delta.
724-@return TRUE on success, FALSE on failure. */
725-static my_bool
726-xb_read_delta_metadata(const char *filepath, xb_delta_info_t *info)
727-{
728- FILE* fp;
729- char key[51];
730- char value[51];
731- my_bool r = TRUE;
732-
733- /* set defaults */
734- info->page_size = ULINT_UNDEFINED;
735- info->zip_size = ULINT_UNDEFINED;
736- info->space_id = ULINT_UNDEFINED;
737-
738- fp = fopen(filepath, "r");
739- if (!fp) {
740- /* Meta files for incremental deltas are optional */
741- return(TRUE);
742- }
743-
744- while (!feof(fp)) {
745- if (fscanf(fp, "%50s = %50s\n", key, value) == 2) {
746- if (strcmp(key, "page_size") == 0) {
747- info->page_size = strtoul(value, NULL, 10);
748- } else if (strcmp(key, "zip_size") == 0) {
749- info->zip_size = strtoul(value, NULL, 10);
750- } else if (strcmp(key, "space_id") == 0) {
751- info->space_id = strtoul(value, NULL, 10);
752- }
753- }
754- }
755-
756- fclose(fp);
757-
758- if (info->page_size == ULINT_UNDEFINED) {
759- msg("xtrabackup: page_size is required in %s\n", filepath);
760- r = FALSE;
761- }
762- if (info->space_id == ULINT_UNDEFINED) {
763- msg("xtrabackup: Warning: This backup was taken with XtraBackup 2.0.1 "
764- "or earlier, some DDL operations between full and incremental "
765- "backups may be handled incorrectly\n");
766- }
767-
768- return(r);
769-}
770-
771-/***********************************************************************
772-Write meta info for an incremental delta.
773-@return TRUE on success, FALSE on failure. */
774-static
775-my_bool
776-xb_write_delta_metadata(ds_ctxt_t *ds_ctxt, const char *filename,
777- const xb_delta_info_t *info)
778-{
779- datasink_t *ds = ds_ctxt->datasink;
780- ds_file_t *f;
781- char buf[64];
782- my_bool ret;
783- size_t len;
784- MY_STAT mystat;
785-
786- snprintf(buf, sizeof(buf),
787- "page_size = %lu\n"
788- "zip_size = %lu\n"
789- "space_id = %lu\n",
790- info->page_size, info->zip_size, info->space_id);
791- len = strlen(buf);
792-
793- mystat.st_size = len;
794- mystat.st_mtime = my_time(0);
795-
796- f = ds->open(ds_ctxt, filename, &mystat);
797- if (f == NULL) {
798- msg("xtrabackup: Error: cannot open output stream for %s\n",
799- filename);
800- return(FALSE);
801- }
802-
803- ret = ds->write(f, buf, len) == 0;
804-
805- ds->close(f);
806-
807- return(ret);
808-}
809-
810-/* ================= backup ================= */
811-static void
812-xtrabackup_io_throttling(void)
813-{
814- if (xtrabackup_throttle && (io_ticket--) < 0) {
815- os_event_reset(wait_throttle);
816- os_event_wait(wait_throttle);
817- }
818-}
819-
820-#ifndef XTRADB_BASED
821-# if MYSQL_VERSION_ID >= 50600
822-# define trx_sys_sys_space(id) (!fil_is_user_tablespace_id(id))
823-# else
824-# define trx_sys_sys_space(id) (id == 0)
825-# endif
826-#endif
827-
828-/****************************************************************//**
829-A simple function to open or create a file.
830-@return own: handle to the file, not defined if error, error number
831-can be retrieved with os_file_get_last_error */
832-UNIV_INLINE
833-os_file_t
834-xb_file_create_no_error_handling(
835-/*=============================*/
836- const char* name, /*!< in: name of the file or path as a
837- null-terminated string */
838- ulint create_mode,/*!< in: OS_FILE_OPEN if an existing file
839- is opened (if does not exist, error), or
840- OS_FILE_CREATE if a new file is created
841- (if exists, error) */
842- ulint access_type,/*!< in: OS_FILE_READ_ONLY,
843- OS_FILE_READ_WRITE, or
844- OS_FILE_READ_ALLOW_DELETE; the last option is
845- used by a backup program reading the file */
846- ibool* success)/*!< out: TRUE if succeed, FALSE if error */
847-{
848-#if MYSQL_VERSION_ID > 50500
849- return os_file_create_simple_no_error_handling(
850- 0, /* innodb_file_data_key */
851- name, create_mode, access_type, success);
852-#else
853- return os_file_create_simple_no_error_handling(
854- name, create_mode, access_type, success);
855-#endif
856-}
857-
858-/****************************************************************//**
859-Opens an existing file or creates a new.
860-@return own: handle to the file, not defined if error, error number
861-can be retrieved with os_file_get_last_error */
862-UNIV_INLINE
863-os_file_t
864-xb_file_create(
865-/*===========*/
866- const char* name, /*!< in: name of the file or path as a
867- null-terminated string */
868- ulint create_mode,/*!< in: OS_FILE_OPEN if an existing file
869- is opened (if does not exist, error), or
870- OS_FILE_CREATE if a new file is created
871- (if exists, error),
872- OS_FILE_OVERWRITE if a new file is created
873- or an old overwritten;
874- OS_FILE_OPEN_RAW, if a raw device or disk
875- partition should be opened */
876- ulint purpose,/*!< in: OS_FILE_AIO, if asynchronous,
877- non-buffered i/o is desired,
878- OS_FILE_NORMAL, if any normal file;
879- NOTE that it also depends on type, os_aio_..
880- and srv_.. variables whether we really use
881- async i/o or unbuffered i/o: look in the
882- function source code for the exact rules */
883- ulint type, /*!< in: OS_DATA_FILE or OS_LOG_FILE */
884- ibool* success)/*!< out: TRUE if succeed, FALSE if error */
885-{
886- os_file_t result;
887-#if MYSQL_VERSION_ID >= 50600
888- ibool old_srv_read_only_mode = srv_read_only_mode;
889-
890- srv_read_only_mode = FALSE;
891-#endif
892-#if MYSQL_VERSION_ID > 50500
893- result = os_file_create(0 /* innodb_file_data_key */,
894- name, create_mode, purpose, type, success);
895-#else
896- result = os_file_create(name, create_mode, purpose, type, success);
897-#endif
898-#if MYSQL_VERSION_ID >= 50600
899- srv_read_only_mode = old_srv_read_only_mode;
900-#endif
901- return result;
902-}
903-
904-/***********************************************************************//**
905-Renames a file (can also move it to another directory). It is safest that the
906-file is closed before calling this function.
907-@return TRUE if success */
908-UNIV_INLINE
909-ibool
910-xb_file_rename(
911-/*===========*/
912- const char* oldpath,/*!< in: old file path as a null-terminated
913- string */
914- const char* newpath)/*!< in: new file path */
915-{
916-#if MYSQL_VERSION_ID > 50500
917- return os_file_rename(
918- 0 /* innodb_file_data_key */, oldpath, newpath);
919-#else
920- return os_file_rename(oldpath, newpath);
921-#endif
922-}
923-
924-UNIV_INLINE
925-void
926-xb_file_set_nocache(
927-/*================*/
928- os_file_t fd, /* in: file descriptor to alter */
929- const char* file_name, /* in: used in the diagnostic message */
930- const char* operation_name) /* in: used in the diagnostic message,
931- we call os_file_set_nocache()
932- immediately after opening or creating
933- a file, so this is either "open" or
934- "create" */
935-{
936-#ifndef __WIN__
937- if (srv_unix_file_flush_method == SRV_UNIX_O_DIRECT) {
938- os_file_set_nocache(fd, file_name, operation_name);
939- }
940-#endif
941-}
942-
943-#ifdef INNODB_VERSION_SHORT
944-/***********************************************************************
945->>>>>>> MERGE-SOURCE
946 Reads the space flags from a given data file and returns the compressed
947 page size, or 0 if the space is not compressed. */
948 ulint
949@@ -2021,10 +1797,24 @@
950 xb_write_filt_ctxt_t write_filt_ctxt;
951 const char *action;
952 xb_read_filt_t *read_filter;
953-
954- if (!trx_sys_sys_space(node->space->id) && /* don't skip system space */
955- check_if_skip_table(node->name, "ibd")) {
956- msg("[%02u] Skipping %s\n", thread_n, node->name);
957+ ibool is_system;
958+
959+ /* Get the name and the path for the tablespace. node->name always
960+ contains the path (which may be absolute for remote tablespaces in
961+ 5.6+). space->name contains the tablespace name in the form
962+ "./database/table.ibd" (in 5.5-) or "database/table" (in 5.6+). For a
963+ multi-node shared tablespace, space->name contains the name of the first
964+ node, but that's irrelevant, since we only need node_name to match them
965+ against filters, and the shared tablespace is always copied regardless
966+ of the filters value. */
967+
968+ const char* const node_name = node->space->name;
969+ const char* const node_path = node->name;
970+
971+ is_system = trx_sys_sys_space(node->space->id);
972+
973+ if (!is_system && check_if_skip_table(node_name)) {
974+ msg("[%02u] Skipping %s.\n", thread_n, node_name);
975 return(FALSE);
976 }
977
978@@ -2041,7 +1831,7 @@
979 goto error;
980 }
981
982- strncpy(dst_name, cursor.path, sizeof(dst_name));
983+ strncpy(dst_name, cursor.rel_path, sizeof(dst_name));
984
985 /* Setup the page write filter */
986 if (xtrabackup_incremental) {
987@@ -2082,7 +1872,7 @@
988 } else {
989 action = "Streaming";
990 }
991- msg("[%02u] %s %s\n", thread_n, action, node->name);
992+ msg("[%02u] %s %s\n", thread_n, action, node_path);
993 } else {
994 if (xtrabackup_compress) {
995 if (xtrabackup_encrypt) {
996@@ -2096,7 +1886,7 @@
997 action = "Copying";
998 }
999 msg("[%02u] %s %s to %s\n", thread_n, action,
1000- node->name, dstfile->path);
1001+ node_path, dstfile->path);
1002 }
1003
1004 /* The main copy loop */
1005@@ -2147,8 +1937,8 @@
1006 msg("[%02u] xtrabackup: Warning: We assume the "
1007 "table was dropped during xtrabackup execution "
1008 "and ignore the file.\n", thread_n);
1009- msg("[%02u] xtrabackup: Warning: skipping file %s.\n",
1010- thread_n, node->name);
1011+ msg("[%02u] xtrabackup: Warning: skipping tablespace %s.\n",
1012+ thread_n, node_name);
1013 return(FALSE);
1014 }
1015
1016@@ -3791,8 +3581,7 @@
1017 table = dict_table_get_low(table_name);
1018 mem_free(table_name);
1019
1020-
1021- if (table && check_if_skip_table(table->name, ""))
1022+ if (table && check_if_skip_table(table->name))
1023 goto skip;
1024
1025
1026@@ -5038,7 +4827,7 @@
1027
1028 p = info_file_path;
1029 prev = NULL;
1030- while ((next = strstr(p, SRV_PATH_SEPARATOR_STR)) != NULL)
1031+ while ((next = strchr(p, SRV_PATH_SEPARATOR)) != NULL)
1032 {
1033 prev = p;
1034 p = next + 1;
1035
1036=== modified file 'test/inc/common.sh'
1037--- test/inc/common.sh 2013-04-23 10:01:10 +0000
1038+++ test/inc/common.sh 2013-04-23 10:01:10 +0000
1039@@ -220,17 +220,8 @@
1040 MYSQLD_PORT="${SRV_MYSQLD_PORT[$id]}"
1041 MYSQLD_SOCKET="${SRV_MYSQLD_SOCKET[$id]}"
1042
1043-<<<<<<< TREE
1044- MYSQL_ARGS="--no-defaults --socket=${MYSQLD_SOCKET} --user=root"
1045- MYSQLD_ARGS="--no-defaults --basedir=${MYSQL_BASEDIR} \
1046---log-error=${MYSQLD_ERRFILE}
1047---socket=${MYSQLD_SOCKET} --port=${MYSQLD_PORT} --server-id=$id \
1048---datadir=${MYSQLD_DATADIR} --tmpdir=${MYSQLD_TMPDIR} --log-bin=mysql-bin \
1049---relay-log=mysql-relay-bin --pid-file=${MYSQLD_PIDFILE} ${MYSQLD_EXTRA_ARGS}"
1050-=======
1051 MYSQL_ARGS="--defaults-file=$MYSQLD_VARDIR/my.cnf "
1052 MYSQLD_ARGS="--defaults-file=$MYSQLD_VARDIR/my.cnf ${MYSQLD_EXTRA_ARGS}"
1053->>>>>>> MERGE-SOURCE
1054 if [ "`whoami`" = "root" ]
1055 then
1056 MYSQLD_ARGS="$MYSQLD_ARGS --user=root"
1057@@ -280,6 +271,7 @@
1058 basedir=${MYSQL_BASEDIR}
1059 datadir=${MYSQLD_DATADIR}
1060 tmpdir=${MYSQLD_TMPDIR}
1061+log-error=${MYSQLD_ERRFILE}
1062 log-bin=mysql-bin
1063 relay-log=mysql-relay-bin
1064 pid-file=${MYSQLD_PIDFILE}
1065
1066=== modified file 'test/t/bug977101.sh'
1067--- test/t/bug977101.sh 2013-04-23 10:01:10 +0000
1068+++ test/t/bug977101.sh 2013-04-23 10:01:10 +0000
1069@@ -17,27 +17,14 @@
1070
1071 # Check that binlog info is correct with --safe-slave-backup
1072 innobackupex --no-timestamp --safe-slave-backup $topdir/backup
1073-<<<<<<< TREE
1074-run_cmd egrep -q '^mysql-bin.000001[[:space:]]+[0-9]+[[:space:]]+$' \
1075-=======
1076-egrep -q '^mysql-bin.[0-9]+[[:space:]]+[0-9]+[[:space:]]+$' \
1077->>>>>>> MERGE-SOURCE
1078+run_cmd 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-<<<<<<< TREE
1086-run_cmd egrep -q '^mysql-bin.000001[[:space:]]+[0-9]+[[:space:]]+$' \
1087-=======
1088-egrep -q '^mysql-bin.[0-9]+[[:space:]]+[0-9]+[[:space:]]+$' \
1089->>>>>>> MERGE-SOURCE
1090+run_cmd egrep -q '^mysql-bin.[0-9]+[[:space:]]+[0-9]+[[:space:]]+$' \
1091 $topdir/backup/xtrabackup_binlog_info
1092-<<<<<<< TREE
1093-run_cmd egrep -q \
1094- '^CHANGE MASTER TO MASTER_LOG_FILE='\''mysql-bin.000001'\'', MASTER_LOG_POS=[0-9]+$' \
1095-=======
1096-egrep -q '^CHANGE MASTER TO MASTER_LOG_FILE='\''mysql-bin.[0-9]+'\'', MASTER_LOG_POS=[0-9]+$' \
1097->>>>>>> MERGE-SOURCE
1098+run_cmd egrep -q '^CHANGE MASTER TO MASTER_LOG_FILE='\''mysql-bin.[0-9]+'\'', MASTER_LOG_POS=[0-9]+$' \
1099 $topdir/backup/xtrabackup_slave_info
1100
1101=== modified file 'test/t/ib_doublewrite.sh'
1102--- test/t/ib_doublewrite.sh 2013-04-23 10:01:10 +0000
1103+++ test/t/ib_doublewrite.sh 2013-04-23 10:01:10 +0000
1104@@ -14,10 +14,6 @@
1105 exit $SKIPPED_EXIT_CODE
1106 fi
1107
1108-<<<<<<< TREE
1109-DBLWR=${TEST_BASEDIR}/var1/data/dblwr.ibd
1110-start_server --innodb_file_per_table --innodb_doublewrite_file=${DBLWR}
1111-=======
1112 DBLWR=dblwr.ibd
1113
1114 MYSQLD_EXTRA_MY_CNF_OPTS="
1115@@ -25,7 +21,6 @@
1116 innodb_doublewrite_file=$DBLWR
1117 "
1118 start_server
1119->>>>>>> MERGE-SOURCE
1120 load_dbase_schema incremental_sample
1121
1122 # Workaround for bug #1072695
1123
1124=== modified file 'test/t/ib_part_include.sh'
1125--- test/t/ib_part_include.sh 2013-03-07 11:38:14 +0000
1126+++ test/t/ib_part_include.sh 2013-04-23 10:01:10 +0000
1127@@ -27,9 +27,9 @@
1128
1129 # also test xtrabackup --stats work with --tables-file
1130 COUNT=`xtrabackup --stats --tables='test.test$' --datadir=$topdir/backup \
1131- | grep table: | awk '{print $2}' | sort -u | wc -l`
1132+ | grep table: | grep -v SYS_ | awk '{print $2}' | sort -u | wc -l`
1133
1134-if [ $COUNT != 7 ] ; then
1135+if [ $COUNT != 5 ] ; then
1136 vlog "xtrabackup --stats does not work"
1137 exit -1
1138 fi
1139
1140=== modified file 'test/t/ib_part_tf_innodb.sh'
1141--- test/t/ib_part_tf_innodb.sh 2013-03-07 11:38:14 +0000
1142+++ test/t/ib_part_tf_innodb.sh 2013-04-23 10:01:10 +0000
1143@@ -30,9 +30,9 @@
1144 vlog "Backup taken"
1145
1146 COUNT=`xtrabackup --stats --tables-file=$topdir/tables --datadir=$topdir/backup \
1147- | grep table: | awk '{print $2}' | sort -u | wc -l`
1148+ | grep table: | grep -v SYS_ | awk '{print $2}' | sort -u | wc -l`
1149 echo "COUNT = $COUNT"
1150-if [ $COUNT != 7 ] ; then
1151+if [ $COUNT != 5 ] ; then
1152 vlog "xtrabackup --stats does not work"
1153 exit -1
1154 fi
1155
1156=== added file 'test/t/remote_tablespaces.sh'
1157--- test/t/remote_tablespaces.sh 1970-01-01 00:00:00 +0000
1158+++ test/t/remote_tablespaces.sh 2013-04-23 10:01:10 +0000
1159@@ -0,0 +1,53 @@
1160+########################################################################
1161+# Test remote tablespaces in InnoDB 5.6
1162+########################################################################
1163+
1164+. inc/common.sh
1165+
1166+if [ ${MYSQL_VERSION:0:3} != "5.6" ]
1167+then
1168+ echo "Requires a 5.6 server" > $SKIPPED_REASON
1169+ exit $SKIPPED_EXIT_CODE
1170+fi
1171+
1172+start_server --innodb_file_per_table
1173+
1174+remote_dir=$TEST_BASEDIR/var1/remote_dir
1175+
1176+$MYSQL $MYSQL_ARGS test <<EOF
1177+CREATE TABLE t(id INT AUTO_INCREMENT PRIMARY KEY, c INT)
1178+ DATA DIRECTORY = '$remote_dir' ENGINE=InnoDB;
1179+INSERT INTO t(c) VALUES (1), (2), (3), (4), (5), (6), (7), (8);
1180+EOF
1181+
1182+# Generate some log data, as we also want to test recovery of remote tablespaces
1183+for ((i=0; i<12; i++))
1184+do
1185+ $MYSQL $MYSQL_ARGS test <<EOF
1186+ INSERT INTO t(c) SELECT c FROM t;
1187+EOF
1188+done
1189+
1190+checksum_a=`checksum_table test t`
1191+
1192+innobackupex --no-timestamp $topdir/backup
1193+
1194+stop_server
1195+
1196+rm -rf $mysql_datadir/*
1197+
1198+innobackupex --apply-log $topdir/backup
1199+innobackupex --copy-back $topdir/backup
1200+
1201+start_server
1202+
1203+checksum_b=`checksum_table test t`
1204+
1205+vlog "Old checksum: $checksum_a"
1206+vlog "New checksum: $checksum_b"
1207+
1208+if [ "$checksum_a" != "$checksum_b" ]
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 2013-04-23 10:01:10 +0000
1216+++ test/t/xb_basic.sh 2013-03-11 19:11:29 +0000
1217@@ -1,39 +1,5 @@
1218-<<<<<<< TREE
1219 ############################################################################
1220 # Test basic local backup
1221 ############################################################################
1222
1223 . inc/xb_local.sh
1224-=======
1225-. inc/common.sh
1226-
1227-start_server
1228-
1229-load_dbase_schema sakila
1230-load_dbase_data sakila
1231-
1232-mkdir -p $topdir/backup
1233-innobackupex $topdir/backup
1234-backup_dir=`grep "innobackupex: Backup created in directory" $OUTFILE | awk -F\' '{ print $2}'`
1235-vlog "Backup created in directory $backup_dir"
1236-
1237-stop_server
1238-# Remove datadir
1239-rm -r $mysql_datadir
1240-# Restore sakila
1241-vlog "Applying log"
1242-vlog "###########"
1243-vlog "# PREPARE #"
1244-vlog "###########"
1245-innobackupex --apply-log $backup_dir
1246-vlog "Restoring MySQL datadir"
1247-mkdir -p $mysql_datadir
1248-vlog "###########"
1249-vlog "# RESTORE #"
1250-vlog "###########"
1251-innobackupex --copy-back $backup_dir
1252-
1253-start_server
1254-# Check sakila
1255-run_cmd ${MYSQL} ${MYSQL_ARGS} -e "SELECT count(*) from actor" sakila
1256->>>>>>> MERGE-SOURCE

Subscribers

People subscribed via source and target branches

to all changes: