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

Proposed by Vlad Lesin
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) Needs Fixing
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.
Revision history for this message
Alexey Kopytov (akopytov) wrote :

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

review: Needs Fixing
Revision history for this message
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
1=== modified file 'innobackupex'
2--- innobackupex 2013-06-21 11:39:45 +0000
3+++ innobackupex 2013-07-08 09:31:25 +0000
4@@ -440,28 +440,40 @@
5 $suspend_file = $work_dir . $xb_fn_suspended_at_end;
6 wait_for_ibbackup_suspend($suspend_file);
7
8- if ($option_safe_slave_backup) {
9- wait_for_safe_slave(\%mysql);
10- }
11-
12- # flush tables with read lock
13 if (!$option_no_lock) {
14- # make a prep copy before locking tables, if using rsync
15- backup_files(1);
16-
17- # flush tables with read lock
18- mysql_lockall(\%mysql);
19- }
20-
21- if ($option_slave_info) {
22+ if ($option_safe_slave_backup) {
23+ wait_for_safe_slave(\%mysql);
24+ }
25+
26+ # flush tables with read lock
27+ # make a prep copy before locking tables, if using rsync
28+ backup_files(1);
29+
30+ # flush tables with read lock
31+ mysql_lockall(\%mysql);
32+
33+ if ($option_slave_info) {
34 write_slave_info(\%mysql);
35+ }
36 }
37
38-
39 # backup non-InnoDB files and tables
40 # (or finalize the backup by syncing changes if using rsync)
41 backup_files(0);
42
43+ # There is no need to stop slave thread before coping non-Innodb data when
44+ # --no-lock option is used because --no-lock option requires that no DDL or
45+ # DML to non-transaction tables can occur.
46+ if ($option_no_lock)
47+ {
48+ if ($option_safe_slave_backup)
49+ {
50+ wait_for_safe_slave(\%mysql);
51+ }
52+ if ($option_slave_info) {
53+ write_slave_info(\%mysql);
54+ }
55+ }
56 # resume XtraBackup and wait till it has finished
57 resume_ibbackup($suspend_file);
58 $suspend_file = $work_dir . $xb_fn_log_copied;
59
60=== added file 'test/t/bug1182726.sh'
61--- test/t/bug1182726.sh 1970-01-01 00:00:00 +0000
62+++ test/t/bug1182726.sh 2013-07-08 09:31:25 +0000
63@@ -0,0 +1,37 @@
64+. inc/common.sh
65+########################################################################
66+# Bug #1182726: Reduce Replication Delay when Taking Backup from Slave
67+#
68+# Using --no-lock, --slave-info and --safe-slave-backup options together must
69+# not stop replication while copying non-InnoDB data.
70+########################################################################
71+
72+
73+master_id=1
74+slave_id=2
75+
76+start_server_with_id $master_id
77+start_server_with_id $slave_id
78+
79+setup_slave $slave_id $master_id
80+
81+switch_server $master_id
82+load_dbase_schema incremental_sample
83+
84+# Adding initial rows
85+vlog "Adding initial rows to database..."
86+numrow=100
87+count=0
88+while [ "$numrow" -gt "$count" ]
89+do
90+ ${MYSQL} ${MYSQL_ARGS} -e "insert into test values ($count, $numrow);" incremental_sample
91+ let "count=count+1"
92+done
93+vlog "Initial rows added"
94+
95+# Full backup of the slave server
96+switch_server $slave_id
97+
98+innobackupex --no-timestamp --slave-info --safe-slave-backup --no-lock $topdir/backup
99+egrep -q '^CHANGE MASTER TO MASTER_LOG_FILE='\''mysql-bin.[0-9]+'\'', MASTER_LOG_POS=[0-9]+$' \
100+ $topdir/backup/xtrabackup_slave_info

Subscribers

People subscribed via source and target branches