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

解决 AUTO-INC 锁中图文不一致问题 #302

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion mysql/lock/mysql_lock.md
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ InnoDB 存储引擎提供了个 innodb_autoinc_lock_mode 的系统变量,是

![](https://cdn.xiaolincoding.com/gh/xiaolincoder/mysql/锁/innodb_autoinc_lock_mode=2.png)

session A 往表 t 中插入了 4 行数据,然后创建了一个相同结构的表 t2,然后**两个 session 同时执行向表 t2 中插入数据**。
session A 往表 t 中插入了 4 行数据,然后 session B 创建了一个相同结构的表 t2,然后**两个 session 同时执行向表 t2 中插入数据**。

如果 innodb_autoinc_lock_mode = 2,意味着「申请自增主键后就释放锁,不必等插入语句执行完」。那么就可能出现这样的情况:

Expand Down
Loading