2 Aug 2010 09:21
Re: Psycopg 2.2.x issue with PgBouncer
On 8/2/10, Daniele Varrazzo <daniele.varrazzo@...> wrote: > On Wed, Jul 28, 2010 at 4:28 PM, Marko Kreen <markokr@...> wrote: > > > This behavior is bad. The original user code was buggy - it closed > > the connection while in mid-transaction. PgBouncer was correct > > to drop the connection to force the server to do rollback. > > > > I recently had use-case in production env where such behaviour > > (making buggy client act as non-buggy client) was clearly broken: > > > > There was COPY-to-COPY pipeline, where target side got error. > > Now if I do .close() on source side, what happens? It starts > > to consume data until command end... Which is silly. > > > > Same can happen with big (async?) SELECT, where it's impossible > > to get rid of the connection. Even __del__ will consume data... > > > > Only way to get out of such situation would be: > > > > os.close(db.cursor().fileno()) > > > > but it seems silly to force users to use such workaround. > > > > My conclusion: .close() and .__del__() should close the > > connection immediately, without any workarounds, to guarantee > > predictable behavior. There is no need to drain data to > > issue ROLLBACK, because mid-trancation disconnect will > > do that anyway. > >(Continue reading)
RSS Feed