On Friday 07 April 2006 15:40, Frank Sweetser wrote:
> 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.

Every once in a while it is unavoidable to make a non-compatible change, but I 
find that more and more programmers (probably trained on Windows) make 
incompatible changes that could be avoided with a bit of thought ... so I 
probably would second whatever came out of your cubical.

>
> > 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 really don't understand why they just didn't do that in mysql_init() and 
leave the packet alone after that.

> -----
>
> 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.

Thanks for your research. You really have done us all a nice service here -- I 
wouldn't ever had thought that it could be fixed so simply.  I've applied 
your patch and will also post it on the web site ...

-- 
Best regards,

Kern

  (">
  /\
  V_V


-------------------------------------------------------
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