相关疑难解决方法(0)

乐观锁定绝对安全吗?

当使用乐观锁定策略时,它可以解决如下的并发问题:

| the first transaction started        |
|                                      |  
| select a row                         |
|                                      |  the second transaction started
| update the row with version checking |
|                                      |  select the same row 
| commit txn                           |
|                                      |  update the row with version checking
|                                      |  
|                                      |  rolls back because version is dirty

但是,如果在极少数情况下,第二个事务中的更新是在第一个事务中的udpate之后但是在事务提交之前呢?

| the first transaction started        |
|                                      |  the second transaction started
| select a row                         |
|                                      |  select the same row …

optimistic-locking

5
推荐指数
1
解决办法
538
查看次数

标签 统计

optimistic-locking ×1