« Previous | Next » 

Revision 5f6ad491

ID5f6ad4918b409cffe05193e785e1c5513297469e

Added by Christos Stavrakakis almost 10 years ago

Fix cleanup of DB pooled connections

Fix bug in cleanup of DB pooled connections before putting them back to
the pool. The way the connection was cleaned, resulted in mishandling of
the transactions.

Accoring to psycopg2 docs, in case of a READ COMMITED isolation level:

"A new transaction is started at the first execute() command on a cursor
and at each new execute() after a commit() or a rollback()".

Cleaning the connection by executing "ABORT;RESET ALL", resulted in
starting a new transaction which was immediatly aborted:

BEGIN; SET TRANSACTION ISOLATION LEVEL READ COMMITTED
ABORT; RESET ALL

Also this resulted in database queries that were executed in connections
from pool, to possible run without being inside a transaction.

Files

  • added
  • modified
  • copied
  • renamed
  • deleted

View differences