In our user environment, we find deadlock cause by this example.However, in this case, sometimes session 2 and session 3 lead to dead lock and sometimes it won’t.create table t(a int AUTO_INCREMENT, b int, PRIMARY KEY (a));
insert into t(a, b) values(10, 8);
insert into t(a, b) values(5, 8);
session 1: begin; delete from t where a=5;
session 2: insert into t(a, b) values (5, 8) on duplicate key update b = 11;
session 3: insert into t(a, b) values (5, 8) on duplicate key update b = 11;
session 1: commit;
# Then sometimes session 2 and session 3 lead to dead lock and sometimes it won't.I fin
...
继续阅读
(56)