changelog_bot (changelog_bot) wrote in changelog,
changelog_bot
changelog_bot
changelog

[miscperl] r271: fix a bug that was causing dbcheck.pl an...

Committer: ldoolan
fix a bug that was causing dbcheck.pl and get-binlogs.pl to crash
U   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;

Tags: changelog_bot, miscperl, pm
Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 0 comments