mysql版本:
5.5.31-0ubuntu0.12.10.1-log
repeatable read隔离级别下client1:start transaction;
select count(1) from account;//发现有900条数据client2:start transaction;
insert into account set name='2';
select count(1) from account;//发现有901条数据
commit;这时候切换到client1:select count(1) from account;//发现还是只有900条数据
commit;
select count(1) from account;//发现这时候有901条数据
问:从试验看来client1的事务不是没有出现幻读吗?同样的操作我换成read committed隔离级别后,在client1确实出现了幻读。我是在哪里理解错了?
5.5.31-0ubuntu0.12.10.1-log
repeatable read隔离级别下client1:start transaction;
select count(1) from account;//发现有900条数据client2:start transaction;
insert into account set name='2';
select count(1) from account;//发现有901条数据
commit;这时候切换到client1:select count(1) from account;//发现还是只有900条数据
commit;
select count(1) from account;//发现这时候有901条数据
问:从试验看来client1的事务不是没有出现幻读吗?同样的操作我换成read committed隔离级别后,在client1确实出现了幻读。我是在哪里理解错了?
按照你的意思,幻读是属于不可重复读范畴里面的?
我查看了下资料说 repeatable read隔离级别可以繁殖脏读,不可重复读,但是不能防止幻读。
最后这个不能防止幻读我要如何模拟出来呢?可以举个例子吗?