Search the web
Sign In
New User? Sign Up
altdotnet · Alt Dot.Net Discussions
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Want to share photos of your group with the world? Add a group photo to Flickr.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
What are the right semantics for automatic transaction management?   Message List  
Reply | Forward Message #4296 of 23235 |
Hi guys,

I am designing the transaction API of a framework that will allow .NET code to
run inside a
database server. For the ease of use, we do not want users to care about
transaction
management manually. There will be implicit transaction management much like
what we
can already do with System.Transactions.TransactionScope, but declaratively
(using a
custom attribute -- and PostSharp under the hood, of course ;- ). The aim is to
make it very, very easy to code applications running directly in the database
server.

I am in front of a dilemna and would like to hear your opinion about that.

Since transactions run in optimistic concurrency mode, there can be conflicts
during
commit. Of course the whole transaction fails in that case -- this is not the
problem.

The most common solution to a conflict is to restart the whole transaction.
Since
transactions are defined declaratively, the server is in charge, and we can
execute again
the block that actually opened the transaction.

Of course, restarting a transaction is safe *only* the sole effects of the code
are either
transactional (can be rolled back), either idempotent (can be repeated).

We have currently no way to analyze the code to determine its effect.

Now, what's the best behavior?

1. Transactions are automatically restarted by default unless some block vote
against it (in
this case the conflict is not solved and the entire transaction failed).

2. Transaction are restarted only on demand, when a block asks it. But this
works only
when that block is actually a transaction boundary, i.e. it opened a new
transaction. So it
is quite limited. Another problem is that, if we make it on-demand, I expect
most of
programmers to forget to demand it. Conversely, I assume non-transactional code
(like
I/O) will be coded by more senior developers, so they won't forget to vote
against
automatic retrial.

Opinions welcome ;)

Gael - postsharp.org




Fri Mar 14, 2008 10:39 am

gfraiteur
Offline Offline
Send Email Send Email

Forward
Message #4296 of 23235 |
Expand Messages Author Sort by Date

Hi guys, I am designing the transaction API of a framework that will allow .NET code to run inside a database server. For the ease of use, we do not want users...
Gael Fraiteur
gfraiteur
Offline Send Email
Mar 14, 2008
10:39 am

Gael, I would do something like this: [Transaction] public virtual void DoSomething() {} [Transaction(RetriesOnFailure = 2)] public virtual void DoSomething2()...
Ayende Rahien
Ayende@...
Send Email
Mar 14, 2008
10:42 am

... Thank you for your answer. Actually, doing as you suggest would forbid to write: [Transaction] public virtual void DoSomething() { DoSometing2(); } because...
Gael Fraiteur
gfraiteur
Offline Send Email
Mar 14, 2008
10:54 am

Gael, Is this possibly an issue of semantics vis-a-vis your customer's requirements? What about a required "Enlist" attribute argument? ...
Christopher Atkins
ca_eg_ah
Offline Send Email
Mar 15, 2008
2:47 pm

Christipher, What I'm currently designing is the semantics of declarative transactions. I have no specific customer requirements. You, community, are the...
Gael Fraiteur
gfraiteur
Offline Send Email
Mar 17, 2008
9:28 am

If you want to see how this should work (it has already been done, rather nicely) you can take a look at the transaction facility for Castle Windsor! Ben...
Ben Lovell
benjamin.lovell@...
Send Email
Mar 17, 2008
11:00 am

Yes, we would like to provide something similar than Castle transaction management. It is also similar to System.Transactions.TransactioScope. But none of...
Gael Fraiteur
gfraiteur
Offline Send Email
Mar 17, 2008
3:10 pm

that is because generally this is not a good thing to do at the method level. the problem is transient state that is not under the current transaction. A...
Ayende Rahien
Ayende@...
Send Email
Mar 17, 2008
4:04 pm

What you want to retry is not the method level, but the request level....
Ayende Rahien
Ayende@...
Send Email
Mar 17, 2008
4:05 pm

I agree. In most of the case the transaction will be at request level, i.e. the outtest method. The transaction boundary is the service boundary. But I want...
Gael Fraiteur
gfraiteur
Offline Send Email
Mar 17, 2008
8:11 pm

Oh, that is certainly the case, but shouldn't cause much issue Store it in local storage and check if one already exists....
Ayende Rahien
Ayende@...
Send Email
Mar 18, 2008
9:39 am

I'd go for Opt-out, but let the user decide the default behavior on it's configuration. Regards, ... -- Claudio Figueiredo jcfigueiredo@... ...
Cláudio Figueiredo
jcfigueiredojr
Offline Send Email
Mar 17, 2008
2:32 pm
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help