diresu wrote:
> 
> Example:
> 
>   database state     process 1            process 2
>   --------------------------------------------------------
>       1              reading 1
>       1                                   reading 1
>       1              adding 1
>       1                                   adding 1
>       2              writing back the 
>                      result 2
>       2                                   writing back the
>                                           result 2
>   --------------------------------------------------------
>   the result is 2
>   but should be 3
> 

Process 2 experiences an update conflict.  It will either error out
immediately, or block until process 1's transaction resolves.

What you have described will not result in the value 3 being written to the
database.  You can't achieve your goal with simple database transactions
alone.  You have to serialize the access to the tables, by using table or
row locking, or by managing access with an interprocess semaphore.

It's likely that you can redesign your application architecture so you don't
encounter this conflict.

Regards,
Bill Karwin
-- 
View this message in context: 
http://www.nabble.com/simple-synchronization---transaction-question-tp18480201p18481630.html
Sent from the Zend Framework mailing list archive at Nabble.com.

Reply via email to