`

乐观锁

阅读更多
推荐文章:http://tiro-li.iteye.com/blog/1908379

可以在数据库中模拟整个过程

SELECT @@tx_isolation;

SET SESSION TRANSACTION ISOLATION LEVEL  SERIALIZABLE; 

start transaction;  
select * from `serializable`;

update `serializable` set maxid = '1603196' where  tablename = '_order';
-- update `serializable` set maxid = '1603196', version = 8 where  tablename = '_order' and version < 8;

COMMIT;

模拟方式是:新建2个事务,分别顺序执行到COMMIT之前,看数据更新情况
重点是理解,乐观锁的version字段起到的作用

关于innodb事务机制 http://xin3336019-sina-com.iteye.com/admin/blogs/2009103
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics