mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-09-06 12:27:56 +00:00
WIP
This commit is contained in:
@@ -6943,7 +6943,36 @@ sub get_slave_status {
|
||||
||= $dbh->prepare('SHOW SLAVE STATUS');
|
||||
PTDEBUG && _d($dbh, 'SHOW SLAVE STATUS');
|
||||
$sth->execute();
|
||||
my ($ss) = @{$sth->fetchall_arrayref({})};
|
||||
my ($sss_rows) = $sth->fetchall_arrayref({}); # Show Slave Status rows
|
||||
|
||||
warn ">>>>====================================================================================================";
|
||||
warn Data::Dumper::Dumper($sss_rows);
|
||||
warn ">>>>====================================================================================================";
|
||||
# If SHOW SLAVE STATUS returns more than one row it means that this slave is connected to more
|
||||
# than one master using replication channels.
|
||||
# If we have a channel name as a parameter, we need to select the correct row and return it.
|
||||
# If we don't have a channel name as a parameter, there is no way to know what the correct master is so,
|
||||
# return an error.
|
||||
my $ss;
|
||||
$self->{channel} = 'masterchan2';
|
||||
if ( $sss_rows && @$sss_rows && scalar @$sss_rows > 1) {
|
||||
warn "KKKKKKKKKKKKKKKKKK";
|
||||
if (!$self->{channel}) {
|
||||
warn 'This server returned more than one row for SHOW SLAVE STATUS but "channel" was not specified on the command line';
|
||||
$self->{not_a_slave}->{$dbh}++;
|
||||
return;
|
||||
}
|
||||
for my $row (@$sss_rows) {
|
||||
if ($row->{Channel_Name} eq $self->{channel}) {
|
||||
$ss = $row;
|
||||
last;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
warn "MMMMMMMMMMMMMMMMMMMMMMMMM";
|
||||
$ss = $sss_rows->[0];
|
||||
}
|
||||
|
||||
|
||||
if ( $ss && %$ss ) {
|
||||
$ss = { map { lc($_) => $ss->{$_} } keys %$ss }; # lowercase the keys
|
||||
@@ -6996,10 +7025,16 @@ sub wait_for_master {
|
||||
. "$master_status->{position}, $timeout)";
|
||||
PTDEBUG && _d($slave_dbh, $sql);
|
||||
my $start = time;
|
||||
($result) = $slave_dbh->selectrow_array($sql);
|
||||
$result = $slave_dbh->selectrow_array($sql);
|
||||
warn ">>>";
|
||||
warn Data::Dumper::Dumper($result);
|
||||
|
||||
$waited = time - $start;
|
||||
|
||||
warn "====================================================================================================";
|
||||
warn "slave_dbh $slave_dbh";
|
||||
warn Data::Dumper::Dumper($slave_dbh);
|
||||
warn Data::Dumper::Dumper($master_status);
|
||||
PTDEBUG && _d('Result of waiting:', $result);
|
||||
PTDEBUG && _d("Waited", $waited, "seconds");
|
||||
}
|
||||
|
Reference in New Issue
Block a user