From 5742175dfe2f94d7dd971d58b775277b99ac05f8 Mon Sep 17 00:00:00 2001 From: Frank Cizmich Date: Tue, 31 Mar 2015 13:07:22 -0300 Subject: [PATCH] pt-table-sync avoid error when closing auxiliary db handles --- bin/pt-table-sync | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/bin/pt-table-sync b/bin/pt-table-sync index 36da0d28..588ddf34 100755 --- a/bin/pt-table-sync +++ b/bin/pt-table-sync @@ -11039,6 +11039,12 @@ sub disconnect { my $dbh = $host->{$thing}; next unless $dbh; delete $dsn_for{$dbh}; + # The following is for when misc_dbh loses + # connection due to timeout. Since it has nothing + # to commit we avoid reporting an error. + if ( $thing eq 'misc_dbh' && !$dbh->ping() ) { + next; + } $dbh->commit() unless $dbh->{AutoCommit}; $dbh->disconnect(); PTDEBUG && _d('Disconnected dbh', $dbh);