On Fri, Apr 07, 2006 at 09:13:15AM +0200, Kern Sibbald wrote:
> Bacula sets the mysql.reconnect flag to 1 prior to calling real_connect() so 
> the above behavior  in versions greater than 5.0.3 (implemented by a bunch of 
> idiots) explains the problem.
> 
> I wonder what you do in versions between 5.0.3 and 5.0.13.  I also wonder if 
> MYSQL_OPT_RECONNECT is available or at least ignored on older versions. Sorry 
> for the nasty comments, but the MySQL programmers are really not very 
> cleaver.  

You should have heard what came out of my cubical when they changed the default
output format of timestamp columns.

> I'm not intending to put a lot of MySQL version detecting code in Bacula. 
> Bacula already has enough of that kind of idiocy with Windows.  So, I would 
> appreciate it if someone who is using one of the new broken versions of MySQL 
> would research the issue enough to determine a reasonable way of working 
> around this problem ...

I'm not in a position to test MySQL 5.0 directly, but I've done a little more
research.

First off, there's the simple quick fix of just cranking the timeout value way
up on the server.  I've added an example of how to do this in the relevant FAQ
entry on the wiki.

The simplest way to change the behavior back to the old one appears to be to
simply move the assignment of the reconnect flag to after the call to
mysql_real_connect().  From the 5.0.3 changelog history:

-----
API change: the reconnect flag in the MYSQL structure is now set to 0 by
mysql_real_connect(). Only those client programs which didn't explicitly set
this flag to 0 or 1 after mysql_real_connect() experience a change.
-----

I've attached a trivial patch that does this just by moving the relevant line
around.

Finally, I looked at the MYSQL_OPT_RECONNECT option.  It didn't exist at all
before 5.0.13.  Currently, the code around that option just sets exactly the
same reconnect flag that bacula is tweaking.  The only reason I can think of to
bother checking for and using MYSQL_OPT_RECONNECT is if the internal structure
changes at some point, and the reconnect flag is no longer directly accessible.

-- 
Frank Sweetser fs at wpi.edu  |  For every problem, there is a solution that
WPI Network Engineer          |  is simple, elegant, and wrong. - HL Mencken
    GPG fingerprint = 6174 1257 129E 0D21 D8D4  E8A3 8E39 29E3 E2E8 8CEC


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
Bacula-users mailing list
Bacula-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bacula-users

Reply via email to