mysql锁_32
innodb_print_all_deadlocks参数开始之后 会把所有的死锁信息打印到错误日志
create table z(a int, key (a))
insert into z values(1,10);
begin;
select * from z where a = 8 lock in share mode; 只锁住10,但是10本身不被锁住,只有gap锁
insert into z values(8); 保证值是唯一的
commit;
create table z(a int not null,unique key(a))
insert into z values(1,10);
s1:begin
insert into z values(8) s2:begin s3:begin
insert into z values(8) insert into z values(8)
rollback 插入成功 死锁
锁升级 锁迁移
./mysqld_debug启动mysql