You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modules-dev@httpd.apache.org by Frank Jones <jo...@gmail.com> on 2007/05/09 13:39:36 UTC
Re: [users@httpd] mod_dbd and mysql
[thread moved from users list]
On 5/8/07, Nick Kew <ni...@webthing.com> wrote:
> On Tue, 8 May 2007 08:11:13 -0500
> "Frank Jones" <jo...@gmail.com> wrote:
> > However, I don't know what to do if apr_dbd_pvselect using the
> > prepared statement returns 2013 (Lost connection).
> What MySQL version are you using? This appears to have changed between
> 4.1 (where mysql_ping would reestablish a lost connection) and 5.0
> (where it doesn't).
I'm using MySQL 5.0.22 on Ubuntu server 6.06 LTS with Apache/2.2.4.
> The correct solution is for your module to call apr_dbd_invalidate
> to invalidate the stale connection, then grab another from the pool.
> But alas, only your module can decide how many times to retry in
> case of problems.
I grepped the whole source tree for apr_dbd_invalidate and also
googled for it with no result. Is that the right name?
> BTW, this would be more on-topic on the dev or modules-dev list.
moved
Re: [users@httpd] mod_dbd and mysql
Posted by Frank Jones <jo...@gmail.com>.
On 5/9/07, Nick Kew <ni...@webthing.com> wrote:
> Aaargh! Sorry, I meant apr_reslist_invalidate.
>
> In penance, I'm going to try and find a bug report that discusses
> the issue. Aha, I think this is the one:
> http://issues.apache.org/bugzilla/show_bug.cgi?id=39329
> It was left open for more reports to come in (what variant of the fix
> will work best, etc). But it wants revisiting.
OK, I believe I have fully identified the problem now, and I don't
think that this bug report addresses my issue. My problem specifically
involves the mysql dbd provider (apr_dbd_mysql.c). When I create a
prepared statement with DBDPrepareSQL, that statement is created with
a call to apr_dbd_prepare. The mysql version of apr_dbd_prepare
creates its own connection to the database. It has to do this because
prepared statements are associated with a specific connection and
become invalid if that connection is closed. I can't just grab another
connection with ap_dbd_acquire because the prepared statement wouldn't
be valid for that connection and there's no way for me to change the
connection used by an apr_dbd_prepared_t. The only solution seems to
be to call apr_dbd_prepare to create a new prepared statement followed
by:
apr_hash_set ( dbd->prepared, label, APR_HASH_KEY_STRING, statement);
but this raises potential threading issues, doesn't it?
I'm new to apache development so please forgive me if I've made some
obvious mistake.
Re: [users@httpd] mod_dbd and mysql
Posted by Nick Kew <ni...@webthing.com>.
On Wed, 9 May 2007 06:39:36 -0500
"Frank Jones" <jo...@gmail.com> wrote:
> > The correct solution is for your module to call apr_dbd_invalidate
> > to invalidate the stale connection, then grab another from the pool.
> > But alas, only your module can decide how many times to retry in
> > case of problems.
>
> I grepped the whole source tree for apr_dbd_invalidate and also
> googled for it with no result. Is that the right name?
Aaargh! Sorry, I meant apr_reslist_invalidate.
In penance, I'm going to try and find a bug report that discusses
the issue. Aha, I think this is the one:
http://issues.apache.org/bugzilla/show_bug.cgi?id=39329
It was left open for more reports to come in (what variant of the fix
will work best, etc). But it wants revisiting.
--
Nick Kew
Application Development with Apache - the Apache Modules Book
http://www.apachetutor.org/