Merge lp:~sergei.glushchenko/percona-xtrabackup/xb2.0-bug483827 into lp:percona-xtrabackup/2.0
- xb2.0-bug483827
- Merge into 2.0
Status: | Merged | ||||
---|---|---|---|---|---|
Approved by: | Alexey Kopytov | ||||
Approved revision: | no longer in the source branch. | ||||
Merged at revision: | 431 | ||||
Proposed branch: | lp:~sergei.glushchenko/percona-xtrabackup/xb2.0-bug483827 | ||||
Merge into: | lp:percona-xtrabackup/2.0 | ||||
Prerequisite: | lp:~sergei.glushchenko/percona-xtrabackup/xb2.0-bug996493 | ||||
Diff against target: |
325 lines (+108/-19) 6 files modified
doc/source/how-tos.rst (+1/-0) doc/source/innobackupex/innobackupex_option_reference.rst (+4/-0) doc/source/xtrabackup_bin/xbk_option_reference.rst (+4/-0) innobackupex (+34/-16) src/xtrabackup.c (+20/-3) test/t/bug483827.sh (+45/-0) |
||||
To merge this branch: | bzr merge lp:~sergei.glushchenko/percona-xtrabackup/xb2.0-bug483827 | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Alexey Kopytov (community) | Approve | ||
Review via email: mp+106348@code.launchpad.net |
This proposal supersedes a proposal from 2012-03-29.
Commit message
Description of the change
Bug #483827. Support for mysqld_multi.
Fix based on work of Daniël van Eeden (lp:~dveeden/percona-xtrabackup/lp483827)
--section option added to innobackupex, specifying which section of my.cnf to handle.
--mysqld-section option added to xtrabackup for the same purpose.
Tescase does not run mysqld_multi, it just tests correctness of --section option.
http://
Alexey Kopytov (akopytov) wrote : Posted in a previous version of this proposal | # |
Sergei Glushchenko (sergei.glushchenko) wrote : | # |
--defaults-group option instead of --section and --mysql-section
kept group name argument for has_option.
fixed typos.
reformatted code to be more InnoDB-style (if there are other requirements, I'm ready for the next iteration).
removed unnecessary strstr.
Alexey Kopytov (akopytov) wrote : | # |
Sergei,
As discussed on IRC, --defaults-group does not necessarily have to be the first option, so docs should be corrected.
And, while you are at it would be good to correct built-in help for --defaults-group in innobackupex.
Help text for other options either have units or some description of possible values after the '=' sign, e.g.:
--ibbackup=
--remote-
So the text for --defaults-group should be something like "--defaults-
Sergei Glushchenko (sergei.glushchenko) wrote : | # |
Docs fixed
Alexey Kopytov (akopytov) : | # |
Preview Diff
1 | === modified file 'doc/source/how-tos.rst' | |||
2 | --- doc/source/how-tos.rst 2011-07-07 05:32:50 +0000 | |||
3 | +++ doc/source/how-tos.rst 2012-05-18 11:25:23 +0000 | |||
4 | @@ -13,6 +13,7 @@ | |||
5 | 13 | howtos/recipes_ibkx_local | 13 | howtos/recipes_ibkx_local |
6 | 14 | howtos/recipes_ibkx_stream | 14 | howtos/recipes_ibkx_stream |
7 | 15 | howtos/recipes_ibkx_inc | 15 | howtos/recipes_ibkx_inc |
8 | 16 | howtos/recipes_ibkx_multi | ||
9 | 16 | 17 | ||
10 | 17 | 18 | ||
11 | 18 | .. _recipes-xbk: | 19 | .. _recipes-xbk: |
12 | 19 | 20 | ||
13 | === modified file 'doc/source/innobackupex/innobackupex_option_reference.rst' | |||
14 | --- doc/source/innobackupex/innobackupex_option_reference.rst 2012-05-15 09:30:50 +0000 | |||
15 | +++ doc/source/innobackupex/innobackupex_option_reference.rst 2012-05-18 11:25:23 +0000 | |||
16 | @@ -70,6 +70,10 @@ | |||
17 | 70 | 70 | ||
18 | 71 | This option accepts a string argument that specifies the port to use when connecting to the database server with TCP/IP. It is passed to the :command:`mysql` child process. It is passed to the :command:`mysql` child process without alteration. See :command:`mysql --help` for details. | 71 | This option accepts a string argument that specifies the port to use when connecting to the database server with TCP/IP. It is passed to the :command:`mysql` child process. It is passed to the :command:`mysql` child process without alteration. See :command:`mysql --help` for details. |
19 | 72 | 72 | ||
20 | 73 | .. option:: --defaults-group | ||
21 | 74 | |||
22 | 75 | This option accepts a string argument that specifies the group which should be read from the configuration file. This is needed if you use mysqld_multi. | ||
23 | 76 | |||
24 | 73 | .. option:: --socket | 77 | .. option:: --socket |
25 | 74 | 78 | ||
26 | 75 | This option accepts a string argument that specifies the socket to use when connecting to the local database server with a UNIX domain socket. It is passed to the mysql child process without alteration. See :command:`mysql --help` for details. | 79 | This option accepts a string argument that specifies the socket to use when connecting to the local database server with a UNIX domain socket. It is passed to the mysql child process without alteration. See :command:`mysql --help` for details. |
27 | 76 | 80 | ||
28 | === modified file 'doc/source/xtrabackup_bin/xbk_option_reference.rst' | |||
29 | --- doc/source/xtrabackup_bin/xbk_option_reference.rst 2012-04-21 07:12:28 +0000 | |||
30 | +++ doc/source/xtrabackup_bin/xbk_option_reference.rst 2012-05-18 11:25:23 +0000 | |||
31 | @@ -101,6 +101,10 @@ | |||
32 | 101 | --innodb-read-io-threads | 101 | --innodb-read-io-threads |
33 | 102 | --innodb-write-io-threads | 102 | --innodb-write-io-threads |
34 | 103 | 103 | ||
35 | 104 | .. option:: --defaults-group | ||
36 | 105 | |||
37 | 106 | This option is to set the group which should be read from the configuration file. This is used by innobackupex if you use the `--defaults-group` option. It is needed for mysqld_multi deployments. | ||
38 | 107 | |||
39 | 104 | .. option:: --log-stream | 108 | .. option:: --log-stream |
40 | 105 | 109 | ||
41 | 106 | Makes xtrabackup not copy data files, and output the contents of the InnoDB log files to STDOUT until the :option:`--suspend-at-end` file is deleted. This option enables :option:`--suspend-at-end` automatically. | 110 | Makes xtrabackup not copy data files, and output the contents of the InnoDB log files to STDOUT until the :option:`--suspend-at-end` file is deleted. This option enables :option:`--suspend-at-end` automatically. |
42 | 107 | 111 | ||
43 | === modified file 'innobackupex' | |||
44 | --- innobackupex 2012-05-18 11:25:23 +0000 | |||
45 | +++ innobackupex 2012-05-18 11:25:23 +0000 | |||
46 | @@ -84,6 +84,7 @@ | |||
47 | 84 | my $option_mysql_port = ''; | 84 | my $option_mysql_port = ''; |
48 | 85 | my $option_mysql_socket = ''; | 85 | my $option_mysql_socket = ''; |
49 | 86 | my $option_mysql_host = ''; | 86 | my $option_mysql_host = ''; |
50 | 87 | my $option_defaults_group = 'mysqld'; | ||
51 | 87 | my $option_no_timestamp = ''; | 88 | my $option_no_timestamp = ''; |
52 | 88 | my $option_slave_info = ''; | 89 | my $option_slave_info = ''; |
53 | 89 | my $option_galera_info = ''; | 90 | my $option_galera_info = ''; |
54 | @@ -377,7 +378,7 @@ | |||
55 | 377 | # process. | 378 | # process. |
56 | 378 | # | 379 | # |
57 | 379 | sub backup { | 380 | sub backup { |
59 | 380 | my $orig_datadir = get_option(\%config, 'mysqld', 'datadir'); | 381 | my $orig_datadir = get_option(\%config, $option_defaults_group, 'datadir'); |
60 | 381 | 382 | ||
61 | 382 | # check that we can connect to the database. This done by | 383 | # check that we can connect to the database. This done by |
62 | 383 | # connecting, issuing a query, and closing the connection. | 384 | # connecting, issuing a query, and closing the connection. |
63 | @@ -626,13 +627,13 @@ | |||
64 | 626 | # back to their original locations. | 627 | # back to their original locations. |
65 | 627 | # | 628 | # |
66 | 628 | sub copy_back { | 629 | sub copy_back { |
68 | 629 | my $orig_datadir = get_option(\%config, 'mysqld', 'datadir'); | 630 | my $orig_datadir = get_option(\%config, $option_defaults_group, 'datadir'); |
69 | 630 | my $orig_ibdata_dir = | 631 | my $orig_ibdata_dir = |
71 | 631 | get_option(\%config, 'mysqld', 'innodb_data_home_dir'); | 632 | get_option(\%config, $option_defaults_group, 'innodb_data_home_dir'); |
72 | 632 | my $orig_innodb_data_file_path = | 633 | my $orig_innodb_data_file_path = |
74 | 633 | get_option(\%config, 'mysqld', 'innodb_data_file_path'); | 634 | get_option(\%config, $option_defaults_group, 'innodb_data_file_path'); |
75 | 634 | my $orig_iblog_dir = | 635 | my $orig_iblog_dir = |
77 | 635 | get_option(\%config, 'mysqld', 'innodb_log_group_home_dir'); | 636 | get_option(\%config, $option_defaults_group, 'innodb_log_group_home_dir'); |
78 | 636 | my $iblog_files = 'ib_logfile.*'; | 637 | my $iblog_files = 'ib_logfile.*'; |
79 | 637 | my $excluded_files = | 638 | my $excluded_files = |
80 | 638 | '\.\.?|backup-my\.cnf|xtrabackup_logfile|' . | 639 | '\.\.?|backup-my\.cnf|xtrabackup_logfile|' . |
81 | @@ -740,6 +741,10 @@ | |||
82 | 740 | $options = $options . " --defaults-file=\"${backup_dir}/backup-my.cnf\" "; | 741 | $options = $options . " --defaults-file=\"${backup_dir}/backup-my.cnf\" "; |
83 | 741 | } | 742 | } |
84 | 742 | 743 | ||
85 | 744 | if ($option_defaults_group) { | ||
86 | 745 | $options = $options . " --defaults-group=\"$option_defaults_group\" "; | ||
87 | 746 | } | ||
88 | 747 | |||
89 | 743 | $options = $options . "--prepare --target-dir=$backup_dir"; | 748 | $options = $options . "--prepare --target-dir=$backup_dir"; |
90 | 744 | 749 | ||
91 | 745 | if ($option_uncompress) { | 750 | if ($option_uncompress) { |
92 | @@ -863,6 +868,10 @@ | |||
93 | 863 | $options = $options . " --defaults-file=\"$option_defaults_file\" "; | 868 | $options = $options . " --defaults-file=\"$option_defaults_file\" "; |
94 | 864 | } | 869 | } |
95 | 865 | 870 | ||
96 | 871 | if ($option_defaults_group) { | ||
97 | 872 | $options = $options . " --defaults-group=\"$option_defaults_group\" "; | ||
98 | 873 | } | ||
99 | 874 | |||
100 | 866 | $options = $options . "--backup --suspend-at-end"; | 875 | $options = $options . "--backup --suspend-at-end"; |
101 | 867 | 876 | ||
102 | 868 | if (!$option_remote_host && !$option_stream) { | 877 | if (!$option_remote_host && !$option_stream) { |
103 | @@ -925,13 +934,13 @@ | |||
104 | 925 | 934 | ||
105 | 926 | if($option_remote_host) { | 935 | if($option_remote_host) { |
106 | 927 | #direct copy to remote | 936 | #direct copy to remote |
108 | 928 | my $orig_datadir = get_option(\%config, 'mysqld', 'datadir'); | 937 | my $orig_datadir = get_option(\%config, $option_defaults_group, 'datadir'); |
109 | 929 | my $orig_ibdata_dir = | 938 | my $orig_ibdata_dir = |
111 | 930 | get_option(\%config, 'mysqld', 'innodb_data_home_dir'); | 939 | get_option(\%config, $option_defaults_group, 'innodb_data_home_dir'); |
112 | 931 | my $orig_innodb_data_file_path = | 940 | my $orig_innodb_data_file_path = |
114 | 932 | get_option(\%config, 'mysqld', 'innodb_data_file_path'); | 941 | get_option(\%config, $option_defaults_group, 'innodb_data_file_path'); |
115 | 933 | my $innodb_flush_method = | 942 | my $innodb_flush_method = |
117 | 934 | get_option(\%config, 'mysqld', 'innodb_flush_method'); | 943 | get_option(\%config, $option_defaults_group, 'innodb_flush_method'); |
118 | 935 | my $innodb_use_odirect; | 944 | my $innodb_use_odirect; |
119 | 936 | $innodb_use_odirect = 1 if $innodb_flush_method =~ m/^(ALL_)?O_DIRECT$/i; | 945 | $innodb_use_odirect = 1 if $innodb_flush_method =~ m/^(ALL_)?O_DIRECT$/i; |
120 | 937 | 946 | ||
121 | @@ -1582,7 +1591,7 @@ | |||
122 | 1582 | read_config_file(\%config); | 1591 | read_config_file(\%config); |
123 | 1583 | 1592 | ||
124 | 1584 | if(!$option_tmpdir) { | 1593 | if(!$option_tmpdir) { |
126 | 1585 | $option_tmpdir = get_option(\%config, 'mysqld', 'tmpdir'); | 1594 | $option_tmpdir = get_option(\%config, $option_defaults_group, 'tmpdir'); |
127 | 1586 | } | 1595 | } |
128 | 1587 | 1596 | ||
129 | 1588 | # get innodb log home directory from options file | 1597 | # get innodb log home directory from options file |
130 | @@ -1658,8 +1667,8 @@ | |||
131 | 1658 | 1667 | ||
132 | 1659 | my $option_name; | 1668 | my $option_name; |
133 | 1660 | foreach $option_name (@option_names) { | 1669 | foreach $option_name (@option_names) { |
136 | 1661 | if (has_option(\%config, 'mysqld', $option_name)) { | 1670 | if (has_option(\%config, $option_defaults_group, $option_name)) { |
137 | 1662 | my $option_value = get_option(\%config, 'mysqld', $option_name); | 1671 | my $option_value = get_option(\%config, $option_defaults_group, $option_name); |
138 | 1663 | $options_dump .= "$option_name=$option_value\n"; | 1672 | $options_dump .= "$option_name=$option_value\n"; |
139 | 1664 | } | 1673 | } |
140 | 1665 | } | 1674 | } |
141 | @@ -1725,6 +1734,7 @@ | |||
142 | 1725 | 'user=s' => \$option_mysql_user, | 1734 | 'user=s' => \$option_mysql_user, |
143 | 1726 | 'host=s' => \$option_mysql_host, | 1735 | 'host=s' => \$option_mysql_host, |
144 | 1727 | 'port=s' => \$option_mysql_port, | 1736 | 'port=s' => \$option_mysql_port, |
145 | 1737 | 'defaults-group=s' => \$option_defaults_group, | ||
146 | 1728 | 'slave-info' => \$option_slave_info, | 1738 | 'slave-info' => \$option_slave_info, |
147 | 1729 | 'galera-info' => \$option_galera_info, | 1739 | 'galera-info' => \$option_galera_info, |
148 | 1730 | 'socket=s' => \$option_mysql_socket, | 1740 | 'socket=s' => \$option_mysql_socket, |
149 | @@ -1840,7 +1850,7 @@ | |||
150 | 1840 | sub make_backup_dir { | 1850 | sub make_backup_dir { |
151 | 1841 | my $dir; | 1851 | my $dir; |
152 | 1842 | my $innodb_data_file_path = | 1852 | my $innodb_data_file_path = |
154 | 1843 | get_option(\%config, 'mysqld', 'innodb_data_file_path'); | 1853 | get_option(\%config, $option_defaults_group, 'innodb_data_file_path'); |
155 | 1844 | 1854 | ||
156 | 1845 | # create backup directory | 1855 | # create backup directory |
157 | 1846 | $dir = $backup_root; | 1856 | $dir = $backup_root; |
158 | @@ -1932,7 +1942,7 @@ | |||
159 | 1932 | # | 1942 | # |
160 | 1933 | sub backup_files { | 1943 | sub backup_files { |
161 | 1934 | my $prep_mode = shift; | 1944 | my $prep_mode = shift; |
163 | 1935 | my $source_dir = get_option(\%config, 'mysqld', 'datadir'); | 1945 | my $source_dir = get_option(\%config, $option_defaults_group, 'datadir'); |
164 | 1936 | my @list; | 1946 | my @list; |
165 | 1937 | my $file; | 1947 | my $file; |
166 | 1938 | my $database; | 1948 | my $database; |
167 | @@ -2211,6 +2221,10 @@ | |||
168 | 2211 | $options = $options . " --defaults-file=\"${backup_dir}/backup-my.cnf\" "; | 2221 | $options = $options . " --defaults-file=\"${backup_dir}/backup-my.cnf\" "; |
169 | 2212 | } | 2222 | } |
170 | 2213 | 2223 | ||
171 | 2224 | if ($option_defaults_group) { | ||
172 | 2225 | $options = $options . " --defaults-group=\"$option_defaults_group\" "; | ||
173 | 2226 | } | ||
174 | 2227 | |||
175 | 2214 | $options = $options . "--print-param"; | 2228 | $options = $options . "--print-param"; |
176 | 2215 | 2229 | ||
177 | 2216 | 2230 | ||
178 | @@ -2616,7 +2630,7 @@ | |||
179 | 2616 | [--no-timestamp] [--ibbackup=IBBACKUP-BINARY] | 2630 | [--no-timestamp] [--ibbackup=IBBACKUP-BINARY] |
180 | 2617 | [--slave-info] [--stream=tar|xbstream] | 2631 | [--slave-info] [--stream=tar|xbstream] |
181 | 2618 | [--scpopt=OPTIONS-FOR-SCP] [--sshopt=OPTIONS-FOR-SSH] | 2632 | [--scpopt=OPTIONS-FOR-SCP] [--sshopt=OPTIONS-FOR-SSH] |
183 | 2619 | [--defaults-file=MY.CNF] | 2633 | [--defaults-file=MY.CNF] [--defaults-group=GROUP-NAME] |
184 | 2620 | [--databases=LIST] [--remote-host=HOSTNAME] [--no-lock] | 2634 | [--databases=LIST] [--remote-host=HOSTNAME] [--no-lock] |
185 | 2621 | [--tmpdir=DIRECTORY] [--tables-file=FILE] | 2635 | [--tmpdir=DIRECTORY] [--tables-file=FILE] |
186 | 2622 | [--incremental] [--incremental-basedir] | 2636 | [--incremental] [--incremental-basedir] |
187 | @@ -2628,7 +2642,7 @@ | |||
188 | 2628 | [--export] [--redo-only] [--ibbackup=IBBACKUP-BINARY] | 2642 | [--export] [--redo-only] [--ibbackup=IBBACKUP-BINARY] |
189 | 2629 | BACKUP-DIR | 2643 | BACKUP-DIR |
190 | 2630 | 2644 | ||
192 | 2631 | innobackupex --copy-back [--defaults-file=MY.CNF] BACKUP-DIR | 2645 | innobackupex --copy-back [--defaults-file=MY.CNF] [--defaults-group=GROUP-NAME] BACKUP-DIR |
193 | 2632 | 2646 | ||
194 | 2633 | =head1 DESCRIPTION | 2647 | =head1 DESCRIPTION |
195 | 2634 | 2648 | ||
196 | @@ -2811,6 +2825,10 @@ | |||
197 | 2811 | 2825 | ||
198 | 2812 | This option specifies the MySQL username used when connecting to the server, if that's not the current user. The option accepts a string argument. It is passed to the mysql child process without alteration. See mysql --help for details. | 2826 | This option specifies the MySQL username used when connecting to the server, if that's not the current user. The option accepts a string argument. It is passed to the mysql child process without alteration. See mysql --help for details. |
199 | 2813 | 2827 | ||
200 | 2828 | =item --defaults-group=GROUP-NAME | ||
201 | 2829 | |||
202 | 2830 | This option specifies the group name in my.cnf which should be used. This is needed for mysqld_multi deployments. | ||
203 | 2831 | |||
204 | 2814 | =item --version | 2832 | =item --version |
205 | 2815 | 2833 | ||
206 | 2816 | This option displays the xtrabackup version and copyright notice and then exits. | 2834 | This option displays the xtrabackup version and copyright notice and then exits. |
207 | 2817 | 2835 | ||
208 | === modified file 'src/xtrabackup.c' | |||
209 | --- src/xtrabackup.c 2012-05-18 11:25:23 +0000 | |||
210 | +++ src/xtrabackup.c 2012-05-18 11:25:23 +0000 | |||
211 | @@ -769,6 +769,8 @@ | |||
212 | 769 | char *opt_mysql_tmpdir = NULL; | 769 | char *opt_mysql_tmpdir = NULL; |
213 | 770 | MY_TMPDIR mysql_tmpdir_list; | 770 | MY_TMPDIR mysql_tmpdir_list; |
214 | 771 | 771 | ||
215 | 772 | const char *defaults_group = "mysqld"; | ||
216 | 773 | |||
217 | 772 | /* === static parameters in ha_innodb.cc */ | 774 | /* === static parameters in ha_innodb.cc */ |
218 | 773 | 775 | ||
219 | 774 | #define HA_INNOBASE_ROWS_IN_TABLE 10000 /* to get optimization right */ | 776 | #define HA_INNOBASE_ROWS_IN_TABLE 10000 /* to get optimization right */ |
220 | @@ -994,7 +996,8 @@ | |||
221 | 994 | OPT_INNODB_SYNC_SPIN_LOOPS, | 996 | OPT_INNODB_SYNC_SPIN_LOOPS, |
222 | 995 | OPT_INNODB_THREAD_CONCURRENCY, | 997 | OPT_INNODB_THREAD_CONCURRENCY, |
223 | 996 | OPT_INNODB_THREAD_SLEEP_DELAY, | 998 | OPT_INNODB_THREAD_SLEEP_DELAY, |
225 | 997 | OPT_XTRA_DEBUG_SYNC | 999 | OPT_XTRA_DEBUG_SYNC, |
226 | 1000 | OPT_DEFAULTS_GROUP | ||
227 | 998 | }; | 1001 | }; |
228 | 999 | 1002 | ||
229 | 1000 | static struct my_option my_long_options[] = | 1003 | static struct my_option my_long_options[] = |
230 | @@ -1278,6 +1281,9 @@ | |||
231 | 1278 | 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, | 1281 | 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, |
232 | 1279 | #endif | 1282 | #endif |
233 | 1280 | 1283 | ||
234 | 1284 | {"defaults_group", OPT_DEFAULTS_GROUP, "defaults group in config file (default \"mysqld\").", | ||
235 | 1285 | (G_PTR*) &defaults_group, (G_PTR*) &defaults_group, | ||
236 | 1286 | 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, | ||
237 | 1281 | { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0} | 1287 | { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0} |
238 | 1282 | }; | 1288 | }; |
239 | 1283 | 1289 | ||
240 | @@ -1337,7 +1343,7 @@ | |||
241 | 1337 | #endif | 1343 | #endif |
242 | 1338 | } | 1344 | } |
243 | 1339 | 1345 | ||
245 | 1340 | static const char *load_default_groups[]= { "mysqld","xtrabackup",0 }; | 1346 | static const char *load_default_groups[]= { "mysqld","xtrabackup",0,0 }; |
246 | 1341 | 1347 | ||
247 | 1342 | static void print_version(void) | 1348 | static void print_version(void) |
248 | 1343 | { | 1349 | { |
249 | @@ -6280,6 +6286,17 @@ | |||
250 | 6280 | MY_INIT(argv[0]); | 6286 | MY_INIT(argv[0]); |
251 | 6281 | xb_regex_init(); | 6287 | xb_regex_init(); |
252 | 6282 | 6288 | ||
253 | 6289 | /* scan options for group to load defaults from */ | ||
254 | 6290 | { | ||
255 | 6291 | int i; | ||
256 | 6292 | char* optend; | ||
257 | 6293 | for (i=1; i < argc; i++) { | ||
258 | 6294 | optend = strcend(argv[i], '='); | ||
259 | 6295 | if (strncmp(argv[i], "--defaults-group", optend - argv[i]) == 0) { | ||
260 | 6296 | load_default_groups[2] = defaults_group = optend + 1; | ||
261 | 6297 | } | ||
262 | 6298 | } | ||
263 | 6299 | } | ||
264 | 6283 | load_defaults("my",load_default_groups,&argc,&argv); | 6300 | load_defaults("my",load_default_groups,&argc,&argv); |
265 | 6284 | 6301 | ||
266 | 6285 | /* ignore unsupported options */ | 6302 | /* ignore unsupported options */ |
267 | @@ -6518,7 +6535,7 @@ | |||
268 | 6518 | exit(EXIT_FAILURE); | 6535 | exit(EXIT_FAILURE); |
269 | 6519 | 6536 | ||
270 | 6520 | printf("# This MySQL options file was generated by XtraBackup.\n"); | 6537 | printf("# This MySQL options file was generated by XtraBackup.\n"); |
272 | 6521 | printf("[mysqld]\n"); | 6538 | printf("[%s]\n", defaults_group); |
273 | 6522 | printf("datadir = \"%s\"\n", mysql_data_home); | 6539 | printf("datadir = \"%s\"\n", mysql_data_home); |
274 | 6523 | printf("tmpdir = \"%s\"\n", mysql_tmpdir_list.list[0]); | 6540 | printf("tmpdir = \"%s\"\n", mysql_tmpdir_list.list[0]); |
275 | 6524 | printf("innodb_data_home_dir = \"%s\"\n", | 6541 | printf("innodb_data_home_dir = \"%s\"\n", |
276 | 6525 | 6542 | ||
277 | === added file 'test/t/bug483827.sh' | |||
278 | --- test/t/bug483827.sh 1970-01-01 00:00:00 +0000 | |||
279 | +++ test/t/bug483827.sh 2012-05-18 11:25:23 +0000 | |||
280 | @@ -0,0 +1,45 @@ | |||
281 | 1 | ######################################################################## | ||
282 | 2 | # Bug #483827: support for mysqld_multi | ||
283 | 3 | ######################################################################## | ||
284 | 4 | |||
285 | 5 | function modify_args() | ||
286 | 6 | { | ||
287 | 7 | XB_ARGS=`echo $XB_ARGS | sed -e 's/my.cnf/my_multi.cnf/'` | ||
288 | 8 | IB_ARGS=`echo $IB_ARGS | sed -e 's/my.cnf/my_multi.cnf/'` | ||
289 | 9 | } | ||
290 | 10 | |||
291 | 11 | . inc/common.sh | ||
292 | 12 | |||
293 | 13 | init | ||
294 | 14 | mv ${mysql_datadir} ${mysql_datadir}1 | ||
295 | 15 | run_mysqld --datadir=${mysql_datadir}1 | ||
296 | 16 | |||
297 | 17 | backup_dir=$topdir/backup | ||
298 | 18 | rm -rf $backup_dir | ||
299 | 19 | |||
300 | 20 | # change defaults file from my.cnf to my_multi.cnf | ||
301 | 21 | modify_args | ||
302 | 22 | |||
303 | 23 | # make my_multi.cnf | ||
304 | 24 | echo " | ||
305 | 25 | [mysqld1] | ||
306 | 26 | datadir=${mysql_datadir}1 | ||
307 | 27 | tmpdir=$mysql_tmpdir" > $topdir/my_multi.cnf | ||
308 | 28 | |||
309 | 29 | # Backup | ||
310 | 30 | innobackupex --no-timestamp --defaults-group=mysqld1 $backup_dir | ||
311 | 31 | innobackupex --apply-log $backup_dir | ||
312 | 32 | |||
313 | 33 | stop_mysqld | ||
314 | 34 | |||
315 | 35 | # clean datadir | ||
316 | 36 | rm -rf ${mysql_datadir}1/* | ||
317 | 37 | |||
318 | 38 | # restore backup | ||
319 | 39 | innobackupex --copy-back --defaults-group=mysqld1 $backup_dir | ||
320 | 40 | |||
321 | 41 | # make sure that data are in correct place | ||
322 | 42 | if [ ! -f ${mysql_datadir}1/ibdata1 ] ; then | ||
323 | 43 | vlog "Data not found in ${mysql_datadir}1" | ||
324 | 44 | exit -1 | ||
325 | 45 | fi |
Sergei,
- sections in my.cnf are called groups in MySQL documentation. So defaults- group, rather than --section and --mysqld-section
let's be consistent and call them groups as well, and name the
options (both the innobackupex and the xtrabackup one)
--
- it looks like get_option is always passed the same value as its mysqld_ section (or whatever it will be defaults_ group) internally.
second argument, so I wonder if it really needs that argument, or
rather just use $option_
renamed to, i.e. $option_
- s/laod/load/ args/restore_ args/. Though you don't really need that
- s/accetps/accepts/
- s/rstore_
function, as tests are executed in a separate shell process, so
modifications to variables have no effect on other tests anyway.
- I know that code in main() that scan options for "--mysqld-section"
was copy-pasted, but please format it according to InnoDB
style. Because currently it's a terrible mix of all possible
formatting styles.
- in the same code, I don't think strstr() is necessary, because you
already have the pointer to '=' (or terminating zero) in optend.