~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to innobackupex-1.5.1

Added incremental option to innobackupex-1.5.1 script

Show diffs side-by-side

added added

removed removed

Lines of Context:
172
172
# current local time
173
173
my $now;
174
174
 
 
175
# incremental backup base directory
 
176
my $incremental_basedir = '';
 
177
 
175
178
######################################################################
176
179
# program execution begins here
177
180
######################################################################
463
466
        wait_for_ibbackup_suspend();
464
467
    }
465
468
 
466
 
    # connect to database
467
 
    mysql_open();
468
 
 
469
 
    # flush tables with read lock
470
 
    mysql_check();
471
 
    mysql_lockall();
472
 
 
473
 
    # backup .frm, .MRG, .MYD, .MYI, .TRG, .TRN, and .opt files
474
 
    backup_files();
 
469
    if (!$option_incremental) {
 
470
        # connect to database
 
471
        mysql_open();
 
472
 
 
473
        # flush tables with read lock
 
474
        mysql_check();
 
475
        mysql_lockall();
 
476
 
 
477
        # backup .frm, .MRG, .MYD, .MYI, .TRG, .TRN, and .opt files
 
478
        backup_files();
 
479
    }
475
480
 
476
481
    # resume ibbackup and wait till it has finished
477
482
    resume_ibbackup();
478
483
 
479
 
    # release read locks on all tables
480
 
    mysql_unlockall();
 
484
    if (!$option_incremental) {
 
485
        # release read locks on all tables
 
486
        mysql_unlockall();
481
487
 
482
 
    # disconnect from database
483
 
    mysql_close();
 
488
        # disconnect from database
 
489
        mysql_close();
 
490
    }
484
491
 
485
492
    if ($option_remote_host) {
486
493
        system("scp -Cp -c arcfour '$tmp_logfile' '$option_remote_host:$backup_dir/xtrabackup_logfile'")
824
831
    if ($option_include) {
825
832
        $options = $options . " --tables='$option_include'";
826
833
    }
 
834
    if ($option_incremental) {
 
835
        $options = $options . " --incremental-basedir='$incremental_basedir'";
 
836
    }
827
837
    $cmdline = "$option_ibbackup_binary $options";
828
838
 
829
839
    # run ibbackup as a child process
965
975
    # prepare options for mysql
966
976
    if ($option_mysql_password) {
967
977
        $options = "$options --password=$option_mysql_password";
 
978
    } else {
 
979
        $options = "$options --";
968
980
    }
969
981
    if ($option_mysql_user) {
970
982
        $options = "$options --user=$option_mysql_user";
1555
1567
            print STDERR "$prefix Warning: perl $required_version or newer!\n";
1556
1568
        }
1557
1569
    } else {
1558
 
        $perl_version = chr($required_perl_version[0])
1559
 
            . chr($required_perl_version[1])
1560
 
            . chr($required_perl_version[2]);
 
1570
        #$perl_version = chr($required_perl_version[0])
 
1571
            #. chr($required_perl_version[1])
 
1572
            #. chr($required_perl_version[2]);
 
1573
        $perl_version = "v$required_perl_version[0].$required_perl_version[1].$required_perl_version[2]";
1561
1574
        if ($^V lt $perl_version) {
1562
1575
            my $version = chr(48 + $required_perl_version[0])
1563
1576
                . "." . chr(48 + $required_perl_version[1])
1654
1667
        # we are making a backup, get backup root directory
1655
1668
        $backup_root = $ARGV[0];
1656
1669
        if ($option_incremental) {
1657
 
            print STDERR "incremental backup is not supported for now.\n";
1658
 
            exit(1);
 
1670
            my @dirs = `ls -1 -t $backup_root`;
 
1671
            my $inc_dir = $dirs[0];
 
1672
            chomp($inc_dir);
 
1673
            $incremental_basedir = File::Spec->catfile($backup_root, $inc_dir);
 
1674
            #print STDERR "--incremental_basedir=$incremental_basedir\n";
 
1675
            #print STDERR "incremental backup is not supported for now.\n";
 
1676
            #exit(1);
1659
1677
        }
1660
1678
    } else {
1661
1679
        # get backup directory