Merge lp:~gl-az/percona-xtrabackup/2.1-bug740489 into lp:percona-xtrabackup/2.1

Proposed by George Ormond Lorch III
Status: Merged
Approved by: Alexey Kopytov
Approved revision: no longer in the source branch.
Merged at revision: 479
Proposed branch: lp:~gl-az/percona-xtrabackup/2.1-bug740489
Merge into: lp:percona-xtrabackup/2.1
Diff against target: 154 lines (+77/-2)
3 files modified
innobackupex (+28/-0)
test/inc/common.sh (+3/-2)
test/t/bug740489.sh (+46/-0)
To merge this branch: bzr merge lp:~gl-az/percona-xtrabackup/2.1-bug740489
Reviewer Review Type Date Requested Status
Alexey Kopytov (community) Approve
Sergei Glushchenko g2 Pending
Review via email: mp+142179@code.launchpad.net

This proposal supersedes a proposal from 2012-12-27.

Description of the change

Incorporated patch for Bug #740489 : Add --defaults-extra-file param to innobackupex

Added check in innobackupex for presence of defaults-file and defaults-extra-file to print error and exit if both are specified.

Created test case as bug740489.sh.

Modified test/inc/common.sh to set MYSQL_HOME instead of specifying --defaults-file for innobackupex call.

To post a comment you must log in.
Revision history for this message
George Ormond Lorch III (gl-az) wrote : Posted in a previous version of this proposal
Revision history for this message
Sergei Glushchenko (sergei.glushchenko) wrote : Posted in a previous version of this proposal

Approve. Comments are the same as for 2.0 version of patch.

review: Approve (g2)
Revision history for this message
Alexey Kopytov (akopytov) wrote : Posted in a previous version of this proposal

Same comments as in 2.1 MP.

