@import url(http://www.tkk7.com/CuteSoft_Client/CuteEditor/Load.ashx?type=style&file=SyntaxHighlighter.css);@import url(/css/cuteeditor.css);
1. 使用默認隔離級別 repeatable read
2. 開始,使用 select @@tx_isolation 確認當前 session 的隔離級別,并且創建個表 create table tt (id int, name varchar(300)) engine=innodb
3. 啟動 transaction 1(t1),使用 start transaction
4. 啟動 transaction 2(t2), 再開個 mysql,使用 start transaction
5. 在 t2 執行 select * from tt
6. 在 t1 執行 insert into tt values(1, 'haha')
7. 在 t2 再次執行 select * from tt,是看不到數據的。
8. 在 t2 執行 update tt set name='hehe' where id=1
9. 在 t2 再再次執行 select * from tt,居然看到 id=1 那條 hehe 了!
10. 我們幻讀了......
參考自:
http://blog.bitfly.cn/post/mysql-innodb-phantom-read/
原作者寫得非常好
posted on 2011-08-02 17:59
哈哈的日子 閱讀(1463)
評論(4) 編輯 收藏