Committer: ldoolan
fix a bug that was causing dbcheck.pl and get-binlogs.pl to crashU trunk/DBI/Role.pm
Modified: trunk/DBI/Role.pm =================================================================== --- trunk/DBI/Role.pm 2011-08-31 04:32:47 UTC (rev 270) +++ trunk/DBI/Role.pm 2011-09-20 12:28:47 UTC (rev 271) @@ -325,14 +325,14 @@ # check replication/busy processes... see if we should not use # this one undef $dbh if connection_bad($dbh, $opts); - - # default wait_timeout is 60 seconds. - $dbh->do("SET SESSION wait_timeout = 600"); - - # if this is an unshared connection, we don't want to put it - # in the cache for somebody else to use later. (which happens below) - return $dbh if $opts->{'unshared'}; - + if ($dbh) { + # default wait_timeout is 60 seconds. + $dbh->do("SET SESSION wait_timeout = 600"); + + # if this is an unshared connection, we don't want to put it + # in the cache for somebody else to use later. (which happens below) + return $dbh if $opts->{'unshared'}; + } # mark server as dead if dead. won't try to reconnect again for 5 seconds. if ($dbh) { $self->{'DB_USED_AT'}->{$fdsn} = $now;