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
1=== modified file 'doc/source/innobackupex/restoring_a_backup_ibk.rst'
2--- doc/source/innobackupex/restoring_a_backup_ibk.rst 2011-07-07 05:32:50 +0000
3+++ doc/source/innobackupex/restoring_a_backup_ibk.rst 2012-05-18 05:55:22 +0000
4@@ -6,7 +6,7 @@
5
6 $ innobackupex --copy-back /path/to/BACKUP-DIR
7
8-It 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::
9+It 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::
10
11 innobackupex: Finished copying back files.
12
13
14=== modified file 'innobackupex'
15--- innobackupex 2012-05-15 09:30:50 +0000
16+++ innobackupex 2012-05-18 05:55:22 +0000
17@@ -736,6 +736,8 @@
18
19 if ($option_defaults_file) {
20 $options = $options . " --defaults-file=\"$option_defaults_file\" ";
21+ } else {
22+ $options = $options . " --defaults-file=\"${backup_dir}/backup-my.cnf\" ";
23 }
24
25 $options = $options . "--prepare --target-dir=$backup_dir";
26@@ -1633,22 +1635,10 @@
27 #
28 sub write_backup_config_file {
29 my $filename = shift;
30- my $innodb_data_file_path =
31- get_option(\%config, 'mysqld', 'innodb_data_file_path');
32- my $root;
33-
34- my @array = split(/;/, $innodb_data_file_path);
35- for (my $i = 0; $i <= $#array; $i++) {
36- my @tmp = split(/\/+/, $array[$i]);
37- $array[$i] = $tmp[-1];
38- }
39- $innodb_data_file_path = join(";", @array);
40
41 if (!$option_remote_host) {
42- $root = $backup_dir;
43 open(FILE, "> $filename") || Die "Failed to open file '$filename': $!";
44 } else {
45- $root = `ssh $option_ssh_opt $option_remote_host 'cd $backup_dir; pwd'`;
46 open(FILE, "| ssh $option_ssh_opt $option_remote_host 'cat > $filename'")
47 || Die "Failed to open file '$option_remote_host:$filename': $!";
48 }
49@@ -1664,10 +1654,7 @@
50
51 my $options_dump = "# This MySQL options file was generated by $innobackup_script.\n\n" .
52 "# The MySQL server\n" .
53- "[mysqld]\n" .
54- "datadir=$root\n" .
55- "innodb_data_home_dir=$root\n" .
56- "innodb_log_group_home_dir=$root\n";
57+ "[mysqld]\n";
58
59 my $option_name;
60 foreach $option_name (@option_names) {
61@@ -2217,8 +2204,11 @@
62 my $cmdline = '';
63 my $options = '';
64
65+
66 if ($option_defaults_file) {
67 $options = $options . " --defaults-file=\"$option_defaults_file\" ";
68+ } elsif ($option_apply_log) {
69+ $options = $options . " --defaults-file=\"${backup_dir}/backup-my.cnf\" ";
70 }
71
72 $options = $options . "--print-param";
73@@ -2304,7 +2294,6 @@
74 if (!exists ${$config_ref}{$group}) {
75 # no group
76 print STDERR "$prefix fatal error: no '$group' group in MySQL options\n";
77- print STDERR "$prefix fatal error: OR no 'datadir' option in group '$group' in MySQL options\n";
78 exit(1);
79 }
80
81@@ -2332,7 +2321,6 @@
82 if (!exists $config{$group}) {
83 # no group
84 print STDERR "$prefix fatal error: no '$group' group in MySQL options\n";
85- print STDERR "$prefix fatal error: OR no 'datadir' option in group '$group' in MySQL options\n";
86 exit(1);
87 }
88
89
90=== modified file 'src/xtrabackup.c'
91--- src/xtrabackup.c 2012-05-15 16:53:07 +0000
92+++ src/xtrabackup.c 2012-05-18 05:55:22 +0000
93@@ -6333,7 +6333,7 @@
94 if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option)))
95 exit(ho_error);
96
97- if ((!xtrabackup_prepare) && (strcmp(mysql_data_home, "./") == 0)) {
98+ if ((!xtrabackup_print_param) && (!xtrabackup_prepare) && (strcmp(mysql_data_home, "./") == 0)) {
99 if (!xtrabackup_print_param)
100 usage();
101 msg("\nxtrabackup: Error: Please set parameter 'datadir'\n");
102
103=== modified file 'test/t/bug983685.sh'
104--- test/t/bug983685.sh 2012-04-17 12:55:16 +0000
105+++ test/t/bug983685.sh 2012-05-18 05:55:22 +0000
106@@ -6,7 +6,7 @@
107
108 init
109
110-options="innodb_data_file_path innodb_log_group_home_dir"
111+options="innodb_data_file_path"
112
113 run_mysqld
114
115
116=== added file 'test/t/bug996493.sh'
117--- test/t/bug996493.sh 1970-01-01 00:00:00 +0000
118+++ test/t/bug996493.sh 2012-05-18 05:55:22 +0000
119@@ -0,0 +1,39 @@
120+########################################################################
121+# Bug #996493: innobackupex --apply-log doesn't read config from
122+# backup-my.cnf
123+########################################################################
124+
125+. inc/common.sh
126+
127+init
128+
129+run_mysqld
130+
131+backup_dir=$topdir/backup
132+innobackupex --no-timestamp $backup_dir
133+vlog "Backup created in directory $backup_dir"
134+
135+vlog "Stop mysqld"
136+stop_mysqld
137+
138+vlog "Remove datadir"
139+rm -r $mysql_datadir/*
140+
141+vlog "Remove my.cnf"
142+mv $topdir/my.cnf $topdir/my.cnf.bak
143+
144+trap "vlog restoring $topdir/my.cnf ; \
145+mv $topdir/my.cnf.bak $topdir/my.cnf" INT TERM EXIT
146+
147+vlog "Apply log"
148+# Do not run innobackupex, because it pass option --defaults-file
149+# which we should avoid. Our goal is to test that backup-my.cnf
150+# will be read by default when apply-log is run.
151+run_cmd $IB_BIN --ibbackup=$XB_BIN --apply-log $backup_dir
152+
153+vlog "Get my.cnf back"
154+mv $topdir/my.cnf.bak $topdir/my.cnf
155+trap "vlog test exit" INT TERM EXIT
156+
157+vlog "Copy back"
158+innobackupex --copy-back $backup_dir

Subscribers

People subscribed via source and target branches