Merge lp:~sergei.glushchenko/percona-xtrabackup/xb2.0-bug996493 into lp:percona-xtrabackup/2.0

Proposed by Sergei Glushchenko
Status: Merged
Approved by: Alexey Kopytov
Approved revision: no longer in the source branch.
Merged at revision: 430
Proposed branch: lp:~sergei.glushchenko/percona-xtrabackup/xb2.0-bug996493
Merge into: lp:percona-xtrabackup/2.0
Diff against target: 158 lines (+48/-21)
5 files modified
doc/source/innobackupex/restoring_a_backup_ibk.rst (+1/-1)
innobackupex (+6/-18)
src/xtrabackup.c (+1/-1)
test/t/bug983685.sh (+1/-1)
test/t/bug996493.sh (+39/-0)
To merge this branch: bzr merge lp:~sergei.glushchenko/percona-xtrabackup/xb2.0-bug996493
Reviewer Review Type Date Requested Status
Alexey Kopytov (community) Approve
Sergei Glushchenko Pending
Review via email: mp+106308@code.launchpad.net

This proposal supersedes a proposal from 2012-05-14.

Description of the change

Bug 996493: innobackupex --apply-log doesn't read config from backup-my.cnf
Following have been done:
1. Remove datadir and innodb_data_home_dir from backup-my.cnf
2. When do --apply-log read settings from backup-my.cnf
3. When do --copy-back read settings from /etc/my.cnf

To post a comment you must log in.
Revision history for this message
Sergei Glushchenko (sergei.glushchenko) wrote : Posted in a previous version of this proposal
Revision history for this message
Alexey Kopytov (akopytov) : Posted in a previous version of this proposal
review: Approve
Revision history for this message
Sergei Glushchenko (sergei.glushchenko) wrote : Posted in a previous version of this proposal

Resubmit as appropriate branch for 1.6 has been changed

