Subject Re: [firebird-support] Re: Fwd: How to avoid deadlock ?
Author Vander Clock Stephane
Thanks dimitry !

now yes it's work like i want ...

juste one remark, the with lock have a little weakness
again the equivalent lock with update ...

ex :

TranstactionStart
Insert ... fieldA=1;

then

Select ... where FieldA=1 with lock

=> return imediatly :(



On 1/14/2012 12:01 PM, Dmitry Yemanov wrote:
>
> 14.01.2012 0:29, Vander Clock Stephane wrote:
> >
> > What i want to say :
> >
> > Table_A
> > Field_A
> > 12
> >
> > Transac 1 (isc_tpb_wait) :
> > update Table_A Set Field_A = Field_A + 1;
> >
> > At the same time
> >
> > Transac 2 (isc_tpb_wait) :
> > update Table_A Set Field_A = Field_A + 1;
> >
> > here we imagine a dead lock will appear !
> > but we set isc_tpb_wait to say to wait
> > that the lock dispear
> >
> > BUT the probleme is that at the begining
> >
> > Transac_1 Is the first to do the job (FieldA = 12)
> > Transac_2 wait (FieldA = 12)
> > Transac 1 finish the job (FieldA = 13)
> > Transac_2 ok i can do the job ... ooh no i can't because fieldA <> what
> > it was at the begining 12 :(
>
> As far as I understand, your problem can be worked around in two
> different ways in Firebird:
>
> a) by using read-committed no-record-version isolation mode
> b) by locking the records explicitly (SELECT WITH LOCK) before updating
>
> Dmitry
>
>


[Non-text portions of this message have been removed]