Merge lp:~sergei.glushchenko/percona-xtrabackup/xb1.6-bug996493 into lp:percona-xtrabackup/1.6

Proposed by Sergei Glushchenko
Status: Merged
Approved by: Alexey Kopytov
Approved revision: no longer in the source branch.
Merged at revision: 350
Proposed branch: lp:~sergei.glushchenko/percona-xtrabackup/xb1.6-bug996493
Merge into: lp:percona-xtrabackup/1.6
Diff against target: 158 lines (+48/-21)
5 files modified
doc/source/innobackupex/restoring_a_backup_ibk.rst (+1/-1)
innobackupex (+6/-18)
test/t/bug983685.sh (+1/-1)
test/t/bug996493.sh (+39/-0)
xtrabackup.c (+1/-1)
To merge this branch: bzr merge lp:~sergei.glushchenko/percona-xtrabackup/xb1.6-bug996493
Reviewer Review Type Date Requested Status
Stewart Smith (community) Approve
Alexey Kopytov (community) Approve
Review via email: mp+106305@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

Resolved conflicts from previous MP request

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
Stewart Smith (stewart) wrote : Posted in a previous version of this proposal
review: Needs Fixing
Revision history for this message
Alexey Kopytov (akopytov) :
review: Approve
Revision history for this message
Stewart Smith (stewart) wrote :

doesn't cleanly merge into 2.0, may need a corresponding 2.0 branch

review: Needs Fixing
Revision history for this message
Alexey Kopytov (akopytov) wrote :

This has already been merged into 2.0 (and released in 2.0.1). In 2.0 branch:

$ bzr missing --other lp:~sergei.glushchenko/percona-xtrabackup/xb1.6-bug996493
Other branch has no new revisions.

Revision history for this message
Stewart Smith (stewart) :
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 2012-02-16 17:05:16 +0000
3+++ doc/source/innobackupex/restoring_a_backup_ibk.rst 2012-05-18 05:40: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-04-17 12:44:49 +0000
16+++ innobackupex 2012-05-18 05:40:22 +0000
17@@ -707,6 +707,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@@ -1594,22 +1596,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@@ -1625,10 +1615,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@@ -2187,8 +2174,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@@ -2274,7 +2264,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@@ -2302,7 +2291,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 'test/t/bug983685.sh'
91--- test/t/bug983685.sh 2012-04-17 12:44:49 +0000
92+++ test/t/bug983685.sh 2012-05-18 05:40:22 +0000
93@@ -6,7 +6,7 @@
94
95 init
96
97-options="innodb_data_file_path innodb_log_group_home_dir"
98+options="innodb_data_file_path"
99
100 run_mysqld
101
102
103=== added file 'test/t/bug996493.sh'
104--- test/t/bug996493.sh 1970-01-01 00:00:00 +0000
105+++ test/t/bug996493.sh 2012-05-18 05:40:22 +0000
106@@ -0,0 +1,39 @@
107+########################################################################
108+# Bug #996493: innobackupex --apply-log doesn't read config from
109+# backup-my.cnf
110+########################################################################
111+
112+. inc/common.sh
113+
114+init
115+
116+run_mysqld
117+
118+backup_dir=$topdir/backup
119+innobackupex --no-timestamp $backup_dir
120+vlog "Backup created in directory $backup_dir"
121+
122+vlog "Stop mysqld"
123+stop_mysqld
124+
125+vlog "Remove datadir"
126+rm -r $mysql_datadir/*
127+
128+vlog "Remove my.cnf"
129+mv $topdir/my.cnf $topdir/my.cnf.bak
130+
131+trap "vlog restoring $topdir/my.cnf ; \
132+mv $topdir/my.cnf.bak $topdir/my.cnf" INT TERM EXIT
133+
134+vlog "Apply log"
135+# Do not run innobackupex, because it pass option --defaults-file
136+# which we should avoid. Our goal is to test that backup-my.cnf
137+# will be read by default when apply-log is run.
138+run_cmd $IB_BIN --ibbackup=$XB_BIN --apply-log $backup_dir
139+
140+vlog "Get my.cnf back"
141+mv $topdir/my.cnf.bak $topdir/my.cnf
142+trap "vlog test exit" INT TERM EXIT
143+
144+vlog "Copy back"
145+innobackupex --copy-back $backup_dir
146
147=== modified file 'xtrabackup.c'
148--- xtrabackup.c 2012-03-27 01:07:43 +0000
149+++ xtrabackup.c 2012-05-18 05:40:22 +0000
150@@ -6063,7 +6063,7 @@
151 if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option)))
152 exit(ho_error);
153
154- if ((!xtrabackup_prepare) && (strcmp(mysql_data_home, "./") == 0)) {
155+ if ((!xtrabackup_print_param) && (!xtrabackup_prepare) && (strcmp(mysql_data_home, "./") == 0)) {
156 if (!xtrabackup_print_param)
157 usage();
158 fprintf(stderr, "\n"

Subscribers

People subscribed via source and target branches