Wednesday, August 6, 2014

Rdbms-- Offline Locks/Optimistic locking

Offline lock is a term used for non blocking locks. It is also called as Optimistic Locking, which does not use exclusive/blocking database level locks to protect the concurrently accessed data.
Offline locks relies on version stamps. So we can think that each data record has a version stamp . Lets call it timestamp. So when a session retrieves the data, it also retrieves the version stamp/timestamp of it.. Also when a session posts its changes to the database, it posts the new version stamp/timestamp of the data too.
Another session updating the same data recover will see the version is updated, and then the conflict resolution occurs. The check is made during the update of the data , and conflict resolution methods may differ  according to the needs such as : We may return an error or we re-read the record including the new version stamp and try to apply our updates again and so on. 

Following is a schemantic explanation from dba.stackexchange.com . It explains this type of locking clearly..

No comments :

Post a Comment

If you will ask a question, please don't comment here..

For your questions, please create an issue into my forum.

Forum Link: http://ermanarslan.blogspot.com.tr/p/forum.html

Register and create an issue in the related category.
I will support you from there.