« Previous | Next » 

Revision 00698e35

ID00698e359fd18f068a9dd88e77b031a3f9e96383

Added by Christos Stavrakakis over 11 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