乐观锁是基于比较的无锁并发控制机制。
CAS
mvcc
The general idea is this:
![Optimistic locking](https://enterprisecraftsmanship.com/images/2017/2017-09-18-1.png)
Optimistic locking
Each table you want to implement concurrent access to need a new column: Version
. This column is usually an integer or a timestamp. Every time a record in the table changes, its version changes with it.
https://enterprisecraftsmanship.com/posts/optimistic-locking-automatic-retry/