Merge lp:~sergei.glushchenko/percona-xtrabackup/bug733651_mycnf_opt-1.6 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: 384
Proposed branch: lp:~sergei.glushchenko/percona-xtrabackup/bug733651_mycnf_opt-1.6
Merge into: lp:percona-xtrabackup/2.0
Diff against target: 136 lines (+83/-10)
3 files modified
innobackupex (+46/-10)
test/t/bug733651.sh (+32/-0)
xtrabackup.c (+5/-0)
To merge this branch: bzr merge lp:~sergei.glushchenko/percona-xtrabackup/bug733651_mycnf_opt-1.6
Reviewer Review Type Date Requested Status
Alexey Kopytov (community) Approve
Review via email: mp+90861@code.launchpad.net

Description of the change

Bugfix for #733651 from 1.6

To post a comment you must log in.
Revision history for this message
Alexey Kopytov (akopytov) wrote :

OK to merge.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'innobackupex'
--- innobackupex 2012-01-31 01:46:10 +0000
+++ innobackupex 2012-01-31 13:01:26 +0000
@@ -1643,10 +1643,6 @@
1643 my $filename = shift;1643 my $filename = shift;
1644 my $innodb_data_file_path = 1644 my $innodb_data_file_path =
1645 get_option(\%config, 'mysqld', 'innodb_data_file_path');1645 get_option(\%config, 'mysqld', 'innodb_data_file_path');
1646 my $innodb_log_files_in_group =
1647 get_option(\%config, 'mysqld', 'innodb_log_files_in_group');
1648 my $innodb_log_file_size =
1649 get_option(\%config, 'mysqld', 'innodb_log_file_size');
1650 my $root;1646 my $root;
16511647
1652 my @array = split(/;/, $innodb_data_file_path);1648 my @array = split(/;/, $innodb_data_file_path);
@@ -1665,15 +1661,29 @@
1665 || Die "Failed to open file '$option_remote_host:$filename': $!";1661 || Die "Failed to open file '$option_remote_host:$filename': $!";
1666 }1662 }
16671663
1668 print FILE "# This MySQL options file was generated by $innobackup_script.\n\n" .1664 my @option_names = (
1665 "innodb_log_files_in_group",
1666 "innodb_log_file_size",
1667 "innodb_fast_checksum",
1668 "innodb_page_size",
1669 "innodb_log_block_size",
1670 );
1671
1672 my $options_dump = "# This MySQL options file was generated by $innobackup_script.\n\n" .
1669 "# The MySQL server\n" .1673 "# The MySQL server\n" .
1670 "[mysqld]\n" .1674 "[mysqld]\n" .
1671 "datadir=$root\n" .1675 "datadir=$root\n" .
1672 "innodb_data_home_dir=$root\n" .1676 "innodb_data_home_dir=$root\n";
1673 "innodb_data_file_path=$innodb_data_file_path\n" .1677
1674 "innodb_log_group_home_dir=$root\n" .1678 my $option_name;
1675 "innodb_log_files_in_group=$innodb_log_files_in_group\n" .1679 foreach $option_name (@option_names) {
1676 "innodb_log_file_size=$innodb_log_file_size\n";1680 if (has_option(\%config, 'mysqld', $option_name)) {
1681 my $option_value = get_option(\%config, 'mysqld', $option_name);
1682 $options_dump .= "$option_name=$option_value\n";
1683 }
1684 }
1685
1686 print FILE $options_dump;
1677 close(FILE);1687 close(FILE);
16781688
1679 if ($option_stream) {1689 if ($option_stream) {
@@ -2286,7 +2296,33 @@
2286}2296}
2287 2297
22882298
2299# has_option return whether the config has an option with the given name
2300# Parameters:
2301# config_ref a reference to a config data
2302# group option group name
2303# option_name name of the option
2304# Return value:
2305# true if option exists, otherwise false
2289#2306#
2307sub has_option {
2308 my $config_ref = shift;
2309 my $group = shift;
2310 my $option_name = shift;
2311 my $group_hash_ref;
2312
2313 if (!exists ${$config_ref}{$group}) {
2314 # no group
2315 print STDERR "$prefix fatal error: no '$group' group in MySQL options\n";
2316 print STDERR "$prefix fatal error: OR no 'datadir' option in group '$group' in MySQL options\n";
2317 exit(1);
2318 }
2319
2320 $group_hash_ref = ${$config_ref}{$group};
2321
2322 return exists ${$group_hash_ref}{$option_name};
2323}
2324
2325
2290# get_option subroutine returns the value of given option in the config2326# get_option subroutine returns the value of given option in the config
2291# structure. If option is missing, this subroutine calls exit.2327# structure. If option is missing, this subroutine calls exit.
2292# Parameters:2328# Parameters:
22932329
=== added file 'test/t/bug733651.sh'
--- test/t/bug733651.sh 1970-01-01 00:00:00 +0000
+++ test/t/bug733651.sh 2012-01-31 13:01:26 +0000
@@ -0,0 +1,32 @@
1########################################################################
2# Bug #733651: innobackupex not stores some critical
3# innodb options in backup-my.cnf
4########################################################################
5
6. inc/common.sh
7
8init
9
10options="innodb_log_files_in_group innodb_log_file_size"
11if [ ! -z "$XTRADB_VERSION" ]; then
12 options="$options innodb_page_size innodb_fast_checksum innodb_log_block_size"
13fi
14
15run_mysqld
16
17mkdir -p $topdir/backup
18innobackupex $topdir/backup
19backup_dir=`grep "innobackupex: Backup created in directory" $OUTFILE | awk -F\' '{ print $2}'`
20vlog "Backup created in directory $backup_dir"
21
22# test presence of options
23for option in $options ; do
24
25 if [ "`cat $backup_dir/backup-my.cnf | grep $option | wc -l`" == "0" ] ; then
26 vlog "Option $option is absent"
27 exit -1
28 else
29 vlog "Option $option is present"
30 fi
31
32done
033
=== modified file 'xtrabackup.c'
--- xtrabackup.c 2012-01-31 01:46:10 +0000
+++ xtrabackup.c 2012-01-31 13:01:26 +0000
@@ -6436,6 +6436,11 @@
6436 printf("innodb_flush_method = \"%s\"\n",6436 printf("innodb_flush_method = \"%s\"\n",
6437 (innobase_unix_file_flush_method != NULL) ?6437 (innobase_unix_file_flush_method != NULL) ?
6438 innobase_unix_file_flush_method : "");6438 innobase_unix_file_flush_method : "");
6439#ifdef XTRADB_BASED
6440 printf("innodb_fast_checksum = %d\n", innobase_fast_checksum);
6441 printf("innodb_page_size = %ld\n", innobase_page_size);
6442 printf("innodb_log_block_size = %lu\n", innobase_log_block_size);
6443#endif
6439 exit(EXIT_SUCCESS);6444 exit(EXIT_SUCCESS);
6440 }6445 }
64416446

Subscribers

People subscribed via source and target branches