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

Proposed by Alexey Kopytov
Status: Merged
Approved by: Laurynas Biveinis
Approved revision: no longer in the source branch.
Merged at revision: 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 (community) Approve
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.
Revision history for this message
Alexey Kopytov (akopytov) wrote :
Revision history for this message
Laurynas Biveinis (laurynas-biveinis) wrote :

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
=== modified file 'innobackupex'
--- innobackupex 2013-04-03 07:04:25 +0000
+++ innobackupex 2013-04-23 10:01:01 +0000
@@ -230,6 +230,7 @@
230my $copy_dir_dst;230my $copy_dir_dst;
231my $copy_dir_exclude_regexp;231my $copy_dir_exclude_regexp;
232my $copy_dir_overwrite;232my $copy_dir_overwrite;
233my $copy_dir_resolve_isl;
233234
234######################################################################235######################################################################
235# program execution begins here236# program execution begins here
@@ -618,11 +619,31 @@
618#619#
619sub process_file {620sub process_file {
620 my $process_func = shift;621 my $process_func = shift;
622 my $dst_path;
621623
622 if (/$copy_dir_exclude_regexp/) {624 if (/$copy_dir_exclude_regexp/) {
623 return;625 return;
624 }626 }
625 (my $dst_path = $File::Find::name) =~ s/^$copy_dir_src/$copy_dir_dst/;627
628 # If requested, check if there is a "link" in the .isl file for an InnoDB
629 # tablespace and use it as a destination path.
630 if ($copy_dir_resolve_isl && $File::Find::name =~ m/\.ibd$/) {
631 my $isl_path;
632
633 ($isl_path = $File::Find::name) =~ s/\.ibd$/.isl/;
634 if (-e "$isl_path") {
635 my @lines;
636 print STDERR "Found an .isl file for $File::Find::name\n";
637 file_to_array($isl_path, \@lines);
638 $dst_path = $lines[0];
639 print STDERR "Using $dst_path as the destination path\n";
640 }
641 }
642
643 if (! defined $dst_path) {
644 ($dst_path = $File::Find::name) =~ s/^$copy_dir_src/$copy_dir_dst/;
645 }
646
626 if (-d "$File::Find::name") {647 if (-d "$File::Find::name") {
627 # Create the directory in the destination if necessary648 # Create the directory in the destination if necessary
628 if (! -e "$dst_path") {649 if (! -e "$dst_path") {
@@ -657,14 +678,16 @@
657}678}
658679
659#680#
660# copy_dir_recursively subroutine does a recursive copy of a specified681# copy_dir_recursively subroutine does a recursive copy of a specified directory
661# directory excluding files matching a specifies regexp. If $overwrite682# excluding files matching a specifies regexp. If $overwrite is 1, it overwrites
662# is 1, it overwrites the existing files.683# the existing files. If $resolve_isl is 1, it also resolves InnoDB .isl files,
684# i.e. copies to the absolute path specified in the corresponding .isl file
685# rather than the default location
663#686#
664# SYNOPSIS 687# SYNOPSIS
665#688#
666# copy_dir_recursively($src_dir, $dst_dir, $exclude_regexp,689# copy_dir_recursively($src_dir, $dst_dir, $exclude_regexp,
667# $overwrite);690# $overwrite, $resolve_isl);
668#691#
669# TODO692# TODO
670#693#
@@ -676,6 +699,7 @@
676 $copy_dir_dst = File::Spec->canonpath(shift);699 $copy_dir_dst = File::Spec->canonpath(shift);
677 $copy_dir_exclude_regexp = shift;700 $copy_dir_exclude_regexp = shift;
678 $copy_dir_overwrite = shift;701 $copy_dir_overwrite = shift;
702 $copy_dir_resolve_isl = shift;
679703
680 find(\&copy_file_callback, $copy_dir_src);704 find(\&copy_file_callback, $copy_dir_src);
681}705}
@@ -686,7 +710,7 @@
686# SYNOPSIS710# SYNOPSIS
687#711#
688# move_dir_recursively($src_dir, $dst_dir, $exclude_regexp,712# move_dir_recursively($src_dir, $dst_dir, $exclude_regexp,
689# $overwrite);713# $overwrite, $resolve_isl);
690#714#
691# TODO715# TODO
692#716#
@@ -698,6 +722,7 @@
698 $copy_dir_dst = File::Spec->canonpath(shift);722 $copy_dir_dst = File::Spec->canonpath(shift);
699 $copy_dir_exclude_regexp = shift;723 $copy_dir_exclude_regexp = shift;
700 $copy_dir_overwrite = shift;724 $copy_dir_overwrite = shift;
725 $copy_dir_resolve_isl = shift;
701726
702 find(\&move_file_callback, $copy_dir_src);727 find(\&move_file_callback, $copy_dir_src);
703}728}
@@ -715,12 +740,15 @@
715 get_option(\%config, $option_defaults_group, 'innodb_data_file_path');740 get_option(\%config, $option_defaults_group, 'innodb_data_file_path');
716 my $orig_iblog_dir =741 my $orig_iblog_dir =
717 get_option(\%config, $option_defaults_group, 'innodb_log_group_home_dir');742 get_option(\%config, $option_defaults_group, 'innodb_log_group_home_dir');
743 my $orig_undo_dir = $orig_ibdata_dir;
718 my $iblog_files = 'ib_logfile.*';744 my $iblog_files = 'ib_logfile.*';
745 my $ibundo_files = 'undo[0-9]{3}';
719 my $excluded_files = 746 my $excluded_files =
720 '\.\.?|backup-my\.cnf|xtrabackup_logfile|' .747 '\.\.?|backup-my\.cnf|xtrabackup_logfile|' .
721 'xtrabackup_binary|xtrabackup_binlog_info|xtrabackup_checkpoints|' .748 'xtrabackup_binary|xtrabackup_binlog_info|xtrabackup_checkpoints|' .
722 '.*\.qp|' .749 '.*\.qp|' .
723 $iblog_files;750 $iblog_files . '|'.
751 $ibundo_files;
724 my $compressed_data_file = '.*\.ibz$';752 my $compressed_data_file = '.*\.ibz$';
725 my $file;753 my $file;
726 my $backup_innodb_data_file_path;754 my $backup_innodb_data_file_path;
@@ -732,6 +760,10 @@
732 $excluded_files = $excluded_files . '|' . $doublewrite_file;760 $excluded_files = $excluded_files . '|' . $doublewrite_file;
733 }761 }
734762
763 if (has_option(\%config, $option_defaults_group, 'innodb_undo_directory')) {
764 $orig_undo_dir = get_option(\%config, $option_defaults_group,
765 'innodb_undo_directory');
766 }
735 # check whether files should be copied or moved to dest directory767 # check whether files should be copied or moved to dest directory
736 my $move_or_copy_file = $move_flag ? \&move_file : \&copy_file;768 my $move_or_copy_file = $move_flag ? \&move_file : \&copy_file;
737 my $move_or_copy_dir = $move_flag ?769 my $move_or_copy_dir = $move_flag ?
@@ -743,6 +775,10 @@
743 if_directory_exists_and_empty($orig_datadir, "Original data");775 if_directory_exists_and_empty($orig_datadir, "Original data");
744 if_directory_exists_and_empty($orig_ibdata_dir, "Original InnoDB data");776 if_directory_exists_and_empty($orig_ibdata_dir, "Original InnoDB data");
745 if_directory_exists_and_empty($orig_iblog_dir, "Original InnoDB log");777 if_directory_exists_and_empty($orig_iblog_dir, "Original InnoDB log");
778 if ($orig_undo_dir) {
779 if_directory_exists_and_empty($orig_undo_dir,
780 "Original undo directory");
781 }
746782
747 # check that the original options file and the backup options file have783 # check that the original options file and the backup options file have
748 # the same value for "innodb_data_file_path" option784 # the same value for "innodb_data_file_path" option
@@ -786,7 +822,7 @@
786 my $excluded_regexp = '^(' . $excluded_files . ')$';822 my $excluded_regexp = '^(' . $excluded_files . ')$';
787 print STDERR "$prefix Starting to $operation files in '$backup_dir'\n"; 823 print STDERR "$prefix Starting to $operation files in '$backup_dir'\n";
788 print STDERR "$prefix back to original data directory '$orig_datadir'\n";824 print STDERR "$prefix back to original data directory '$orig_datadir'\n";
789 &$move_or_copy_dir($backup_dir, $orig_datadir, $excluded_regexp, 0);825 &$move_or_copy_dir($backup_dir, $orig_datadir, $excluded_regexp, 0, 1);
790826
791 # copy InnoDB data files to original InnoDB data directory827 # copy InnoDB data files to original InnoDB data directory
792 print STDERR "\n$prefix Starting to $operation InnoDB system tablespace\n";828 print STDERR "\n$prefix Starting to $operation InnoDB system tablespace\n";
@@ -801,6 +837,22 @@
801 &$move_or_copy_file($src_name, $dst_name);837 &$move_or_copy_file($src_name, $dst_name);
802 }838 }
803839
840 # copy InnoDB undo tablespaces to innodb_undo_directory (if specified), or
841 # to the InnoDB data directory
842 print STDERR "\n$prefix Starting to $operation InnoDB undo tablespaces\n";
843 print STDERR "$prefix in '$backup_dir'\n";
844 print STDERR "$prefix back to '$orig_undo_dir'\n";
845 opendir(DIR, $backup_dir)
846 || Die "Can't open directory '$backup_dir': $!\n";
847 while (defined($file = readdir(DIR))) {
848 if ($file =~ /^$ibundo_files$/ && -f "$backup_dir/$file") {
849 $src_name = escape_path("$backup_dir/$file");
850 $dst_name = escape_path("$orig_undo_dir");
851 &$move_or_copy_file($src_name, $dst_name);
852 }
853 }
854 closedir(DIR);
855
804 # copy InnoDB log files to original InnoDB log directory856 # copy InnoDB log files to original InnoDB log directory
805 opendir(DIR, $backup_dir) 857 opendir(DIR, $backup_dir)
806 || Die "Can't open directory '$backup_dir': $!\n";858 || Die "Can't open directory '$backup_dir': $!\n";
@@ -897,7 +949,7 @@
897 copy_dir_recursively($option_incremental_dir, $backup_dir,949 copy_dir_recursively($option_incremental_dir, $backup_dir,
898 '^(\.\.?|backup-my\.cnf|xtrabackup_logfile|' .950 '^(\.\.?|backup-my\.cnf|xtrabackup_logfile|' .
899 'xtrabackup_binary|xtrabackup_checkpoints|' .951 'xtrabackup_binary|xtrabackup_checkpoints|' .
900 '.*\.delta|.*\.meta|ib_logfile.*)$', 1);952 '.*\.delta|.*\.meta|ib_logfile.*)$', 1, 0);
901 # If the latest backup has no file, we need to remove the old953 # If the latest backup has no file, we need to remove the old
902 # xtrabackup_slave_info file, because it is out of date954 # xtrabackup_slave_info file, because it is out of date
903 # TODO: this will not be needed when bug #856400 is fixed.955 # TODO: this will not be needed when bug #856400 is fixed.
@@ -1810,7 +1862,9 @@
1810 "innodb_log_file_size",1862 "innodb_log_file_size",
1811 "innodb_fast_checksum",1863 "innodb_fast_checksum",
1812 "innodb_page_size",1864 "innodb_page_size",
1813 "innodb_log_block_size"1865 "innodb_log_block_size",
1866 "innodb_undo_directory",
1867 "innodb_undo_tablespaces"
1814 );1868 );
18151869
1816 my $options_dump = "# This MySQL options file was generated by $innobackup_script.\n\n" .1870 my $options_dump = "# This MySQL options file was generated by $innobackup_script.\n\n" .
@@ -2105,7 +2159,7 @@
21052159
21062160
2107#2161#
2108# backup_files subroutine copies .frm, .MRG, .MYD and .MYI files to 2162# backup_files subroutine copies .frm, .isl, .MRG, .MYD and .MYI files to
2109# backup directory.2163# backup directory.
2110#2164#
2111sub backup_files {2165sub backup_files {
@@ -2114,7 +2168,7 @@
2114 my @list;2168 my @list;
2115 my $file;2169 my $file;
2116 my $database;2170 my $database;
2117 my $wildcard = '*.{frm,MYD,MYI,MAD,MAI,MRG,TRG,TRN,ARM,ARZ,CSM,CSV,opt,par}';2171 my $wildcard = '*.{frm,isl,MYD,MYI,MAD,MAI,MRG,TRG,TRN,ARM,ARZ,CSM,CSV,opt,par}';
2118 my $rsync_file_list;2172 my $rsync_file_list;
2119 my $operation;2173 my $operation;
2120 my $rsync_tmpfile_pass1 = "$option_tmpdir/xtrabackup_rsyncfiles_pass1";2174 my $rsync_tmpfile_pass1 = "$option_tmpdir/xtrabackup_rsyncfiles_pass1";
@@ -2172,7 +2226,7 @@
21722226
2173 # copy files of this database2227 # copy files of this database
2174 opendir(DBDIR, "$source_dir/$database");2228 opendir(DBDIR, "$source_dir/$database");
2175 @list = grep(/\.(frm|MYD|MYI|MAD|MAI|MRG|TRG|TRN|ARM|ARZ|CSM|CSV|opt|par)$/, readdir(DBDIR));2229 @list = grep(/\.(frm|isl|MYD|MYI|MAD|MAI|MRG|TRG|TRN|ARM|ARZ|CSM|CSV|opt|par)$/, readdir(DBDIR));
2176 closedir DBDIR;2230 closedir DBDIR;
2177 $file_c = @list;2231 $file_c = @list;
2178 if ($file_c <= $backup_file_print_limit) {2232 if ($file_c <= $backup_file_print_limit) {
21792233
=== modified file 'patches/innodb56.patch'
--- patches/innodb56.patch 2013-04-09 13:44:38 +0000
+++ patches/innodb56.patch 2013-04-23 10:01:01 +0000
@@ -47,16 +47,19 @@
47 #include "trx0sys.h"47 #include "trx0sys.h"
48 #include "row0mysql.h"48 #include "row0mysql.h"
49 #ifndef UNIV_HOTBACKUP49 #ifndef UNIV_HOTBACKUP
50@@ -311,7 +313,7 @@50@@ -311,10 +313,7 @@
51 51
52 /** The tablespace memory cache. This variable is NULL before the module is52 /** The tablespace memory cache. This variable is NULL before the module is
53 initialized. */53 initialized. */
54-static fil_system_t* fil_system = NULL;54-static fil_system_t* fil_system = NULL;
55-
56-/** Determine if (i) is a user tablespace id or not. */
57-# define fil_is_user_tablespace_id(i) ((i) > srv_undo_tablespaces_open)
55+fil_system_t* fil_system = NULL;58+fil_system_t* fil_system = NULL;
56 59
57 /** Determine if (i) is a user tablespace id or not. */60 /** Determine if user has explicitly disabled fsync(). */
58 # define fil_is_user_tablespace_id(i) ((i) > srv_undo_tablespaces_open)61 #ifndef __WIN__
59@@ -376,7 +378,7 @@62@@ -376,7 +375,7 @@
60 off the LRU list if it is in the LRU list. The caller must hold the fil_sys63 off the LRU list if it is in the LRU list. The caller must hold the fil_sys
61 mutex. */64 mutex. */
62 static65 static
@@ -65,7 +68,7 @@
65 fil_node_prepare_for_io(68 fil_node_prepare_for_io(
66 /*====================*/69 /*====================*/
67 fil_node_t* node, /*!< in: file node */70 fil_node_t* node, /*!< in: file node */
68@@ -691,7 +693,7 @@71@@ -691,7 +690,7 @@
69 Opens a file of a node of a tablespace. The caller must own the fil_system72 Opens a file of a node of a tablespace. The caller must own the fil_system
70 mutex. */73 mutex. */
71 static74 static
@@ -74,7 +77,7 @@
74 fil_node_open_file(77 fil_node_open_file(
75 /*===============*/78 /*===============*/
76 fil_node_t* node, /*!< in: file node */79 fil_node_t* node, /*!< in: file node */
77@@ -725,6 +727,18 @@80@@ -725,6 +724,18 @@
78 OS_FILE_READ_ONLY, &success);81 OS_FILE_READ_ONLY, &success);
79 if (!success) {82 if (!success) {
80 /* The following call prints an error message */83 /* The following call prints an error message */
@@ -93,7 +96,7 @@
93 os_file_get_last_error(true);96 os_file_get_last_error(true);
94 97
95 ut_print_timestamp(stderr);98 ut_print_timestamp(stderr);
96@@ -783,12 +797,17 @@99@@ -783,12 +794,17 @@
97 100
98 if (UNIV_UNLIKELY(space_id != space->id)) {101 if (UNIV_UNLIKELY(space_id != space->id)) {
99 fprintf(stderr,102 fprintf(stderr,
@@ -114,7 +117,7 @@
114 }117 }
115 118
116 if (UNIV_UNLIKELY(space_id == ULINT_UNDEFINED119 if (UNIV_UNLIKELY(space_id == ULINT_UNDEFINED
117@@ -825,8 +844,9 @@120@@ -825,8 +841,9 @@
118 }121 }
119 122
120 if (size_bytes >= 1024 * 1024) {123 if (size_bytes >= 1024 * 1024) {
@@ -126,7 +129,7 @@
126 }129 }
127 130
128 if (!fsp_flags_is_compressed(flags)) {131 if (!fsp_flags_is_compressed(flags)) {
129@@ -879,6 +899,8 @@132@@ -879,6 +896,8 @@
130 /* Put the node to the LRU list */133 /* Put the node to the LRU list */
131 UT_LIST_ADD_FIRST(LRU, system->LRU, node);134 UT_LIST_ADD_FIRST(LRU, system->LRU, node);
132 }135 }
@@ -135,7 +138,7 @@
135 }138 }
136 139
137 /**********************************************************************//**140 /**********************************************************************//**
138@@ -1491,7 +1513,12 @@141@@ -1491,7 +1510,12 @@
139 the file yet; the following calls will open it and update the142 the file yet; the following calls will open it and update the
140 size fields */143 size fields */
141 144
@@ -149,7 +152,7 @@
149 fil_node_complete_io(node, fil_system, OS_FILE_READ);152 fil_node_complete_io(node, fil_system, OS_FILE_READ);
150 }153 }
151 154
152@@ -2095,7 +2122,7 @@155@@ -2095,7 +2119,7 @@
153 mem_free(path);156 mem_free(path);
154 }157 }
155 158
@@ -158,7 +161,7 @@
158 /********************************************************//**161 /********************************************************//**
159 Writes a log record about an .ibd file create/rename/delete. */162 Writes a log record about an .ibd file create/rename/delete. */
160 static163 static
161@@ -2329,7 +2356,7 @@164@@ -2329,7 +2353,7 @@
162 space_id, name, path, flags,165 space_id, name, path, flags,
163 DICT_TF2_USE_TABLESPACE,166 DICT_TF2_USE_TABLESPACE,
164 FIL_IBD_FILE_INITIAL_SIZE) != DB_SUCCESS) {167 FIL_IBD_FILE_INITIAL_SIZE) != DB_SUCCESS) {
@@ -167,7 +170,7 @@
167 }170 }
168 }171 }
169 172
170@@ -2687,7 +2714,7 @@173@@ -2687,7 +2711,7 @@
171 }174 }
172 175
173 if (err == DB_SUCCESS) {176 if (err == DB_SUCCESS) {
@@ -176,7 +179,7 @@
176 /* Write a log record about the deletion of the .ibd179 /* Write a log record about the deletion of the .ibd
177 file, so that ibbackup can replay it in the180 file, so that ibbackup can replay it in the
178 --apply-log phase. We use a dummy mtr and the familiar181 --apply-log phase. We use a dummy mtr and the familiar
179@@ -3042,7 +3069,7 @@182@@ -3042,7 +3066,7 @@
180 183
181 mutex_exit(&fil_system->mutex);184 mutex_exit(&fil_system->mutex);
182 185
@@ -185,7 +188,7 @@
185 if (success && !recv_recovery_on) {188 if (success && !recv_recovery_on) {
186 mtr_t mtr;189 mtr_t mtr;
187 190
188@@ -3426,7 +3453,7 @@191@@ -3426,7 +3450,7 @@
189 goto error_exit_1;192 goto error_exit_1;
190 }193 }
191 194
@@ -194,7 +197,7 @@
194 {197 {
195 mtr_t mtr;198 mtr_t mtr;
196 ulint mlog_file_flag = 0;199 ulint mlog_file_flag = 0;
197@@ -3504,6 +3531,97 @@200@@ -3504,6 +3528,97 @@
198 #endif /* UNIV_LOG_ARCHIVE */201 #endif /* UNIV_LOG_ARCHIVE */
199 };202 };
200 203
@@ -292,7 +295,25 @@
292 /********************************************************************//**295 /********************************************************************//**
293 Tries to open a single-table tablespace and optionally checks that the296 Tries to open a single-table tablespace and optionally checks that the
294 space id in it is correct. If this does not succeed, print an error message297 space id in it is correct. If this does not succeed, print an error message
295@@ -3712,11 +3830,15 @@298@@ -3569,6 +3684,9 @@
299 in the default location. If it is remote, it should not be here. */
300 def.filepath = fil_make_ibd_name(tablename, false);
301
302+ /* We skip SYS_DATAFILES validation and remote tablespaces discovery for
303+ XtraBackup, as all tablespaces are local for XtraBackup recovery. */
304+#if 0
305 /* The path_in was read from SYS_DATAFILES. */
306 if (path_in) {
307 if (strcmp(def.filepath, path_in)) {
308@@ -3616,6 +3734,7 @@
309 tablespaces_found++;
310 }
311 }
312+#endif
313
314 /* Always look for a file at the default location. */
315 ut_a(def.filepath);
316@@ -3712,11 +3831,15 @@
296 /* The following call prints an error message */317 /* The following call prints an error message */
297 os_file_get_last_error(true);318 os_file_get_last_error(true);
298 319
@@ -309,7 +330,25 @@
309 330
310 err = DB_CORRUPTION;331 err = DB_CORRUPTION;
311 332
312@@ -4135,7 +4257,7 @@333@@ -4018,6 +4141,9 @@
334 # endif /* !UNIV_HOTBACKUP */
335 #endif
336
337+ /* Ignore .isl files on XtraBackup recovery. All tablespaces must be
338+ local. */
339+ if (!recv_recovery_on) {
340 /* Check for a link file which locates a remote tablespace. */
341 remote.success = fil_open_linked_file(
342 tablename, &remote.filepath, &remote.file);
343@@ -4030,6 +4156,7 @@
344 mem_free(remote.filepath);
345 }
346 }
347+ }
348
349
350 /* Try to open the tablespace in the datadir. */
351@@ -4135,7 +4262,7 @@
313 cannot be ok. */352 cannot be ok. */
314 ulong minimum_size = FIL_IBD_FILE_INITIAL_SIZE * UNIV_PAGE_SIZE;353 ulong minimum_size = FIL_IBD_FILE_INITIAL_SIZE * UNIV_PAGE_SIZE;
315 if (size < minimum_size) {354 if (size < minimum_size) {
@@ -318,7 +357,7 @@
318 ib_logf(IB_LOG_LEVEL_ERROR,357 ib_logf(IB_LOG_LEVEL_ERROR,
319 "The size of single-table tablespace file %s "358 "The size of single-table tablespace file %s "
320 "is only " UINT64PF ", should be at least %lu!",359 "is only " UINT64PF ", should be at least %lu!",
321@@ -4263,7 +4385,7 @@360@@ -4263,7 +4390,7 @@
322 idea is to read as much good data as we can and jump over bad data.361 idea is to read as much good data as we can and jump over bad data.
323 @return 0 if ok, -1 if error even after the retries, 1 if at the end362 @return 0 if ok, -1 if error even after the retries, 1 if at the end
324 of the directory */363 of the directory */
@@ -327,7 +366,7 @@
327 int366 int
328 fil_file_readdir_next_file(367 fil_file_readdir_next_file(
329 /*=======================*/368 /*=======================*/
330@@ -4359,7 +4481,9 @@369@@ -4359,7 +4486,9 @@
331 "%s/%s", fil_path_to_mysql_datadir, dbinfo.name);370 "%s/%s", fil_path_to_mysql_datadir, dbinfo.name);
332 srv_normalize_path_for_win(dbpath);371 srv_normalize_path_for_win(dbpath);
333 372
@@ -338,7 +377,23 @@
338 377
339 if (dbdir != NULL) {378 if (dbdir != NULL) {
340 379
341@@ -4538,6 +4662,7 @@380@@ -4380,9 +4509,13 @@
381 && (0 == strcmp(fileinfo.name
382 + strlen(fileinfo.name) - 4,
383 ".ibd")
384- || 0 == strcmp(fileinfo.name
385+ /* Ignore .isl files on XtraBackup
386+ recovery, all tablespaces must be
387+ local. */
388+ || (!recv_recovery_on &&
389+ 0 == strcmp(fileinfo.name
390 + strlen(fileinfo.name) - 4,
391- ".isl"))) {
392+ ".isl")))) {
393 /* The name ends in .ibd or .isl;
394 try opening the file */
395 fil_load_single_table_tablespace(
396@@ -4538,6 +4671,7 @@
342 {397 {
343 fil_space_t* fnamespace;398 fil_space_t* fnamespace;
344 fil_space_t* space;399 fil_space_t* space;
@@ -346,7 +401,7 @@
346 401
347 ut_ad(fil_system);402 ut_ad(fil_system);
348 403
349@@ -4615,6 +4740,10 @@404@@ -4615,6 +4749,10 @@
350 if (fnamespace == NULL) {405 if (fnamespace == NULL) {
351 if (print_error_if_does_not_exist) {406 if (print_error_if_does_not_exist) {
352 fil_report_missing_tablespace(name, id);407 fil_report_missing_tablespace(name, id);
@@ -357,7 +412,7 @@
357 }412 }
358 } else {413 } else {
359 ut_print_timestamp(stderr);414 ut_print_timestamp(stderr);
360@@ -4638,6 +4767,10 @@415@@ -4638,6 +4776,10 @@
361 416
362 mutex_exit(&fil_system->mutex);417 mutex_exit(&fil_system->mutex);
363 418
@@ -368,7 +423,7 @@
368 return(FALSE);423 return(FALSE);
369 }424 }
370 425
371@@ -4728,6 +4861,7 @@426@@ -4728,6 +4870,7 @@
372 ulint page_size;427 ulint page_size;
373 ulint pages_added;428 ulint pages_added;
374 ibool success;429 ibool success;
@@ -376,7 +431,7 @@
376 431
377 ut_ad(!srv_read_only_mode);432 ut_ad(!srv_read_only_mode);
378 433
379@@ -4772,13 +4906,17 @@434@@ -4772,13 +4915,17 @@
380 goto retry;435 goto retry;
381 }436 }
382 437
@@ -395,7 +450,7 @@
395 start_page_no = space->size;450 start_page_no = space->size;
396 file_start_page_no = space->size - node->size;451 file_start_page_no = space->size - node->size;
397 452
398@@ -5024,7 +5162,7 @@453@@ -5024,7 +5171,7 @@
399 off the LRU list if it is in the LRU list. The caller must hold the fil_sys454 off the LRU list if it is in the LRU list. The caller must hold the fil_sys
400 mutex. */455 mutex. */
401 static456 static
@@ -404,7 +459,7 @@
404 fil_node_prepare_for_io(459 fil_node_prepare_for_io(
405 /*====================*/460 /*====================*/
406 fil_node_t* node, /*!< in: file node */461 fil_node_t* node, /*!< in: file node */
407@@ -5044,9 +5182,12 @@462@@ -5044,9 +5191,12 @@
408 }463 }
409 464
410 if (node->open == FALSE) {465 if (node->open == FALSE) {
@@ -418,7 +473,7 @@
418 }473 }
419 474
420 if (node->n_pending == 0 && fil_space_belongs_in_lru(space)) {475 if (node->n_pending == 0 && fil_space_belongs_in_lru(space)) {
421@@ -5058,6 +5199,8 @@476@@ -5058,6 +5208,8 @@
422 }477 }
423 478
424 node->n_pending++;479 node->n_pending++;
@@ -427,7 +482,7 @@
427 }482 }
428 483
429 /********************************************************************//**484 /********************************************************************//**
430@@ -5259,6 +5402,16 @@485@@ -5259,6 +5411,16 @@
431 486
432 ut_ad(mode != OS_AIO_IBUF || space->purpose == FIL_TABLESPACE);487 ut_ad(mode != OS_AIO_IBUF || space->purpose == FIL_TABLESPACE);
433 488
@@ -444,7 +499,7 @@
444 node = UT_LIST_GET_FIRST(space->chain);499 node = UT_LIST_GET_FIRST(space->chain);
445 500
446 for (;;) {501 for (;;) {
447@@ -5290,7 +5443,11 @@502@@ -5290,7 +5452,11 @@
448 }503 }
449 504
450 /* Open file if closed */505 /* Open file if closed */
@@ -457,7 +512,7 @@
457 512
458 /* Check that at least the start offset is within the bounds of a513 /* Check that at least the start offset is within the bounds of a
459 single-table tablespace, including rollback tablespaces. */514 single-table tablespace, including rollback tablespaces. */
460@@ -6164,6 +6321,7 @@515@@ -6164,6 +6330,7 @@
461 return(err);516 return(err);
462 }517 }
463 518
@@ -465,7 +520,7 @@
465 /****************************************************************//**520 /****************************************************************//**
466 Generate redo logs for swapping two .ibd files */521 Generate redo logs for swapping two .ibd files */
467 UNIV_INTERN522 UNIV_INTERN
468@@ -6187,4 +6345,4 @@523@@ -6187,4 +6354,4 @@
469 0, 0, new_name, old_name, &mtr);524 0, 0, new_name, old_name, &mtr);
470 mtr_commit(&mtr);525 mtr_commit(&mtr);
471 }526 }
@@ -482,6 +537,107 @@
482 537
483 if (thd && thd_sql_command(thd) == SQLCOM_DROP_TABLE) {538 if (thd && thd_sql_command(thd) == SQLCOM_DROP_TABLE) {
484 539
540@@ -2423,43 +2423,19 @@
541 ulint buflen, /*!< in: length of buf, in bytes */
542 const char* id, /*!< in: identifier to convert */
543 ulint idlen, /*!< in: length of id, in bytes */
544- THD* thd, /*!< in: MySQL connection thread, or NULL */
545- ibool file_id)/*!< in: TRUE=id is a table or database name;
546+ THD* thd __attribute__((unused)),
547+ /*!< in: MySQL connection thread, or NULL */
548+ ibool file_id __attribute__((unused)))
549+ /*!< in: TRUE=id is a table or database name;
550 FALSE=id is an UTF-8 string */
551 {
552- char nz[NAME_LEN + 1];
553- char nz2[NAME_LEN + 1 + EXPLAIN_FILENAME_MAX_EXTRA_LENGTH];
554-
555 const char* s = id;
556 int q;
557
558- if (file_id) {
559- /* Decode the table name. The MySQL function expects
560- a NUL-terminated string. The input and output strings
561- buffers must not be shared. */
562-
563- if (UNIV_UNLIKELY(idlen > (sizeof nz) - 1)) {
564- idlen = (sizeof nz) - 1;
565- }
566-
567- memcpy(nz, id, idlen);
568- nz[idlen] = 0;
569-
570- s = nz2;
571- idlen = explain_filename(thd, nz, nz2, sizeof nz2,
572- EXPLAIN_PARTITIONS_AS_COMMENT);
573- goto no_quote;
574- }
575-
576 /* See if the identifier needs to be quoted. */
577- if (UNIV_UNLIKELY(!thd)) {
578- q = '"';
579- } else {
580- q = get_quote_char_for_identifier(thd, s, (int) idlen);
581- }
582+ q = '"';
583
584 if (q == EOF) {
585-no_quote:
586 if (UNIV_UNLIKELY(idlen > buflen)) {
587 idlen = buflen;
588 }
589@@ -16642,45 +16618,21 @@
590 void
591 ib_logf(
592 /*====*/
593- ib_log_level_t level, /*!< in: warning level */
594+ ib_log_level_t level __attribute__((unused)),
595+ /*!< in: warning level */
596 const char* format, /*!< printf format */
597 ...) /*!< Args */
598 {
599- char* str;
600 va_list args;
601
602 va_start(args, format);
603
604-#ifdef __WIN__
605- int size = _vscprintf(format, args) + 1;
606- str = static_cast<char*>(malloc(size));
607- str[size - 1] = 0x0;
608- vsnprintf(str, size, format, args);
609-#elif HAVE_VASPRINTF
610- (void) vasprintf(&str, format, args);
611-#else
612- /* Use a fixed length string. */
613- str = static_cast<char*>(malloc(BUFSIZ));
614- my_vsnprintf(str, BUFSIZ, format, args);
615-#endif /* __WIN__ */
616-
617- switch(level) {
618- case IB_LOG_LEVEL_INFO:
619- sql_print_information("InnoDB: %s", str);
620- break;
621- case IB_LOG_LEVEL_WARN:
622- sql_print_warning("InnoDB: %s", str);
623- break;
624- case IB_LOG_LEVEL_ERROR:
625- sql_print_error("InnoDB: %s", str);
626- break;
627- case IB_LOG_LEVEL_FATAL:
628- sql_print_error("InnoDB: %s", str);
629- break;
630- }
631+ /* Don't use server logger for XtraBackup, just print to stderr. */
632+ vfprintf(stderr, format, args);
633
634 va_end(args);
635- free(str);
636+
637+ fputc('\n', stderr);
638
639 if (level == IB_LOG_LEVEL_FATAL) {
640 ut_error;
485--- a/storage/innobase/include/srv0srv.h641--- a/storage/innobase/include/srv0srv.h
486+++ b/storage/innobase/include/srv0srv.h642+++ b/storage/innobase/include/srv0srv.h
487@@ -353,6 +353,9 @@643@@ -353,6 +353,9 @@
@@ -676,7 +832,60 @@
676 dberr_t832 dberr_t
677 open_or_create_data_files(833 open_or_create_data_files(
678 /*======================*/834 /*======================*/
679@@ -2065,11 +2065,13 @@835@@ -1204,12 +1204,16 @@
836 /********************************************************************
837 Opens the configured number of undo tablespaces.
838 @return DB_SUCCESS or error code */
839-static
840+UNIV_INTERN
841 dberr_t
842 srv_undo_tablespaces_init(
843 /*======================*/
844 ibool create_new_db, /*!< in: TRUE if new db being
845 created */
846+ ibool backup_mode, /*!< in: TRUE disables reading
847+ the system tablespace (used in
848+ XtraBackup), FALSE is passed on
849+ recovery. */
850 const ulint n_conf_tablespaces, /*!< in: configured undo
851 tablespaces */
852 ulint* n_opened) /*!< out: number of UNDO
853@@ -1225,6 +1229,7 @@
854 *n_opened = 0;
855
856 ut_a(n_conf_tablespaces <= TRX_SYS_N_RSEGS);
857+ ut_a(!create_new_db || !backup_mode);
858
859 memset(undo_tablespace_ids, 0x0, sizeof(undo_tablespace_ids));
860
861@@ -1258,12 +1263,13 @@
862 }
863 }
864
865- /* Get the tablespace ids of all the undo segments excluding
866- the system tablespace (0). If we are creating a new instance then
867+ /* Get the tablespace ids of all the undo segments excluding the system
868+ tablespace (0). If we are creating a new instance then
869 we build the undo_tablespace_ids ourselves since they don't
870- already exist. */
871+ already exist. If we are in the backup mode, don't read the trx header,
872+ we just need to add all available undo tablespaces to fil_system. */
873
874- if (!create_new_db) {
875+ if (!create_new_db && !backup_mode) {
876 n_undo_tablespaces = trx_rseg_get_n_undo_tablespaces(
877 undo_tablespace_ids);
878 } else {
879@@ -1369,7 +1375,7 @@
880 ib_logf(IB_LOG_LEVEL_INFO, "Opened %lu undo tablespaces",
881 n_undo_tablespaces);
882
883- if (n_conf_tablespaces == 0) {
884+ if (n_conf_tablespaces == 0 && !backup_mode) {
885 ib_logf(IB_LOG_LEVEL_WARN,
886 "Using the system tablespace for all UNDO "
887 "logging because innodb_undo_tablespaces=0");
888@@ -2065,11 +2071,13 @@
680 max_flushed_lsn = min_flushed_lsn889 max_flushed_lsn = min_flushed_lsn
681 = log_get_lsn();890 = log_get_lsn();
682 goto files_checked;891 goto files_checked;
@@ -690,7 +899,15 @@
690 }899 }
691 900
692 /* opened all files */901 /* opened all files */
693@@ -2326,6 +2328,10 @@902@@ -2162,6 +2170,7 @@
903
904 err = srv_undo_tablespaces_init(
905 create_new_db,
906+ FALSE,
907 srv_undo_tablespaces,
908 &srv_undo_tablespaces_open);
909
910@@ -2326,6 +2335,10 @@
694 911
695 recv_recovery_from_checkpoint_finish();912 recv_recovery_from_checkpoint_finish();
696 913
@@ -701,7 +918,7 @@
701 if (srv_force_recovery < SRV_FORCE_NO_IBUF_MERGE) {918 if (srv_force_recovery < SRV_FORCE_NO_IBUF_MERGE) {
702 /* The following call is necessary for the insert919 /* The following call is necessary for the insert
703 buffer to work with multiple tablespaces. We must920 buffer to work with multiple tablespaces. We must
704@@ -2647,6 +2653,7 @@921@@ -2647,6 +2660,7 @@
705 && srv_auto_extend_last_data_file922 && srv_auto_extend_last_data_file
706 && sum_of_data_file_sizes < tablespace_size_in_header) {923 && sum_of_data_file_sizes < tablespace_size_in_header) {
707 924
@@ -709,7 +926,7 @@
709 ut_print_timestamp(stderr);926 ut_print_timestamp(stderr);
710 fprintf(stderr,927 fprintf(stderr,
711 " InnoDB: Error: tablespace size stored in header"928 " InnoDB: Error: tablespace size stored in header"
712@@ -2683,6 +2690,7 @@929@@ -2683,6 +2697,7 @@
713 930
714 return(DB_ERROR);931 return(DB_ERROR);
715 }932 }
@@ -717,7 +934,7 @@
717 }934 }
718 935
719 /* Check that os_fast_mutexes work as expected */936 /* Check that os_fast_mutexes work as expected */
720@@ -2739,6 +2747,7 @@937@@ -2739,6 +2754,7 @@
721 fts_optimize_init();938 fts_optimize_init();
722 }939 }
723 940
@@ -725,7 +942,7 @@
725 srv_was_started = TRUE;942 srv_was_started = TRUE;
726 943
727 return(DB_SUCCESS);944 return(DB_SUCCESS);
728@@ -2794,7 +2803,7 @@945@@ -2794,7 +2810,7 @@
729 return(DB_SUCCESS);946 return(DB_SUCCESS);
730 }947 }
731 948
@@ -844,3 +1061,41 @@
844 1061
845 UNIV_MEM_FREE(buf, n);1062 UNIV_MEM_FREE(buf, n);
846 }1063 }
1064--- a/storage/innobase/include/fil0fil.h
1065+++ b/storage/innobase/include/fil0fil.h
1066@@ -163,6 +163,9 @@
1067 #define FIL_LOG 502 /*!< redo log */
1068 /* @} */
1069
1070+/** Determine if (i) is a user tablespace id or not. */
1071+#define fil_is_user_tablespace_id(i) ((i) > srv_undo_tablespaces_open)
1072+
1073 /** The number of fsyncs done to the log */
1074 extern ulint fil_n_log_flushes;
1075
1076--- a/storage/innobase/include/srv0start.h
1077+++ b/storage/innobase/include/srv0start.h
1078@@ -77,6 +77,23 @@
1079 srv_add_path_separator_if_needed(
1080 /*=============================*/
1081 char* str); /*!< in: null-terminated character string */
1082+/********************************************************************
1083+Opens the configured number of undo tablespaces.
1084+@return DB_SUCCESS or error code */
1085+UNIV_INTERN
1086+dberr_t
1087+srv_undo_tablespaces_init(
1088+/*======================*/
1089+ ibool create_new_db, /*!< in: TRUE if new db being
1090+ created */
1091+ ibool backup_mode, /*!< in: TRUE disables reading
1092+ the system tablespace (used in
1093+ XtraBackup), FALSE is passed on
1094+ recovery. */
1095+ const ulint n_conf_tablespaces, /*!< in: configured undo
1096+ tablespaces */
1097+ ulint* n_opened); /*!< out: number of UNDO
1098+ tablespaces successfully */
1099 #ifndef UNIV_HOTBACKUP
1100 /****************************************************************//**
1101 Starts Innobase and creates a new database if database files
8471102
=== modified file 'src/xtrabackup.cc'
--- src/xtrabackup.cc 2013-04-17 07:50:37 +0000
+++ src/xtrabackup.cc 2013-04-23 10:01:01 +0000
@@ -286,10 +286,8 @@
286286
287#ifdef __WIN__287#ifdef __WIN__
288#define SRV_PATH_SEPARATOR '\\'288#define SRV_PATH_SEPARATOR '\\'
289#define SRV_PATH_SEPARATOR_STR "\\"
290#else289#else
291#define SRV_PATH_SEPARATOR '/'290#define SRV_PATH_SEPARATOR '/'
292#define SRV_PATH_SEPARATOR_STR "/"
293#endif291#endif
294292
295#ifndef UNIV_PAGE_SIZE_MAX293#ifndef UNIV_PAGE_SIZE_MAX
@@ -1643,6 +1641,7 @@
1643 OPT_XTRA_DEBUG_SYNC,1641 OPT_XTRA_DEBUG_SYNC,
1644#if MYSQL_VERSION_ID >= 506001642#if MYSQL_VERSION_ID >= 50600
1645 OPT_INNODB_CHECKSUM_ALGORITHM,1643 OPT_INNODB_CHECKSUM_ALGORITHM,
1644 OPT_INNODB_UNDO_DIRECTORY,
1646 OPT_UNDO_TABLESPACES,1645 OPT_UNDO_TABLESPACES,
1647#endif1646#endif
1648 OPT_DEFAULTS_GROUP1647 OPT_DEFAULTS_GROUP
@@ -1962,14 +1961,17 @@
1962 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},1961 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
1963#endif1962#endif
1964#if MYSQL_VERSION_ID >= 506001963#if MYSQL_VERSION_ID >= 50600
1965 {"checksum-algorithm", OPT_INNODB_CHECKSUM_ALGORITHM,1964 {"innodb_checksum_algorithm", OPT_INNODB_CHECKSUM_ALGORITHM,
1966 "The algorithm InnoDB uses for page checksumming. [CRC32, STRICT_CRC32, "1965 "The algorithm InnoDB uses for page checksumming. [CRC32, STRICT_CRC32, "
1967 "INNODB, STRICT_INNODB, NONE, STRICT_NONE]", &srv_checksum_algorithm,1966 "INNODB, STRICT_INNODB, NONE, STRICT_NONE]", &srv_checksum_algorithm,
1968 &srv_checksum_algorithm, &innodb_checksum_algorithm_typelib, GET_ENUM,1967 &srv_checksum_algorithm, &innodb_checksum_algorithm_typelib, GET_ENUM,
1969 REQUIRED_ARG, 0, 0, 0, 0, 0, 0},1968 REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
1970 {"undo-tablespaces", OPT_UNDO_TABLESPACES,1969 {"innodb_undo_directory", OPT_INNODB_UNDO_DIRECTORY,
1971 "Number of undo tablespaces to use. NON-ZERO VALUES ARE NOT "1970 "Directory where undo tablespace files live, this path can be absolute.",
1972 "CURRENTLY SUPPORTED",1971 (G_PTR*) &srv_undo_dir, (G_PTR*) &srv_undo_dir,
1972 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
1973 {"innodb_undo_tablespaces", OPT_UNDO_TABLESPACES,
1974 "Number of undo tablespaces to use.",
1973 (G_PTR*)&srv_undo_tablespaces, (G_PTR*)&srv_undo_tablespaces,1975 (G_PTR*)&srv_undo_tablespaces, (G_PTR*)&srv_undo_tablespaces,
1974 0, GET_ULONG, REQUIRED_ARG, 0, 0, 126, 0, 1, 0},1976 0, GET_ULONG, REQUIRED_ARG, 0, 0, 126, 0, 1, 0},
1975#endif1977#endif
@@ -3066,7 +3068,7 @@
3066 char *p;3068 char *p;
30673069
3068 p = srv_data_file_names[i];3070 p = srv_data_file_names[i];
3069 while ((p = strstr(p, SRV_PATH_SEPARATOR_STR)) != NULL)3071 while ((p = strchr(p, SRV_PATH_SEPARATOR)) != NULL)
3070 {3072 {
3071 p++;3073 p++;
3072 srv_data_file_names[i] = p;3074 srv_data_file_names[i] = p;
@@ -3152,7 +3154,7 @@
3152 srv_log_file_size = (ulint) innobase_log_file_size;3154 srv_log_file_size = (ulint) innobase_log_file_size;
3153 msg("xtrabackup: innodb_log_files_in_group = %ld\n",3155 msg("xtrabackup: innodb_log_files_in_group = %ld\n",
3154 srv_n_log_files);3156 srv_n_log_files);
3155 msg("xtrabackup: innodb_log_file_size = %ld\n",3157 msg("xtrabackup: innodb_log_file_size = %lld\n",
3156 srv_log_file_size);3158 srv_log_file_size);
31573159
3158#ifdef UNIV_LOG_ARCHIVE3160#ifdef UNIV_LOG_ARCHIVE
@@ -3308,6 +3310,18 @@
3308#endif3310#endif
3309#endif /* MYSQL_VERSION_ID */3311#endif /* MYSQL_VERSION_ID */
33103312
3313#if MYSQL_VERSION_ID >= 50600
3314 /* Assign the default value to srv_undo_dir if it's not specified, as
3315 my_getopt does not support default values for string options. We also
3316 ignore the option and override innodb_undo_directory on --prepare,
3317 because separate undo tablespaces are copied to the root backup
3318 directory. */
3319
3320 if (!srv_undo_dir || !xtrabackup_backup) {
3321 srv_undo_dir = (char *) ".";
3322 }
3323#endif
3324
3311 return(FALSE);3325 return(FALSE);
33123326
3313error:3327error:
@@ -3590,26 +3604,26 @@
3590}3604}
35913605
3592/************************************************************************3606/************************************************************************
3593Checks if a table specified as a path should be skipped from backup3607Checks if a table specified as a name in the form "database/name" (InnoDB 5.6)
3594based on the --tables or --tables-file options.3608or "./database/name.ibd" (InnoDB 5.5-) should be skipped from backup based on
3609the --tables or --tables-file options.
35953610
3596@return TRUE if the table should be skipped. */3611@return TRUE if the table should be skipped. */
3597static my_bool3612static my_bool
3598check_if_skip_table(const char *path, const char *suffix)3613check_if_skip_table(const char *name)
3599{3614{
3600 char buf[FN_REFLEN];3615 char buf[FN_REFLEN];
3601 const char *dbname, *tbname;3616 const char *dbname, *tbname;
3602 const char *ptr;3617 const char *ptr;
3603 char *eptr;3618 char *eptr;
3604 int dbname_len;
36053619
3606 if (xtrabackup_tables == NULL && xtrabackup_tables_file == NULL) {3620 if (xtrabackup_tables == NULL && xtrabackup_tables_file == NULL) {
3607 return(FALSE);3621 return(FALSE);
3608 }3622 }
36093623
3610 dbname = NULL;3624 dbname = NULL;
3611 tbname = path;3625 tbname = name;
3612 while ((ptr = strstr(tbname, SRV_PATH_SEPARATOR_STR)) != NULL) {3626 while ((ptr = strchr(tbname, SRV_PATH_SEPARATOR)) != NULL) {
3613 dbname = tbname;3627 dbname = tbname;
3614 tbname = ptr + 1;3628 tbname = ptr + 1;
3615 }3629 }
@@ -3619,14 +3633,16 @@
3619 }3633 }
36203634
3621 strncpy(buf, dbname, FN_REFLEN);3635 strncpy(buf, dbname, FN_REFLEN);
3622 buf[FN_REFLEN - 1] = 0;3636 buf[FN_REFLEN - 1] = '\0';
3623 buf[tbname - 1 - dbname] = '.';3637 buf[tbname - 1 - dbname] = '.';
36243638
3625 dbname_len = strlen(dbname) - strlen(suffix);3639 /* Check if there's a suffix in the table name. If so, truncate it. We
3626 if (dbname_len < 1) {3640 rely on the fact that a dot cannot be a part of a table name (it is
3627 return(FALSE);3641 encoded by the server with the @NNNN syntax). */
3642 if ((eptr = strchr(&buf[tbname - dbname], '.')) != NULL) {
3643
3644 *eptr = '\0';
3628 }3645 }
3629 buf[dbname_len - 1] = 0;
36303646
3631 /* For partitioned tables first try to match against the regexp3647 /* For partitioned tables first try to match against the regexp
3632 without truncating the #P#... suffix so we can backup individual3648 without truncating the #P#... suffix so we can backup individual
@@ -3747,7 +3763,11 @@
3747}3763}
37483764
3749#ifndef XTRADB_BASED3765#ifndef XTRADB_BASED
3750#define trx_sys_sys_space(id) (id == 0)3766# if MYSQL_VERSION_ID >= 50600
3767# define trx_sys_sys_space(id) (!fil_is_user_tablespace_id(id))
3768# else
3769# define trx_sys_sys_space(id) (id == 0)
3770# endif
3751#endif3771#endif
37523772
3753/****************************************************************//**3773/****************************************************************//**
@@ -3897,6 +3917,48 @@
3897}3917}
3898#endif3918#endif
38993919
3920/***********************************************************************
3921Extracts the relative path ("database/table.ibd") of a tablespace from a
3922specified possibly absolute path.
3923
3924For user tablespaces both "./database/table.ibd" and
3925"/remote/dir/database/table.ibd" result in "database/table.ibd".
3926
3927For system tablepsaces (i.e. When is_system is TRUE) both "/remote/dir/ibdata1"
3928and "./ibdata1" yield "ibdata1" in the output. */
3929static
3930const char *
3931xb_get_relative_path(
3932/*=================*/
3933 const char* path, /*!< in: tablespace path (either
3934 relative or absolute) */
3935 ibool is_system) /*!< in: TRUE for system tablespaces,
3936 i.e. when only the filename must be
3937 returned. */
3938{
3939 const char *next;
3940 const char *cur;
3941 const char *prev;
3942
3943 prev = NULL;
3944 cur = path;
3945
3946 while ((next = strchr(cur, SRV_PATH_SEPARATOR)) != NULL) {
3947
3948 prev = cur;
3949 cur = next + 1;
3950 }
3951
3952 if (is_system) {
3953
3954 return(cur);
3955 } else {
3956
3957 return((prev == NULL) ? cur : prev);
3958 }
3959
3960}
3961
3900/* TODO: We may tune the behavior (e.g. by fil_aio)*/3962/* TODO: We may tune the behavior (e.g. by fil_aio)*/
3901#define COPY_CHUNK 643963#define COPY_CHUNK 64
39023964
@@ -3922,34 +3984,41 @@
3922 xb_delta_info_t info;3984 xb_delta_info_t info;
3923 datasink_t *ds = ds_ctxt->datasink;3985 datasink_t *ds = ds_ctxt->datasink;
3924 ds_file_t *dstfile = NULL;3986 ds_file_t *dstfile = NULL;
3987 ibool is_system;
3988
3989 /* Get the name and the path for the tablespace. node->name always
3990 contains the path (which may be absolute for remote tablespaces in
3991 5.6+). space->name contains the tablespace name in the form
3992 "./database/table.ibd" (in 5.5-) or "database/table" (in 5.6+). For a
3993 multi-node shared tablespace, space->name contains the name of the first
3994 node, but that's irrelevant, since we only need node_name to match them
3995 against filters, and the shared tablespace is always copied regardless
3996 of the filters value. */
3997
3998 const char* const node_name = node->space->name;
3999 const char* const node_path = node->name;
39254000
3926 info.page_size = 0;4001 info.page_size = 0;
3927 info.zip_size = 0;4002 info.zip_size = 0;
3928 info.space_id = 0;4003 info.space_id = 0;
39294004
3930 if ((!trx_sys_sys_space(node->space->id))4005 is_system = trx_sys_sys_space(node->space->id);
3931 && check_if_skip_table(node->name, "ibd")) {4006
3932 msg("[%02u] Skipping %s.\n", thread_n, node->name);4007 if (!is_system && check_if_skip_table(node_name)) {
4008 msg("[%02u] Skipping %s.\n", thread_n, node_name);
3933 return(FALSE);4009 return(FALSE);
3934 }4010 }
39354011
3936 if (trx_sys_sys_space(node->space->id))4012 /* Get the relative path for the destination tablespace name. Non-system
3937 {4013 tablespaces may have absolute paths for remote tablespaces in MySQL
3938 char *next, *p;4014 5.6+. We want to make "local" copies for the backup. We don't use
3939 /* system datafile "/fullpath/datafilename.ibd" or "./datafilename.ibd" */4015 node_name here, because in MySQL 5.6+ it doesn't contain the .ibd
3940 p = node->name;4016 suffix */
3941 while ((next = strstr(p, SRV_PATH_SEPARATOR_STR)) != NULL)4017 strncpy(dst_name, xb_get_relative_path(node_path, is_system),
3942 {4018 sizeof(dst_name));
3943 p = next + 1;
3944 }
3945 strncpy(dst_name, p, sizeof(dst_name));
3946 } else {
3947 /* file per table style "./database/table.ibd" */
3948 strncpy(dst_name, node->name, sizeof(dst_name));
3949 }
39504019
3951 /* open src_file*/4020 /* open src_file*/
3952 src_file = xb_file_create_no_error_handling(node->name,4021 src_file = xb_file_create_no_error_handling(node_path,
3953 OS_FILE_OPEN,4022 OS_FILE_OPEN,
3954 OS_FILE_READ_ONLY,4023 OS_FILE_READ_ONLY,
3955 &success);4024 &success);
@@ -3961,11 +4030,11 @@
3961 "[%02u] xtrabackup: Warning: We assume the "4030 "[%02u] xtrabackup: Warning: We assume the "
3962 "table was dropped or renamed during "4031 "table was dropped or renamed during "
3963 "xtrabackup execution and ignore the file.\n",4032 "xtrabackup execution and ignore the file.\n",
3964 thread_n, node->name, thread_n);4033 thread_n, node_path, thread_n);
3965 goto skip;4034 goto skip;
3966 }4035 }
39674036
3968 xb_file_set_nocache(src_file, node->name, "OPEN");4037 xb_file_set_nocache(src_file, node_path, "OPEN");
39694038
3970#ifdef USE_POSIX_FADVISE4039#ifdef USE_POSIX_FADVISE
3971 posix_fadvise(src_file, 0, 0, POSIX_FADV_SEQUENTIAL);4040 posix_fadvise(src_file, 0, 0, POSIX_FADV_SEQUENTIAL);
@@ -3982,7 +4051,7 @@
3982 page_size = info.zip_size;4051 page_size = info.zip_size;
3983 page_size_shift = get_bit_shift(page_size);4052 page_size_shift = get_bit_shift(page_size);
3984 msg("[%02u] %s is compressed with page size = "4053 msg("[%02u] %s is compressed with page size = "
3985 "%lu bytes\n", thread_n, node->name, page_size);4054 "%lu bytes\n", thread_n, node_name, page_size);
3986 if (page_size_shift < 10 || page_size_shift > 14) {4055 if (page_size_shift < 10 || page_size_shift > 14) {
3987 msg("[%02u] xtrabackup: Error: Invalid "4056 msg("[%02u] xtrabackup: Error: Invalid "
3988 "page size: %lu.\n", thread_n, page_size);4057 "page size: %lu.\n", thread_n, page_size);
@@ -4019,9 +4088,9 @@
4019 } else4088 } else
4020 info.page_size = 0;4089 info.page_size = 0;
40214090
4022 if (my_stat(node->name, &src_stat, MYF(MY_WME)) == NULL) {4091 if (my_stat(node_path, &src_stat, MYF(MY_WME)) == NULL) {
4023 msg("[%02u] xtrabackup: Warning: cannot stat %s\n",4092 msg("[%02u] xtrabackup: Warning: cannot stat %s\n",
4024 thread_n, node->name);4093 thread_n, node_path);
4025 goto skip;4094 goto skip;
4026 }4095 }
4027 dstfile = ds->open(ds_ctxt, dst_name, &src_stat);4096 dstfile = ds->open(ds_ctxt, dst_name, &src_stat);
@@ -4035,7 +4104,7 @@
4035 if (xtrabackup_stream) {4104 if (xtrabackup_stream) {
4036 const char *action = xtrabackup_compress ?4105 const char *action = xtrabackup_compress ?
4037 "Compressing and streaming" : "Streaming";4106 "Compressing and streaming" : "Streaming";
4038 msg("[%02u] %s %s\n", thread_n, action, node->name);4107 msg("[%02u] %s %s\n", thread_n, action, node_path);
4039 } else {4108 } else {
4040 const char *action;4109 const char *action;
40414110
@@ -4045,7 +4114,7 @@
4045 action = "Copying";4114 action = "Copying";
4046 }4115 }
4047 msg("[%02u] %s %s to %s\n", thread_n, action,4116 msg("[%02u] %s %s to %s\n", thread_n, action,
4048 node->name, dstfile->path);4117 node_path, dstfile->path);
4049 }4118 }
40504119
4051 buf2 = static_cast<byte *>(ut_malloc(COPY_CHUNK4120 buf2 = static_cast<byte *>(ut_malloc(COPY_CHUNK
@@ -4112,7 +4181,7 @@
4112 "resulted in fail. File "4181 "resulted in fail. File "
4113 "%s seems to be "4182 "%s seems to be "
4114 "corrupted.\n",4183 "corrupted.\n",
4115 thread_n, node->name);4184 thread_n, node_path);
4116 goto error;4185 goto error;
4117 }4186 }
4118 msg("[%02u] xtrabackup: "4187 msg("[%02u] xtrabackup: "
@@ -4237,8 +4306,8 @@
4237 msg("[%02u] xtrabackup: Warning: We assume the "4306 msg("[%02u] xtrabackup: Warning: We assume the "
4238 "table was dropped during xtrabackup execution "4307 "table was dropped during xtrabackup execution "
4239 "and ignore the file.\n", thread_n);4308 "and ignore the file.\n", thread_n);
4240 msg("[%02u] xtrabackup: Warning: skipping file %s.\n",4309 msg("[%02u] xtrabackup: Warning: skipping tablespace %s.\n",
4241 thread_n, node->name);4310 thread_n, node_name);
4242 return(FALSE);4311 return(FALSE);
4243}4312}
42444313
@@ -4691,7 +4760,24 @@
4691 return(DB_ERROR);4760 return(DB_ERROR);
4692 }4761 }
46934762
4694 return(fil_load_single_table_tablespaces());4763 err = fil_load_single_table_tablespaces();
4764 if (err != DB_SUCCESS) {
4765 return(err);
4766 }
4767
4768#if MYSQL_VERSION_ID >= 50600
4769 /* Add separate undo tablespaces to fil_system */
4770
4771 err = srv_undo_tablespaces_init(FALSE,
4772 TRUE,
4773 srv_undo_tablespaces,
4774 &srv_undo_tablespaces_open);
4775 if (err != DB_SUCCESS) {
4776 return(err);
4777 }
4778#endif
4779
4780 return(DB_SUCCESS);
4695}4781}
46964782
4697/*********************************************************************//**4783/*********************************************************************//**
@@ -6056,7 +6142,7 @@
6056 table = dict_table_get_low(table_name);6142 table = dict_table_get_low(table_name);
6057 mem_free(table_name);6143 mem_free(table_name);
60586144
6059 if (table && check_if_skip_table(table->name, ""))6145 if (table && check_if_skip_table(table->name))
6060 goto skip;6146 goto skip;
60616147
6062 if (table == NULL) {6148 if (table == NULL) {
@@ -7454,7 +7540,9 @@
74547540
7455 p = info_file_path;7541 p = info_file_path;
7456 prev = NULL;7542 prev = NULL;
7457 while ((next = strstr(p, SRV_PATH_SEPARATOR_STR)) != NULL)7543 while ((next =
7544 strchr(p, SRV_PATH_SEPARATOR))
7545 != NULL)
7458 {7546 {
7459 prev = p;7547 prev = p;
7460 p = next + 1;7548 p = next + 1;
@@ -7895,6 +7983,14 @@
7895 printf("innodb_file_per_table = %d\n",7983 printf("innodb_file_per_table = %d\n",
7896 (int) innobase_file_per_table);7984 (int) innobase_file_per_table);
7897#endif7985#endif
7986#if MYSQL_VERSION_ID >= 50600
7987 if (srv_undo_dir) {
7988
7989 printf("innodb_undo_directory = \"%s\"\n",
7990 srv_undo_dir);
7991 }
7992 printf("innodb_undo_tablespaces = %lu\n", srv_undo_tablespaces);
7993#endif
7898 exit(EXIT_SUCCESS);7994 exit(EXIT_SUCCESS);
7899 }7995 }
79007996
79017997
=== modified file 'test/inc/common.sh'
--- test/inc/common.sh 2013-03-08 04:37:16 +0000
+++ test/inc/common.sh 2013-04-23 10:01:01 +0000
@@ -27,25 +27,12 @@
27 exit 127 exit 1
28}28}
2929
30function init_mysql_dir()30function call_mysql_install_db()
31{31{
32 if [ ! -d "$MYSQLD_VARDIR" ]
33 then
34 vlog "Creating server root directory: $MYSQLD_VARDIR"
35 mkdir "$MYSQLD_VARDIR"
36 fi
37 if [ ! -d "$MYSQLD_TMPDIR" ]
38 then
39 vlog "Creating server temporary directory: $MYSQLD_TMPDIR"
40 mkdir "$MYSQLD_TMPDIR"
41 fi
42 if [ ! -d "$MYSQLD_DATADIR" ]
43 then
44 vlog "Creating server data directory: $MYSQLD_DATADIR"
45 mkdir -p "$MYSQLD_DATADIR"
46 vlog "Calling mysql_install_db"32 vlog "Calling mysql_install_db"
47 $MYSQL_INSTALL_DB --no-defaults --basedir=$MYSQL_BASEDIR --datadir="$MYSQLD_DATADIR" --tmpdir="$MYSQLD_TMPDIR" ${MYSQLD_EXTRA_ARGS}33 cd $MYSQL_BASEDIR
48 fi34 $MYSQL_INSTALL_DB --defaults-file=${MYSQLD_VARDIR}/my.cnf ${MYSQLD_EXTRA_ARGS}
35 cd -
49}36}
5037
51########################################################################38########################################################################
@@ -230,20 +217,15 @@
230 MYSQLD_PORT="${SRV_MYSQLD_PORT[$id]}"217 MYSQLD_PORT="${SRV_MYSQLD_PORT[$id]}"
231 MYSQLD_SOCKET="${SRV_MYSQLD_SOCKET[$id]}"218 MYSQLD_SOCKET="${SRV_MYSQLD_SOCKET[$id]}"
232219
233 MYSQL_ARGS="--no-defaults --socket=${MYSQLD_SOCKET} --user=root"220 MYSQL_ARGS="--defaults-file=$MYSQLD_VARDIR/my.cnf "
234 MYSQLD_ARGS="--no-defaults --basedir=${MYSQL_BASEDIR} \221 MYSQLD_ARGS="--defaults-file=$MYSQLD_VARDIR/my.cnf ${MYSQLD_EXTRA_ARGS}"
235--socket=${MYSQLD_SOCKET} --port=${MYSQLD_PORT} --server-id=$id \
236--datadir=${MYSQLD_DATADIR} --tmpdir=${MYSQLD_TMPDIR} --log-bin=mysql-bin \
237--relay-log=mysql-relay-bin --pid-file=${MYSQLD_PIDFILE} ${MYSQLD_EXTRA_ARGS}"
238 if [ "`whoami`" = "root" ]222 if [ "`whoami`" = "root" ]
239 then223 then
240 MYSQLD_ARGS="$MYSQLD_ARGS --user=root"224 MYSQLD_ARGS="$MYSQLD_ARGS --user=root"
241 fi225 fi
242226
243 export MYSQL_HOME=$MYSQLD_VARDIR227 IB_ARGS="--defaults-file=$MYSQLD_VARDIR/my.cnf --ibbackup=$XB_BIN"
244228 XB_ARGS="--defaults-file=$MYSQLD_VARDIR/my.cnf"
245 IB_ARGS="--user=root --socket=${MYSQLD_SOCKET} --ibbackup=$XB_BIN"
246 XB_ARGS="--no-defaults"
247229
248 # Some aliases for compatibility, as tests use the following names230 # Some aliases for compatibility, as tests use the following names
249 topdir="$MYSQLD_VARDIR"231 topdir="$MYSQLD_VARDIR"
@@ -265,14 +247,48 @@
265 init_server_variables $id247 init_server_variables $id
266 switch_server $id248 switch_server $id
267249
268 init_mysql_dir250 if [ ! -d "$MYSQLD_VARDIR" ]
251 then
252 vlog "Creating server root directory: $MYSQLD_VARDIR"
253 mkdir "$MYSQLD_VARDIR"
254 fi
255 if [ ! -d "$MYSQLD_TMPDIR" ]
256 then
257 vlog "Creating server temporary directory: $MYSQLD_TMPDIR"
258 mkdir "$MYSQLD_TMPDIR"
259 fi
260
261 # Create the configuration file used by mysql_install_db, the server
262 # and the xtrabackup binary
269 cat > ${MYSQLD_VARDIR}/my.cnf <<EOF263 cat > ${MYSQLD_VARDIR}/my.cnf <<EOF
270[mysqld]264[mysqld]
265socket=${MYSQLD_SOCKET}
266port=${MYSQLD_PORT}
267server-id=$id
268basedir=${MYSQL_BASEDIR}
271datadir=${MYSQLD_DATADIR}269datadir=${MYSQLD_DATADIR}
272tmpdir=${MYSQLD_TMPDIR}270tmpdir=${MYSQLD_TMPDIR}
271log-bin=mysql-bin
272relay-log=mysql-relay-bin
273pid-file=${MYSQLD_PIDFILE}
274replicate-ignore-db=mysql
275${MYSQLD_EXTRA_MY_CNF_OPTS:-}
276
277[client]
278socket=${MYSQLD_SOCKET}
279user=root
273EOF280EOF
274281
282 # Create datadir and call mysql_install_db if it doesn't exist
283 if [ ! -d "$MYSQLD_DATADIR" ]
284 then
285 vlog "Creating server data directory: $MYSQLD_DATADIR"
286 mkdir -p "$MYSQLD_DATADIR"
287 call_mysql_install_db
288 fi
289
275 # Start the server290 # Start the server
291 echo "Starting ${MYSQLD} ${MYSQLD_ARGS} $* "
276 ${MYSQLD} ${MYSQLD_ARGS} $* &292 ${MYSQLD} ${MYSQLD_ARGS} $* &
277 if ! mysql_ping293 if ! mysql_ping
278 then294 then
@@ -301,6 +317,10 @@
301 vlog "Server PID file '${MYSQLD_PIDFILE}' doesn't exist!"317 vlog "Server PID file '${MYSQLD_PIDFILE}' doesn't exist!"
302 fi318 fi
303319
320 # Reset XB_ARGS so we can call xtrabackup in tests even without starting the
321 # server
322 XB_ARGS="--no-defaults"
323
304 # unlock the port number324 # unlock the port number
305 free_reserved_port $MYSQLD_PORT325 free_reserved_port $MYSQLD_PORT
306326
307327
=== modified file 'test/inc/ib_part.sh'
--- test/inc/ib_part.sh 2013-03-07 11:38:14 +0000
+++ test/inc/ib_part.sh 2013-04-23 10:01:01 +0000
@@ -2,15 +2,15 @@
22
3function check_partitioning()3function check_partitioning()
4{4{
5 $MYSQL $MYSQL_ARGS -Ns -e "show variables like 'have_partitioning'"5 $MYSQL $MYSQL_ARGS -Ns -e "SHOW PLUGINS" 2> /dev/null |
6 egrep -q "^partition"
6}7}
78
8function require_partitioning()9function require_partitioning()
9{10{
10 PARTITION_CHECK=`check_partitioning`11 if ! check_partitioning
1112 then
12 if [ -z "$PARTITION_CHECK" ]; then13 echo "Requires support for partitioning." > $SKIPPED_REASON
13 echo "Requires Partitioning." > $SKIPPED_REASON
14 exit $SKIPPED_EXIT_CODE14 exit $SKIPPED_EXIT_CODE
15 fi15 fi
16}16}
1717
=== modified file 'test/t/bug1062684.sh'
--- test/t/bug1062684.sh 2013-03-08 04:37:16 +0000
+++ test/t/bug1062684.sh 2013-04-23 10:01:01 +0000
@@ -1,11 +1,18 @@
1MYSQLD_EXTRA_ARGS=--innodb-data-file-path="ibdata1:${DEFAULT_IBDATA_SIZE};ibdata2:5M:autoextend"1################################################################################
2# Bug #1062684: Applying incremental backup using xtrabackup 2.0.3 fails when
3# innodb_data_file_path = ibdata1:2000M;ibdata2:10M:autoextend is
4# set in [mysqld]
5################################################################################
6
2. inc/common.sh7. inc/common.sh
38
4start_server --innodb-data-file-path="ibdata1:${DEFAULT_IBDATA_SIZE};ibdata2:5M:autoextend"9MYSQLD_EXTRA_MY_CNF_OPTS="
10innodb-data-file-path=ibdata1:${DEFAULT_IBDATA_SIZE};ibdata2:5M:autoextend
11"
12
13start_server
5load_dbase_schema incremental_sample14load_dbase_schema incremental_sample
615
7echo "innodb-data-file-path=ibdata1:${DEFAULT_IBDATA_SIZE};ibdata2:5M:autoextend" >>$topdir/my.cnf
8
9# Adding initial rows16# Adding initial rows
10vlog "Adding initial rows to database..."17vlog "Adding initial rows to database..."
11${MYSQL} ${MYSQL_ARGS} -e "insert into test values (1, 1);" incremental_sample18${MYSQL} ${MYSQL_ARGS} -e "insert into test values (1, 1);" incremental_sample
1219
=== modified file 'test/t/bug483827.sh'
--- test/t/bug483827.sh 2012-06-05 12:35:33 +0000
+++ test/t/bug483827.sh 2013-04-23 10:01:01 +0000
@@ -18,10 +18,7 @@
18modify_args18modify_args
1919
20# make my_multi.cnf20# make my_multi.cnf
21echo "21sed -e 's/\[mysqld\]/[mysqld1]/' $topdir/my.cnf > $topdir/my_multi.cnf
22[mysqld1]
23datadir=${mysql_datadir}
24tmpdir=$mysql_tmpdir" > $topdir/my_multi.cnf
2522
26# Backup23# Backup
27innobackupex --no-timestamp --defaults-group=mysqld1 $backup_dir24innobackupex --no-timestamp --defaults-group=mysqld1 $backup_dir
2825
=== modified file 'test/t/bug606981.sh'
--- test/t/bug606981.sh 2012-06-19 06:00:44 +0000
+++ test/t/bug606981.sh 2013-04-23 10:01:01 +0000
@@ -6,12 +6,16 @@
6 exit $SKIPPED_EXIT_CODE6 exit $SKIPPED_EXIT_CODE
7fi7fi
88
9start_server --innodb_file_per_table9MYSQLD_EXTRA_MY_CNF_OPTS="
10innodb_file_per_table=1
11innodb_flush_method=O_DIRECT
12"
13
14start_server
1015
11load_sakila16load_sakila
1217
13# Take backup18# Take backup
14echo "innodb_flush_method=O_DIRECT" >> $topdir/my.cnf
15mkdir -p $topdir/backup19mkdir -p $topdir/backup
16innobackupex --stream=tar $topdir/backup > $topdir/backup/out.tar20innobackupex --stream=tar $topdir/backup > $topdir/backup/out.tar
17stop_server21stop_server
@@ -30,11 +34,11 @@
30backup_dir=$topdir/backup34backup_dir=$topdir/backup
31cd $backup_dir35cd $backup_dir
32$TAR -ixvf out.tar36$TAR -ixvf out.tar
33cd - >/dev/null 2>&1 37cd - >/dev/null 2>&1
34innobackupex --apply-log --defaults-file=$topdir/my.cnf $backup_dir38innobackupex --apply-log $backup_dir
35vlog "Restoring MySQL datadir"39vlog "Restoring MySQL datadir"
36mkdir -p $mysql_datadir40mkdir -p $mysql_datadir
37innobackupex --copy-back --defaults-file=$topdir/my.cnf $backup_dir41innobackupex --copy-back $backup_dir
3842
39start_server43start_server
40# Check sakila44# Check sakila
4145
=== modified file 'test/t/bug740489.sh'
--- test/t/bug740489.sh 2013-01-07 19:14:19 +0000
+++ test/t/bug740489.sh 2013-04-23 10:01:01 +0000
@@ -6,26 +6,34 @@
6start_server --innodb_file_per_table6start_server --innodb_file_per_table
7load_sakila7load_sakila
88
9run_cmd ${MYSQL} ${MYSQL_ARGS} -e "UPDATE mysql.user SET Password=PASSWORD('password') WHERE User='root'; FLUSH PRIVILEGES;"9run_cmd ${MYSQL} ${MYSQL_ARGS} <<EOF
1010SET PASSWORD FOR 'root'@'localhost' = PASSWORD('password');
11defaults_extra_file=${TEST_BASEDIR}/740489.cnf11EOF
1212
13echo "[client]" > $defaults_extra_file13defaults_extra_file=$topdir/740489.cnf
14echo "user=root" >> $defaults_extra_file14
15echo "password=password" >> $defaults_extra_file15cat > $defaults_extra_file <<EOF
1616[mysqld]
17mkdir -p $topdir/backup17datadir=${MYSQLD_DATADIR}
18cat ${MYSQLD_VARDIR}/my.cnf18
19run_cmd $IB_BIN --defaults-extra-file=$defaults_extra_file --socket=${MYSQLD_SOCKET} --ibbackup=$XB_BIN $topdir/backup19[client]
20backup_dir=`grep "innobackupex: Backup created in directory" $OUTFILE | awk -F\' '{ print $2}'`20user=root
21password=password
22EOF
23
24backup_dir=$topdir/backup
25run_cmd $IB_BIN \
26 --defaults-extra-file=$defaults_extra_file --socket=${MYSQLD_SOCKET} \
27 --ibbackup=$XB_BIN --no-timestamp $backup_dir
21vlog "Backup created in directory $backup_dir"28vlog "Backup created in directory $backup_dir"
2229
23run_cmd ${MYSQL} ${MYSQL_ARGS} --password=password -e "UPDATE mysql.user SET Password=PASSWORD('') WHERE User='root'; FLUSH PRIVILEGES;"30run_cmd ${MYSQL} ${MYSQL_ARGS} --password=password <<EOF
31SET PASSWORD FOR 'root'@'localhost' = PASSWORD('');
32EOF
2433
25stop_server34stop_server
26# Remove datadir35# Remove datadir
27rm -r $mysql_datadir36rm -r $mysql_datadir
28#init_mysql_dir
29# Restore sakila37# Restore sakila
30vlog "Applying log"38vlog "Applying log"
31vlog "###########"39vlog "###########"
3240
=== modified file 'test/t/bug759225.sh'
--- test/t/bug759225.sh 2012-06-19 06:00:44 +0000
+++ test/t/bug759225.sh 2013-04-23 10:01:01 +0000
@@ -16,11 +16,13 @@
16 exit $SKIPPED_EXIT_CODE16 exit $SKIPPED_EXIT_CODE
17fi17fi
1818
19MYSQLD_EXTRA_MY_CNF_OPTS="
20innodb_flush_method=ALL_O_DIRECT
21"
19start_server22start_server
20load_sakila23load_sakila
2124
22# Take backup25# Take backup
23echo "innodb_flush_method=ALL_O_DIRECT" >> $topdir/my.cnf
24mkdir -p $topdir/backup26mkdir -p $topdir/backup
25innobackupex --stream=tar $topdir/backup > $topdir/backup/out.tar27innobackupex --stream=tar $topdir/backup > $topdir/backup/out.tar
26stop_server28stop_server
@@ -39,11 +41,11 @@
39backup_dir=$topdir/backup41backup_dir=$topdir/backup
40cd $backup_dir42cd $backup_dir
41$TAR -ixvf out.tar43$TAR -ixvf out.tar
42cd - >/dev/null 2>&1 44cd - >/dev/null 2>&1
43innobackupex --apply-log --defaults-file=$topdir/my.cnf $backup_dir45innobackupex --apply-log $backup_dir
44vlog "Restoring MySQL datadir"46vlog "Restoring MySQL datadir"
45mkdir -p $mysql_datadir47mkdir -p $mysql_datadir
46innobackupex --copy-back --defaults-file=$topdir/my.cnf $backup_dir48innobackupex --copy-back $backup_dir
4749
48start_server50start_server
49# Check sakila51# Check sakila
5052
=== modified file 'test/t/bug870119.sh'
--- test/t/bug870119.sh 2013-03-05 13:07:11 +0000
+++ test/t/bug870119.sh 2013-04-23 10:01:01 +0000
@@ -4,10 +4,13 @@
44
5. inc/common.sh5. inc/common.sh
66
7start_server --innodb_file_per_table
8
9# Set the minimum value for innodb_open_files to be used by xtrabackup7# Set the minimum value for innodb_open_files to be used by xtrabackup
10echo "innodb_open_files=10" >>$topdir/my.cnf8MYSQLD_EXTRA_MY_CNF_OPTS="
9innodb_file_per_table=1
10innodb_open_files=10
11"
12
13start_server
1114
12load_dbase_schema sakila15load_dbase_schema sakila
13load_dbase_data sakila16load_dbase_data sakila
1417
=== modified file 'test/t/bug891496.sh'
--- test/t/bug891496.sh 2013-03-08 04:37:16 +0000
+++ test/t/bug891496.sh 2013-04-23 10:01:01 +0000
@@ -5,13 +5,11 @@
55
6. inc/common.sh6. inc/common.sh
77
8innodb_data_file_path="ibdata1:3M;ibdata2:10M:autoextend"8MYSQLD_EXTRA_MY_CNF_OPTS="
99innodb_data_file_path=ibdata1:3M;ibdata2:10M:autoextend
10start_server --innodb_data_file_path=$innodb_data_file_path10"
1111
12cat >> $topdir/my.cnf <<EOF12start_server
13innodb_data_file_path=$innodb_data_file_path
14EOF
1513
16load_dbase_schema sakila14load_dbase_schema sakila
17load_dbase_data sakila15load_dbase_data sakila
@@ -40,6 +38,6 @@
40vlog "###########"38vlog "###########"
41innobackupex --copy-back $backup_dir39innobackupex --copy-back $backup_dir
4240
43start_server --innodb_data_file_path=$innodb_data_file_path41start_server
44# Check sakila42# Check sakila
45run_cmd ${MYSQL} ${MYSQL_ARGS} -e "SELECT count(*) from actor" sakila43run_cmd ${MYSQL} ${MYSQL_ARGS} -e "SELECT count(*) from actor" sakila
4644
=== modified file 'test/t/bug976945.sh'
--- test/t/bug976945.sh 2012-06-18 03:38:41 +0000
+++ test/t/bug976945.sh 2013-04-23 10:01:01 +0000
@@ -8,8 +8,10 @@
8 exit $SKIPPED_EXIT_CODE8 exit $SKIPPED_EXIT_CODE
9fi9fi
1010
11start_server --innodb_log_block_size=409611MYSQLD_EXTRA_MY_CNF_OPTS="
12echo innodb_log_block_size=4096 >> ${MYSQLD_VARDIR}/my.cnf12innodb_log_block_size=4096
13"
14start_server
13load_sakila15load_sakila
1416
15# Full backup17# Full backup
1618
=== modified file 'test/t/bug977101.sh'
--- test/t/bug977101.sh 2012-06-08 18:46:19 +0000
+++ test/t/bug977101.sh 2013-04-23 10:01:01 +0000
@@ -17,15 +17,14 @@
1717
18# Check that binlog info is correct with --safe-slave-backup18# Check that binlog info is correct with --safe-slave-backup
19innobackupex --no-timestamp --safe-slave-backup $topdir/backup19innobackupex --no-timestamp --safe-slave-backup $topdir/backup
20egrep -q '^mysql-bin.000001[[:space:]]+[0-9]+[[:space:]]+$' \20egrep -q '^mysql-bin.[0-9]+[[:space:]]+[0-9]+[[:space:]]+$' \
21 $topdir/backup/xtrabackup_binlog_info21 $topdir/backup/xtrabackup_binlog_info
2222
23# Check that both binlog info and slave info are correct with 23# Check that both binlog info and slave info are correct with
24# --safe-slave-backup24# --safe-slave-backup
25rm -rf $topdir/backup25rm -rf $topdir/backup
26innobackupex --no-timestamp --slave-info --safe-slave-backup $topdir/backup26innobackupex --no-timestamp --slave-info --safe-slave-backup $topdir/backup
27egrep -q '^mysql-bin.000001[[:space:]]+[0-9]+[[:space:]]+$' \27egrep -q '^mysql-bin.[0-9]+[[:space:]]+[0-9]+[[:space:]]+$' \
28 $topdir/backup/xtrabackup_binlog_info28 $topdir/backup/xtrabackup_binlog_info
29egrep -q '^CHANGE MASTER TO MASTER_LOG_FILE='\''mysql-bin.000001'\'', MASTER_LOG_POS=[0-9]+$' \29egrep -q '^CHANGE MASTER TO MASTER_LOG_FILE='\''mysql-bin.[0-9]+'\'', MASTER_LOG_POS=[0-9]+$' \
30 $topdir/backup/xtrabackup_slave_info30 $topdir/backup/xtrabackup_slave_info
31
3231
=== modified file 'test/t/ib_doublewrite.sh'
--- test/t/ib_doublewrite.sh 2012-11-15 15:27:58 +0000
+++ test/t/ib_doublewrite.sh 2013-04-23 10:01:01 +0000
@@ -15,7 +15,12 @@
15fi15fi
1616
17DBLWR=dblwr.ibd17DBLWR=dblwr.ibd
18start_server --innodb_file_per_table --innodb_doublewrite_file=${DBLWR}18
19MYSQLD_EXTRA_MY_CNF_OPTS="
20innodb_file_per_table=1
21innodb_doublewrite_file=$DBLWR
22"
23start_server
19load_dbase_schema incremental_sample24load_dbase_schema incremental_sample
2025
21# Workaround for bug #107269526# Workaround for bug #1072695
@@ -25,8 +30,6 @@
25 run_cmd $IB_BIN $IB_ARGS_NO_DEFAULTS_FILE $*30 run_cmd $IB_BIN $IB_ARGS_NO_DEFAULTS_FILE $*
26}31}
2732
28echo "innodb_doublewrite_file=${DBLWR}" >>$topdir/my.cnf
29
30# Adding initial rows33# Adding initial rows
31vlog "Adding initial rows to database..."34vlog "Adding initial rows to database..."
32${MYSQL} ${MYSQL_ARGS} -e "insert into test values (1, 1);" incremental_sample35${MYSQL} ${MYSQL_ARGS} -e "insert into test values (1, 1);" incremental_sample
3336
=== modified file 'test/t/ib_part_include.sh'
--- test/t/ib_part_include.sh 2013-03-07 11:38:14 +0000
+++ test/t/ib_part_include.sh 2013-04-23 10:01:01 +0000
@@ -27,9 +27,9 @@
2727
28# also test xtrabackup --stats work with --tables-file28# also test xtrabackup --stats work with --tables-file
29COUNT=`xtrabackup --stats --tables='test.test$' --datadir=$topdir/backup \29COUNT=`xtrabackup --stats --tables='test.test$' --datadir=$topdir/backup \
30 | grep table: | awk '{print $2}' | sort -u | wc -l`30 | grep table: | grep -v SYS_ | awk '{print $2}' | sort -u | wc -l`
3131
32if [ $COUNT != 7 ] ; then32if [ $COUNT != 5 ] ; then
33 vlog "xtrabackup --stats does not work"33 vlog "xtrabackup --stats does not work"
34 exit -134 exit -1
35fi35fi
3636
=== modified file 'test/t/ib_part_tf_innodb.sh'
--- test/t/ib_part_tf_innodb.sh 2013-03-07 11:38:14 +0000
+++ test/t/ib_part_tf_innodb.sh 2013-04-23 10:01:01 +0000
@@ -30,9 +30,9 @@
30vlog "Backup taken"30vlog "Backup taken"
3131
32COUNT=`xtrabackup --stats --tables-file=$topdir/tables --datadir=$topdir/backup \32COUNT=`xtrabackup --stats --tables-file=$topdir/tables --datadir=$topdir/backup \
33 | grep table: | awk '{print $2}' | sort -u | wc -l`33 | grep table: | grep -v SYS_ | awk '{print $2}' | sort -u | wc -l`
34echo "COUNT = $COUNT"34echo "COUNT = $COUNT"
35if [ $COUNT != 7 ] ; then35if [ $COUNT != 5 ] ; then
36 vlog "xtrabackup --stats does not work"36 vlog "xtrabackup --stats does not work"
37 exit -137 exit -1
38fi38fi
3939
=== modified file 'test/t/ib_slave_info.sh'
--- test/t/ib_slave_info.sh 2012-06-05 12:35:33 +0000
+++ test/t/ib_slave_info.sh 2013-04-23 10:01:01 +0000
@@ -30,7 +30,7 @@
30 $topdir/backup30 $topdir/backup
3131
32innobackupex --no-timestamp --slave-info $topdir/backup32innobackupex --no-timestamp --slave-info $topdir/backup
33egrep -q '^mysql-bin.000001[[:space:]]+[0-9]+[[:space:]]+$' \33egrep -q '^mysql-bin.[0-9]+[[:space:]]+[0-9]+[[:space:]]+$' \
34 $topdir/backup/xtrabackup_binlog_info34 $topdir/backup/xtrabackup_binlog_info
35egrep -q '^CHANGE MASTER TO MASTER_LOG_FILE='\''mysql-bin.000001'\'', MASTER_LOG_POS=[0-9]+$' \35egrep -q '^CHANGE MASTER TO MASTER_LOG_FILE='\''mysql-bin.[0-9]+'\'', MASTER_LOG_POS=[0-9]+$' \
36 $topdir/backup/xtrabackup_slave_info36 $topdir/backup/xtrabackup_slave_info
3737
=== added file 'test/t/remote_tablespaces.sh'
--- test/t/remote_tablespaces.sh 1970-01-01 00:00:00 +0000
+++ test/t/remote_tablespaces.sh 2013-04-23 10:01:01 +0000
@@ -0,0 +1,53 @@
1########################################################################
2# Test remote tablespaces in InnoDB 5.6
3########################################################################
4
5. inc/common.sh
6
7if [ ${MYSQL_VERSION:0:3} != "5.6" ]
8then
9 echo "Requires a 5.6 server" > $SKIPPED_REASON
10 exit $SKIPPED_EXIT_CODE
11fi
12
13start_server --innodb_file_per_table
14
15remote_dir=$TEST_BASEDIR/var1/remote_dir
16
17$MYSQL $MYSQL_ARGS test <<EOF
18CREATE TABLE t(id INT AUTO_INCREMENT PRIMARY KEY, c INT)
19 DATA DIRECTORY = '$remote_dir' ENGINE=InnoDB;
20INSERT INTO t(c) VALUES (1), (2), (3), (4), (5), (6), (7), (8);
21EOF
22
23# Generate some log data, as we also want to test recovery of remote tablespaces
24for ((i=0; i<12; i++))
25do
26 $MYSQL $MYSQL_ARGS test <<EOF
27 INSERT INTO t(c) SELECT c FROM t;
28EOF
29done
30
31checksum_a=`checksum_table test t`
32
33innobackupex --no-timestamp $topdir/backup
34
35stop_server
36
37rm -rf $mysql_datadir/*
38
39innobackupex --apply-log $topdir/backup
40innobackupex --copy-back $topdir/backup
41
42start_server
43
44checksum_b=`checksum_table test t`
45
46vlog "Old checksum: $checksum_a"
47vlog "New checksum: $checksum_b"
48
49if [ "$checksum_a" != "$checksum_b" ]
50then
51 vlog "Checksums do not match"
52 exit -1
53fi
054
=== added file 'test/t/undo_tablespaces.sh'
--- test/t/undo_tablespaces.sh 1970-01-01 00:00:00 +0000
+++ test/t/undo_tablespaces.sh 2013-04-23 10:01:01 +0000
@@ -0,0 +1,75 @@
1########################################################################
2# Test support for separate UNDO tablespace
3########################################################################
4
5. inc/common.sh
6
7if [ ${MYSQL_VERSION:0:3} != "5.6" ]
8then
9 echo "Requires a 5.6 server" > $SKIPPED_REASON
10 exit $SKIPPED_EXIT_CODE
11fi
12
13################################################################################
14# Start an uncommitted transaction pause "indefinitely" to keep the connection
15# open
16################################################################################
17function start_uncomitted_transaction()
18{
19 run_cmd $MYSQL $MYSQL_ARGS sakila <<EOF
20START TRANSACTION;
21DELETE FROM payment;
22SELECT SLEEP(10000);
23EOF
24}
25
26undo_directory=$TEST_BASEDIR/var1/undo_dir
27
28MYSQLD_EXTRA_MY_CNF_OPTS="
29innodb_file_per_table=1
30innodb_undo_directory=$undo_directory
31innodb_undo_tablespaces=4
32"
33
34start_server
35load_sakila
36
37checksum1=`checksum_table sakila payment`
38test -n "$checksum1" || die "Failed to checksum table sakila.payment"
39
40# Start a transaction, modify some data and keep it uncommitted for the backup
41# stage. InnoDB avoids using the rollback segment in the system tablespace, if
42# separate undo tablespaces are used, so the test would fail if we did not
43# handle separate undo tablespaces correctly.
44start_uncomitted_transaction &
45job_master=$!
46
47innobackupex --no-timestamp $topdir/backup
48
49kill -SIGKILL $job_master
50stop_server
51
52rm -rf $MYSQLD_DATADIR/*
53rm -rf $undo_directory/*
54
55innobackupex --apply-log $topdir/backup
56
57innobackupex --copy-back $topdir/backup
58
59
60
61start_server
62
63# Check that the uncommitted transaction has been rolled back
64
65checksum2=`checksum_table sakila payment`
66test -n "$checksum2" || die "Failed to checksum table sakila.payment"
67
68vlog "Old checksum: $checksum1"
69vlog "New checksum: $checksum2"
70
71if [ "$checksum1" != "$checksum2" ]
72then
73 vlog "Checksums do not match"
74 exit -1
75fi
076
=== modified file 'test/t/xb_basic.sh'
--- test/t/xb_basic.sh 2012-10-15 16:14:59 +0000
+++ test/t/xb_basic.sh 2013-04-23 10:01:01 +0000
@@ -13,7 +13,6 @@
13stop_server13stop_server
14# Remove datadir14# Remove datadir
15rm -r $mysql_datadir15rm -r $mysql_datadir
16#init_mysql_dir
17# Restore sakila16# Restore sakila
18vlog "Applying log"17vlog "Applying log"
19vlog "###########"18vlog "###########"
2019
=== modified file 'test/t/xb_version.sh'
--- test/t/xb_version.sh 2011-06-14 14:34:23 +0000
+++ test/t/xb_version.sh 2013-04-23 10:01:01 +0000
@@ -1,4 +1,3 @@
1. inc/common.sh1. inc/common.sh
22
3xtrabackup --version3xtrabackup --version
4
54
=== modified file 'test/testrun.sh'
--- test/testrun.sh 2013-03-13 05:05:16 +0000
+++ test/testrun.sh 2013-04-23 10:01:01 +0000
@@ -176,7 +176,7 @@
176 then176 then
177 INNODB_FLAVOR="XtraDB"177 INNODB_FLAVOR="XtraDB"
178 else178 else
179 INNODB_FLAVOR="innoDB"179 INNODB_FLAVOR="InnoDB"
180 fi180 fi
181181
182 if [ "$XB_BUILD" = "autodetect" ]182 if [ "$XB_BUILD" = "autodetect" ]

Subscribers

People subscribed via source and target branches