Merge lp:~akopytov/percona-xtrabackup/bug834657-1.6 into lp:percona-xtrabackup/1.6

Proposed by Alexey Kopytov
Status: Merged
Approved by: Stewart Smith
Approved revision: no longer in the source branch.
Merged at revision: 281
Proposed branch: lp:~akopytov/percona-xtrabackup/bug834657-1.6
Merge into: lp:percona-xtrabackup/1.6
Diff against target: 113 lines (+53/-10)
2 files modified
innobackupex (+25/-10)
test/t/ib_slave_info.sh (+28/-0)
To merge this branch: bzr merge lp:~akopytov/percona-xtrabackup/bug834657-1.6
Reviewer Review Type Date Requested Status
Stewart Smith (community) Approve
Review via email: mp+73321@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Stewart Smith (stewart) :
review: Approve
Revision history for this message
Stewart Smith (stewart) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'innobackupex'
--- innobackupex 2011-06-11 08:00:46 +0000
+++ innobackupex 2011-08-30 03:13:23 +0000
@@ -359,20 +359,25 @@
359 wait_for_ibbackup_suspend();359 wait_for_ibbackup_suspend();
360 }360 }
361361
362 if ($option_safe_slave_backup) {
363 mysql_open();
364 mysql_check();
365 wait_for_safe_slave();
366 mysql_close();
367 }
368
362 if (!$option_incremental) {369 if (!$option_incremental) {
363 # connect to database370 # connect to database
364 mysql_open();371 mysql_open();
365372
366 if ( $option_safe_slave_backup ) {
367 wait_for_safe_slave();
368 }
369
370 # flush tables with read lock373 # flush tables with read lock
371 mysql_check();374 mysql_check();
372 mysql_lockall() if !$option_no_lock;375 mysql_lockall() if !$option_no_lock;
373376
374 }377 }
375378
379 write_slave_info() if $option_slave_info;
380
376 # backup .frm, .MRG, .MYD, .MYI, .TRG, .TRN, .ARM, .ARZ, .CSM, .CSV and .opt files381 # backup .frm, .MRG, .MYD, .MYI, .TRG, .TRN, .ARM, .ARZ, .CSM, .CSV and .opt files
377 backup_files();382 backup_files();
378383
@@ -383,15 +388,18 @@
383 # release read locks on all tables388 # release read locks on all tables
384 mysql_unlockall() if !$option_no_lock;389 mysql_unlockall() if !$option_no_lock;
385390
386 if ( $option_safe_slave_backup ) {
387 print STDERR "$prefix: Starting slave SQL thread\n";
388 mysql_send('START SLAVE SQL_THREAD;');
389 }
390
391 # disconnect from database391 # disconnect from database
392 mysql_close();392 mysql_close();
393 }393 }
394394
395 if ( $option_safe_slave_backup ) {
396 mysql_open();
397 mysql_check();
398 print STDERR "$prefix: Starting slave SQL thread\n";
399 mysql_send('START SLAVE SQL_THREAD;');
400 mysql_close();
401 }
402
395 if ($option_remote_host) {403 if ($option_remote_host) {
396 system("scp $option_scp_opt '$tmp_logfile' '$option_remote_host:$backup_dir/xtrabackup_logfile'")404 system("scp $option_scp_opt '$tmp_logfile' '$option_remote_host:$backup_dir/xtrabackup_logfile'")
397 and Die "Failed to scp file '$option_remote_host:$backup_dir/xtrabackup_logfile': $!";405 and Die "Failed to scp file '$option_remote_host:$backup_dir/xtrabackup_logfile': $!";
@@ -1203,7 +1211,6 @@
1203 mysql_send "COMMIT;";1211 mysql_send "COMMIT;";
1204 }1212 }
1205 write_binlog_info;1213 write_binlog_info;
1206 write_slave_info if $option_slave_info;
1207 1214
1208 $now = current_time();1215 $now = current_time();
1209 print STDERR "$now $prefix All tables locked and flushed to disk\n";1216 print STDERR "$now $prefix All tables locked and flushed to disk\n";
@@ -1670,6 +1677,14 @@
1670 $backup_dir = File::Spec->rel2abs($ARGV[0]);1677 $backup_dir = File::Spec->rel2abs($ARGV[0]);
1671 } 1678 }
16721679
1680 if ($option_slave_info) {
1681 if (($option_no_lock or $option_incremental) and
1682 !$option_safe_slave_backup) {
1683 print STDERR "--slave-info is used with either --no-lock or --incremental but without --safe-slave-backup. The binlog position cannot be consistent with the backup data.\n";
1684 exit(1);
1685 }
1686 }
1687
1673 print STDERR "\n";1688 print STDERR "\n";
16741689
1675 parse_databases_option_value();1690 parse_databases_option_value();
16761691
=== added file 'test/t/ib_slave_info.sh'
--- test/t/ib_slave_info.sh 1970-01-01 00:00:00 +0000
+++ test/t/ib_slave_info.sh 2011-08-30 03:13:23 +0000
@@ -0,0 +1,28 @@
1. inc/common.sh
2
3init
4run_mysqld --innodb_file_per_table
5load_dbase_schema incremental_sample
6
7# Adding initial rows
8vlog "Adding initial rows to database..."
9numrow=100
10count=0
11while [ "$numrow" -gt "$count" ]
12do
13 ${MYSQL} ${MYSQL_ARGS} -e "insert into test values ($count, $numrow);" incremental_sample
14 let "count=count+1"
15done
16vlog "Initial rows added"
17
18# Full backup
19# backup root directory
20mkdir -p $topdir/backup
21
22vlog "Check that --slave-info with --no-lock and no --safe-slave-backup fails"
23run_cmd_expect_failure $IB_BIN $IB_ARGS --slave-info --no-lock $topdir/backup
24
25vlog "Check that --slave-info with --incremental and no --safe-slave-backup fails"
26run_cmd_expect_failure $IB_BIN $IB_ARGS --slave-info --incremental --incremental-basedir=$topdir/backup $topdir/backup
27
28# TODO: add positive tests when the test suite is able to setup replication

Subscribers

People subscribed via source and target branches