Merge lp:~akopytov/percona-xtrabackup/bug1372679 into lp:percona-xtrabackup/2.2

Proposed by Alexey Kopytov
Status: Merged
Approved by: Alexey Kopytov
Approved revision: no longer in the source branch.
Merged at revision: 5041
Proposed branch: lp:~akopytov/percona-xtrabackup/bug1372679
Merge into: lp:percona-xtrabackup/2.2
Diff against target: 151 lines (+93/-9)
2 files modified
storage/innobase/xtrabackup/innobackupex.pl (+39/-9)
storage/innobase/xtrabackup/test/t/bug1372679.sh (+54/-0)
To merge this branch: bzr merge lp:~akopytov/percona-xtrabackup/bug1372679
Reviewer Review Type Date Requested Status
Alexey Kopytov (community) Approve
Review via email: mp+239732@code.launchpad.net

Description of the change

    Bug #1372679: innobackupex --slave-info doesn't handle
    slave_parallel_workers>0

    Changed innobackupex to fail with an error when --slave-info is used on
    a multi-threaded non-GTID slave, because Exec_Master_Log_Pos cannot be
    trusted for a multi-threaded slave.

http://jenkins.percona.com/view/PXB%202.2/job/percona-xtrabackup-2.2-param/245/

To post a comment you must log in.
Revision history for this message
Alexey Kopytov (akopytov) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'storage/innobase/xtrabackup/innobackupex.pl'
--- storage/innobase/xtrabackup/innobackupex.pl 2014-10-27 10:31:20 +0000
+++ storage/innobase/xtrabackup/innobackupex.pl 2014-10-27 14:49:12 +0000
@@ -77,6 +77,8 @@
77my $have_backup_locks = 0;77my $have_backup_locks = 0;
78my $have_galera_enabled = 0;78my $have_galera_enabled = 0;
79my $have_flush_engine_logs = 0;79my $have_flush_engine_logs = 0;
80my $have_multi_threaded_slave = 0;
81my $have_gtid_slave = 0;
8082
81# command line options83# command line options
82my $option_help = '';84my $option_help = '';
@@ -1904,6 +1906,15 @@
19041906
1905 detect_mysql_capabilities_for_backup(\%mysql);1907 detect_mysql_capabilities_for_backup(\%mysql);
19061908
1909
1910 # Do not allow --slave-info with a multi-threded non-GTID slave,
1911 # see https://bugs.launchpad.net/percona-xtrabackup/+bug/1372679
1912 if ($option_slave_info and $have_multi_threaded_slave
1913 and !$have_gtid_slave) {
1914 die "The --slave-info option requires GTID enabled for a " .
1915 "multi-threaded slave."
1916 }
1917
1907 #1918 #
1908 # if one of the history incrementals is being used, try to grab the1919 # if one of the history incrementals is being used, try to grab the
1909 # innodb_to_lsn from the history table and set the option_incremental_lsn1920 # innodb_to_lsn from the history table and set the option_incremental_lsn
@@ -4927,20 +4938,26 @@
4927# Query the server to find out what backup capabilities it supports.4938# Query the server to find out what backup capabilities it supports.
4928#4939#
4929sub detect_mysql_capabilities_for_backup {4940sub detect_mysql_capabilities_for_backup {
4941 my $con = shift;
4942
4930 if ($option_incremental) {4943 if ($option_incremental) {
4931 $have_changed_page_bitmaps =4944 $have_changed_page_bitmaps =
4932 mysql_query($_[0], "SELECT COUNT(*) FROM " .4945 mysql_query($con, "SELECT COUNT(*) FROM " .
4933 "INFORMATION_SCHEMA.PLUGINS " .4946 "INFORMATION_SCHEMA.PLUGINS " .
4934 "WHERE PLUGIN_NAME LIKE 'INNODB_CHANGED_PAGES'");4947 "WHERE PLUGIN_NAME LIKE 'INNODB_CHANGED_PAGES'");
4935 }4948 }
49364949
4937 if (!defined($_[0]->{vars})) {4950 if (!defined($con->{vars})) {
4938 get_mysql_vars($_[0]);4951 get_mysql_vars($con);
4939 }4952 }
49404953
4941 $have_backup_locks = defined($_[0]->{vars}->{have_backup_locks});4954 if (!defined($con->{slave_status})) {
49424955 get_mysql_slave_status($con);
4943 $have_galera_enabled = defined($_[0]->{vars}->{wsrep_on});4956 }
4957
4958 $have_backup_locks = defined($con->{vars}->{have_backup_locks});
4959
4960 $have_galera_enabled = defined($con->{vars}->{wsrep_on});
49444961
4945 if ($option_galera_info && !$have_galera_enabled) {4962 if ($option_galera_info && !$have_galera_enabled) {
4946 my $now = current_time();4963 my $now = current_time();
@@ -4952,7 +4969,7 @@
4952 $option_galera_info = 0;4969 $option_galera_info = 0;
4953 }4970 }
49544971
4955 if ($mysql{vars}->{version}->{Value} =~ m/5\.[123]\.\d/) {4972 if ($con->{vars}->{version}->{Value} =~ m/5\.[123]\.\d/) {
4956 my $now = current_time();4973 my $now = current_time();
49574974
4958 print STDERR "\n$now $prefix Warning: FLUSH ENGINE LOGS " .4975 print STDERR "\n$now $prefix Warning: FLUSH ENGINE LOGS " .
@@ -4964,6 +4981,19 @@
4964 } else {4981 } else {
4965 $have_flush_engine_logs = 1;4982 $have_flush_engine_logs = 1;
4966 }4983 }
4984
4985 if (defined($con->{vars}->{slave_parallel_workers}) and
4986 ($con->{vars}->{slave_parallel_workers}->{Value} > 0)) {
4987 $have_multi_threaded_slave = 1;
4988 }
4989
4990 my $gtid_executed = $con->{slave_status}->{Executed_Gtid_Set};
4991 my $gtid_slave_pos = $con->{vars}->{gtid_slave_pos};
4992
4993 if ((defined($gtid_executed) and $gtid_executed ne '') or
4994 (defined($gtid_slave_pos) and $gtid_slave_pos ne '')) {
4995 $have_gtid_slave = 1;
4996 }
4967}4997}
49684998
4969#4999#
49705000
=== added file 'storage/innobase/xtrabackup/test/t/bug1372679.sh'
--- storage/innobase/xtrabackup/test/t/bug1372679.sh 1970-01-01 00:00:00 +0000
+++ storage/innobase/xtrabackup/test/t/bug1372679.sh 2014-10-27 14:49:12 +0000
@@ -0,0 +1,54 @@
1########################################################################
2# Bug #1372679: innobackupex --slave-info doesn't handle
3# slave_parallel_workers>0
4########################################################################
5
6require_server_version_higher_than 5.6.0
7
8# Test that --slave-info with MTS enabled + GTID disabled fails
9
10MYSQLD_EXTRA_MY_CNF_OPTS="
11slave_parallel_workers=2
12"
13master_id=1
14slave_id=2
15
16start_server_with_id $master_id
17
18start_server_with_id $slave_id
19
20setup_slave $slave_id $master_id
21
22switch_server $slave_id
23
24innobackupex --no-timestamp --slave-info $topdir/backup 2>&1 |
25 grep 'The --slave-info option requires GTID enabled for a multi-threaded slave' ||
26 die "could not find the error message"
27
28if [[ ${PIPESTATUS[0]} == 0 ]]
29then
30 die "innobackupex did not fail as expected"
31fi
32
33stop_server_with_id $master_id
34stop_server_with_id $slave_id
35
36remove_var_dirs
37
38# Test that --slave-info with MTS enabled + GTID enabled works
39
40MYSQLD_EXTRA_MY_CNF_OPTS="
41gtid_mode=on
42log_slave_updates=on
43enforce_gtid_consistency=on
44slave_parallel_workers=2
45"
46
47start_server_with_id $master_id
48start_server_with_id $slave_id
49
50setup_slave $slave_id $master_id
51
52switch_server $slave_id
53
54innobackupex --no-timestamp --slave-info $topdir/backup

Subscribers

People subscribed via source and target branches

to all changes: