Re: PATCH: two phase commit
Federico Di Gregorio <fog-NGVKUo/i/[email protected]>
| Newsgroups | gmane.comp.python.db.psycopg.devel |
|---|---|
| Organization | initd.org |
| Message-ID | <[email protected]> |
Il giorno ven, 18/01/2008 alle 18.05 +0900, James Henstridge ha scritto: > On 18/01/2008, Federico Di Gregorio <fog-NGVKUo/i/[email protected]> wrote: > I've sent an email to the db-sig mailing list about this now: > http://mail.python.org/pipermail/db-sig/2008-January/005290.html Read. > I am not convinced that separating off the transaction commit API from > the connection is not a good idea. > > At one level, I am not hugely concerned by the API, since it is > unlikely to be used by many programmers -- instead only being used by > glue code that hooks the database connection into the transaction > manager (which is often DB specific anyway). This is true. > I did take a look for existing adapters for ideas and found two others: > > The kinterbasdb module adds a prepare() method to the connection > object. After calling this method, the standard commit() and > rollback() methods can be used to perform the second phase of the > commit. This would be implementable in psycopg2, with the following > caveats: > 1. we'd need to be able to generate unique transaction identifiers. > 2. it provides no way to commit a transaction prepared with another connection. First of all we can't user prepare() because that should be reserved for prepared statements. prepare_transaction() or even the very explicit prepare_current_transaction() (that is exactly what the method does) are fine. The ability to generate XID is undubtely useful. The question is, we want to "lock" the connection untill the current prepared transaction is commited or we want to give the client the ability to set aside prepared transactions and execute them from a different connection? If nobody need the second one the first option is "safe"; you can even abort the currently prepared transaction on object dealloc. federico p.s. did you find M.A.L. answer confusing? I did.. :/ -- Federico Di Gregorio http://people.initd.org/fog Debian GNU/Linux Developer [email protected] INIT.D Developer fog-NGVKUo/i/[email protected] Gli avvoltoi cinesi si nutrono di arte, ma possono anche mangiare i `domani'. -- Haruki Murakami _______________________________________________ Psycopg mailing list Psycopg-IAPFreCvJWPBWskQ1e/[email protected] http://lists.initd.org/mailman/listinfo/psycopg
signature.asc
(application/pgp-signature, 189 B)
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) iD8DBQBHkH0DvcCgrgZGjesRAjKsAJ9kustcN9fZAvxhe/6f601RgqpKMgCdGEbF 1dp6sjled7bL21fzQXo9WWM= =K1gc -----END PGP SIGNATURE-----