3 Replies Latest reply: May 2, 2012 4:42 AM by Dushyant Tiwari RSS

Isolation levels

Dushyant Tiwari Newbie

I saw there are 2 supported isolation levels of transactions in Infinispan: READ_COMMITTED  and RR.

 

However I am not able to see the functional difference between the two. Both using optimistic locking and pessimistic locking. The documentation says locks are acquired only when a put operation is done. Can you give me a test case where we can see the functional difference between the two. Also please explain conceptually what it means in infinispan domain. Because what would make sense for RR is taking a lock on read also.

 

Impact:

Consider the following case -

 

tx.begin()

 

read and check if a key exists

 

if not make a custom object and put

 

//Do some thing here - other cache operations.

 

tx.commit()

 

If we have 2 such transactions running simultanously even in RR level the second tx will over write the key - even with PESSIMISTIC locks which is not good! Am I mistaken somewhere?

 

Thanks,

Dushyant