Merge lp:~vlad-lesin/percona-xtrabackup/bug1182726-2.1 into lp:percona-xtrabackup/2.1

Proposed by Vlad Lesin on 2013-07-04
Status: Merged
Merged at revision: 624
Proposed branch: lp:~vlad-lesin/percona-xtrabackup/bug1182726-2.1
Merge into: lp:percona-xtrabackup/2.1
Diff against target: 100 lines (+63/-14)
2 files modified
innobackupex (+26/-14)
test/t/bug1182726.sh (+37/-0)
To merge this branch: bzr merge lp:~vlad-lesin/percona-xtrabackup/bug1182726-2.1
Reviewer Review Type Date Requested Status
Alexey Kopytov (community) 2013-07-04 Needs Fixing on 2013-07-05
Review via email: mp+173109@code.launchpad.net

Description of the change

Fix for bug #1182726.

Slave thread is not stopped during coping non-Innodb data when
--no-lock option is used as using this option requires absence
of DDL or DML to non-tracsaction tables during backup. It is stopped
just before resuming xtrabackup and starts again after innodb log file
was copied.

http://jenkins.percona.com/view/XtraBackup/job/percona-xtrabackup-2.1-param/361/

To post a comment you must log in.
Alexey Kopytov (akopytov) wrote :

Looks good except the wrong bug # in the test case comment.

review: Needs Fixing
Vlad Lesin (vlad-lesin) wrote :

> Looks good except the wrong bug # in the test case comment.
fixed

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'innobackupex'
--- innobackupex 2013-06-21 11:39:45 +0000
+++ innobackupex 2013-07-08 09:31:25 +0000
@@ -440,28 +440,40 @@
440 $suspend_file = $work_dir . $xb_fn_suspended_at_end;440 $suspend_file = $work_dir . $xb_fn_suspended_at_end;
441 wait_for_ibbackup_suspend($suspend_file);441 wait_for_ibbackup_suspend($suspend_file);
442442
443 if ($option_safe_slave_backup) {
444 wait_for_safe_slave(\%mysql);
445 }
446
447 # flush tables with read lock
448 if (!$option_no_lock) {443 if (!$option_no_lock) {
449 # make a prep copy before locking tables, if using rsync444 if ($option_safe_slave_backup) {
450 backup_files(1);445 wait_for_safe_slave(\%mysql);
451446 }
452 # flush tables with read lock447
453 mysql_lockall(\%mysql);448 # flush tables with read lock
454 }449 # make a prep copy before locking tables, if using rsync
455450 backup_files(1);
456 if ($option_slave_info) {451
452 # flush tables with read lock
453 mysql_lockall(\%mysql);
454
455 if ($option_slave_info) {
457 write_slave_info(\%mysql);456 write_slave_info(\%mysql);
457 }
458 }458 }
459459
460
461 # backup non-InnoDB files and tables460 # backup non-InnoDB files and tables
462 # (or finalize the backup by syncing changes if using rsync)461 # (or finalize the backup by syncing changes if using rsync)
463 backup_files(0);462 backup_files(0);
464463
464 # There is no need to stop slave thread before coping non-Innodb data when
465 # --no-lock option is used because --no-lock option requires that no DDL or
466 # DML to non-transaction tables can occur.
467 if ($option_no_lock)
468 {
469 if ($option_safe_slave_backup)
470 {
471 wait_for_safe_slave(\%mysql);
472 }
473 if ($option_slave_info) {
474 write_slave_info(\%mysql);
475 }
476 }
465 # resume XtraBackup and wait till it has finished477 # resume XtraBackup and wait till it has finished
466 resume_ibbackup($suspend_file);478 resume_ibbackup($suspend_file);
467 $suspend_file = $work_dir . $xb_fn_log_copied;479 $suspend_file = $work_dir . $xb_fn_log_copied;
468480
=== added file 'test/t/bug1182726.sh'
--- test/t/bug1182726.sh 1970-01-01 00:00:00 +0000
+++ test/t/bug1182726.sh 2013-07-08 09:31:25 +0000
@@ -0,0 +1,37 @@
1. inc/common.sh
2########################################################################
3# Bug #1182726: Reduce Replication Delay when Taking Backup from Slave
4#
5# Using --no-lock, --slave-info and --safe-slave-backup options together must
6# not stop replication while copying non-InnoDB data.
7########################################################################
8
9
10master_id=1
11slave_id=2
12
13start_server_with_id $master_id
14start_server_with_id $slave_id
15
16setup_slave $slave_id $master_id
17
18switch_server $master_id
19load_dbase_schema incremental_sample
20
21# Adding initial rows
22vlog "Adding initial rows to database..."
23numrow=100
24count=0
25while [ "$numrow" -gt "$count" ]
26do
27 ${MYSQL} ${MYSQL_ARGS} -e "insert into test values ($count, $numrow);" incremental_sample
28 let "count=count+1"
29done
30vlog "Initial rows added"
31
32# Full backup of the slave server
33switch_server $slave_id
34
35innobackupex --no-timestamp --slave-info --safe-slave-backup --no-lock $topdir/backup
36egrep -q '^CHANGE MASTER TO MASTER_LOG_FILE='\''mysql-bin.[0-9]+'\'', MASTER_LOG_POS=[0-9]+$' \
37 $topdir/backup/xtrabackup_slave_info

Subscribers

People subscribed via source and target branches