Posts

Showing posts from April, 2017

Mongo - Custom pessimistic locking mechanism

Problem:Having one thread updating a document at a time.
Solution:Lock manager:


, lock implementation:


, how to:
1) check if the document is locked
2) acquire the lock
3) release the lock