???????? MySQL ????????
???????? ???????[ 2016/11/18 11:49:36 ] ????????????? MySQL ????
????1????????????2016??11??15??????????bug???????????鵵?????????????????????????????????????
????2???????????????£??????????InnoDb???????????RR[REPEATABLE]??
-- ??????test1
CREATE TABLE test1 (
id int(11) NOT NULL AUTO_INCREMENT??
name varchar(10) NOT NULL??
PRIMARY KEY (id)
);
insert into test1 values('hello');
-- ??????test2
CREATE TABLE test2 (
id int(11) NOT NULL AUTO_INCREMENT??
name varchar(10) NOT NULL??
PRIMARY KEY (id)
);
-- Transcation 1
begin;
insert into test2 select * from test1 where id = 1;
delete from test1 where id = 1;
-- Transcation 2
begin;
insert into test2 select * from test1 where id = 1;
????3????????????
????Mysql ???????
????Deadlock occurs here because client A needs an X lock to delete the row. However?? that lock request cannot be granted because client B already has a request for an X lock and is waiting for client A to release its S lock. Nor can the S lock held by A be upgraded to an X lock because of the prior request by B for an X lock. As a result?? InnoDBgenerates an error for one of the clients and releases its locks. The client returns this error??
????????????mysql?????Щ??????????????????X???????????????????????S????
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11