-
Notifications
You must be signed in to change notification settings - Fork 126
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
事务隔离性有点不对 #121
Comments
这个问题是我先发现的,过来打个卡,群主出来挨打! |
事务执行中,插入数据后,无法读取相同事务中已经插入的数据 |
希望在底层调用db的时候就锁定该db的session,因为目前的情况就是除非用session+原生语句的形式才能规避,这样着实就变得很不方便了,尤其是金融类型的项目,很多地方要用到事务,缺少了这个,几乎每个地方都要写语句了,所以……比较严重吧 |
已解决, 暂时没油打 tag, 使用 master版本即可 |
有劳了 |
感谢群主,我翘起来了,请尽情享用吧! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
先贴一下代码,其中,
wrong()
方法是使用gorose的事务来进行操作的.right()
使用的底层提供事务,并且分别预设事务级别isolation=0,1,2
三种不同事务级别进行同样的操作。wrong()
里的count
未能响应到insert的变化,而right()
是可以的。贴一下结果:
right() isolation=0:
1
right() isolation=1:
1
right() isolation=2:
1
wrong():
right()方法,分别对isolation=1,2,0进行操作,所得到的的count都是健康的1,也就是同事务里,count可以响应到插入,哪怕是未commit。
wrong()方法,count无法响应到insert的方法。
基于以上结论,猜测:
gorose的事务脏了,期望同事务下的
select count
和insert
可能各自进了不同的事务里,导致了事务隔离造成的count异常。go1.12.7
gorose/v2
win10 x64
mysql, docker image<36fcb346aa55> Ver 8.0.18 for Linux on x86_64
The text was updated successfully, but these errors were encountered: