Skip to content
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

案例 5 的特殊重现 #7

Open
pickjob opened this issue Jun 20, 2019 · 2 comments
Open

案例 5 的特殊重现 #7

pickjob opened this issue Jun 20, 2019 · 2 comments

Comments

@pickjob
Copy link

pickjob commented Jun 20, 2019

Table: CREATE TABLE test(no VARCHAR(20) PRIMARY KEY, idx int)
Session1 :
insert into test(no, idx) values ('5', 14);
select sleep(2);
insert into test(no, idx) values ('7', 17);
Session:
update test set idx = 31 where no = 5 ;
这里锁的情形符合案例 5的描述,但是,有些奇怪,我试过,跟Session1 的插入的数据有关,也和Session2的no不用 字符而用 数字有关,极其特殊。。。

@aneasystone
Copy link
Owner

会出现死锁吗?能否提供下 test 表的初始数据?

@pickjob
Copy link
Author

pickjob commented Jun 21, 2019

会出现死锁吗?能否提供下 test 表的初始数据?
没有初始数据,就是用两个线程两个连接,机缘巧合重现了。。。你可以试试,我试过5.7, 8.0不知道为什么。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants