~sergei.glushchenko/percona-xtrabackup/test976945

« back to all changes in this revision

Viewing changes to innobackupex

  • Committer: Stewart Smith
  • Date: 2012-05-21 07:55:19 UTC
  • mfrom: (427.1.2 xb2.0-bug483827)
  • Revision ID: stewart@flamingspork.com-20120521075519-2n2rwb5g8oxvkofq
merge support for mysqld_multi

Show diffs side-by-side

added added

removed removed

Lines of Context:
84
84
my $option_mysql_port = '';
85
85
my $option_mysql_socket = '';
86
86
my $option_mysql_host = '';
 
87
my $option_defaults_group = 'mysqld';
87
88
my $option_no_timestamp = '';
88
89
my $option_slave_info = '';
89
90
my $option_galera_info = '';
377
378
# process.
378
379
#
379
380
sub backup {
380
 
    my $orig_datadir = get_option(\%config, 'mysqld', 'datadir');
 
381
    my $orig_datadir = get_option(\%config, $option_defaults_group, 'datadir');
381
382
 
382
383
    # check that we can connect to the database. This done by
383
384
    # connecting, issuing a query, and closing the connection.
626
627
# back to their original locations.
627
628
#
628
629
sub copy_back {
629
 
    my $orig_datadir = get_option(\%config, 'mysqld', 'datadir');
 
630
    my $orig_datadir = get_option(\%config, $option_defaults_group, 'datadir');
630
631
    my $orig_ibdata_dir = 
631
 
        get_option(\%config, 'mysqld', 'innodb_data_home_dir');
 
632
        get_option(\%config, $option_defaults_group, 'innodb_data_home_dir');
632
633
    my $orig_innodb_data_file_path = 
633
 
        get_option(\%config, 'mysqld', 'innodb_data_file_path');
 
634
        get_option(\%config, $option_defaults_group, 'innodb_data_file_path');
634
635
    my $orig_iblog_dir =
635
 
        get_option(\%config, 'mysqld', 'innodb_log_group_home_dir');
 
636
        get_option(\%config, $option_defaults_group, 'innodb_log_group_home_dir');
636
637
    my $iblog_files = 'ib_logfile.*';
637
638
    my $excluded_files = 
638
639
        '\.\.?|backup-my\.cnf|xtrabackup_logfile|' .
740
741
        $options = $options . " --defaults-file=\"${backup_dir}/backup-my.cnf\" ";
741
742
    }
742
743
 
 
744
    if ($option_defaults_group) {
 
745
        $options = $options . " --defaults-group=\"$option_defaults_group\" ";
 
746
    }
 
747
 
743
748
    $options = $options . "--prepare --target-dir=$backup_dir";
744
749
 
745
750
    if ($option_uncompress) {
863
868
        $options = $options . " --defaults-file=\"$option_defaults_file\" ";
864
869
    }
865
870
 
 
871
    if ($option_defaults_group) {
 
872
        $options = $options . " --defaults-group=\"$option_defaults_group\" ";
 
873
    }
 
874
 
866
875
    $options = $options . "--backup --suspend-at-end";
867
876
 
868
877
    if (!$option_remote_host && !$option_stream) {
925
934
 
926
935
            if($option_remote_host) {
927
936
                #direct copy to remote
928
 
                my $orig_datadir = get_option(\%config, 'mysqld', 'datadir');
 
937
                my $orig_datadir = get_option(\%config, $option_defaults_group, 'datadir');
929
938
                my $orig_ibdata_dir =
930
 
                    get_option(\%config, 'mysqld', 'innodb_data_home_dir');
 
939
                    get_option(\%config, $option_defaults_group, 'innodb_data_home_dir');
931
940
                my $orig_innodb_data_file_path =
932
 
                    get_option(\%config, 'mysqld', 'innodb_data_file_path');
 
941
                    get_option(\%config, $option_defaults_group, 'innodb_data_file_path');
933
942
                my $innodb_flush_method = 
934
 
                    get_option(\%config, 'mysqld', 'innodb_flush_method');
 
943
                    get_option(\%config, $option_defaults_group, 'innodb_flush_method');
935
944
                my $innodb_use_odirect;
936
945
                $innodb_use_odirect = 1 if $innodb_flush_method =~ m/^(ALL_)?O_DIRECT$/i;
937
946
 
1582
1591
    read_config_file(\%config);
1583
1592
 
1584
1593
    if(!$option_tmpdir) {
1585
 
        $option_tmpdir = get_option(\%config, 'mysqld', 'tmpdir');
 
1594
        $option_tmpdir = get_option(\%config, $option_defaults_group, 'tmpdir');
1586
1595
    }
1587
1596
 
1588
1597
    # get innodb log home directory from options file
1658
1667
 
1659
1668
    my $option_name;
1660
1669
    foreach $option_name (@option_names) {
1661
 
        if (has_option(\%config, 'mysqld', $option_name)) {
1662
 
            my $option_value = get_option(\%config, 'mysqld', $option_name);
 
1670
        if (has_option(\%config, $option_defaults_group, $option_name)) {
 
1671
            my $option_value = get_option(\%config, $option_defaults_group, $option_name);
1663
1672
            $options_dump .= "$option_name=$option_value\n";
1664
1673
        }
1665
1674
    }
1725
1734
                        'user=s' => \$option_mysql_user,
1726
1735
                        'host=s' => \$option_mysql_host,
1727
1736
                        'port=s' => \$option_mysql_port,
 
1737
                        'defaults-group=s' => \$option_defaults_group,
1728
1738
                        'slave-info' => \$option_slave_info,
1729
1739
                        'galera-info' => \$option_galera_info,
1730
1740
                        'socket=s' => \$option_mysql_socket,
1840
1850
sub make_backup_dir {
1841
1851
    my $dir;
1842
1852
    my $innodb_data_file_path = 
1843
 
        get_option(\%config, 'mysqld', 'innodb_data_file_path');
 
1853
        get_option(\%config, $option_defaults_group, 'innodb_data_file_path');
1844
1854
 
1845
1855
    # create backup directory
1846
1856
    $dir = $backup_root;
1932
1942
#
1933
1943
sub backup_files {
1934
1944
    my $prep_mode = shift;
1935
 
    my $source_dir = get_option(\%config, 'mysqld', 'datadir');
 
1945
    my $source_dir = get_option(\%config, $option_defaults_group, 'datadir');
1936
1946
    my @list;
1937
1947
    my $file;
1938
1948
    my $database;
2211
2221
        $options = $options . " --defaults-file=\"${backup_dir}/backup-my.cnf\" ";
2212
2222
    }
2213
2223
 
 
2224
    if ($option_defaults_group) {
 
2225
        $options = $options . " --defaults-group=\"$option_defaults_group\" ";
 
2226
    }
 
2227
 
2214
2228
    $options = $options . "--print-param";
2215
2229
 
2216
2230
 
2616
2630
             [--no-timestamp] [--ibbackup=IBBACKUP-BINARY]
2617
2631
             [--slave-info] [--stream=tar|xbstream]
2618
2632
             [--scpopt=OPTIONS-FOR-SCP]  [--sshopt=OPTIONS-FOR-SSH]
2619
 
             [--defaults-file=MY.CNF]
 
2633
             [--defaults-file=MY.CNF] [--defaults-group=GROUP-NAME]
2620
2634
             [--databases=LIST] [--remote-host=HOSTNAME] [--no-lock] 
2621
2635
             [--tmpdir=DIRECTORY] [--tables-file=FILE]
2622
2636
             [--incremental] [--incremental-basedir]
2628
2642
             [--export] [--redo-only] [--ibbackup=IBBACKUP-BINARY]
2629
2643
             BACKUP-DIR
2630
2644
 
2631
 
innobackupex --copy-back [--defaults-file=MY.CNF] BACKUP-DIR
 
2645
innobackupex --copy-back [--defaults-file=MY.CNF] [--defaults-group=GROUP-NAME] BACKUP-DIR
2632
2646
 
2633
2647
=head1 DESCRIPTION
2634
2648
 
2811
2825
 
2812
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.
2813
2827
 
 
2828
=item --defaults-group=GROUP-NAME
 
2829
 
 
2830
This option specifies the group name in my.cnf which should be used. This is needed for mysqld_multi deployments.
 
2831
 
2814
2832
=item --version
2815
2833
 
2816
2834
This option displays the xtrabackup version and copyright notice and then exits.