[Zope-dev] deciding whether to do work in tpc_vote or tpc_finish
Chris Withers
chris at simplistix.co.uk
Tue Jun 8 07:47:20 EDT 2010
Laurence Rowe wrote:
> 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.
Okay, I see the two different cases. What's the recommended course of
action when you end up with two data managers where tpc_vote is the
"right" place to implement?
cheers,
Chris
More information about the Zope-Dev
mailing list