Garage pool, prepared statements and DB connection failures

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Garage pool, prepared statements and DB connection failures

zecke-2
Hi!

first of all thank you for Garage(-MySQL) it has helped me a lot in a project. I have some questions for corner cases.

My application has a long-standing MySQL connection so the danger is that it is actually dead when I want to use
it. So my code is doing something like:

    [
      connection execute: 'SELECT 1+2'.
    ] on: Error do: [:err |].

    connection isConnected ifFalse: [
         connection connect].

Now I had something odd. I think I ended up in a case where for one MySQL request.. and failures.. I actually read
the result of the previous query. This means that code that tried to use 'atName:' of the result set failed miserably
and the issue seemed to have continued. I have modified the code my client code in two ways:

* In case a failure occurs I don't go through >>#close but get theStream of the netSession to close it directly. There is no point in sending a quit.
* I re-create the GADriver instead of calling >>#connect again


Somehow I think that my application is not that special in that regard and it would be nice if such and similar
features could go into the GAConnectionPool.

* GAConnectionPool>>#withConnectionDo: to avoid get/put connection
* Connections are validated only on returning connection but not when getting one.
* How would you use the GAConnectionPool with a prepared statement? E.g. like the validation block you could create a
>>#prepareBlock: that is executed when a new connection is created but where would you store the handles?
* Handling of ConnectionTimedOut? (e.g. validation fails and no new connection can be created?) E.g. on transient
failures (networking, mysqld restart, overload)?

holger

--
You received this message because you are subscribed to the Google Groups "DBXTalk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.