On 11/06/2010, at 1:48 PM, Antony Blakey wrote:
>
> On 11/06/2010, at 7:28 AM, James Reeves wrote:
>
>> On 10 June 2010 22:40, Michael Jaaka <[email protected]> wrote:
>>> Not good, since if database commit fail it is too late for dosync to
>>> rollback.
>>> In fact database commit should somehow cooparate with dosync commit
>>> which is just a case of distributed transaction.
>>
>> You're right. In which case, I don't believe there's a way to do this
>> without accessing the clojure.lang.LockingTransaction class directly.
>
> It's not possible to do this without a two phase commit, which would require
> quite a change to clojure's transactional mechanism in order to break the
> existing commit login into a prepare and commit.
Now that I think about it, you could do this in clojure if you treat the
clojure transaction as the last in line requiring prepare/commit. The final
transaction participant can fold the prepare/commit into a simple commit using
the following algorithm:
prepare all data sources
if any fail
rollback all data sources and rollback the clojure transaction
else
commit the clojure transaction
if it succeeds
commit all data sources
else
rollback all data sources
This doesn't give you full 2PC because it doesn't handle comms failure, but it
does handle normal transactional semantics.
Antony Blakey
-------------
CTO, Linkuistics Pty Ltd
Ph: 0438 840 787
If you pick up a starving dog and make him prosperous, he will not bite you.
This is the principal difference between a man and a dog.
-- Mark Twain
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en