mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-09-11 21:51:21 +00:00
PT-1760 MasterSlave fix for rep channels
This commit is contained in:
@@ -3916,13 +3916,20 @@ sub get_slave_status {
|
|||||||
if (!$self->{channel}) {
|
if (!$self->{channel}) {
|
||||||
die 'This server returned more than one row for SHOW SLAVE STATUS but "channel" was not specified on the command line';
|
die 'This server returned more than one row for SHOW SLAVE STATUS but "channel" was not specified on the command line';
|
||||||
}
|
}
|
||||||
|
my $slave_use_channels;
|
||||||
for my $row (@$sss_rows) {
|
for my $row (@$sss_rows) {
|
||||||
$row = { map { lc($_) => $row->{$_} } keys %$row }; # lowercase the keys
|
$row = { map { lc($_) => $row->{$_} } keys %$row }; # lowercase the keys
|
||||||
|
if ($row->{channel_name}) {
|
||||||
|
$slave_use_channels = 1;
|
||||||
|
}
|
||||||
if ($row->{channel_name} eq $self->{channel}) {
|
if ($row->{channel_name} eq $self->{channel}) {
|
||||||
$ss = $row;
|
$ss = $row;
|
||||||
last;
|
last;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (!$ss && $slave_use_channels) {
|
||||||
|
die 'This server is using replication channels but "channel" was not specified on the command line';
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if ($sss_rows->[0]->{channel_name} && $sss_rows->[0]->{channel_name} ne $self->{channel}) {
|
if ($sss_rows->[0]->{channel_name} && $sss_rows->[0]->{channel_name} ne $self->{channel}) {
|
||||||
die 'This server is using replication channels but "channel" was not specified on the command line';
|
die 'This server is using replication channels but "channel" was not specified on the command line';
|
||||||
@@ -3935,6 +3942,9 @@ sub get_slave_status {
|
|||||||
$ss = { map { lc($_) => $ss->{$_} } keys %$ss }; # lowercase the keys
|
$ss = { map { lc($_) => $ss->{$_} } keys %$ss }; # lowercase the keys
|
||||||
return $ss;
|
return $ss;
|
||||||
}
|
}
|
||||||
|
if (!$ss && $self->{channel}) {
|
||||||
|
die "Specified channel name is invalid";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PTDEBUG && _d('This server returns nothing for SHOW SLAVE STATUS');
|
PTDEBUG && _d('This server returns nothing for SHOW SLAVE STATUS');
|
||||||
|
@@ -465,13 +465,20 @@ sub get_slave_status {
|
|||||||
if (!$self->{channel}) {
|
if (!$self->{channel}) {
|
||||||
die 'This server returned more than one row for SHOW SLAVE STATUS but "channel" was not specified on the command line';
|
die 'This server returned more than one row for SHOW SLAVE STATUS but "channel" was not specified on the command line';
|
||||||
}
|
}
|
||||||
|
my $slave_use_channels;
|
||||||
for my $row (@$sss_rows) {
|
for my $row (@$sss_rows) {
|
||||||
$row = { map { lc($_) => $row->{$_} } keys %$row }; # lowercase the keys
|
$row = { map { lc($_) => $row->{$_} } keys %$row }; # lowercase the keys
|
||||||
|
if ($row->{channel_name}) {
|
||||||
|
$slave_use_channels = 1;
|
||||||
|
}
|
||||||
if ($row->{channel_name} eq $self->{channel}) {
|
if ($row->{channel_name} eq $self->{channel}) {
|
||||||
$ss = $row;
|
$ss = $row;
|
||||||
last;
|
last;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (!$ss && $slave_use_channels) {
|
||||||
|
die 'This server is using replication channels but "channel" was not specified on the command line';
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if ($sss_rows->[0]->{channel_name} && $sss_rows->[0]->{channel_name} ne $self->{channel}) {
|
if ($sss_rows->[0]->{channel_name} && $sss_rows->[0]->{channel_name} ne $self->{channel}) {
|
||||||
die 'This server is using replication channels but "channel" was not specified on the command line';
|
die 'This server is using replication channels but "channel" was not specified on the command line';
|
||||||
@@ -484,6 +491,9 @@ sub get_slave_status {
|
|||||||
$ss = { map { lc($_) => $ss->{$_} } keys %$ss }; # lowercase the keys
|
$ss = { map { lc($_) => $ss->{$_} } keys %$ss }; # lowercase the keys
|
||||||
return $ss;
|
return $ss;
|
||||||
}
|
}
|
||||||
|
if (!$ss && $self->{channel}) {
|
||||||
|
die "Specified channel name is invalid";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PTDEBUG && _d('This server returns nothing for SHOW SLAVE STATUS');
|
PTDEBUG && _d('This server returns nothing for SHOW SLAVE STATUS');
|
||||||
|
10
bin/pt-kill
10
bin/pt-kill
@@ -4197,13 +4197,20 @@ sub get_slave_status {
|
|||||||
if (!$self->{channel}) {
|
if (!$self->{channel}) {
|
||||||
die 'This server returned more than one row for SHOW SLAVE STATUS but "channel" was not specified on the command line';
|
die 'This server returned more than one row for SHOW SLAVE STATUS but "channel" was not specified on the command line';
|
||||||
}
|
}
|
||||||
|
my $slave_use_channels;
|
||||||
for my $row (@$sss_rows) {
|
for my $row (@$sss_rows) {
|
||||||
$row = { map { lc($_) => $row->{$_} } keys %$row }; # lowercase the keys
|
$row = { map { lc($_) => $row->{$_} } keys %$row }; # lowercase the keys
|
||||||
|
if ($row->{channel_name}) {
|
||||||
|
$slave_use_channels = 1;
|
||||||
|
}
|
||||||
if ($row->{channel_name} eq $self->{channel}) {
|
if ($row->{channel_name} eq $self->{channel}) {
|
||||||
$ss = $row;
|
$ss = $row;
|
||||||
last;
|
last;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (!$ss && $slave_use_channels) {
|
||||||
|
die 'This server is using replication channels but "channel" was not specified on the command line';
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if ($sss_rows->[0]->{channel_name} && $sss_rows->[0]->{channel_name} ne $self->{channel}) {
|
if ($sss_rows->[0]->{channel_name} && $sss_rows->[0]->{channel_name} ne $self->{channel}) {
|
||||||
die 'This server is using replication channels but "channel" was not specified on the command line';
|
die 'This server is using replication channels but "channel" was not specified on the command line';
|
||||||
@@ -4216,6 +4223,9 @@ sub get_slave_status {
|
|||||||
$ss = { map { lc($_) => $ss->{$_} } keys %$ss }; # lowercase the keys
|
$ss = { map { lc($_) => $ss->{$_} } keys %$ss }; # lowercase the keys
|
||||||
return $ss;
|
return $ss;
|
||||||
}
|
}
|
||||||
|
if (!$ss && $self->{channel}) {
|
||||||
|
die "Specified channel name is invalid";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PTDEBUG && _d('This server returns nothing for SHOW SLAVE STATUS');
|
PTDEBUG && _d('This server returns nothing for SHOW SLAVE STATUS');
|
||||||
|
@@ -4522,6 +4522,9 @@ sub get_slave_status {
|
|||||||
my $slave_use_channels;
|
my $slave_use_channels;
|
||||||
for my $row (@$sss_rows) {
|
for my $row (@$sss_rows) {
|
||||||
$row = { map { lc($_) => $row->{$_} } keys %$row }; # lowercase the keys
|
$row = { map { lc($_) => $row->{$_} } keys %$row }; # lowercase the keys
|
||||||
|
if ($row->{channel_name}) {
|
||||||
|
$slave_use_channels = 1;
|
||||||
|
}
|
||||||
if ($row->{channel_name} eq $self->{channel}) {
|
if ($row->{channel_name} eq $self->{channel}) {
|
||||||
$ss = $row;
|
$ss = $row;
|
||||||
last;
|
last;
|
||||||
@@ -4531,7 +4534,7 @@ sub get_slave_status {
|
|||||||
die 'This server is using replication channels but "channel" was not specified on the command line';
|
die 'This server is using replication channels but "channel" was not specified on the command line';
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if ($sss_rows->[0]->{channel_name} && $sss_rows->[0]->{channel_name} ne ($self->{channel} || '')) {
|
if ($sss_rows->[0]->{channel_name} && $sss_rows->[0]->{channel_name} ne $self->{channel}) {
|
||||||
die 'This server is using replication channels but "channel" was not specified on the command line';
|
die 'This server is using replication channels but "channel" was not specified on the command line';
|
||||||
} else {
|
} else {
|
||||||
$ss = $sss_rows->[0];
|
$ss = $sss_rows->[0];
|
||||||
@@ -4542,6 +4545,9 @@ sub get_slave_status {
|
|||||||
$ss = { map { lc($_) => $ss->{$_} } keys %$ss }; # lowercase the keys
|
$ss = { map { lc($_) => $ss->{$_} } keys %$ss }; # lowercase the keys
|
||||||
return $ss;
|
return $ss;
|
||||||
}
|
}
|
||||||
|
if (!$ss && $self->{channel}) {
|
||||||
|
die "Specified channel name is invalid";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PTDEBUG && _d('This server returns nothing for SHOW SLAVE STATUS');
|
PTDEBUG && _d('This server returns nothing for SHOW SLAVE STATUS');
|
||||||
|
@@ -10845,13 +10845,20 @@ sub get_slave_status {
|
|||||||
if (!$self->{channel}) {
|
if (!$self->{channel}) {
|
||||||
die 'This server returned more than one row for SHOW SLAVE STATUS but "channel" was not specified on the command line';
|
die 'This server returned more than one row for SHOW SLAVE STATUS but "channel" was not specified on the command line';
|
||||||
}
|
}
|
||||||
|
my $slave_use_channels;
|
||||||
for my $row (@$sss_rows) {
|
for my $row (@$sss_rows) {
|
||||||
$row = { map { lc($_) => $row->{$_} } keys %$row }; # lowercase the keys
|
$row = { map { lc($_) => $row->{$_} } keys %$row }; # lowercase the keys
|
||||||
|
if ($row->{channel_name}) {
|
||||||
|
$slave_use_channels = 1;
|
||||||
|
}
|
||||||
if ($row->{channel_name} eq $self->{channel}) {
|
if ($row->{channel_name} eq $self->{channel}) {
|
||||||
$ss = $row;
|
$ss = $row;
|
||||||
last;
|
last;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (!$ss && $slave_use_channels) {
|
||||||
|
die 'This server is using replication channels but "channel" was not specified on the command line';
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if ($sss_rows->[0]->{channel_name} && $sss_rows->[0]->{channel_name} ne $self->{channel}) {
|
if ($sss_rows->[0]->{channel_name} && $sss_rows->[0]->{channel_name} ne $self->{channel}) {
|
||||||
die 'This server is using replication channels but "channel" was not specified on the command line';
|
die 'This server is using replication channels but "channel" was not specified on the command line';
|
||||||
@@ -10864,6 +10871,9 @@ sub get_slave_status {
|
|||||||
$ss = { map { lc($_) => $ss->{$_} } keys %$ss }; # lowercase the keys
|
$ss = { map { lc($_) => $ss->{$_} } keys %$ss }; # lowercase the keys
|
||||||
return $ss;
|
return $ss;
|
||||||
}
|
}
|
||||||
|
if (!$ss && $self->{channel}) {
|
||||||
|
die "Specified channel name is invalid";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PTDEBUG && _d('This server returns nothing for SHOW SLAVE STATUS');
|
PTDEBUG && _d('This server returns nothing for SHOW SLAVE STATUS');
|
||||||
|
@@ -2605,13 +2605,20 @@ sub get_slave_status {
|
|||||||
if (!$self->{channel}) {
|
if (!$self->{channel}) {
|
||||||
die 'This server returned more than one row for SHOW SLAVE STATUS but "channel" was not specified on the command line';
|
die 'This server returned more than one row for SHOW SLAVE STATUS but "channel" was not specified on the command line';
|
||||||
}
|
}
|
||||||
|
my $slave_use_channels;
|
||||||
for my $row (@$sss_rows) {
|
for my $row (@$sss_rows) {
|
||||||
$row = { map { lc($_) => $row->{$_} } keys %$row }; # lowercase the keys
|
$row = { map { lc($_) => $row->{$_} } keys %$row }; # lowercase the keys
|
||||||
|
if ($row->{channel_name}) {
|
||||||
|
$slave_use_channels = 1;
|
||||||
|
}
|
||||||
if ($row->{channel_name} eq $self->{channel}) {
|
if ($row->{channel_name} eq $self->{channel}) {
|
||||||
$ss = $row;
|
$ss = $row;
|
||||||
last;
|
last;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (!$ss && $slave_use_channels) {
|
||||||
|
die 'This server is using replication channels but "channel" was not specified on the command line';
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if ($sss_rows->[0]->{channel_name} && $sss_rows->[0]->{channel_name} ne $self->{channel}) {
|
if ($sss_rows->[0]->{channel_name} && $sss_rows->[0]->{channel_name} ne $self->{channel}) {
|
||||||
die 'This server is using replication channels but "channel" was not specified on the command line';
|
die 'This server is using replication channels but "channel" was not specified on the command line';
|
||||||
@@ -2624,6 +2631,9 @@ sub get_slave_status {
|
|||||||
$ss = { map { lc($_) => $ss->{$_} } keys %$ss }; # lowercase the keys
|
$ss = { map { lc($_) => $ss->{$_} } keys %$ss }; # lowercase the keys
|
||||||
return $ss;
|
return $ss;
|
||||||
}
|
}
|
||||||
|
if (!$ss && $self->{channel}) {
|
||||||
|
die "Specified channel name is invalid";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PTDEBUG && _d('This server returns nothing for SHOW SLAVE STATUS');
|
PTDEBUG && _d('This server returns nothing for SHOW SLAVE STATUS');
|
||||||
|
@@ -3016,13 +3016,20 @@ sub get_slave_status {
|
|||||||
if (!$self->{channel}) {
|
if (!$self->{channel}) {
|
||||||
die 'This server returned more than one row for SHOW SLAVE STATUS but "channel" was not specified on the command line';
|
die 'This server returned more than one row for SHOW SLAVE STATUS but "channel" was not specified on the command line';
|
||||||
}
|
}
|
||||||
|
my $slave_use_channels;
|
||||||
for my $row (@$sss_rows) {
|
for my $row (@$sss_rows) {
|
||||||
$row = { map { lc($_) => $row->{$_} } keys %$row }; # lowercase the keys
|
$row = { map { lc($_) => $row->{$_} } keys %$row }; # lowercase the keys
|
||||||
|
if ($row->{channel_name}) {
|
||||||
|
$slave_use_channels = 1;
|
||||||
|
}
|
||||||
if ($row->{channel_name} eq $self->{channel}) {
|
if ($row->{channel_name} eq $self->{channel}) {
|
||||||
$ss = $row;
|
$ss = $row;
|
||||||
last;
|
last;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (!$ss && $slave_use_channels) {
|
||||||
|
die 'This server is using replication channels but "channel" was not specified on the command line';
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if ($sss_rows->[0]->{channel_name} && $sss_rows->[0]->{channel_name} ne $self->{channel}) {
|
if ($sss_rows->[0]->{channel_name} && $sss_rows->[0]->{channel_name} ne $self->{channel}) {
|
||||||
die 'This server is using replication channels but "channel" was not specified on the command line';
|
die 'This server is using replication channels but "channel" was not specified on the command line';
|
||||||
@@ -3035,6 +3042,9 @@ sub get_slave_status {
|
|||||||
$ss = { map { lc($_) => $ss->{$_} } keys %$ss }; # lowercase the keys
|
$ss = { map { lc($_) => $ss->{$_} } keys %$ss }; # lowercase the keys
|
||||||
return $ss;
|
return $ss;
|
||||||
}
|
}
|
||||||
|
if (!$ss && $self->{channel}) {
|
||||||
|
die "Specified channel name is invalid";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PTDEBUG && _d('This server returns nothing for SHOW SLAVE STATUS');
|
PTDEBUG && _d('This server returns nothing for SHOW SLAVE STATUS');
|
||||||
|
@@ -5469,13 +5469,20 @@ sub get_slave_status {
|
|||||||
if (!$self->{channel}) {
|
if (!$self->{channel}) {
|
||||||
die 'This server returned more than one row for SHOW SLAVE STATUS but "channel" was not specified on the command line';
|
die 'This server returned more than one row for SHOW SLAVE STATUS but "channel" was not specified on the command line';
|
||||||
}
|
}
|
||||||
|
my $slave_use_channels;
|
||||||
for my $row (@$sss_rows) {
|
for my $row (@$sss_rows) {
|
||||||
$row = { map { lc($_) => $row->{$_} } keys %$row }; # lowercase the keys
|
$row = { map { lc($_) => $row->{$_} } keys %$row }; # lowercase the keys
|
||||||
|
if ($row->{channel_name}) {
|
||||||
|
$slave_use_channels = 1;
|
||||||
|
}
|
||||||
if ($row->{channel_name} eq $self->{channel}) {
|
if ($row->{channel_name} eq $self->{channel}) {
|
||||||
$ss = $row;
|
$ss = $row;
|
||||||
last;
|
last;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (!$ss && $slave_use_channels) {
|
||||||
|
die 'This server is using replication channels but "channel" was not specified on the command line';
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if ($sss_rows->[0]->{channel_name} && $sss_rows->[0]->{channel_name} ne $self->{channel}) {
|
if ($sss_rows->[0]->{channel_name} && $sss_rows->[0]->{channel_name} ne $self->{channel}) {
|
||||||
die 'This server is using replication channels but "channel" was not specified on the command line';
|
die 'This server is using replication channels but "channel" was not specified on the command line';
|
||||||
@@ -5488,6 +5495,9 @@ sub get_slave_status {
|
|||||||
$ss = { map { lc($_) => $ss->{$_} } keys %$ss }; # lowercase the keys
|
$ss = { map { lc($_) => $ss->{$_} } keys %$ss }; # lowercase the keys
|
||||||
return $ss;
|
return $ss;
|
||||||
}
|
}
|
||||||
|
if (!$ss && $self->{channel}) {
|
||||||
|
die "Specified channel name is invalid";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PTDEBUG && _d('This server returns nothing for SHOW SLAVE STATUS');
|
PTDEBUG && _d('This server returns nothing for SHOW SLAVE STATUS');
|
||||||
|
@@ -6999,13 +6999,20 @@ sub get_slave_status {
|
|||||||
if (!$self->{channel}) {
|
if (!$self->{channel}) {
|
||||||
die 'This server returned more than one row for SHOW SLAVE STATUS but "channel" was not specified on the command line';
|
die 'This server returned more than one row for SHOW SLAVE STATUS but "channel" was not specified on the command line';
|
||||||
}
|
}
|
||||||
|
my $slave_use_channels;
|
||||||
for my $row (@$sss_rows) {
|
for my $row (@$sss_rows) {
|
||||||
$row = { map { lc($_) => $row->{$_} } keys %$row }; # lowercase the keys
|
$row = { map { lc($_) => $row->{$_} } keys %$row }; # lowercase the keys
|
||||||
|
if ($row->{channel_name}) {
|
||||||
|
$slave_use_channels = 1;
|
||||||
|
}
|
||||||
if ($row->{channel_name} eq $self->{channel}) {
|
if ($row->{channel_name} eq $self->{channel}) {
|
||||||
$ss = $row;
|
$ss = $row;
|
||||||
last;
|
last;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (!$ss && $slave_use_channels) {
|
||||||
|
die 'This server is using replication channels but "channel" was not specified on the command line';
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if ($sss_rows->[0]->{channel_name} && $sss_rows->[0]->{channel_name} ne $self->{channel}) {
|
if ($sss_rows->[0]->{channel_name} && $sss_rows->[0]->{channel_name} ne $self->{channel}) {
|
||||||
die 'This server is using replication channels but "channel" was not specified on the command line';
|
die 'This server is using replication channels but "channel" was not specified on the command line';
|
||||||
@@ -7018,6 +7025,9 @@ sub get_slave_status {
|
|||||||
$ss = { map { lc($_) => $ss->{$_} } keys %$ss }; # lowercase the keys
|
$ss = { map { lc($_) => $ss->{$_} } keys %$ss }; # lowercase the keys
|
||||||
return $ss;
|
return $ss;
|
||||||
}
|
}
|
||||||
|
if (!$ss && $self->{channel}) {
|
||||||
|
die "Specified channel name is invalid";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PTDEBUG && _d('This server returns nothing for SHOW SLAVE STATUS');
|
PTDEBUG && _d('This server returns nothing for SHOW SLAVE STATUS');
|
||||||
|
@@ -175,16 +175,6 @@ sub parse {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# The Perl MySQL driver will override the values from the options file with the other
|
|
||||||
# values specified in the DSN. For us, if the user specified the F parameter, we only
|
|
||||||
# want options to be loaded from the config file.
|
|
||||||
# This is important because if for example, the user specifies F for the --check-slave-lag
|
|
||||||
# paramteter and we don't clean up the other options, the other DSN parameters will be
|
|
||||||
# inherited from the master and we don't want that.
|
|
||||||
if ($final_props{F}) {
|
|
||||||
%final_props = ( 'F' => $final_props{F} );
|
|
||||||
}
|
|
||||||
|
|
||||||
return \%final_props;
|
return \%final_props;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -475,6 +475,9 @@ sub get_slave_status {
|
|||||||
$ss = { map { lc($_) => $ss->{$_} } keys %$ss }; # lowercase the keys
|
$ss = { map { lc($_) => $ss->{$_} } keys %$ss }; # lowercase the keys
|
||||||
return $ss;
|
return $ss;
|
||||||
}
|
}
|
||||||
|
if (!$ss && $self->{channel}) {
|
||||||
|
die "Specified channel name is invalid";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PTDEBUG && _d('This server returns nothing for SHOW SLAVE STATUS');
|
PTDEBUG && _d('This server returns nothing for SHOW SLAVE STATUS');
|
||||||
|
Reference in New Issue
Block a user