[Zope-dev] deciding whether to do work in tpc_vote or tpc_finish

Laurence Rowe l at lrowe.co.uk
Tue Jun 8 05:42:34 EDT 2010


On 8 June 2010 09:51, Chris Withers <chris at simplistix.co.uk> wrote:
> Hi All,
>
> I need to write a data manger that interacts with a transactional system
> that doesn't support two phase commit.
>
> Looking for inspiration, I went to look at zope.sqlalchemy and
> zope.sendmail.
>
> In the non-tpc situation, the former does the "commit" in tpc_vote while
> the latter does it in tpc_finish.
>
> Which is "right"? What are the tradeoffs involved?

Committing in tpc_vote is right so long as you ensure your data
manager sorts last, and that there are no other data managers in the
transaction which are using the same trick. See:
https://mail.zope.org/pipermail/zodb-dev/2007-May/010996.html

For zope.sendmail, committing in tpc_finish makes sense, especially
when using QueuedMailDelivery because enqueuing the message in the
maildir is guaranteed to succeed (the file is just renamed on commit).
Any failure here would lead to a critical error and inconsistent state
between the transactional resources.

Laurence

Laurence.


More information about the Zope-Dev mailing list