示例

行锁-InnoDB

  1. create table rlock(a int(10) unsigned not null auto_increment primary key)engine=InnoDB;
  2. insert into rlock(a) values(1),(2),(3);
  3. insert into rlock select null from rlock;

session1:
image.png
image.png
session2:
3. 行锁 - 图3
session3:
注意:Id-10的查询状态为updating而不是locked
image.png

验证InnoDB引擎中是否有一个请求阻塞

  1. show engine innodb status\G

image.png