Merge lp:~gl-az/percona-xtrabackup/bug1250375-2.2 into lp:percona-xtrabackup/2.2

Proposed by George Ormond Lorch III
Status: Merged
Approved by: Alexey Kopytov
Approved revision: 4922
Merged at revision: 4930
Proposed branch: lp:~gl-az/percona-xtrabackup/bug1250375-2.2
Merge into: lp:percona-xtrabackup/2.2
Diff against target: 75 lines (+60/-0)
2 files modified
storage/innobase/xtrabackup/innobackupex.pl (+22/-0)
storage/innobase/xtrabackup/test/t/bug1250375.sh (+38/-0)
To merge this branch: bzr merge lp:~gl-az/percona-xtrabackup/bug1250375-2.2
Reviewer Review Type Date Requested Status
Alexey Kopytov (community) Approve
Review via email: mp+201527@code.launchpad.net

Description of the change

Fix for bug 1250375 : PXB 56 in galera mode should backup last binlog file.

When --galera-info is specified and Executed_Gtid_Set is valid (PXB 5.6 only or better), innobackupex will execute FLUSH BINARY LOGS and then carry the current binary log as indicated in SHOW MASTER STATUS into the backup set.

Created simple test case (bug1250375.sh) based on xb_galera_info.sh that is only valid for PXC 5.6 or greater to test that the correct bin-log file is present within the backup set.

To post a comment you must log in.
Revision history for this message
George Ormond Lorch III (gl-az) wrote :
Revision history for this message
George Ormond Lorch III (gl-az) wrote :

Similar to the 2.1 comments:

Reviewed the changes myself again after a break and re-orderd things a bit in write_galera_info...new jenkins here http://jenkins.percona.com/view/PXB%202.2/job/percona-xtrabackup-2.2-param/84/ but one host is now having issues. I will restart tests when the issue clears and post new comments.

Revision history for this message
George Ormond Lorch III (gl-az) wrote :
Revision history for this message
Alexey Kopytov (akopytov) :
review: Needs Fixing
4922. By George Ormond Lorch III

Fix for bug 1250375 : PXB 56 in galera mode should backup last binlog file.

When --galera-info is specified and Executed_Gtid_Set is valid (PXB 5.6 only or better), innobackupex will execute FLUSH BINARY LOGS and then carry the current binary log as indicated in SHOW MASTER STATUS into the backup set.

Created simple test case (bug1250375.sh) based on xb_galera_info.sh that is only valid for PXC 5.6 or greater to test that the correct bin-log file is present within the backup set.

Revision history for this message
Alexey Kopytov (akopytov) wrote :

After running it through PXC 5.6 enabled Jenkins:

- log_slave_updates is also a pre-requisite for gtid_mode
- $con->{master_status}->{Executed_Gtid_Set} is always defined on a 5.6 server (but is empty, if GTID is disabled).

I will fix it in the merge revision.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'storage/innobase/xtrabackup/innobackupex.pl'
2--- storage/innobase/xtrabackup/innobackupex.pl 2014-01-12 13:29:37 +0000
3+++ storage/innobase/xtrabackup/innobackupex.pl 2014-01-15 18:32:40 +0000
4@@ -3149,6 +3149,28 @@
5
6 write_to_backup_file("$galera_info", "$state_uuid" .
7 ":" . "$last_committed" . "\n");
8+
9+ if (!defined($con->{master_status})) {
10+ get_mysql_master_status($con);
11+ }
12+
13+ if (defined($con->{master_status}->{Executed_Gtid_Set})) {
14+ my $log_bin_dir;
15+ my $log_bin_file;
16+
17+ mysql_query($con, "FLUSH BINARY LOGS");
18+ get_mysql_master_status($con);
19+
20+ $log_bin_file = $con->{master_status}->{File};
21+ $log_bin_dir = File::Basename::dirname($mysql{vars}->{log_bin_basename}->{Value});
22+
23+ if (!defined($log_bin_file) || !defined($log_bin_dir)) {
24+ die "Failed to get master binlog coordinates from SHOW MASTER STATUS";
25+ }
26+
27+ backup_file("$log_bin_dir", "$log_bin_file",
28+ "$backup_dir/$log_bin_dir/$log_bin_file")
29+ }
30 }
31
32
33
34=== added file 'storage/innobase/xtrabackup/test/t/bug1250375.sh'
35--- storage/innobase/xtrabackup/test/t/bug1250375.sh 1970-01-01 00:00:00 +0000
36+++ storage/innobase/xtrabackup/test/t/bug1250375.sh 2014-01-15 18:32:40 +0000
37@@ -0,0 +1,38 @@
38+. inc/common.sh
39+
40+require_galera
41+require_server_version_higher_than 5.6.0
42+
43+ADDR=127.0.0.1
44+
45+if [[ -n ${WSREP_DEBUG:-} ]];then
46+ start_server --log-bin=`hostname`-bin --binlog-format=ROW --wsrep-provider=${MYSQL_BASEDIR}/lib/libgalera_smm.so --wsrep_cluster_address=gcomm:// --wsrep-debug=1 --wsrep_provider_options="debug=1" --wsrep_node_address=$ADDR --gtid_mode=ON
47+else
48+ start_server --log-bin=`hostname`-bin --binlog-format=ROW --wsrep-provider=${MYSQL_BASEDIR}/lib/libgalera_smm.so --wsrep_cluster_address=gcomm:// --wsrep_node_address=$ADDR --gtid_mode=ON
49+
50+fi
51+
52+
53+innobackupex --no-timestamp --galera-info $topdir/backup
54+backup_dir=$topdir/backup
55+vlog "Backup created in directory $backup_dir"
56+
57+count=0
58+master_file=
59+
60+while read line; do
61+ if [ $count -eq 1 ] # File:
62+ then
63+ master_file=`echo "$line" | sed s/File://`
64+ break
65+ fi
66+ count=$((count+1))
67+done <<< "`run_cmd $MYSQL $MYSQL_ARGS -Nse 'SHOW MASTER STATUS\G' mysql`"
68+
69+stop_server
70+
71+if [ -f "$backup_dir/$master_file" ]
72+then
73+ vlog "Could not find bin-log file in backup set, expecting to find $master_file"
74+ exit 1
75+fi

Subscribers

People subscribed via source and target branches