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
=== modified file 'innobackupex'
--- innobackupex 2013-01-02 04:23:18 +0000
+++ innobackupex 2013-01-07 19:19:35 +0000
@@ -96,6 +96,7 @@
96my $option_ibbackup_binary = 'autodetect';96my $option_ibbackup_binary = 'autodetect';
9797
98my $option_defaults_file = '';98my $option_defaults_file = '';
99my $option_defaults_extra_file = '';
99my $option_incremental = '';100my $option_incremental = '';
100my $option_incremental_basedir = '';101my $option_incremental_basedir = '';
101my $option_incremental_dir = '';102my $option_incremental_dir = '';
@@ -812,6 +813,10 @@
812 $options = $options . " --defaults-file=\"${backup_dir}/backup-my.cnf\" ";813 $options = $options . " --defaults-file=\"${backup_dir}/backup-my.cnf\" ";
813 }814 }
814815
816 if ($option_defaults_extra_file) {
817 $options = $options . " --defaults-extra-file=\"$option_defaults_extra_file\" ";
818 }
819
815 if ($option_defaults_group) {820 if ($option_defaults_group) {
816 $options = $options . " --defaults-group=\"$option_defaults_group\" ";821 $options = $options . " --defaults-group=\"$option_defaults_group\" ";
817 }822 }
@@ -983,6 +988,10 @@
983 $options = $options . " --defaults-file=\"$option_defaults_file\" ";988 $options = $options . " --defaults-file=\"$option_defaults_file\" ";
984 }989 }
985990
991 if ($option_defaults_extra_file) {
992 $options = $options . " --defaults-extra-file=\"$option_defaults_extra_file\" ";
993 }
994
986 if ($option_defaults_group) {995 if ($option_defaults_group) {
987 $options = $options . " --defaults-group=\"$option_defaults_group\" ";996 $options = $options . " --defaults-group=\"$option_defaults_group\" ";
988 }997 }
@@ -1070,6 +1079,10 @@
1070 $options = "$options --defaults-file='$option_defaults_file'";1079 $options = "$options --defaults-file='$option_defaults_file'";
1071 }1080 }
10721081
1082 if ($option_defaults_extra_file) {
1083 $options = $options . " --defaults-extra-file=\"$option_defaults_extra_file\" ";
1084 }
1085
1073 if ($option_mysql_password) {1086 if ($option_mysql_password) {
1074 $options = "$options --password='$option_mysql_password'";1087 $options = "$options --password='$option_mysql_password'";
1075 }1088 }
@@ -1732,6 +1745,7 @@
1732 'socket=s' => \$option_mysql_socket,1745 'socket=s' => \$option_mysql_socket,
1733 'no-timestamp' => \$option_no_timestamp,1746 'no-timestamp' => \$option_no_timestamp,
1734 'defaults-file=s' => \$option_defaults_file,1747 'defaults-file=s' => \$option_defaults_file,
1748 'defaults-extra-file=s' => \$option_defaults_extra_file,
1735 'incremental' => \$option_incremental,1749 'incremental' => \$option_incremental,
1736 'incremental-basedir=s' => \$option_incremental_basedir,1750 'incremental-basedir=s' => \$option_incremental_basedir,
1737 'incremental-lsn=s' => \$option_incremental_lsn,1751 'incremental-lsn=s' => \$option_incremental_lsn,
@@ -1764,6 +1778,12 @@
1764 exit(0);1778 exit(0);
1765 }1779 }
17661780
1781 if ($option_defaults_file && $option_defaults_extra_file) {
1782 print STDERR "$prefix --defaults-file and --defaults-extra-file " .
1783 "options are mutually exclusive";
1784 exit(1);
1785 }
1786
1767 if ($option_copy_back && $option_move_back) {1787 if ($option_copy_back && $option_move_back) {
1768 print STDERR "$prefix --copy-back and --move-back options are " .1788 print STDERR "$prefix --copy-back and --move-back options are " .
1769 "mutually exclusive";1789 "mutually exclusive";
@@ -2187,6 +2207,10 @@
2187 $options = $options . " --defaults-file=\"${backup_dir}/backup-my.cnf\" ";2207 $options = $options . " --defaults-file=\"${backup_dir}/backup-my.cnf\" ";
2188 }2208 }
21892209
2210 if ($option_defaults_extra_file) {
2211 $options = $options . " --defaults-extra-file=\"$option_defaults_extra_file\" ";
2212 }
2213
2190 if ($option_defaults_group) {2214 if ($option_defaults_group) {
2191 $options = $options . " --defaults-group=\"$option_defaults_group\" ";2215 $options = $options . " --defaults-group=\"$option_defaults_group\" ";
2192 }2216 }
@@ -2706,6 +2730,10 @@
27062730
2707This 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.2731This 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.
27082732
2733=item --defaults-extra-file=[MY.CNF]
2734
2735This 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.
2736
2709=item --export2737=item --export
27102738
2711This 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.2739This 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.
27122740
=== modified file 'test/inc/common.sh'
--- test/inc/common.sh 2012-11-21 12:14:07 +0000
+++ test/inc/common.sh 2013-01-07 19:19:35 +0000
@@ -239,8 +239,9 @@
239 MYSQLD_ARGS="$MYSQLD_ARGS --user=root"239 MYSQLD_ARGS="$MYSQLD_ARGS --user=root"
240 fi240 fi
241241
242 IB_ARGS="--defaults-file=${MYSQLD_VARDIR}/my.cnf --user=root \242 export MYSQL_HOME=$MYSQLD_VARDIR
243--socket=${MYSQLD_SOCKET} --ibbackup=$XB_BIN"243
244 IB_ARGS="--user=root --socket=${MYSQLD_SOCKET} --ibbackup=$XB_BIN"
244 XB_ARGS="--no-defaults"245 XB_ARGS="--no-defaults"
245246
246 # Some aliases for compatibility, as tests use the following names247 # Some aliases for compatibility, as tests use the following names
247248
=== added file 'test/t/bug740489.sh'
--- test/t/bug740489.sh 1970-01-01 00:00:00 +0000
+++ test/t/bug740489.sh 2013-01-07 19:19:35 +0000
@@ -0,0 +1,46 @@
1############################################################################
2# Bug #740489: Add --defaults-extra-file param to innobackupex
3############################################################################
4. inc/common.sh
5
6start_server --innodb_file_per_table
7load_sakila
8
9run_cmd ${MYSQL} ${MYSQL_ARGS} -e "UPDATE mysql.user SET Password=PASSWORD('password') WHERE User='root'; FLUSH PRIVILEGES;"
10
11defaults_extra_file=${TEST_BASEDIR}/740489.cnf
12
13echo "[client]" > $defaults_extra_file
14echo "user=root" >> $defaults_extra_file
15echo "password=password" >> $defaults_extra_file
16
17mkdir -p $topdir/backup
18cat ${MYSQLD_VARDIR}/my.cnf
19run_cmd $IB_BIN --defaults-extra-file=$defaults_extra_file --socket=${MYSQLD_SOCKET} --ibbackup=$XB_BIN $topdir/backup
20backup_dir=`grep "innobackupex: Backup created in directory" $OUTFILE | awk -F\' '{ print $2}'`
21vlog "Backup created in directory $backup_dir"
22
23run_cmd ${MYSQL} ${MYSQL_ARGS} --password=password -e "UPDATE mysql.user SET Password=PASSWORD('') WHERE User='root'; FLUSH PRIVILEGES;"
24
25stop_server
26# Remove datadir
27rm -r $mysql_datadir
28#init_mysql_dir
29# Restore sakila
30vlog "Applying log"
31vlog "###########"
32vlog "# PREPARE #"
33vlog "###########"
34innobackupex --apply-log $backup_dir
35vlog "Restoring MySQL datadir"
36mkdir -p $mysql_datadir
37vlog "###########"
38vlog "# RESTORE #"
39vlog "###########"
40innobackupex --copy-back $backup_dir
41
42start_server
43# Check sakila
44run_cmd ${MYSQL} ${MYSQL_ARGS} --password=password -e "SELECT count(*) from actor" sakila
45
46rm -f $defaults_extra_file

Subscribers

People subscribed via source and target branches