review: Needs Fixing
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 'innobackupex'
2--- innobackupex 2013-01-02 04:23:18 +0000
3+++ innobackupex 2013-01-07 19:19:35 +0000
4@@ -96,6 +96,7 @@
5 my $option_ibbackup_binary = 'autodetect';
6
7 my $option_defaults_file = '';
8+my $option_defaults_extra_file = '';
9 my $option_incremental = '';
10 my $option_incremental_basedir = '';
11 my $option_incremental_dir = '';
12@@ -812,6 +813,10 @@
13 $options = $options . " --defaults-file=\"${backup_dir}/backup-my.cnf\" ";
14 }
15
16+ if ($option_defaults_extra_file) {
17+ $options = $options . " --defaults-extra-file=\"$option_defaults_extra_file\" ";
18+ }
19+
20 if ($option_defaults_group) {
21 $options = $options . " --defaults-group=\"$option_defaults_group\" ";
22 }
23@@ -983,6 +988,10 @@
24 $options = $options . " --defaults-file=\"$option_defaults_file\" ";
25 }
26
27+ if ($option_defaults_extra_file) {
28+ $options = $options . " --defaults-extra-file=\"$option_defaults_extra_file\" ";
29+ }
30+
31 if ($option_defaults_group) {
32 $options = $options . " --defaults-group=\"$option_defaults_group\" ";
33 }
34@@ -1070,6 +1079,10 @@
35 $options = "$options --defaults-file='$option_defaults_file'";
36 }
37
38+ if ($option_defaults_extra_file) {
39+ $options = $options . " --defaults-extra-file=\"$option_defaults_extra_file\" ";
40+ }
41+
42 if ($option_mysql_password) {
43 $options = "$options --password='$option_mysql_password'";
44 }
45@@ -1732,6 +1745,7 @@
46 'socket=s' => \$option_mysql_socket,
47 'no-timestamp' => \$option_no_timestamp,
48 'defaults-file=s' => \$option_defaults_file,
49+ 'defaults-extra-file=s' => \$option_defaults_extra_file,
50 'incremental' => \$option_incremental,
51 'incremental-basedir=s' => \$option_incremental_basedir,
52 'incremental-lsn=s' => \$option_incremental_lsn,
53@@ -1764,6 +1778,12 @@
54 exit(0);
55 }
56
57+ if ($option_defaults_file && $option_defaults_extra_file) {
58+ print STDERR "$prefix --defaults-file and --defaults-extra-file " .
59+ "options are mutually exclusive";
60+ exit(1);
61+ }
62+
63 if ($option_copy_back && $option_move_back) {
64 print STDERR "$prefix --copy-back and --move-back options are " .
65 "mutually exclusive";
66@@ -2187,6 +2207,10 @@
67 $options = $options . " --defaults-file=\"${backup_dir}/backup-my.cnf\" ";
68 }
69
70+ if ($option_defaults_extra_file) {
71+ $options = $options . " --defaults-extra-file=\"$option_defaults_extra_file\" ";
72+ }
73+
74 if ($option_defaults_group) {
75 $options = $options . " --defaults-group=\"$option_defaults_group\" ";
76 }
77@@ -2706,6 +2730,10 @@
78
79 This option specifies what file to read the default MySQL options from. The option accepts a string argument. It is also passed directly to xtrabackup's --defaults-file option. See the xtrabackup documentation for details.
80
81+=item --defaults-extra-file=[MY.CNF]
82+
83+This option specifies what extra file to read the default MySQL options from before the standard defaults-file. The option accepts a string argument. It is also passed directly to xtrabackup's --defaults-extra-file option. See the xtrabackup documentation for details.
84+
85 =item --export
86
87 This option is passed directly to xtrabackup's --export option. It enables exporting individual tables for import into another server. See the xtrabackup documentation for details.
88
89=== modified file 'test/inc/common.sh'
90--- test/inc/common.sh 2012-11-21 12:14:07 +0000
91+++ test/inc/common.sh 2013-01-07 19:19:35 +0000
92@@ -239,8 +239,9 @@
93 MYSQLD_ARGS="$MYSQLD_ARGS --user=root"
94 fi
95
96- IB_ARGS="--defaults-file=${MYSQLD_VARDIR}/my.cnf --user=root \
97---socket=${MYSQLD_SOCKET} --ibbackup=$XB_BIN"
98+ export MYSQL_HOME=$MYSQLD_VARDIR
99+
100+ IB_ARGS="--user=root --socket=${MYSQLD_SOCKET} --ibbackup=$XB_BIN"
101 XB_ARGS="--no-defaults"
102
103 # Some aliases for compatibility, as tests use the following names
104
105=== added file 'test/t/bug740489.sh'
106--- test/t/bug740489.sh 1970-01-01 00:00:00 +0000
107+++ test/t/bug740489.sh 2013-01-07 19:19:35 +0000
108@@ -0,0 +1,46 @@
109+############################################################################
110+# Bug #740489: Add --defaults-extra-file param to innobackupex
111+############################################################################
112+. inc/common.sh
113+
114+start_server --innodb_file_per_table
115+load_sakila
116+
117+run_cmd ${MYSQL} ${MYSQL_ARGS} -e "UPDATE mysql.user SET Password=PASSWORD('password') WHERE User='root'; FLUSH PRIVILEGES;"
118+
119+defaults_extra_file=${TEST_BASEDIR}/740489.cnf
120+
121+echo "[client]" > $defaults_extra_file
122+echo "user=root" >> $defaults_extra_file
123+echo "password=password" >> $defaults_extra_file
124+
125+mkdir -p $topdir/backup
126+cat ${MYSQLD_VARDIR}/my.cnf
127+run_cmd $IB_BIN --defaults-extra-file=$defaults_extra_file --socket=${MYSQLD_SOCKET} --ibbackup=$XB_BIN $topdir/backup
128+backup_dir=`grep "innobackupex: Backup created in directory" $OUTFILE | awk -F\' '{ print $2}'`
129+vlog "Backup created in directory $backup_dir"
130+
131+run_cmd ${MYSQL} ${MYSQL_ARGS} --password=password -e "UPDATE mysql.user SET Password=PASSWORD('') WHERE User='root'; FLUSH PRIVILEGES;"
132+
133+stop_server
134+# Remove datadir
135+rm -r $mysql_datadir
136+#init_mysql_dir
137+# Restore sakila
138+vlog "Applying log"
139+vlog "###########"
140+vlog "# PREPARE #"
141+vlog "###########"
142+innobackupex --apply-log $backup_dir
143+vlog "Restoring MySQL datadir"
144+mkdir -p $mysql_datadir
145+vlog "###########"
146+vlog "# RESTORE #"
147+vlog "###########"
148+innobackupex --copy-back $backup_dir
149+
150+start_server
151+# Check sakila
152+run_cmd ${MYSQL} ${MYSQL_ARGS} --password=password -e "SELECT count(*) from actor" sakila
153+
154+rm -f $defaults_extra_file

Subscribers

People subscribed via source and target branches