directory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kiran Ayyagari <kayyag...@apache.org>
Subject Re: [Mavibot] Transaction discussion
Date Sat, 08 Feb 2014 07:28:01 GMT
On Fri, Feb 7, 2014 at 11:29 PM, Emmanuel Lécharny <elecharny@gmail.com>wrote:

> Le 2/7/14 11:22 AM, Kiran Ayyagari a écrit :
> > On Fri, Feb 7, 2014 at 3:42 PM, Emmanuel Lécharny <elecharny@symas.com
> >wrote:
> >
> >> Hi,
> >>
> >> there are two things to consider in order to support transactions :
> >>
> >> - we could have automatique transaction per operation (ie, we don't have
> >> to start a transaction before issuing an operation)
> >> - we can also create a transaction explicitely, and use it across more
> >> than one operation.
> >>
> >> We want to support both cases.
> >>
> >> +1 , IMHO implicit transaction support is a MUST
>
> A complex MUST...
>
>
> >> This is not trivial, as we want to make it as easy as possible for our
> >> users. Typically, how should an operation know which kind of transaction
> >> it is dealing with ? Let's have a look at such an operation :
> >>
> >> insert :
> >>     // check if we are already into a txn
> >>     if (in transaction)        (1)
> >>         then
> >>             process operation
> >>         else
> >>             start transaction  (2)
> >>             process operation
> >>             commit operation
> >>
> >> so far, it seems ok, but what if another thread has started a
> >> transaction *just* after the test (1) and before (2) ? This is
> complicated.
> >>
> >> hmmm, how about using ThreadLocal,
> > and not sure we need to branch based on the presence of txn handle, the
> > start transaction(2)
> > should always give the txn handle present in ThreadLocal
>
> That would work if only we were in a single thread environment... In our
> case, we have no idea how many threads will try to write data in Mavibot.
>
> ThreadLocal is meant for multithreaded environments

>
> --
> Regards,
> Cordialement,
> Emmanuel Lécharny
> www.iktek.com
>
>


-- 
Kiran Ayyagari
http://keydap.com

Mime
View raw message