review: Needs Resubmitting
Revision history for this message
Alexey Kopytov (akopytov) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'doc/source/innobackupex/restoring_a_backup_ibk.rst'
--- doc/source/innobackupex/restoring_a_backup_ibk.rst 2011-07-07 05:32:50 +0000
+++ doc/source/innobackupex/restoring_a_backup_ibk.rst 2012-05-18 05:55:22 +0000
@@ -6,7 +6,7 @@
66
7 $ innobackupex --copy-back /path/to/BACKUP-DIR7 $ innobackupex --copy-back /path/to/BACKUP-DIR
88
9It will copy all the data-related files back to the server's :term:`datadir`, determined by the :file:`backup-my.cnf` configuration file in the directory. You should check the last line of the output for a success message::9It will copy all the data-related files back to the server's :term:`datadir`, determined by the server's :file:`my.cnf` configuration file. You should check the last line of the output for a success message::
1010
11 innobackupex: Finished copying back files.11 innobackupex: Finished copying back files.
1212
1313
=== modified file 'innobackupex'
--- innobackupex 2012-05-15 09:30:50 +0000
+++ innobackupex 2012-05-18 05:55:22 +0000
@@ -736,6 +736,8 @@
736736
737 if ($option_defaults_file) {737 if ($option_defaults_file) {
738 $options = $options . " --defaults-file=\"$option_defaults_file\" ";738 $options = $options . " --defaults-file=\"$option_defaults_file\" ";
739 } else {
740 $options = $options . " --defaults-file=\"${backup_dir}/backup-my.cnf\" ";
739 }741 }
740742
741 $options = $options . "--prepare --target-dir=$backup_dir";743 $options = $options . "--prepare --target-dir=$backup_dir";
@@ -1633,22 +1635,10 @@
1633#1635#
1634sub write_backup_config_file {1636sub write_backup_config_file {
1635 my $filename = shift;1637 my $filename = shift;
1636 my $innodb_data_file_path =
1637 get_option(\%config, 'mysqld', 'innodb_data_file_path');
1638 my $root;
1639
1640 my @array = split(/;/, $innodb_data_file_path);
1641 for (my $i = 0; $i <= $#array; $i++) {
1642 my @tmp = split(/\/+/, $array[$i]);
1643 $array[$i] = $tmp[-1];
1644 }
1645 $innodb_data_file_path = join(";", @array);
16461638
1647 if (!$option_remote_host) {1639 if (!$option_remote_host) {
1648 $root = $backup_dir;
1649 open(FILE, "> $filename") || Die "Failed to open file '$filename': $!";1640 open(FILE, "> $filename") || Die "Failed to open file '$filename': $!";
1650 } else {1641 } else {
1651 $root = `ssh $option_ssh_opt $option_remote_host 'cd $backup_dir; pwd'`;
1652 open(FILE, "| ssh $option_ssh_opt $option_remote_host 'cat > $filename'")1642 open(FILE, "| ssh $option_ssh_opt $option_remote_host 'cat > $filename'")
1653 || Die "Failed to open file '$option_remote_host:$filename': $!";1643 || Die "Failed to open file '$option_remote_host:$filename': $!";
1654 }1644 }
@@ -1664,10 +1654,7 @@
16641654
1665 my $options_dump = "# This MySQL options file was generated by $innobackup_script.\n\n" .1655 my $options_dump = "# This MySQL options file was generated by $innobackup_script.\n\n" .
1666 "# The MySQL server\n" .1656 "# The MySQL server\n" .
1667 "[mysqld]\n" .1657 "[mysqld]\n";
1668 "datadir=$root\n" .
1669 "innodb_data_home_dir=$root\n" .
1670 "innodb_log_group_home_dir=$root\n";
16711658
1672 my $option_name;1659 my $option_name;
1673 foreach $option_name (@option_names) {1660 foreach $option_name (@option_names) {
@@ -2217,8 +2204,11 @@
2217 my $cmdline = '';2204 my $cmdline = '';
2218 my $options = '';2205 my $options = '';
22192206
2207
2220 if ($option_defaults_file) {2208 if ($option_defaults_file) {
2221 $options = $options . " --defaults-file=\"$option_defaults_file\" ";2209 $options = $options . " --defaults-file=\"$option_defaults_file\" ";
2210 } elsif ($option_apply_log) {
2211 $options = $options . " --defaults-file=\"${backup_dir}/backup-my.cnf\" ";
2222 }2212 }
22232213
2224 $options = $options . "--print-param";2214 $options = $options . "--print-param";
@@ -2304,7 +2294,6 @@
2304 if (!exists ${$config_ref}{$group}) {2294 if (!exists ${$config_ref}{$group}) {
2305 # no group2295 # no group
2306 print STDERR "$prefix fatal error: no '$group' group in MySQL options\n";2296 print STDERR "$prefix fatal error: no '$group' group in MySQL options\n";
2307 print STDERR "$prefix fatal error: OR no 'datadir' option in group '$group' in MySQL options\n";
2308 exit(1);2297 exit(1);
2309 }2298 }
23102299
@@ -2332,7 +2321,6 @@
2332 if (!exists $config{$group}) {2321 if (!exists $config{$group}) {
2333 # no group2322 # no group
2334 print STDERR "$prefix fatal error: no '$group' group in MySQL options\n";2323 print STDERR "$prefix fatal error: no '$group' group in MySQL options\n";
2335 print STDERR "$prefix fatal error: OR no 'datadir' option in group '$group' in MySQL options\n";
2336 exit(1);2324 exit(1);
2337 }2325 }
2338 2326
23392327
=== modified file 'src/xtrabackup.c'
--- src/xtrabackup.c 2012-05-15 16:53:07 +0000
+++ src/xtrabackup.c 2012-05-18 05:55:22 +0000
@@ -6333,7 +6333,7 @@
6333 if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option)))6333 if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option)))
6334 exit(ho_error);6334 exit(ho_error);
63356335
6336 if ((!xtrabackup_prepare) && (strcmp(mysql_data_home, "./") == 0)) {6336 if ((!xtrabackup_print_param) && (!xtrabackup_prepare) && (strcmp(mysql_data_home, "./") == 0)) {
6337 if (!xtrabackup_print_param)6337 if (!xtrabackup_print_param)
6338 usage();6338 usage();
6339 msg("\nxtrabackup: Error: Please set parameter 'datadir'\n");6339 msg("\nxtrabackup: Error: Please set parameter 'datadir'\n");
63406340
=== modified file 'test/t/bug983685.sh'
--- test/t/bug983685.sh 2012-04-17 12:55:16 +0000
+++ test/t/bug983685.sh 2012-05-18 05:55:22 +0000
@@ -6,7 +6,7 @@
66
7init7init
88
9options="innodb_data_file_path innodb_log_group_home_dir"9options="innodb_data_file_path"
1010
11run_mysqld11run_mysqld
1212
1313
=== added file 'test/t/bug996493.sh'
--- test/t/bug996493.sh 1970-01-01 00:00:00 +0000
+++ test/t/bug996493.sh 2012-05-18 05:55:22 +0000
@@ -0,0 +1,39 @@
1########################################################################
2# Bug #996493: innobackupex --apply-log doesn't read config from
3# backup-my.cnf
4########################################################################
5
6. inc/common.sh
7
8init
9
10run_mysqld
11
12backup_dir=$topdir/backup
13innobackupex --no-timestamp $backup_dir
14vlog "Backup created in directory $backup_dir"
15
16vlog "Stop mysqld"
17stop_mysqld
18
19vlog "Remove datadir"
20rm -r $mysql_datadir/*
21
22vlog "Remove my.cnf"
23mv $topdir/my.cnf $topdir/my.cnf.bak
24
25trap "vlog restoring $topdir/my.cnf ; \
26mv $topdir/my.cnf.bak $topdir/my.cnf" INT TERM EXIT
27
28vlog "Apply log"
29# Do not run innobackupex, because it pass option --defaults-file
30# which we should avoid. Our goal is to test that backup-my.cnf
31# will be read by default when apply-log is run.
32run_cmd $IB_BIN --ibbackup=$XB_BIN --apply-log $backup_dir
33
34vlog "Get my.cnf back"
35mv $topdir/my.cnf.bak $topdir/my.cnf
36trap "vlog test exit" INT TERM EXIT
37
38vlog "Copy back"
39innobackupex --copy-back $backup_dir

Subscribers

People subscribed via source and target branches