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

Boris Kolpackov boris at codesynthesis.com
Thu Aug 28 08:53:53 EDT 2014


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