Re: [Sqlrelay-discussion] Patch to fix MySQLauto-reconnect (MYSQL_OPT_RECONNECT option)
Brought to you by:
mused
|
From: Renaud A. <re...@me...> - 2008-02-20 00:48:44
|
Hey David, I just tried again by enabling/disabling the MYSQL_OPT_RECONNECT line in mysqlconnection.C and I still get the same results. I'm running Centos 5.0 and MySQL 5.0.22. Here are the steps: 1. start sqlrelay instance 2. launch sqlrsh, run a query, verify that it's working ok, exit sqlrsh 3. restart mysqld 4. run sqlrsh again and run a query In step 4, when I'm running the sqlr-connection-mysql daemon compiled with MYSQL_OPT_RECONNECT enabled, the connection daemon reconnects to the database and the query is successful. When I'm running the sqlr-connection-mysql with MYSQL_OPT_RECONNECT disabled, the connection daemon cannot reconnect and the query fails. In order to reproduce this problem, I'm thinking that you might want to make sure you're running the same kind of sqlrelay.conf parameters I'm using. Here are the params for my SQL Relay instance: <instance id="sqlrelay-test" port="960" socket="/var/sqlrelay/tmp/sockets/sqlrelay-test.socket" dbase="mysql" connections="3" maxconnections="5" maxqueuelength="5" growby="1" ttl="5" endofsession="commit" sessiontimeout="1" runasuser="root" runasgroup="root" cursors="5" authtier="listener" handoff="pass" deniedips="" allowedips="" debug="none" maxquerysize="65536" maxstringbindvaluelength="4000" maxlobbindvaluelength="71680" idleclienttimeout="1" maxlisteners="100" listenertimeout="1" reloginatstart="false"> <users> <user user="test" password="test"/> </users> <connections> <connection connectionid="user_map" string="user=test;password=test;db=sqlrelaytest;host=localhost" metric="1" behindloadbalancer="no"/> </connections> </instance> The MySQL config file I'm using is very basic: [mysqld] datadir=/var/lib/mysql socket=/var/lib/mysql/mysql.sock old_passwords=1 [mysql.server] user=mysql basedir=/var/lib [mysqld_safe] log-error=/var/log/mysqld.log pid-file=/var/run/mysqld/mysqld.pid Hope that helps! Renaud. -----Original Message----- From: sql...@li... [mailto:sql...@li...] On Behalf Of David Muse Sent: Tuesday, February 19, 2008 7:16 AM To: Discussion of topics related to SQL Relay Subject: Re: [Sqlrelay-discussion] Patch to fix MySQLauto-reconnect (MYSQL_OPT_RECONNECT option) This patch appears to be more correct that the code I had before, so I'll apply it. Though even without this patch, I can't replicate the problem that several folks have reported. If I run an instance of mysql, run sqlrelay against it, run some queries through sqlrsh, stop the mysql server, run a query through sqlrsh, then restart the mysql server, sqlrelay successfully reconnects and the query goes through. I've tried several different versions of mysql and tried restart vs. stop/start, and other things, but I can't seem to reproduce the error. Could someone who's had trouble with this send me some more info. What version of mysql are you using, what platform, and exactly what steps are you using to reproduce the error? Thanks, David Muse dav...@fi... On Fri, 2008-02-15 at 00:17 -0500, David Muse wrote: > Cool. I'll give it a try and should be able to include it in the next > release. > > Thanks! > > Dave Muse > dav...@fi... > > > On Mon, 2008-02-11 at 18:05 -0800, Renaud Amar wrote: > > I wrote a small patch which fixes an issue I’ve noticed with the SQL > > Relay connection daemons for MySQL: > > > > the connection daemon doesn’t automatically reconnect to the MySQL > > database once it’s been disconnected (either when restarting mysqld or > > when the connection times out). I’ve also noticed that after being > > disconnected, the connection daemon usually gets stuck in a weird loop > > where it keeps trying to unsuccessfully send a query over and over. > > > > > > > > After looking through the mysql connection daemon code, I noticed that > > the code that is supposed to enable the MYSQL_OPT_RECONNECT option > > (in mysqlconnection.h and mysqlconnection.C) was ifdef’ed using a > > different #define symbol as the one used in the config.h file. > > > > Namely, it’s using “#ifdef MYSQL_OPT_RECONNECT” while config.h defines > > “HAVE_MYSQL_OPT_RECONNECT”. > > > > This patch simply modifies mysqlconnection.h and mysqlconnection.C to > > use HAVE_MYSQL_OPT_RECONNECT. > > > > > > > > This is probably the same issue Abraham Müller mentioned in a previous > > post (here: > > http://sourceforge.net/mailarchive/forum.php?thread_name=47739600.8090800%40gmx.de&forum_name=sqlrelay-discussion). > > > > Hopefully, this patch will fix this issue as well. > > > > > > > > > > > > > > > > Renaud. > > > > > > > > > > > > PS: when applying the patch in your spec file, in the %prep section, > > make sure you call it with the –p1 option, in order to strip one level > > of directories from the paths in the patch file. > > > > > > > > > > __________________________________________________ > > D O T E A S Y - "Join the web hosting revolution!" > > http://www.doteasy.com > > ------------------------------------------------------------------------- > > This SF.net email is sponsored by: Microsoft > > Defy all challenges. Microsoft(R) Visual Studio 2008. > > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ > > _______________________________________________ Sqlrelay-discussion mailing list Sql...@li... https://lists.sourceforge.net/lists/listinfo/sqlrelay-discussion __________________________________________________ D O T E A S Y - "Join the web hosting revolution!" http://www.doteasy.com ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ Sqlrelay-discussion mailing list Sql...@li... https://lists.sourceforge.net/lists/listinfo/sqlrelay-discussion |