Merge lp:~akopytov/percona-xtrabackup/bug664128 into lp:percona-xtrabackup/2.2

Proposed by Alexey Kopytov
Status: Merged
Approved by: Alexey Kopytov
Approved revision: no longer in the source branch.
Merged at revision: 5034
Proposed branch: lp:~akopytov/percona-xtrabackup/bug664128
Merge into: lp:percona-xtrabackup/2.2
Diff against target: 147 lines (+70/-44)
2 files modified
storage/innobase/xtrabackup/src/xtrabackup.cc (+30/-44)
storage/innobase/xtrabackup/test/t/bug664128.sh (+40/-0)
To merge this branch: bzr merge lp:~akopytov/percona-xtrabackup/bug664128
Reviewer Review Type Date Requested Status
Alexey Kopytov (community) Approve
Review via email: mp+237726@code.launchpad.net

Description of the change

    Bug #664128: xtrabackup does not support "--loose-" options

    Added support for all option modifiers supported by upstream MySQL:

    skip, disable, enable, maximum, loose.

    Percona Server supports some additional arguments, but those are
    rarely used especially for InnoDB variables.

http://jenkins.percona.com/view/PXB%202.2/job/percona-xtrabackup-2.2-param/229/

To post a comment you must log in.
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 'storage/innobase/xtrabackup/src/xtrabackup.cc'
--- storage/innobase/xtrabackup/src/xtrabackup.cc 2014-10-06 10:45:17 +0000
+++ storage/innobase/xtrabackup/src/xtrabackup.cc 2014-10-09 06:28:36 +0000
@@ -315,6 +315,8 @@
315parsed from the defaults file */315parsed from the defaults file */
316static std::ostringstream print_param_str;316static std::ostringstream print_param_str;
317317
318static ulonglong global_max_value;
319
318extern "C" sig_handler handle_fatal_signal(int sig);320extern "C" sig_handler handle_fatal_signal(int sig);
319321
320/* Simple datasink creation tracking...add datasinks in the reverse order you322/* Simple datasink creation tracking...add datasinks in the reverse order you
@@ -6145,61 +6147,45 @@
6145 "# This MySQL options file was generated by XtraBackup.\n"6147 "# This MySQL options file was generated by XtraBackup.\n"
6146 "[" << defaults_group << "]\n";6148 "[" << defaults_group << "]\n";
61476149
6148 /* ignore unsupported options */6150 /* Throw a descriptive error if --defaults-file is not the first command
6149 {6151 line argument */
6150 int i,j,argc_new,find;6152 for (int i = 2 ; i < argc ; i++) {
6151 char *optend, *prev_found = NULL;6153 char *optend = strcend((argv)[i], '=');
6152 argc_new = argc;6154
61536155 if (!strncmp(argv[i], "--defaults-file", optend - argv[i])) {
6154 j=1;6156
6155 for (i=1 ; i < argc ; i++) {
6156 uint count;
6157 struct my_option *opt= (struct my_option *) xb_long_options;
6158 optend= strcend((argv)[i], '=');
6159 if (!strncmp(argv[i], "--defaults-file", optend - argv[i]))
6160 {
6161 msg("xtrabackup: Error: --defaults-file "6157 msg("xtrabackup: Error: --defaults-file "
6162 "must be specified first on the command "6158 "must be specified first on the command "
6163 "line\n");6159 "line\n");
6164 exit(EXIT_FAILURE);6160 exit(EXIT_FAILURE);
6165 }6161 }
6166 for (count= 0; opt->name; opt++) {
6167 if (!getopt_compare_strings(opt->name, (argv)[i] + 2,
6168 (uint)(optend - (argv)[i] - 2))) /* match found */
6169 {
6170 if (!opt->name[(uint)(optend - (argv)[i] - 2)]) {
6171 find = 1;
6172 goto next_opt;
6173 }
6174 if (!count) {
6175 count= 1;
6176 prev_found= (char *) opt->name;
6177 }
6178 else if (strcmp(prev_found, opt->name)) {
6179 count++;
6180 }
6181 }
6182 }
6183 find = count;
6184next_opt:
6185 if(!find){
6186 argc_new--;
6187 } else {
6188 (argv)[j]=(argv)[i];
6189 j++;
6190 }
6191 }6162 }
6192 argc = argc_new;6163
6193 argv[argc] = NULL;6164 /* We want xtrabackup to ignore unknown options, because it only
6165 recognizes a small subset of server variables */
6166 my_getopt_skip_unknown = TRUE;
6167
6168 /* Reset u_max_value for all options, as we don't want the
6169 --maximum-... modifier to set the actual option values */
6170 for (my_option *optp= xb_long_options; optp->name; optp++) {
6171 optp->u_max_value = (G_PTR *) &global_max_value;
6194 }6172 }
61956173
6196 if ((ho_error=handle_options(&argc, &argv, xb_long_options, get_one_option)))6174 if ((ho_error=handle_options(&argc, &argv, xb_long_options, get_one_option)))
6197 exit(ho_error);6175 exit(ho_error);
61986176
6199 if (argc != 0) {6177 /* Reject command line arguments that don't look like options, i.e. are
6200 msg("xtrabackup: Error: unknown argument: '%s'\n",6178 not of the form '-X' (single-character options) or '--option' (long
6201 argv[0]);6179 options) */
6202 exit(EXIT_FAILURE);6180 for (int i = 1 ; i < argc ; i++) {
6181 const char * const opt = argv[i];
6182
6183 if (strncmp(opt, "--", 2) &&
6184 !(strlen(opt) == 2 && opt[0] == '-')) {
6185
6186 msg("xtrabackup: Error: unknown argument: '%s'\n", opt);
6187 exit(EXIT_FAILURE);
6188 }
6203 }6189 }
62046190
6205 if ((!xtrabackup_print_param) && (!xtrabackup_prepare) && (strcmp(mysql_data_home, "./") == 0)) {6191 if ((!xtrabackup_print_param) && (!xtrabackup_prepare) && (strcmp(mysql_data_home, "./") == 0)) {
62066192
=== added file 'storage/innobase/xtrabackup/test/t/bug664128.sh'
--- storage/innobase/xtrabackup/test/t/bug664128.sh 1970-01-01 00:00:00 +0000
+++ storage/innobase/xtrabackup/test/t/bug664128.sh 2014-10-09 06:28:36 +0000
@@ -0,0 +1,40 @@
1########################################################################
2# Bug #664128: xtrabackup does not support "--loose-" options
3########################################################################
4
5cat >$topdir/my.cnf <<EOF
6[mysqld]
7loose-innodb_log_file_size=5M
8maximum-innodb_log_file_size=6M
9skip-innodb_fast_checksum
10EOF
11
12diff -u - <($XB_BIN --defaults-file=$topdir/my.cnf --print-param) <<EOF
13# This MySQL options file was generated by XtraBackup.
14[mysqld]
15innodb_log_file_size=5242880
16innodb_log_file_size=5242880
17innodb_fast_checksum=0
18EOF
19
20cat >$topdir/my.cnf <<EOF
21[mysqld]
22enable-innodb_fast_checksum
23EOF
24
25diff -u - <($XB_BIN --defaults-file=$topdir/my.cnf --print-param) <<EOF
26# This MySQL options file was generated by XtraBackup.
27[mysqld]
28innodb_fast_checksum=1
29EOF
30
31cat >$topdir/my.cnf <<EOF
32[mysqld]
33disable-innodb_fast_checksum
34EOF
35
36diff -u - <($XB_BIN --defaults-file=$topdir/my.cnf --print-param) <<EOF
37# This MySQL options file was generated by XtraBackup.
38[mysqld]
39innodb_fast_checksum=0
40EOF

Subscribers

People subscribed via source and target branches

to all changes: