Skip to content

Commit

Permalink
Bug #1326967: innobackupex --galera-info incompatible with MGC-10.0 -
Browse files Browse the repository at this point in the history
              part 2

Merged a patch contributed by Nirbhay Choubey implementing the
following changes:

1. Since MariaDB does not provide Executed_Gtid_Set in SHOW MASTER STATUS,
use its MariaDB equivalent, the gtid_binlog_state system variable.

2. Since there is no MariaDB equivalent to the log_bin_basename
variable, assume it is the same as the datadir and look for the current
binlog file there.
  • Loading branch information
akopytov committed Sep 5, 2014
1 parent d384c70 commit 60f9795
Showing 1 changed file with 22 additions and 3 deletions.
25 changes: 22 additions & 3 deletions storage/innobase/xtrabackup/innobackupex.pl
Expand Up @@ -3074,6 +3074,7 @@ sub write_galera_info {
my @info_lines = ();
my $state_uuid = undef;
my $last_committed = undef;
my $gtid_exists= 0;

# When backup locks are supported by the server, we should skip creating
# xtrabackup_galera_info file on the backup stage, because
Expand Down Expand Up @@ -3111,17 +3112,35 @@ sub write_galera_info {
get_mysql_master_status($con);
}

my $gtid = $con->{master_status}->{Executed_Gtid_Set} || '';
if (defined($con->{master_status}->{Executed_Gtid_Set})) {
# MySQL >= 5.6
if ($con->{master_status}->{Executed_Gtid_Set} ne '') {
$gtid_exists = 1;
}
} elsif (defined($con->{vars}->{gtid_binlog_state})) {
# MariaDB >= 10.0
if ($con->{vars}->{gtid_binlog_state}->{Value}) {
$gtid_exists = 1;
}
}

if ($gtid) {
if ($gtid_exists) {
my $log_bin_dir;
my $log_bin_file;

mysql_query($con, "FLUSH BINARY LOGS");
get_mysql_master_status($con);

$log_bin_file = $con->{master_status}->{File};
$log_bin_dir = File::Basename::dirname($mysql{vars}->{log_bin_basename}->{Value});
if (defined($con->{vars}->{log_bin_basename})) {
# MySQL >= 5.6
$log_bin_dir =
File::Basename::dirname($con->{vars}->{log_bin_basename}->{Value});
} else {
# MariaDB >= 10.0
# log_bin_basename does not exist in MariaDB, fallback to datadir
$log_bin_dir = $con->{vars}->{datadir}->{Value};
}

if (!defined($log_bin_file) || !defined($log_bin_dir)) {
die "Failed to get master binlog coordinates from SHOW MASTER STATUS";
Expand Down

0 comments on commit 60f9795

Please sign in to comment.