List:MySQL++« Previous MessageNext Message »
From:Warren Young Date:August 6 2009 9:52pm
Subject:Re: Automatic Reconnect
View as plain text  
On Aug 6, 2009, at 3:42 PM, Dan Cook (dancook) wrote:

> The rub comes from connections that have not expired in the pool  
> after a
> server restart - the next grab will fail (I just tested this using  
> gdb).
> I don't think there is anything a programmer can do about this except
> retry.

Yes.  Even ping-on-grab() isn't 100% foolproof, as the DB server or  
network link could bounce between a successful ping and the query.   
So, if you either need a bulletproof system or these are common cases  
for you, you still need connection retry logic.

> But then how do you purge (expire) all the connections in the
> pool to get them to reset and do a fresh reconnect?

Ping-on-grab() would handle that.  I don't see a compelling reason to  
special-case this, dumping all the connections at once.  Just handle  
it as part of your normal connection robustness assurance code.
Thread
Automatic ReconnectNishant Mittal6 Aug
  • Re: Automatic ReconnectChris Morgan6 Aug
    • RE: Automatic ReconnectJim Wallace6 Aug
      • RE: Automatic Reconnectdancook)6 Aug
        • Re: Automatic ReconnectWarren Young6 Aug
          • RE: Automatic Reconnectdancook)6 Aug
            • Re: Automatic ReconnectWarren Young6 Aug
    • RE: Automatic ReconnectNishant Mittal6 Aug