~sergei.glushchenko/percona-xtrabackup/test976945

« back to all changes in this revision

Viewing changes to innobackupex

  • Committer: Stewart Smith
  • Date: 2012-05-18 04:22:43 UTC
  • mfrom: (425.1.1 xb2.0-bug996493-try2)
  • Revision ID: stewart@flamingspork.com-20120518042243-xrg6znxsz2ox0azc
merge fix for Bug #996493: innobackupex --apply-log doesn't read config from backup-my.cnf

Show diffs side-by-side

added added

removed removed

Lines of Context:
736
736
 
737
737
    if ($option_defaults_file) {
738
738
        $options = $options . " --defaults-file=\"$option_defaults_file\" ";
 
739
    } else {
 
740
        $options = $options . " --defaults-file=\"${backup_dir}/backup-my.cnf\" ";
739
741
    }
740
742
 
741
743
    $options = $options . "--prepare --target-dir=$backup_dir";
1633
1635
#
1634
1636
sub write_backup_config_file {
1635
1637
    my $filename = shift;
1636
 
    my $innodb_data_file_path = 
1637
 
        get_option(\%config, 'mysqld', 'innodb_data_file_path');
1638
 
    my $root;
1639
 
 
1640
 
    my @array = split(/;/, $innodb_data_file_path);
1641
 
    for (my $i = 0; $i <= $#array; $i++) {
1642
 
        my @tmp = split(/\/+/, $array[$i]);
1643
 
        $array[$i] = $tmp[-1];
1644
 
    }
1645
 
    $innodb_data_file_path = join(";", @array);
1646
1638
 
1647
1639
    if (!$option_remote_host) {
1648
 
        $root = $backup_dir;
1649
1640
        open(FILE, "> $filename") || Die "Failed to open file '$filename': $!";
1650
1641
    } else {
1651
 
        $root = `ssh $option_ssh_opt $option_remote_host 'cd $backup_dir; pwd'`;
1652
1642
        open(FILE, "| ssh $option_ssh_opt $option_remote_host 'cat > $filename'")
1653
1643
            || Die "Failed to open file '$option_remote_host:$filename': $!";
1654
1644
    }
1664
1654
 
1665
1655
    my $options_dump = "# This MySQL options file was generated by $innobackup_script.\n\n" .
1666
1656
          "# The MySQL server\n" .
1667
 
          "[mysqld]\n" .
1668
 
          "datadir=$root\n" .
1669
 
          "innodb_data_home_dir=$root\n" .
1670
 
          "innodb_log_group_home_dir=$root\n";
 
1657
          "[mysqld]\n";
1671
1658
 
1672
1659
    my $option_name;
1673
1660
    foreach $option_name (@option_names) {
2217
2204
    my $cmdline = '';
2218
2205
    my $options = '';
2219
2206
 
 
2207
 
2220
2208
    if ($option_defaults_file) {
2221
2209
        $options = $options . " --defaults-file=\"$option_defaults_file\" ";
 
2210
    } elsif ($option_apply_log) {
 
2211
        $options = $options . " --defaults-file=\"${backup_dir}/backup-my.cnf\" ";
2222
2212
    }
2223
2213
 
2224
2214
    $options = $options . "--print-param";
2304
2294
    if (!exists ${$config_ref}{$group}) {
2305
2295
        # no group
2306
2296
        print STDERR "$prefix fatal error: no '$group' group in MySQL options\n";
2307
 
        print STDERR "$prefix fatal error: OR no 'datadir' option in group '$group' in MySQL options\n";
2308
2297
        exit(1);
2309
2298
    }
2310
2299
 
2332
2321
    if (!exists $config{$group}) {
2333
2322
        # no group
2334
2323
        print STDERR "$prefix fatal error: no '$group' group in MySQL options\n";
2335
 
        print STDERR "$prefix fatal error: OR no 'datadir' option in group '$group' in MySQL options\n";
2336
2324
        exit(1);
2337
2325
    }
2338
2326