Re: Optimistic Locking and the Prepare Phase

2018-02-13 Thread Valentin Kulichenko
John, There is always a prepare phase during which locks are acquired and commit phase during which changes are finalized and locks are released. The only difference is that pessimistic transaction acquires each lock separately while keys are accessed, but optimistic transaction runs the prepare p

Re: Optimistic Locking and the Prepare Phase

2018-02-13 Thread John Wilson
Hi Vladimir, Your answer is what is depicted in the graphics and makes perfect sense to me. I guess what I'm confused about is what a "prepare" phase means and what "*In optimistic transactions, locks are acquired on primary nodes during the "prepare" phase* " means. My understanding of a "prepa

Re: Optimistic Locking and the Prepare Phase

2018-02-13 Thread Vladimir Ozerov
Hi John, 1) In PESSIMISTIC mode locks are obtained either on first update (READ_COMMITTED) or even read (REPEATABLE_READ). I.e. they obtained before prepare phase and are held for the duration of transaction. In OPTIMISTIC mode locks are obtained only after you call IgniteTransaction.commit(). 2)

Optimistic Locking and the Prepare Phase

2018-02-12 Thread John Wilson
Hi, The design doc below states: *" In optimistic transactions, locks are acquired on primary nodes during the "prepare" phase, then promoted to backup nodes and released once the transaction is committed. Depending on an isolation level, if Ignite detects that a version of an entry has been chan