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

Andreas Jung lists at zopyx.com
Fri May 4 20:39:09 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
>
> The DataManager is given a high sortKey to ensure that it is considered
> last, and commits in tpc_vote, before the other (2PC) DataManagers'
> tpc_finish methods are called.
>
> The hack obviously relies on only one DataManager making use of the
> trick. It would be nice to make this was supported directly so that an a
> error could be thrown when more than one 1PC DataManager joined a
> transaction.

Well, the hack is really only a hack. As soon as more than one data manager 
is involved you'll run into the same problems. I have some apps with 
multiple SQL connections so this hack would give me nothing.

>
> This could be implemented by changing the signature of
> transaction._transaction.Transaction.join to have an optional
> single_phase argument (default would be False). The 1PC resource would
> then be registered seperately to the 2PC resources and _commitResources
> would call commit on the 1PC resource between tpc_vote and tpc_finish.
>
> If you think this would be helpful I'll try and supply a patch (need to
> look into the detail of how failed transactions are cleaned up).

You could resolve this issue only if all subsystems participating in 
transaction could rollback a commit happened with this transaction in case 
of a data manager failing during its 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/7ab9fb9f/attachment.bin


More information about the ZODB-Dev mailing list