Merge lp:~percona-toolkit-dev/percona-toolkit/pt-table-sync-fails-to-close-one-db-handle-1401399 into lp:~percona-toolkit-dev/percona-toolkit/release-2.2.14

Proposed by Frank Cizmich
Status: Merged
Approved by: Frank Cizmich
Approved revision: 614
Merged at revision: 625
Proposed branch: lp:~percona-toolkit-dev/percona-toolkit/pt-table-sync-fails-to-close-one-db-handle-1401399
Merge into: lp:~percona-toolkit-dev/percona-toolkit/release-2.2.14
Diff against target: 16 lines (+6/-0)
1 file modified
bin/pt-table-sync (+6/-0)
To merge this branch: bzr merge lp:~percona-toolkit-dev/percona-toolkit/pt-table-sync-fails-to-close-one-db-handle-1401399
Reviewer Review Type Date Requested Status
Percona Toolkit developers Pending
Review via email: mp+255565@code.launchpad.net

Description of the change

Auxiliary db connections created at start of run sometimes timeout when their work is already done.
This change avoids confusing errors when closing connections at the very end of the tool run.

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'bin/pt-table-sync'
2--- bin/pt-table-sync 2015-01-23 10:19:56 +0000
3+++ bin/pt-table-sync 2015-04-08 19:36:52 +0000
4@@ -11039,6 +11039,12 @@
5 my $dbh = $host->{$thing};
6 next unless $dbh;
7 delete $dsn_for{$dbh};
8+ # The following is for when misc_dbh loses
9+ # connection due to timeout. Since it has nothing
10+ # to commit we avoid reporting an error.
11+ if ( $thing eq 'misc_dbh' && !$dbh->ping() ) {
12+ next;
13+ }
14 $dbh->commit() unless $dbh->{AutoCommit};
15 $dbh->disconnect();
16 PTDEBUG && _d('Disconnected dbh', $dbh);

Subscribers

People subscribed via source and target branches

to all changes: