mirror of
https://github.com/percona/percona-toolkit.git
synced 2026-02-27 02:00:57 +08:00
PT-1829 Fixed reconnection in heartbeat
This commit is contained in:
@@ -6386,19 +6386,6 @@ sub main {
|
||||
sleep $next_interval - $time;
|
||||
PTDEBUG && _d('Woke up at', ts(time));
|
||||
|
||||
if ( $o->get('check-read-only') && $o->get('update') ) {
|
||||
my $read_only_interval = $o->get('read-only-interval') || $interval;
|
||||
while (server_is_readonly($dbh)) {
|
||||
PTDEBUG && _d("Server is read only. Sleeping for $read_only_interval seconds...");
|
||||
sleep($read_only_interval);
|
||||
if (
|
||||
-f $sentinel
|
||||
) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# Connect or reconnect if necessary.
|
||||
if ( !$dbh->ping() ) {
|
||||
$dbh = $dp->get_dbh($dp->get_cxn_params($dsn), { AutoCommit => 1 });
|
||||
@@ -6409,6 +6396,17 @@ sub main {
|
||||
$heartbeat_sth = undef;
|
||||
}
|
||||
|
||||
if ( $o->get('check-read-only') && $o->get('update') ) {
|
||||
my $read_only_interval = $o->get('read-only-interval') || $interval;
|
||||
while (server_is_readonly($dbh)) {
|
||||
PTDEBUG && _d("Server is read only. Sleeping for $read_only_interval seconds...");
|
||||
sleep($read_only_interval);
|
||||
if (-f $sentinel) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( $o->get('monitor') ) {
|
||||
$heartbeat_sth ||= $dbh->prepare($heartbeat_sql);
|
||||
my ($delay) = $get_delay->($heartbeat_sth);
|
||||
|
||||
Reference in New Issue
Block a user