[odb-users] Optimistic mode doesn't work for multiple select? (while another process update data)

Quentin Deldycke quentindeldycke at gmail.com
Thu Aug 28 11:11:17 EDT 2014


Thanks for your help!

I modified a bit my code to work as you suggested:

"start the transaction, query the database, and end the transaction".

Even if the architecture force me to be a bit more like:
"end the transaction if one is open, start the transaction, query the
database".

The actual architecture is a bit complicated, and i took time to see if
this wouldn't impact everything. But it seems everything is ok.
Sadly it is not as optimised as i would like...

Anyway, it is now working!

--
Deldycke Quentin



On 28 August 2014 14:53, Boris Kolpackov <boris at codesynthesis.com> wrote:

> Hi Quentin,
>
> Quentin Deldycke <quentindeldycke at gmail.com> writes:
>
> > I have a process A who query every 10 seconds on the database. Let's say
> > one entry having data 'ABCD'
> >
> > During the same time, a process (B) updates the value to 'EFGH'. (a mysql
> > client show me that data is correctly commited)
> >
> > A need to reset the transaction between each query or it will continue to
> > pull data 'ABCD'...
>
> I am not 100% sure what you mean by resetting the transaction but I
> suspect you have one long-running transaction that queries the database
> every 10 second. In that case, it is the expected behavior that you don't
> see changes made by other transactions running in parallel (the 'I' part
> in 'ACID'). In fact, I would expect your UPDATE transaction to block until
> this one is committed.
>
> The solution is not to have a long-lived transaction (i.e., start the
> transaction, query the database, and end the transaction).
>
> If this is not the setup that you have, then please show the code for
> both transactions.
>
> Boris
>


More information about the odb-users mailing list