Merge lp:~akopytov/percona-xtrabackup/read-server-options-with-show-variables into lp:percona-xtrabackup/2.2
- read-server-options-with-show-variables
- Merge into 2.2
Status: | Merged |
---|---|
Approved by: | Sergei Glushchenko |
Approved revision: | no longer in the source branch. |
Merged at revision: | 5032 |
Proposed branch: | lp:~akopytov/percona-xtrabackup/read-server-options-with-show-variables |
Merge into: | lp:percona-xtrabackup/2.2 |
Diff against target: |
875 lines (+385/-197) 8 files modified
storage/innobase/xtrabackup/innobackupex.pl (+182/-136) storage/innobase/xtrabackup/src/xtrabackup.cc (+106/-48) storage/innobase/xtrabackup/test/run.sh (+2/-6) storage/innobase/xtrabackup/test/t/bug1062684.sh (+6/-6) storage/innobase/xtrabackup/test/t/bug1334062.sh (+24/-0) storage/innobase/xtrabackup/test/t/bug1343722.sh (+18/-0) storage/innobase/xtrabackup/test/t/bug766305.sh (+1/-1) storage/innobase/xtrabackup/test/t/xb_print_param.sh (+46/-0) |
To merge this branch: | bzr merge lp:~akopytov/percona-xtrabackup/read-server-options-with-show-variables |
Related bugs: |
|
Related blueprints: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Sergei Glushchenko (community) | Approve | ||
Review via email: mp+237249@code.launchpad.net |
Commit message
Description of the change
Implementation of
https:/
On the backup stage, read options from the server via SHOW VARIABLES
rather than my.cnf. For the ‘datadir’ option, make sure we get the same
value as we would get from my.cnf (if the option is defined there),
because the xtrabackup binary does not have a server connection and uses
my.cnf instead.
Alexey Kopytov (akopytov) wrote : | # |
Sergei Glushchenko (sergei.glushchenko) wrote : | # |
Hi Alexey,
The patch itself looks good, but
I am concerned of "Bug #1343722: Too easy to backup wrong datadir with
multiple instances". Not only datadir but every other important option
can be different if we read options from my.cnf which doesn't belong
to MySQL instance.
This patch makes following change:
innobackupex reads options from running MySQL.
xtrabackup reads options from my.cnf.
Now instead of single source we have two sources which can be out of
sync. We making sure that xtrabackup and innobackupex agree about
"datadir" but we don't take proper care of other options. Wouldn't it
be better to make both innobackupex and xtrabackup to use runtime
options (innobackupex could simply pass all sensitive options to
xtrabackup or even dump them into tmp-my.cnf).
Alexey Kopytov (akopytov) wrote : | # |
Hi Sergei,
On Tue, Oct 07 2014 13:05:13 +0400, Sergei Glushchenko wrote:
> Hi Alexey,
>
> The patch itself looks good, but
>
> I am concerned of "Bug #1343722: Too easy to backup wrong datadir with
> multiple instances". Not only datadir but every other important option
> can be different if we read options from my.cnf which doesn't belong
> to MySQL instance.
>
> This patch makes following change:
>
> innobackupex reads options from running MySQL.
> xtrabackup reads options from my.cnf.
>
> Now instead of single source we have two sources which can be out of
> sync. We making sure that xtrabackup and innobackupex agree about
> "datadir" but we don't take proper care of other options. Wouldn't it
> be better to make both innobackupex and xtrabackup to use runtime
> options (innobackupex could simply pass all sensitive options to
> xtrabackup or even dump them into tmp-my.cnf).
Well, the patch went through multiple iterations. In one of them, it did
exactly that: it verified all options rather than just datadir. A few
problems had been revealed in testing:
- boolean values like innodb_
have a value) in the defaults file. That’s how ‘xtrabackup
--print-param’ prints them. But their values in SHOW VARIABLES are
ON/OFF. So this must be taken into account when validating all
options.
- path options like innodb_
etc. They can be specified in an unnormalized way (with multiple
slashes, “.”, “..”, etc.) in configuration file, but for some of them
the server normalizes the paths as shown in SHOW VARIABLES, and for
some of them no normalization is done. This could be solved with
realpath() as we currently do with datadir. But on top of that, those
paths can be relative to datadir, and that would require even more
complex validation logic than just using realpath()
- sometimes we deliberately want to override some options for xtrabackup
in the [xtrabackup] section of my.cnf, so that the values would be
deliberately different between SHOW VARIABLES and the ones printed by
‘xtrabackup --print-param’.
After some considerations, I decided to only validate datadir, as
everything else would be a bit too risky for a point release. The patch
is rather invasive for a point release even without those changes.
As to passing all sensitive options from innobackupex to xtrabackup,
that’s what we do now for some of them (namely, datadir,
innodb_
have different defaults across major server versions, so using runtime
values is crucial.
Passing other value would work, and would eliminate possibility (which
is rather low in practice) of cases when ‘datadir’ is the same in SHOW
VARIABLES and my.cnf, but other (sensitive for XtraBackup) options are
different. But it comes with its own bunch of drawbacks and further
complications and corner cases in the code.
I decided to keep the patch minimal to solve current issues
for a point release, and scheduled
https:/
for the next major release. Seriously, we should do it ASAP...
Sergei Glushchenko (sergei.glushchenko) wrote : | # |
Hi Alexey,
The patch looks good to me. I agree that getting rid of innobackupex will solve many issues and I believe we should include https:/
Approved.
Preview Diff
1 | === modified file 'storage/innobase/xtrabackup/innobackupex.pl' | |||
2 | --- storage/innobase/xtrabackup/innobackupex.pl 2014-10-05 12:02:02 +0000 | |||
3 | +++ storage/innobase/xtrabackup/innobackupex.pl 2014-10-06 12:20:08 +0000 | |||
4 | @@ -23,6 +23,7 @@ | |||
5 | 23 | use English qw(-no_match_vars); | 23 | use English qw(-no_match_vars); |
6 | 24 | use Time::HiRes qw(usleep); | 24 | use Time::HiRes qw(usleep); |
7 | 25 | use Carp qw(longmess); | 25 | use Carp qw(longmess); |
8 | 26 | use Cwd qw(realpath); | ||
9 | 26 | 27 | ||
10 | 27 | # version of this script | 28 | # version of this script |
11 | 28 | my $innobackup_version = '1.5.1-xtrabackup'; | 29 | my $innobackup_version = '1.5.1-xtrabackup'; |
12 | @@ -1896,10 +1897,10 @@ | |||
13 | 1896 | # process. | 1897 | # process. |
14 | 1897 | # | 1898 | # |
15 | 1898 | sub backup { | 1899 | sub backup { |
17 | 1899 | my $orig_datadir = get_option(\%config, $option_defaults_group, 'datadir'); | 1900 | my $orig_datadir = get_option('datadir'); |
18 | 1900 | my $suspend_file; | 1901 | my $suspend_file; |
21 | 1901 | my $buffer_pool_filename = get_option(\%config, $option_defaults_group, | 1902 | my $buffer_pool_filename = get_option_safe('innodb_buffer_pool_filename', |
22 | 1902 | 'innodb_buffer_pool_filename'); | 1903 | ''); |
23 | 1903 | 1904 | ||
24 | 1904 | detect_mysql_capabilities_for_backup(\%mysql); | 1905 | detect_mysql_capabilities_for_backup(\%mysql); |
25 | 1905 | 1906 | ||
26 | @@ -2038,7 +2039,8 @@ | |||
27 | 2038 | # copy ib_lru_dump | 2039 | # copy ib_lru_dump |
28 | 2039 | # Copy buffer poll dump and/or LRU dump | 2040 | # Copy buffer poll dump and/or LRU dump |
29 | 2040 | foreach my $dump_name ($buffer_pool_filename, 'ib_lru_dump') { | 2041 | foreach my $dump_name ($buffer_pool_filename, 'ib_lru_dump') { |
31 | 2041 | if (!$option_rsync && -e "$orig_datadir/$dump_name") { | 2042 | if (!$option_rsync && $dump_name ne '' && |
32 | 2043 | -e "$orig_datadir/$dump_name") { | ||
33 | 2042 | backup_file("$orig_datadir", "$dump_name", "$backup_dir/$dump_name") | 2044 | backup_file("$orig_datadir", "$dump_name", "$backup_dir/$dump_name") |
34 | 2043 | } | 2045 | } |
35 | 2044 | } | 2046 | } |
36 | @@ -2401,14 +2403,6 @@ | |||
37 | 2401 | # | 2403 | # |
38 | 2402 | sub copy_back { | 2404 | sub copy_back { |
39 | 2403 | my $move_flag = shift; | 2405 | my $move_flag = shift; |
40 | 2404 | my $orig_datadir = get_option(\%config, $option_defaults_group, 'datadir'); | ||
41 | 2405 | my $orig_ibdata_dir = | ||
42 | 2406 | get_option(\%config, $option_defaults_group, 'innodb_data_home_dir'); | ||
43 | 2407 | my $orig_innodb_data_file_path = | ||
44 | 2408 | get_option(\%config, $option_defaults_group, 'innodb_data_file_path'); | ||
45 | 2409 | my $orig_iblog_dir = | ||
46 | 2410 | get_option(\%config, $option_defaults_group, 'innodb_log_group_home_dir'); | ||
47 | 2411 | my $orig_undo_dir = $orig_ibdata_dir; | ||
48 | 2412 | my $iblog_files = 'ib_logfile.*'; | 2406 | my $iblog_files = 'ib_logfile.*'; |
49 | 2413 | my $ibundo_files = 'undo[0-9]{3}'; | 2407 | my $ibundo_files = 'undo[0-9]{3}'; |
50 | 2414 | my $excluded_files = | 2408 | my $excluded_files = |
51 | @@ -2418,21 +2412,24 @@ | |||
52 | 2418 | '.*\.pmap|.*\.tmp|' . | 2412 | '.*\.pmap|.*\.tmp|' . |
53 | 2419 | $iblog_files . '|'. | 2413 | $iblog_files . '|'. |
54 | 2420 | $ibundo_files; | 2414 | $ibundo_files; |
55 | 2421 | my $compressed_data_file = '.*\.ibz$'; | ||
56 | 2422 | my $file; | 2415 | my $file; |
60 | 2423 | my $backup_innodb_data_file_path; | 2416 | |
61 | 2424 | 2417 | my $orig_datadir = get_option('datadir'); | |
62 | 2425 | if (has_option(\%config, $option_defaults_group, 'innodb_doublewrite_file')) { | 2418 | my $orig_ibdata_dir = get_option_safe('innodb_data_home_dir', |
63 | 2419 | $orig_datadir); | ||
64 | 2420 | my $orig_innodb_data_file_path = get_option_safe('innodb_data_file_path', | ||
65 | 2421 | ''); | ||
66 | 2422 | my $orig_iblog_dir = get_option_safe('innodb_log_group_home_dir', | ||
67 | 2423 | $orig_datadir); | ||
68 | 2424 | my $orig_undo_dir = get_option_safe('innodb_undo_directory', | ||
69 | 2425 | $orig_datadir); | ||
70 | 2426 | |||
71 | 2427 | if (has_option('innodb_doublewrite_file')) { | ||
72 | 2426 | my $doublewrite_file = | 2428 | my $doublewrite_file = |
75 | 2427 | get_option(\%config, $option_defaults_group, | 2429 | get_option('innodb_doublewrite_file'); |
74 | 2428 | 'innodb_doublewrite_file'); | ||
76 | 2429 | $excluded_files = $excluded_files . '|' . $doublewrite_file; | 2430 | $excluded_files = $excluded_files . '|' . $doublewrite_file; |
77 | 2430 | } | 2431 | } |
78 | 2431 | 2432 | ||
79 | 2432 | if (has_option(\%config, $option_defaults_group, 'innodb_undo_directory')) { | ||
80 | 2433 | $orig_undo_dir = get_option(\%config, $option_defaults_group, | ||
81 | 2434 | 'innodb_undo_directory'); | ||
82 | 2435 | } | ||
83 | 2436 | # check whether files should be copied or moved to dest directory | 2433 | # check whether files should be copied or moved to dest directory |
84 | 2437 | my $move_or_copy_file = $move_flag ? \&move_file : \©_file; | 2434 | my $move_or_copy_file = $move_flag ? \&move_file : \©_file; |
85 | 2438 | my $move_or_copy_dir = $move_flag ? | 2435 | my $move_or_copy_dir = $move_flag ? |
86 | @@ -2568,11 +2565,7 @@ | |||
87 | 2568 | my $cmdline_copy = ''; | 2565 | my $cmdline_copy = ''; |
88 | 2569 | my $options = ''; | 2566 | my $options = ''; |
89 | 2570 | 2567 | ||
95 | 2571 | if ($option_defaults_file) { | 2568 | $options = $options . " --defaults-file=\"${backup_dir}/backup-my.cnf\" "; |
91 | 2572 | $options = $options . " --defaults-file=\"$option_defaults_file\" "; | ||
92 | 2573 | } else { | ||
93 | 2574 | $options = $options . " --defaults-file=\"${backup_dir}/backup-my.cnf\" "; | ||
94 | 2575 | } | ||
96 | 2576 | 2569 | ||
97 | 2577 | if ($option_defaults_extra_file) { | 2570 | if ($option_defaults_extra_file) { |
98 | 2578 | $options = $options . " --defaults-extra-file=\"$option_defaults_extra_file\" "; | 2571 | $options = $options . " --defaults-extra-file=\"$option_defaults_extra_file\" "; |
99 | @@ -2603,7 +2596,7 @@ | |||
100 | 2603 | } | 2596 | } |
101 | 2604 | 2597 | ||
102 | 2605 | my $innodb_data_file_path = | 2598 | my $innodb_data_file_path = |
104 | 2606 | get_option(\%config, $option_defaults_group, 'innodb_data_file_path'); | 2599 | get_option('innodb_data_file_path'); |
105 | 2607 | 2600 | ||
106 | 2608 | # run ibbackup as a child process | 2601 | # run ibbackup as a child process |
107 | 2609 | $cmdline = "$option_ibbackup_binary $options"; | 2602 | $cmdline = "$option_ibbackup_binary $options"; |
108 | @@ -2786,6 +2779,21 @@ | |||
109 | 2786 | $options = $options . " --target-dir=$backup_dir"; | 2779 | $options = $options . " --target-dir=$backup_dir"; |
110 | 2787 | } | 2780 | } |
111 | 2788 | 2781 | ||
112 | 2782 | my $datadir = get_option('datadir'); | ||
113 | 2783 | if (!has_option_in_config('datadir')) { | ||
114 | 2784 | $options .= " --datadir=\"$datadir\""; | ||
115 | 2785 | } | ||
116 | 2786 | |||
117 | 2787 | my $innodb_log_file_size = get_option('innodb_log_file_size'); | ||
118 | 2788 | if (!has_option_in_config('innodb_log_file_size')) { | ||
119 | 2789 | $options .= " --innodb_log_file_size=\"$innodb_log_file_size\""; | ||
120 | 2790 | } | ||
121 | 2791 | |||
122 | 2792 | my $innodb_data_file_path = get_option('innodb_data_file_path'); | ||
123 | 2793 | if (!has_option_in_config('innodb_data_file_path')) { | ||
124 | 2794 | $options .= " --innodb_data_file_path=\"$innodb_data_file_path\""; | ||
125 | 2795 | } | ||
126 | 2796 | |||
127 | 2789 | if ($option_tmpdir) { | 2797 | if ($option_tmpdir) { |
128 | 2790 | $options .= " --tmpdir=$option_tmpdir"; | 2798 | $options .= " --tmpdir=$option_tmpdir"; |
129 | 2791 | } | 2799 | } |
130 | @@ -3579,44 +3587,44 @@ | |||
131 | 3579 | print STDERR " At the end of a successful $run run $innobackup_script\n"; | 3587 | print STDERR " At the end of a successful $run run $innobackup_script\n"; |
132 | 3580 | print STDERR " prints \"completed OK!\".\n\n"; | 3588 | print STDERR " prints \"completed OK!\".\n\n"; |
133 | 3581 | 3589 | ||
142 | 3582 | if (!$option_copy_back && !$option_move_back | 3590 | if ($option_apply_log || $option_copy_back || $option_move_back) { |
143 | 3583 | && !$option_decrypt && !$option_decompress) { | 3591 | # read server configuration file |
144 | 3584 | # we are making a backup or applying log to backup | 3592 | read_config_file(\%config); |
145 | 3585 | if (!$option_apply_log) { | 3593 | } elsif ($option_backup) { |
146 | 3586 | # we are making a backup, we need mysql server | 3594 | # we are making a backup, read server configuration from SHOW VARIABLES |
147 | 3587 | get_mysql_vars(\%mysql); | 3595 | get_mysql_vars(\%mysql); |
148 | 3588 | $mysql_server_version = $mysql{vars}->{version}->{Value}; | 3596 | |
149 | 3589 | print STDERR "$prefix Using mysql server version $mysql_server_version\n"; | 3597 | # and make sure datadir value is the same in configuration file |
150 | 3598 | read_config_file(\%config); | ||
151 | 3599 | |||
152 | 3600 | my $server_val = $mysql{vars}->{datadir}->{Value}; | ||
153 | 3601 | |||
154 | 3602 | if (has_option_in_config('datadir')) { | ||
155 | 3603 | my $config_val = $config{$option_defaults_group}{datadir}; | ||
156 | 3604 | |||
157 | 3605 | if ($server_val ne $config_val && | ||
158 | 3606 | # Try to canonicalize paths | ||
159 | 3607 | realpath($server_val) ne realpath($config_val)) { | ||
160 | 3608 | |||
161 | 3609 | die "option 'datadir' has different values:\n" . | ||
162 | 3610 | " '$config_val' in defaults file\n" . | ||
163 | 3611 | " '$server_val' in SHOW VARIABLES\n" | ||
164 | 3612 | } | ||
165 | 3590 | } | 3613 | } |
166 | 3614 | |||
167 | 3615 | $mysql_server_version = $mysql{vars}->{version}->{Value}; | ||
168 | 3616 | print STDERR "$prefix Using server version $mysql_server_version\n"; | ||
169 | 3591 | print STDERR "\n"; | 3617 | print STDERR "\n"; |
198 | 3592 | 3618 | } | |
199 | 3593 | if ($option_include | 3619 | |
200 | 3594 | && $ibbackup_version | 3620 | if (!$option_tmpdir && ($option_backup || $option_apply_log) && |
201 | 3595 | && $ibbackup_version le "2.0") { | 3621 | has_option('tmpdir')) { |
202 | 3596 | # --include option was given, but ibbackup is too | 3622 | $option_tmpdir = get_option('tmpdir'); |
203 | 3597 | # old to support it | 3623 | # tmpdir can be a colon-separated list of multiple directories |
204 | 3598 | die "--include option was given, but ibbackup is too old" | 3624 | $option_tmpdir = (split(/:/, $option_tmpdir))[0]; |
205 | 3599 | . " to support it. You must upgrade to InnoDB Hot Backup" | 3625 | } |
206 | 3600 | . " v2.0 in order to use --include option.\n"; | 3626 | |
207 | 3601 | } | 3627 | if ($option_backup) { |
180 | 3602 | } | ||
181 | 3603 | |||
182 | 3604 | if (!$option_decrypt && !$option_decompress) { | ||
183 | 3605 | # read MySQL options file | ||
184 | 3606 | #read_config_file($config_file, \%config); | ||
185 | 3607 | read_config_file(\%config); | ||
186 | 3608 | |||
187 | 3609 | if(!$option_tmpdir) { | ||
188 | 3610 | $option_tmpdir = get_option(\%config, $option_defaults_group, 'tmpdir'); | ||
189 | 3611 | } | ||
190 | 3612 | } | ||
191 | 3613 | |||
192 | 3614 | # get innodb log home directory from options file | ||
193 | 3615 | #$innodb_log_group_home_dir = | ||
194 | 3616 | # get_option(\%config, 'mysqld', 'innodb_log_group_home_dir'); | ||
195 | 3617 | |||
196 | 3618 | if (!$option_apply_log && !$option_copy_back && !$option_move_back | ||
197 | 3619 | && !$option_decrypt && !$option_decompress) { | ||
208 | 3620 | # we are making a backup, create a new backup directory | 3628 | # we are making a backup, create a new backup directory |
209 | 3621 | $backup_dir = File::Spec->rel2abs(make_backup_dir()); | 3629 | $backup_dir = File::Spec->rel2abs(make_backup_dir()); |
210 | 3622 | print STDERR "$prefix Created backup directory $backup_dir\n"; | 3630 | print STDERR "$prefix Created backup directory $backup_dir\n"; |
211 | @@ -3656,10 +3664,6 @@ | |||
212 | 3656 | die "Failed to delete " . | 3664 | die "Failed to delete " . |
213 | 3657 | "'$option_tmpdir/$xtrabackup_pid_file': $!"; | 3665 | "'$option_tmpdir/$xtrabackup_pid_file': $!"; |
214 | 3658 | } | 3666 | } |
215 | 3659 | |||
216 | 3660 | } elsif ($option_copy_back || $option_move_back) { | ||
217 | 3661 | #$backup_config_file = $backup_dir . '/backup-my.cnf'; | ||
218 | 3662 | #read_config_file($backup_config_file, \%backup_config); | ||
219 | 3663 | } | 3667 | } |
220 | 3664 | } | 3668 | } |
221 | 3665 | 3669 | ||
222 | @@ -3693,16 +3697,18 @@ | |||
223 | 3693 | 3697 | ||
224 | 3694 | my $option_name; | 3698 | my $option_name; |
225 | 3695 | foreach $option_name (@option_names) { | 3699 | foreach $option_name (@option_names) { |
228 | 3696 | if (has_option(\%config, $option_defaults_group, $option_name)) { | 3700 | if (has_option($option_name)) { |
229 | 3697 | my $option_value = get_option(\%config, $option_defaults_group, $option_name); | 3701 | my $option_value = get_option($option_name); |
230 | 3698 | $options_dump .= "$option_name=$option_value\n"; | 3702 | $options_dump .= "$option_name=$option_value\n"; |
231 | 3699 | } | 3703 | } |
232 | 3700 | } | 3704 | } |
238 | 3701 | if (has_option(\%config, | 3705 | if (has_option('innodb_doublewrite_file')) { |
239 | 3702 | $option_defaults_group, "innodb_doublewrite_file")) { | 3706 | my $option_value = (split(/\/+/, |
240 | 3703 | $options_dump .= "innodb_doublewrite_file=" . (split(/\/+/, | 3707 | get_option('innodb_doublewrite_file')))[-1]; |
241 | 3704 | get_option(\%config, $option_defaults_group, | 3708 | |
242 | 3705 | 'innodb_doublewrite_file')))[-1] . "\n"; | 3709 | if (defined($option_value)) { |
243 | 3710 | $options_dump .= "innodb_doublewrite_file=" . $option_value . "\n"; | ||
244 | 3711 | } | ||
245 | 3706 | } | 3712 | } |
246 | 3707 | 3713 | ||
247 | 3708 | write_to_backup_file("$filename", "$options_dump"); | 3714 | write_to_backup_file("$filename", "$options_dump"); |
248 | @@ -3940,8 +3946,6 @@ | |||
249 | 3940 | # | 3946 | # |
250 | 3941 | sub make_backup_dir { | 3947 | sub make_backup_dir { |
251 | 3942 | my $dir; | 3948 | my $dir; |
252 | 3943 | my $innodb_data_file_path = | ||
253 | 3944 | get_option(\%config, $option_defaults_group, 'innodb_data_file_path'); | ||
254 | 3945 | 3949 | ||
255 | 3946 | # create backup directory | 3950 | # create backup directory |
256 | 3947 | $dir = $backup_root; | 3951 | $dir = $backup_root; |
257 | @@ -3953,19 +3957,6 @@ | |||
258 | 3953 | unless $option_no_timestamp; | 3957 | unless $option_no_timestamp; |
259 | 3954 | mkdir($dir, 0777) || die "Failed to create backup directory $dir: $!"; | 3958 | mkdir($dir, 0777) || die "Failed to create backup directory $dir: $!"; |
260 | 3955 | 3959 | ||
261 | 3956 | # create subdirectories for ibdata files if needed | ||
262 | 3957 | # foreach my $a (split(/;/, $innodb_data_file_path)) { | ||
263 | 3958 | # my $path = (split(/:/,$a))[0]; | ||
264 | 3959 | # my @relative_path = split(/\/+/, $path); | ||
265 | 3960 | # pop @relative_path; | ||
266 | 3961 | # if (@relative_path) { | ||
267 | 3962 | # # there is a non-trivial path from the backup directory | ||
268 | 3963 | # # to the directory of this backup ibdata file, check | ||
269 | 3964 | # # that all the directories in the path exist. | ||
270 | 3965 | # create_path_if_needed($dir, \@relative_path); | ||
271 | 3966 | # } | ||
272 | 3967 | # } | ||
273 | 3968 | |||
274 | 3969 | return $dir; | 3960 | return $dir; |
275 | 3970 | } | 3961 | } |
276 | 3971 | 3962 | ||
277 | @@ -4023,9 +4014,9 @@ | |||
278 | 4023 | # | 4014 | # |
279 | 4024 | sub backup_files { | 4015 | sub backup_files { |
280 | 4025 | my $prep_mode = shift; | 4016 | my $prep_mode = shift; |
284 | 4026 | my $source_dir = get_option(\%config, $option_defaults_group, 'datadir'); | 4017 | my $source_dir = get_option('datadir'); |
285 | 4027 | my $buffer_pool_filename = get_option(\%config, $option_defaults_group, | 4018 | my $buffer_pool_filename = get_option_safe('innodb_buffer_pool_filename', |
286 | 4028 | 'innodb_buffer_pool_filename'); | 4019 | ''); |
287 | 4029 | my @list; | 4020 | my @list; |
288 | 4030 | my $file; | 4021 | my $file; |
289 | 4031 | my $database; | 4022 | my $database; |
290 | @@ -4145,7 +4136,7 @@ | |||
291 | 4145 | 4136 | ||
292 | 4146 | if ($option_rsync) { | 4137 | if ($option_rsync) { |
293 | 4147 | foreach my $dump_name ($buffer_pool_filename, 'ib_lru_dump') { | 4138 | foreach my $dump_name ($buffer_pool_filename, 'ib_lru_dump') { |
295 | 4148 | if (-e "$source_dir/$dump_name") { | 4139 | if ($dump_name ne '' && -e "$source_dir/$dump_name") { |
296 | 4149 | print RSYNC "$dump_name\n"; | 4140 | print RSYNC "$dump_name\n"; |
297 | 4150 | if (!$prep_mode) { | 4141 | if (!$prep_mode) { |
298 | 4151 | $rsync_files_hash{"$dump_name"} = 1; | 4142 | $rsync_files_hash{"$dump_name"} = 1; |
299 | @@ -4289,10 +4280,11 @@ | |||
300 | 4289 | my $options = ''; | 4280 | my $options = ''; |
301 | 4290 | 4281 | ||
302 | 4291 | 4282 | ||
304 | 4292 | if ($option_defaults_file) { | 4283 | if ($option_apply_log) { |
305 | 4284 | $options = $options . | ||
306 | 4285 | " --defaults-file=\"${backup_dir}/backup-my.cnf\" "; | ||
307 | 4286 | } elsif ($option_defaults_file) { | ||
308 | 4293 | $options = $options . " --defaults-file=\"$option_defaults_file\" "; | 4287 | $options = $options . " --defaults-file=\"$option_defaults_file\" "; |
309 | 4294 | } elsif ($option_apply_log) { | ||
310 | 4295 | $options = $options . " --defaults-file=\"${backup_dir}/backup-my.cnf\" "; | ||
311 | 4296 | } | 4288 | } |
312 | 4297 | 4289 | ||
313 | 4298 | if ($option_defaults_extra_file) { | 4290 | if ($option_defaults_extra_file) { |
314 | @@ -4367,60 +4359,114 @@ | |||
315 | 4367 | } | 4359 | } |
316 | 4368 | } | 4360 | } |
317 | 4369 | } | 4361 | } |
324 | 4370 | 4362 | ||
325 | 4371 | 4363 | ||
326 | 4372 | # has_option return whether the config has an option with the given name | 4364 | # has_option_in_config return true if the configuration file defines an option |
327 | 4373 | # Parameters: | 4365 | # with the given name. |
328 | 4374 | # config_ref a reference to a config data | 4366 | # |
329 | 4375 | # group option group name | 4367 | # Parameters: |
330 | 4368 | # option_name name of the option | ||
331 | 4369 | # Return value: | ||
332 | 4370 | # true if option exists, otherwise false | ||
333 | 4371 | # | ||
334 | 4372 | sub has_option_in_config { | ||
335 | 4373 | my $option_name = shift; | ||
336 | 4374 | my $group_hash_ref; | ||
337 | 4375 | |||
338 | 4376 | if (!exists $config{$option_defaults_group}) { | ||
339 | 4377 | return 0; | ||
340 | 4378 | } | ||
341 | 4379 | |||
342 | 4380 | $group_hash_ref = $config{$option_defaults_group}; | ||
343 | 4381 | |||
344 | 4382 | return exists ${$group_hash_ref}{$option_name}; | ||
345 | 4383 | } | ||
346 | 4384 | |||
347 | 4385 | |||
348 | 4386 | # has_option returns 1 if an option with the given name exists in either | ||
349 | 4387 | # defaults file file as reported by 'xtrabackup --print-param' or (in backup | ||
350 | 4388 | # mode) SHOW VARIABLES. Otherwise returns 0. | ||
351 | 4389 | # | ||
352 | 4390 | # Parameters: | ||
353 | 4376 | # option_name name of the option | 4391 | # option_name name of the option |
354 | 4377 | # Return value: | 4392 | # Return value: |
355 | 4378 | # true if option exists, otherwise false | 4393 | # true if option exists, otherwise false |
356 | 4379 | # | 4394 | # |
357 | 4380 | sub has_option { | 4395 | sub has_option { |
358 | 4381 | my $config_ref = shift; | ||
359 | 4382 | my $group = shift; | ||
360 | 4383 | my $option_name = shift; | 4396 | my $option_name = shift; |
371 | 4384 | my $group_hash_ref; | 4397 | |
372 | 4385 | 4398 | if (has_option_in_config($option_name)) { | |
373 | 4386 | if (!exists ${$config_ref}{$group}) { | 4399 | return 1; |
374 | 4387 | # no group | 4400 | } |
375 | 4388 | die "no '$group' group in MySQL options"; | 4401 | |
376 | 4389 | } | 4402 | if ($option_backup) { |
377 | 4390 | 4403 | if (!defined($mysql{vars})) { | |
378 | 4391 | $group_hash_ref = ${$config_ref}{$group}; | 4404 | get_mysql_vars(\%mysql); |
379 | 4392 | 4405 | } | |
380 | 4393 | return exists ${$group_hash_ref}{$option_name}; | 4406 | |
381 | 4407 | return defined($mysql{vars}->{$option_name}); | ||
382 | 4408 | } | ||
383 | 4409 | |||
384 | 4410 | return 0; | ||
385 | 4394 | } | 4411 | } |
393 | 4395 | 4412 | ||
394 | 4396 | 4413 | ||
395 | 4397 | # get_option subroutine returns the value of given option in the config | 4414 | # get_option returns the value of an option with the given name as defined |
396 | 4398 | # structure. If option is missing, this subroutine calls exit. | 4415 | # either in defaults file as reported by 'xtrabackup --print-param' or (in |
397 | 4399 | # Parameters: | 4416 | # backup mode) SHOW VARIABLES. |
398 | 4400 | # config_ref a reference to a config data | 4417 | # |
399 | 4401 | # group option group name | 4418 | # This subroutine aborts with an error if the option is not defined. |
400 | 4419 | # | ||
401 | 4420 | # Parameters: | ||
402 | 4402 | # option_name name of the option | 4421 | # option_name name of the option |
403 | 4403 | # Return value: | 4422 | # Return value: |
404 | 4404 | # option value as a string | 4423 | # option value as a string |
405 | 4405 | # | 4424 | # |
406 | 4406 | sub get_option { | 4425 | sub get_option { |
407 | 4407 | my $config_ref = shift; | ||
408 | 4408 | my $group = shift; | ||
409 | 4409 | my $option_name = shift; | 4426 | my $option_name = shift; |
410 | 4410 | my $group_hash_ref; | 4427 | my $group_hash_ref; |
411 | 4411 | 4428 | ||
424 | 4412 | if (!exists $config{$group}) { | 4429 | if (!$option_backup) { |
425 | 4413 | # no group | 4430 | if (!exists $config{$option_defaults_group}) { |
426 | 4414 | die "no '$group' group in MySQL options"; | 4431 | # no group |
427 | 4415 | } | 4432 | die "no '$option_defaults_group' group in server configuration " . |
428 | 4416 | 4433 | "file '$option_defaults_file'"; | |
429 | 4417 | $group_hash_ref = ${$config_ref}{$group}; | 4434 | } |
430 | 4418 | if (!exists ${$group_hash_ref}{$option_name}) { | 4435 | |
431 | 4419 | # no option | 4436 | $group_hash_ref = $config{$option_defaults_group}; |
432 | 4420 | die "no '$option_name' option in group '$group' in MySQL options"; | 4437 | if (!exists ${$group_hash_ref}{$option_name}) { |
433 | 4421 | } | 4438 | # no option |
434 | 4422 | 4439 | die "no '$option_name' option in group '$option_defaults_group' " . | |
435 | 4423 | return ${$group_hash_ref}{$option_name}; | 4440 | "in server configuration file '$option_defaults_file'"; |
436 | 4441 | } | ||
437 | 4442 | |||
438 | 4443 | return ${$group_hash_ref}{$option_name}; | ||
439 | 4444 | } | ||
440 | 4445 | |||
441 | 4446 | if (!defined($mysql{vars})) { | ||
442 | 4447 | get_mysql_vars(\%mysql); | ||
443 | 4448 | } | ||
444 | 4449 | |||
445 | 4450 | if (!defined($mysql{vars}->{$option_name})) { | ||
446 | 4451 | die "no '$option_name' option in SHOW VARIABLES"; | ||
447 | 4452 | } | ||
448 | 4453 | |||
449 | 4454 | return $mysql{vars}->{$option_name}->{Value}; | ||
450 | 4455 | } | ||
451 | 4456 | |||
452 | 4457 | # | ||
453 | 4458 | # Identical to get_option, except that the second argument is returned on error, | ||
454 | 4459 | # i.e. if the option is not defined. | ||
455 | 4460 | # | ||
456 | 4461 | sub get_option_safe { | ||
457 | 4462 | my $option_name = shift; | ||
458 | 4463 | my $fallback_value = shift; | ||
459 | 4464 | |||
460 | 4465 | if (has_option($option_name)) { | ||
461 | 4466 | return get_option($option_name); | ||
462 | 4467 | } | ||
463 | 4468 | |||
464 | 4469 | return $fallback_value; | ||
465 | 4424 | } | 4470 | } |
466 | 4425 | 4471 | ||
467 | 4426 | # get_table_name subroutine returns table name of specified file. | 4472 | # get_table_name subroutine returns table name of specified file. |
468 | 4427 | 4473 | ||
469 | === modified file 'storage/innobase/xtrabackup/src/xtrabackup.cc' | |||
470 | --- storage/innobase/xtrabackup/src/xtrabackup.cc 2014-09-25 07:02:53 +0000 | |||
471 | +++ storage/innobase/xtrabackup/src/xtrabackup.cc 2014-10-06 12:20:08 +0000 | |||
472 | @@ -66,6 +66,8 @@ | |||
473 | 66 | #include <row0quiesce.h> | 66 | #include <row0quiesce.h> |
474 | 67 | #include <srv0start.h> | 67 | #include <srv0start.h> |
475 | 68 | 68 | ||
476 | 69 | #include <sstream> | ||
477 | 70 | |||
478 | 69 | #define G_PTR uchar* | 71 | #define G_PTR uchar* |
479 | 70 | 72 | ||
480 | 71 | #include "common.h" | 73 | #include "common.h" |
481 | @@ -309,6 +311,10 @@ | |||
482 | 309 | ds_ctxt_t *ds_data = NULL; | 311 | ds_ctxt_t *ds_data = NULL; |
483 | 310 | ds_ctxt_t *ds_meta = NULL; | 312 | ds_ctxt_t *ds_meta = NULL; |
484 | 311 | 313 | ||
485 | 314 | /* String buffer used by --print-param to accumulate server options as they are | ||
486 | 315 | parsed from the defaults file */ | ||
487 | 316 | static std::ostringstream print_param_str; | ||
488 | 317 | |||
489 | 312 | extern "C" sig_handler handle_fatal_signal(int sig); | 318 | extern "C" sig_handler handle_fatal_signal(int sig); |
490 | 313 | 319 | ||
491 | 314 | /* Simple datasink creation tracking...add datasinks in the reverse order you | 320 | /* Simple datasink creation tracking...add datasinks in the reverse order you |
492 | @@ -483,7 +489,7 @@ | |||
493 | 483 | OPT_XTRA_REBUILD_THREADS, | 489 | OPT_XTRA_REBUILD_THREADS, |
494 | 484 | OPT_INNODB_CHECKSUM_ALGORITHM, | 490 | OPT_INNODB_CHECKSUM_ALGORITHM, |
495 | 485 | OPT_INNODB_UNDO_DIRECTORY, | 491 | OPT_INNODB_UNDO_DIRECTORY, |
497 | 486 | OPT_UNDO_TABLESPACES, | 492 | OPT_INNODB_UNDO_TABLESPACES, |
498 | 487 | OPT_INNODB_LOG_CHECKSUM_ALGORITHM, | 493 | OPT_INNODB_LOG_CHECKSUM_ALGORITHM, |
499 | 488 | OPT_XTRA_INCREMENTAL_FORCE_SCAN, | 494 | OPT_XTRA_INCREMENTAL_FORCE_SCAN, |
500 | 489 | OPT_DEFAULTS_GROUP, | 495 | OPT_DEFAULTS_GROUP, |
501 | @@ -839,7 +845,7 @@ | |||
502 | 839 | (G_PTR*) &srv_undo_dir, (G_PTR*) &srv_undo_dir, | 845 | (G_PTR*) &srv_undo_dir, (G_PTR*) &srv_undo_dir, |
503 | 840 | 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, | 846 | 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, |
504 | 841 | 847 | ||
506 | 842 | {"innodb_undo_tablespaces", OPT_UNDO_TABLESPACES, | 848 | {"innodb_undo_tablespaces", OPT_INNODB_UNDO_TABLESPACES, |
507 | 843 | "Number of undo tablespaces to use.", | 849 | "Number of undo tablespaces to use.", |
508 | 844 | (G_PTR*)&srv_undo_tablespaces, (G_PTR*)&srv_undo_tablespaces, | 850 | (G_PTR*)&srv_undo_tablespaces, (G_PTR*)&srv_undo_tablespaces, |
509 | 845 | 0, GET_ULONG, REQUIRED_ARG, 0, 0, 126, 0, 1, 0}, | 851 | 0, GET_ULONG, REQUIRED_ARG, 0, 0, 126, 0, 1, 0}, |
510 | @@ -959,6 +965,9 @@ | |||
511 | 959 | my_print_variables(xb_long_options); | 965 | my_print_variables(xb_long_options); |
512 | 960 | } | 966 | } |
513 | 961 | 967 | ||
514 | 968 | #define ADD_PRINT_PARAM_OPT(value) \ | ||
515 | 969 | print_param_str << opt->name << "=" << value << "\n"; | ||
516 | 970 | |||
517 | 962 | static my_bool | 971 | static my_bool |
518 | 963 | get_one_option(int optid, const struct my_option *opt __attribute__((unused)), | 972 | get_one_option(int optid, const struct my_option *opt __attribute__((unused)), |
519 | 964 | char *argument) | 973 | char *argument) |
520 | @@ -967,7 +976,94 @@ | |||
521 | 967 | case 'h': | 976 | case 'h': |
522 | 968 | strmake(mysql_real_data_home,argument, FN_REFLEN - 1); | 977 | strmake(mysql_real_data_home,argument, FN_REFLEN - 1); |
523 | 969 | mysql_data_home= mysql_real_data_home; | 978 | mysql_data_home= mysql_real_data_home; |
525 | 970 | break; | 979 | |
526 | 980 | ADD_PRINT_PARAM_OPT(mysql_real_data_home); | ||
527 | 981 | break; | ||
528 | 982 | |||
529 | 983 | case 't': | ||
530 | 984 | |||
531 | 985 | ADD_PRINT_PARAM_OPT(opt_mysql_tmpdir); | ||
532 | 986 | break; | ||
533 | 987 | |||
534 | 988 | case OPT_INNODB_DATA_HOME_DIR: | ||
535 | 989 | |||
536 | 990 | ADD_PRINT_PARAM_OPT(innobase_data_home_dir); | ||
537 | 991 | break; | ||
538 | 992 | |||
539 | 993 | case OPT_INNODB_DATA_FILE_PATH: | ||
540 | 994 | |||
541 | 995 | ADD_PRINT_PARAM_OPT(innobase_data_file_path); | ||
542 | 996 | break; | ||
543 | 997 | |||
544 | 998 | case OPT_INNODB_LOG_GROUP_HOME_DIR: | ||
545 | 999 | |||
546 | 1000 | ADD_PRINT_PARAM_OPT(srv_log_group_home_dir); | ||
547 | 1001 | break; | ||
548 | 1002 | |||
549 | 1003 | case OPT_INNODB_LOG_FILES_IN_GROUP: | ||
550 | 1004 | |||
551 | 1005 | ADD_PRINT_PARAM_OPT(innobase_log_files_in_group); | ||
552 | 1006 | break; | ||
553 | 1007 | |||
554 | 1008 | case OPT_INNODB_LOG_FILE_SIZE: | ||
555 | 1009 | |||
556 | 1010 | ADD_PRINT_PARAM_OPT(innobase_log_file_size); | ||
557 | 1011 | break; | ||
558 | 1012 | |||
559 | 1013 | case OPT_INNODB_FLUSH_METHOD: | ||
560 | 1014 | |||
561 | 1015 | ADD_PRINT_PARAM_OPT(innobase_unix_file_flush_method); | ||
562 | 1016 | break; | ||
563 | 1017 | |||
564 | 1018 | case OPT_INNODB_PAGE_SIZE: | ||
565 | 1019 | |||
566 | 1020 | ADD_PRINT_PARAM_OPT(innobase_page_size); | ||
567 | 1021 | break; | ||
568 | 1022 | |||
569 | 1023 | case OPT_INNODB_FAST_CHECKSUM: | ||
570 | 1024 | |||
571 | 1025 | ADD_PRINT_PARAM_OPT(!!innobase_fast_checksum); | ||
572 | 1026 | break; | ||
573 | 1027 | |||
574 | 1028 | case OPT_INNODB_LOG_BLOCK_SIZE: | ||
575 | 1029 | |||
576 | 1030 | ADD_PRINT_PARAM_OPT(innobase_log_block_size); | ||
577 | 1031 | break; | ||
578 | 1032 | |||
579 | 1033 | case OPT_INNODB_DOUBLEWRITE_FILE: | ||
580 | 1034 | |||
581 | 1035 | ADD_PRINT_PARAM_OPT(innobase_doublewrite_file); | ||
582 | 1036 | break; | ||
583 | 1037 | |||
584 | 1038 | case OPT_INNODB_UNDO_DIRECTORY: | ||
585 | 1039 | |||
586 | 1040 | ADD_PRINT_PARAM_OPT(srv_undo_dir); | ||
587 | 1041 | break; | ||
588 | 1042 | |||
589 | 1043 | case OPT_INNODB_UNDO_TABLESPACES: | ||
590 | 1044 | |||
591 | 1045 | ADD_PRINT_PARAM_OPT(srv_undo_tablespaces); | ||
592 | 1046 | break; | ||
593 | 1047 | |||
594 | 1048 | case OPT_INNODB_CHECKSUM_ALGORITHM: | ||
595 | 1049 | |||
596 | 1050 | ut_a(srv_checksum_algorithm <= SRV_CHECKSUM_ALGORITHM_STRICT_NONE); | ||
597 | 1051 | |||
598 | 1052 | ADD_PRINT_PARAM_OPT(innodb_checksum_algorithm_names[srv_checksum_algorithm]); | ||
599 | 1053 | break; | ||
600 | 1054 | |||
601 | 1055 | case OPT_INNODB_LOG_CHECKSUM_ALGORITHM: | ||
602 | 1056 | |||
603 | 1057 | ut_a(srv_log_checksum_algorithm <= SRV_CHECKSUM_ALGORITHM_STRICT_NONE); | ||
604 | 1058 | |||
605 | 1059 | ADD_PRINT_PARAM_OPT(innodb_checksum_algorithm_names[srv_log_checksum_algorithm]); | ||
606 | 1060 | break; | ||
607 | 1061 | |||
608 | 1062 | case OPT_INNODB_BUFFER_POOL_FILENAME: | ||
609 | 1063 | |||
610 | 1064 | ADD_PRINT_PARAM_OPT(innobase_buffer_pool_filename); | ||
611 | 1065 | break; | ||
612 | 1066 | |||
613 | 971 | case OPT_XTRA_TARGET_DIR: | 1067 | case OPT_XTRA_TARGET_DIR: |
614 | 972 | strmake(xtrabackup_real_target_dir,argument, sizeof(xtrabackup_real_target_dir)-1); | 1068 | strmake(xtrabackup_real_target_dir,argument, sizeof(xtrabackup_real_target_dir)-1); |
615 | 973 | xtrabackup_target_dir= xtrabackup_real_target_dir; | 1069 | xtrabackup_target_dir= xtrabackup_real_target_dir; |
616 | @@ -6045,6 +6141,10 @@ | |||
617 | 6045 | } | 6141 | } |
618 | 6046 | load_defaults("my", xb_load_default_groups, &argc, &argv); | 6142 | load_defaults("my", xb_load_default_groups, &argc, &argv); |
619 | 6047 | 6143 | ||
620 | 6144 | print_param_str << | ||
621 | 6145 | "# This MySQL options file was generated by XtraBackup.\n" | ||
622 | 6146 | "[" << defaults_group << "]\n"; | ||
623 | 6147 | |||
624 | 6048 | /* ignore unsupported options */ | 6148 | /* ignore unsupported options */ |
625 | 6049 | { | 6149 | { |
626 | 6050 | int i,j,argc_new,find; | 6150 | int i,j,argc_new,find; |
627 | @@ -6166,51 +6266,9 @@ | |||
628 | 6166 | 6266 | ||
629 | 6167 | /* --print-param */ | 6267 | /* --print-param */ |
630 | 6168 | if (xtrabackup_print_param) { | 6268 | if (xtrabackup_print_param) { |
676 | 6169 | /* === some variables from mysqld === */ | 6269 | |
677 | 6170 | memset((G_PTR) &mysql_tmpdir_list, 0, | 6270 | printf("%s", print_param_str.str().c_str()); |
678 | 6171 | sizeof(mysql_tmpdir_list)); | 6271 | |
634 | 6172 | |||
635 | 6173 | if (init_tmpdir(&mysql_tmpdir_list, opt_mysql_tmpdir)) | ||
636 | 6174 | exit(EXIT_FAILURE); | ||
637 | 6175 | |||
638 | 6176 | printf("# This MySQL options file was generated by XtraBackup.\n"); | ||
639 | 6177 | printf("[%s]\n", defaults_group); | ||
640 | 6178 | printf("datadir = \"%s\"\n", mysql_data_home); | ||
641 | 6179 | printf("tmpdir = \"%s\"\n", mysql_tmpdir_list.list[0]); | ||
642 | 6180 | printf("innodb_data_home_dir = \"%s\"\n", | ||
643 | 6181 | innobase_data_home_dir ? innobase_data_home_dir : mysql_data_home); | ||
644 | 6182 | printf("innodb_data_file_path = \"%s\"\n", | ||
645 | 6183 | innobase_data_file_path ? innobase_data_file_path : "ibdata1:10M:autoextend"); | ||
646 | 6184 | printf("innodb_log_group_home_dir = \"%s\"\n", | ||
647 | 6185 | srv_log_group_home_dir ? | ||
648 | 6186 | srv_log_group_home_dir : mysql_data_home); | ||
649 | 6187 | printf("innodb_log_files_in_group = %ld\n", innobase_log_files_in_group); | ||
650 | 6188 | printf("innodb_log_file_size = %lld\n", innobase_log_file_size); | ||
651 | 6189 | printf("innodb_flush_method = \"%s\"\n", | ||
652 | 6190 | (innobase_unix_file_flush_method != NULL) ? | ||
653 | 6191 | innobase_unix_file_flush_method : ""); | ||
654 | 6192 | printf("innodb_page_size = %lld\n", innobase_page_size); | ||
655 | 6193 | printf("innodb_fast_checksum = %d\n", innobase_fast_checksum); | ||
656 | 6194 | printf("innodb_log_block_size = %lu\n", innobase_log_block_size); | ||
657 | 6195 | if (innobase_doublewrite_file != NULL) { | ||
658 | 6196 | printf("innodb_doublewrite_file = %s\n", innobase_doublewrite_file); | ||
659 | 6197 | } | ||
660 | 6198 | if (srv_undo_dir) { | ||
661 | 6199 | |||
662 | 6200 | printf("innodb_undo_directory = \"%s\"\n", | ||
663 | 6201 | srv_undo_dir); | ||
664 | 6202 | } | ||
665 | 6203 | printf("innodb_undo_tablespaces = %lu\n", srv_undo_tablespaces); | ||
666 | 6204 | printf("innodb_checksum_algorithm = %s\n", | ||
667 | 6205 | innodb_checksum_algorithm_names[srv_checksum_algorithm] | ||
668 | 6206 | ); | ||
669 | 6207 | printf("innodb_log_checksum_algorithm = %s\n", | ||
670 | 6208 | innodb_checksum_algorithm_names[srv_log_checksum_algorithm] | ||
671 | 6209 | ); | ||
672 | 6210 | printf("innodb_buffer_pool_filename = \"%s\"\n", | ||
673 | 6211 | innobase_buffer_pool_filename ? | ||
674 | 6212 | innobase_buffer_pool_filename : | ||
675 | 6213 | "ib_buffer_pool"); | ||
679 | 6214 | exit(EXIT_SUCCESS); | 6272 | exit(EXIT_SUCCESS); |
680 | 6215 | } | 6273 | } |
681 | 6216 | 6274 | ||
682 | 6217 | 6275 | ||
683 | === modified file 'storage/innobase/xtrabackup/test/run.sh' | |||
684 | --- storage/innobase/xtrabackup/test/run.sh 2014-09-10 12:10:01 +0000 | |||
685 | +++ storage/innobase/xtrabackup/test/run.sh 2014-10-06 12:20:08 +0000 | |||
686 | @@ -373,9 +373,6 @@ | |||
687 | 373 | fi | 373 | fi |
688 | 374 | fi | 374 | fi |
689 | 375 | 375 | ||
690 | 376 | # Version-specific defaults | ||
691 | 377 | DEFAULT_IBDATA_SIZE="10M" | ||
692 | 378 | |||
693 | 379 | # Determine MySQL flavor | 376 | # Determine MySQL flavor |
694 | 380 | if [[ "$MYSQL_VERSION" =~ "MariaDB" ]] | 377 | if [[ "$MYSQL_VERSION" =~ "MariaDB" ]] |
695 | 381 | then | 378 | then |
696 | @@ -410,8 +407,7 @@ | |||
697 | 410 | ;; | 407 | ;; |
698 | 411 | 5.5 ) | 408 | 5.5 ) |
699 | 412 | ;; | 409 | ;; |
702 | 413 | 5.6 | 10.0 ) | 410 | 5.6 | 10.0 | 10.1) |
701 | 414 | DEFAULT_IBDATA_SIZE="12M" | ||
703 | 415 | ;; | 411 | ;; |
704 | 416 | *) | 412 | *) |
705 | 417 | vlog "Unknown MySQL/InnoDB version: $MYSQL_VERSION/$INNODB_VERSION" | 413 | vlog "Unknown MySQL/InnoDB version: $MYSQL_VERSION/$INNODB_VERSION" |
706 | @@ -440,7 +436,7 @@ | |||
707 | 440 | export MYSQL_VERSION MYSQL_VERSION_COMMENT MYSQL_FLAVOR \ | 436 | export MYSQL_VERSION MYSQL_VERSION_COMMENT MYSQL_FLAVOR \ |
708 | 441 | INNODB_VERSION XTRADB_VERSION INNODB_FLAVOR \ | 437 | INNODB_VERSION XTRADB_VERSION INNODB_FLAVOR \ |
709 | 442 | XB_BIN IB_BIN IB_ARGS XB_ARGS MYSQLD_EXTRA_ARGS \ | 438 | XB_BIN IB_BIN IB_ARGS XB_ARGS MYSQLD_EXTRA_ARGS \ |
711 | 443 | DEFAULT_IBDATA_SIZE WSREP_READY LIBGALERA_PATH | 439 | WSREP_READY LIBGALERA_PATH |
712 | 444 | } | 440 | } |
713 | 445 | 441 | ||
714 | 446 | ########################################################################### | 442 | ########################################################################### |
715 | 447 | 443 | ||
716 | === modified file 'storage/innobase/xtrabackup/test/t/bug1062684.sh' | |||
717 | --- storage/innobase/xtrabackup/test/t/bug1062684.sh 2013-04-27 18:46:54 +0000 | |||
718 | +++ storage/innobase/xtrabackup/test/t/bug1062684.sh 2014-10-06 12:20:08 +0000 | |||
719 | @@ -7,7 +7,7 @@ | |||
720 | 7 | . inc/common.sh | 7 | . inc/common.sh |
721 | 8 | 8 | ||
722 | 9 | MYSQLD_EXTRA_MY_CNF_OPTS=" | 9 | MYSQLD_EXTRA_MY_CNF_OPTS=" |
724 | 10 | innodb-data-file-path=ibdata1:${DEFAULT_IBDATA_SIZE};ibdata2:5M:autoextend | 10 | innodb-data-file-path=ibdata1:10M;ibdata2:5M:autoextend |
725 | 11 | " | 11 | " |
726 | 12 | 12 | ||
727 | 13 | start_server | 13 | start_server |
728 | @@ -22,8 +22,8 @@ | |||
729 | 22 | mkdir -p $topdir/backup | 22 | mkdir -p $topdir/backup |
730 | 23 | 23 | ||
731 | 24 | vlog "Starting backup" | 24 | vlog "Starting backup" |
734 | 25 | innobackupex $topdir/backup | 25 | full_backup_dir=$topdir/backup/full |
735 | 26 | full_backup_dir=`grep "innobackupex: Backup created in directory" $OUTFILE | awk -F\' '{print $2}'` | 26 | innobackupex --no-timestamp $full_backup_dir |
736 | 27 | vlog "Full backup done to directory $full_backup_dir" | 27 | vlog "Full backup done to directory $full_backup_dir" |
737 | 28 | 28 | ||
738 | 29 | # Changing data | 29 | # Changing data |
739 | @@ -47,9 +47,9 @@ | |||
740 | 47 | vlog "###############" | 47 | vlog "###############" |
741 | 48 | 48 | ||
742 | 49 | # Incremental backup | 49 | # Incremental backup |
743 | 50 | inc_backup_dir=$topdir/backup/inc | ||
744 | 50 | innobackupex --incremental --incremental-basedir=$full_backup_dir \ | 51 | innobackupex --incremental --incremental-basedir=$full_backup_dir \ |
747 | 51 | $topdir/backup | 52 | --no-timestamp $inc_backup_dir |
746 | 52 | inc_backup_dir=`grep "innobackupex: Backup created in directory" $OUTFILE | tail -n 1 | awk -F\' '{print $2}'` | ||
748 | 53 | vlog "Incremental backup done to directory $inc_backup_dir" | 53 | vlog "Incremental backup done to directory $inc_backup_dir" |
749 | 54 | 54 | ||
750 | 55 | vlog "Preparing backup" | 55 | vlog "Preparing backup" |
751 | @@ -84,7 +84,7 @@ | |||
752 | 84 | innobackupex --copy-back $full_backup_dir | 84 | innobackupex --copy-back $full_backup_dir |
753 | 85 | vlog "Data restored" | 85 | vlog "Data restored" |
754 | 86 | 86 | ||
756 | 87 | start_server --innodb-data-file-path="ibdata1:${DEFAULT_IBDATA_SIZE};ibdata2:5M:autoextend" | 87 | start_server |
757 | 88 | 88 | ||
758 | 89 | vlog "Checking checksums" | 89 | vlog "Checking checksums" |
759 | 90 | checksum_test_b=`checksum_table incremental_sample test` | 90 | checksum_test_b=`checksum_table incremental_sample test` |
760 | 91 | 91 | ||
761 | === added file 'storage/innobase/xtrabackup/test/t/bug1334062.sh' | |||
762 | --- storage/innobase/xtrabackup/test/t/bug1334062.sh 1970-01-01 00:00:00 +0000 | |||
763 | +++ storage/innobase/xtrabackup/test/t/bug1334062.sh 2014-10-06 12:20:08 +0000 | |||
764 | @@ -0,0 +1,24 @@ | |||
765 | 1 | ############################################################################# | ||
766 | 2 | # Bug #1334062: Xtrabackup 2.2.3 fails to perform a full backup on PS 5.5 if | ||
767 | 3 | # innodb_log_file_size on the [mysqld] section of my.cnf is not | ||
768 | 4 | # set | ||
769 | 5 | ############################################################################# | ||
770 | 6 | |||
771 | 7 | start_server | ||
772 | 8 | |||
773 | 9 | sed -i -e 's/innodb_log_file_size=.*//' $MYSQLD_VARDIR/my.cnf | ||
774 | 10 | |||
775 | 11 | grep innodb_log_file_size $MYSQLD_VARDIR/my.cnf && | ||
776 | 12 | die "innodb_log_file_size is present in my.cnf" | ||
777 | 13 | |||
778 | 14 | innobackupex --no-timestamp $topdir/backup | ||
779 | 15 | |||
780 | 16 | innobackupex --apply-log $topdir/backup | ||
781 | 17 | |||
782 | 18 | stop_server | ||
783 | 19 | |||
784 | 20 | rm -rf $MYSQLD_DATADIR/* | ||
785 | 21 | |||
786 | 22 | innobackupex --copy-back $topdir/backup | ||
787 | 23 | |||
788 | 24 | start_server | ||
789 | 0 | 25 | ||
790 | === added file 'storage/innobase/xtrabackup/test/t/bug1343722.sh' | |||
791 | --- storage/innobase/xtrabackup/test/t/bug1343722.sh 1970-01-01 00:00:00 +0000 | |||
792 | +++ storage/innobase/xtrabackup/test/t/bug1343722.sh 2014-10-06 12:20:08 +0000 | |||
793 | @@ -0,0 +1,18 @@ | |||
794 | 1 | ######################################################################## | ||
795 | 2 | # Bug #1343722: Too easy to backup wrong datadir with multiple instances | ||
796 | 3 | ######################################################################## | ||
797 | 4 | |||
798 | 5 | start_server_with_id 1 | ||
799 | 6 | |||
800 | 7 | socket=$MYSQLD_SOCKET | ||
801 | 8 | |||
802 | 9 | start_server_with_id 2 | ||
803 | 10 | |||
804 | 11 | # Try to backup server 2, but use server 1's connection socket | ||
805 | 12 | $IB_BIN $IB_ARGS --socket=$socket --no-timestamp $topdir/backup 2>&1 | | ||
806 | 13 | grep 'has different values' | ||
807 | 14 | |||
808 | 15 | if [[ ${PIPESTATUS[0]} == 0 ]] | ||
809 | 16 | then | ||
810 | 17 | die "innobackupex did not fail as expected" | ||
811 | 18 | fi | ||
812 | 0 | 19 | ||
813 | === modified file 'storage/innobase/xtrabackup/test/t/bug766305.sh' | |||
814 | --- storage/innobase/xtrabackup/test/t/bug766305.sh 2014-09-20 17:05:56 +0000 | |||
815 | +++ storage/innobase/xtrabackup/test/t/bug766305.sh 2014-10-06 12:20:08 +0000 | |||
816 | @@ -4,7 +4,7 @@ | |||
817 | 4 | 4 | ||
818 | 5 | start_server --innodb_file_per_table | 5 | start_server --innodb_file_per_table |
819 | 6 | 6 | ||
821 | 7 | if [ ${ASAN_OPTIONS:-undefined} = "undefined" ] | 7 | if [ ${ASAN_OPTIONS:-undefined} != "undefined" ] |
822 | 8 | then | 8 | then |
823 | 9 | skip_test "Incompatible with AddressSanitizer" | 9 | skip_test "Incompatible with AddressSanitizer" |
824 | 10 | fi | 10 | fi |
825 | 11 | 11 | ||
826 | === added file 'storage/innobase/xtrabackup/test/t/xb_print_param.sh' | |||
827 | --- storage/innobase/xtrabackup/test/t/xb_print_param.sh 1970-01-01 00:00:00 +0000 | |||
828 | +++ storage/innobase/xtrabackup/test/t/xb_print_param.sh 2014-10-06 12:20:08 +0000 | |||
829 | @@ -0,0 +1,46 @@ | |||
830 | 1 | ######################################################################## | ||
831 | 2 | # Tests for xtrabackup --print-param | ||
832 | 3 | ######################################################################## | ||
833 | 4 | |||
834 | 5 | my_cnf="[mysqld] | ||
835 | 6 | datadir=/some/data/dir | ||
836 | 7 | tmpdir=/some/tmp/dir1:/some/tmp/dir2 | ||
837 | 8 | innodb_data_home_dir=/some/innodb/dir | ||
838 | 9 | innodb_data_file_path=ibdata1:10M;ibdata2:5M:autoextend | ||
839 | 10 | innodb_log_group_home_dir=/some/log/dir | ||
840 | 11 | innodb_log_files_in_group=3 | ||
841 | 12 | innodb_log_file_size=5M | ||
842 | 13 | innodb_flush_method=O_DIRECT | ||
843 | 14 | innodb_page_size=4K | ||
844 | 15 | innodb_fast_checksum=1 | ||
845 | 16 | innodb_log_block_size=4K | ||
846 | 17 | innodb_doublewrite_file=/some/doublewrite/file | ||
847 | 18 | innodb_undo_directory=/some/undo/directory | ||
848 | 19 | innodb_undo_tablespaces=8 | ||
849 | 20 | innodb_checksum_algorithm=strict_crc32 | ||
850 | 21 | innodb_log_checksum_algorithm=none | ||
851 | 22 | innodb_buffer_pool_filename=/some/buffer/pool/file" | ||
852 | 23 | |||
853 | 24 | echo "$my_cnf" >$topdir/my.cnf | ||
854 | 25 | |||
855 | 26 | diff -u <($XB_BIN --defaults-file=$topdir/my.cnf --print-param) - <<EOF | ||
856 | 27 | # This MySQL options file was generated by XtraBackup. | ||
857 | 28 | [mysqld] | ||
858 | 29 | datadir=/some/data/dir | ||
859 | 30 | tmpdir=/some/tmp/dir1:/some/tmp/dir2 | ||
860 | 31 | innodb_data_home_dir=/some/innodb/dir | ||
861 | 32 | innodb_data_file_path=ibdata1:10M;ibdata2:5M:autoextend | ||
862 | 33 | innodb_log_group_home_dir=/some/log/dir | ||
863 | 34 | innodb_log_files_in_group=3 | ||
864 | 35 | innodb_log_file_size=5242880 | ||
865 | 36 | innodb_flush_method=O_DIRECT | ||
866 | 37 | innodb_page_size=4096 | ||
867 | 38 | innodb_fast_checksum=1 | ||
868 | 39 | innodb_log_block_size=4096 | ||
869 | 40 | innodb_doublewrite_file=/some/doublewrite/file | ||
870 | 41 | innodb_undo_directory=/some/undo/directory | ||
871 | 42 | innodb_undo_tablespaces=8 | ||
872 | 43 | innodb_checksum_algorithm=strict_crc32 | ||
873 | 44 | innodb_log_checksum_algorithm=none | ||
874 | 45 | innodb_buffer_pool_filename=/some/buffer/pool/file | ||
875 | 46 | EOF |
http:// jenkins. percona. com/view/ PXB%202. 2/job/percona- xtrabackup- 2.2-param/ 224/