[ZODB-Dev] Supporting a DataManager without Two Phase Commit

Andreas Jung lists at zopyx.com
Fri May 4 20:46:58 EDT 2007



--On 4. Mai 2007 22:33:05 +0100 Laurence Rowe <l at lrowe.co.uk> wrote:
> Following a discussion with several of the sqlalchemy integration authors
> on #plone today we came up with the following hack to implement this:
> http://dev.plone.org/collective/browser/collective.lead/trunk/collective/
> lead/tx.py
>

I think z3c.zalchemy is doing it right:

"""
Changed how the two phase commit works.

This is how the two phase commit is used in zope.

    1. tpc_begin(txn)
    2. commit(txn)
    3. tpc_vote(txn)
    4. tpc_finish(txn)

What zalchemy is doing:

  - commit does a session.flush() which actually executes all sql 
statements.
  - tpc_finish() does a transaction.commit() in the sqlalchemy transaction
  - tpc_abort() does a transaction.rollback() in the sqlalchemy transaction

If commit fails or another DataManager fails, data is not commited to the
database.

Thanks to Michael Bayer (the author of sqlalchemy) who gave me the hint to
integrate sqlalchemy correctly into the two phase commit.

"""

Andreas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 186 bytes
Desc: not available
Url : http://mail.zope.org/pipermail/zodb-dev/attachments/20070505/250876fe/attachment.bin


More information about the ZODB-Dev mailing list