On Mon, 2006-10-16 at 23:17 +0200, Christoph Zwerschke wrote:
> Jeff Davis wrote:
> > The pgdb module appears to leave transactions idle. My understanding is
> > that this is not a good practice.
> > 
> > In particular, any client connecting with the pgdb module basically
> > prevents Slony from working. Slony waits for all active transactions to
> > complete for some of its operations, and that is indefinite if using
> > pgdb.
> > 
> > Is there a reason it leaves transactions idle? I don't think psycopg2
> > does that.
> 
> I assume you are already aware that PyGreSQL (DB-API2) does not 
> auto-commit; you have to do it manually.
> 

Yes.

> But I think I see your problem: Since there is no "begin transaction" 
> method in DBAPI2, PyGreSQL immediately sends a "begin transaction" after 
> opening a connection and after each commit or rollback command, even if 
> you do nothing. So it can sit there for hours with an opened transaction 
> and do nothing.
> 

Yeah, that's the problem I was experiencing. A daemon (not something I
wrote) maintains a pool of pgdb connections. Some of these connections
inevitably sit idle for days (or more). In this case, that means
transactions are open for days. Slony is essentially unable to operate
in this kind of environment. Also, there could be other bad side
effects, like interfering with VACUUM's ability to free resources.

> Instead, PyGreSQL should wait and send the "begin transaction" not until 
> the application is trying to execute the first real DML command.
> 

Exactly the behavior that I'd expect.

> Is this what you had in mind? Should be easy to fix.
> 

Great!

Thanks,
        Jeff Davis

_______________________________________________
PyGreSQL mailing list
[email protected]
http://mailman.vex.net/mailman/listinfo/pygresql

Reply via email to