Modified pool.lisp:acquire-from-conn-pool to perform connection
authorNathan Bird <nathan@acceleration.net>
Mon, 5 Jan 2009 19:18:42 +0000 (14:18 -0500)
committerNathan Bird <nathan@acceleration.net>
Tue, 2 Mar 2010 23:15:58 +0000 (18:15 -0500)
commit6f6e687a1a642b26d42f82b6f4b9bb5e65343fa3
tree882b5bdd51e64df2cc8dcdfd1f2d8c8b7d2833e7
parent9d73423f3fadcb51b64a43f4387366196956e24d
Modified pool.lisp:acquire-from-conn-pool to perform connection
validity checks on all returned connections. Pooled connections can
become invalid whenever the pipe goes down, (such as db reboot).

Where possible use a reset command against the DB, otherwise we
do a simple 'SELECT 1;' on the connection and catch any errors
that occur, disconnecting the connection if it is no longer valid.

Several databases have reset commands that also reset connection
variables back to their database defaults leading to more consistent
behavior from a new connection.
 * mssql - sp_reset_connection
 * postgres - "RESET ALL"

Also introduced clsql-sys:*db-pool-max-free-connections* which
is a heuristic threshold for when to disconnect a connection
rather than returning it to the pool.
sql/db-interface.lisp
sql/package.lisp
sql/pool.lisp