当前位置:网站首页>mysql deadlock
mysql deadlock
2022-07-30 21:05:00 【Carrot rabbit】
1. View transactions in progress
SELECT * FROM information_schema.INNODB_TRX;
mysql> SELECT * FROM information_schema.INNODB_TRX \G;**************************** 1. row **************************trx_id: 331123705trx_state: RUNNINGtrx_started: 2022-07-19 13:47:12trx_requested_lock_id: NULLtrx_wait_started: NULLtrx_weight: 0trx_mysql_thread_id: 11355trx_query: NULLtrx_operation_state: NULLtrx_tables_in_use: 0trx_tables_locked: 0trx_lock_structs: 0trx_lock_memory_bytes: 360trx_rows_locked: 0trx_rows_modified: 0trx_concurrency_tickets: 0trx_isolation_level: REPEATABLE READtrx_unique_checks: 1trx_foreign_key_checks: 1trx_last_foreign_key_error: NULLtrx_adaptive_hash_latched: 0trx_adaptive_hash_timeout: 10000trx_is_read_only: 0trx_autocommit_non_locking: 0**************************** 2. row **************************trx_id: 331123681trx_state: RUNNINGtrx_started: 2022-07-19 13:47:09trx_requested_lock_id: NULLtrx_wait_started: NULLtrx_weight: 397trx_mysql_thread_id: 11409trx_query: update sys_role_user ruinner join sys_role r on ru.client_role_id = r.client_role_idinner join sys_user_center uc on ru.client_user_id = uc.idset ru.role_id = r.id, ru.open_id = uc.open_idwhere (ru.role_id is null or ru.open_id is null) and ru.update_time >= '2022-07-19 13:47:09'and ru.client_id = 'webApp' and ru.`enable` = '1000102'trx_operation_state: fetching rowstrx_tables_in_use: 3trx_tables_locked: 3trx_lock_structs: 397trx_lock_memory_bytes: 63016trx_rows_locked: 109781trx_rows_modified: 0trx_concurrency_tickets: 0trx_isolation_level: REPEATABLE READtrx_unique_checks: 1trx_foreign_key_checks: 1trx_last_foreign_key_error: NULLtrx_adaptive_hash_latched: 0trx_adaptive_hash_timeout: 9974trx_is_read_only: 0trx_autocommit_non_locking: 02 rows in set (0.00 sec)If it is found that trx_state is LOCK_WAIT, a deadlock occurs, you can use trx_mysql_thread_id mysql thread, and pass kill thread kill thread
2 . View locked transactions
SELECT * FROM INFORMATION_SCHEMA.INNODB_LOCKS;3. View transactions waiting for locks
SELECT * FROM INFORMATION_SCHEMA.INNODB_LOCK_WAITS;4. Check whether the table is locked
SHOW OPEN TABLES where In_use > 0;5. Resolving deadlocks
Remove deadlock
If you need to remove the deadlock, there is one of the simplest and rude ways, that is, after finding the process id, kill it directly.
View currently ongoing processes
show processlist// Also available
SELECT * FROM information_schema.INNODB_TRX;The process id found by these two commands is the same.
kill the process corresponding to the process
kill idVerify (after killing to see if there is still a lock)
SHOW OPEN TABLES where In_use > 0;边栏推荐
- IDEA2018.3.5取消双击Shift快捷键
- MySQL (2)
- MySQL_关于JSON数据的查询
- 【深度学习】目标检测|SSD原理与实现
- Image Restoration by Estimating Frequency Distribution of Local Patches
- GateWay实现负载均衡
- MySQL的DATE_FORMAT()函数将Date转为字符串
- Simple configuration of three-tier architecture
- How to make a deb package
- IDEA2018.3.5 cancel double-click Shift shortcut
猜你喜欢

5分钟搞懂MySQL - 行转列

数字货币期货现货交易技巧,把握关键进场的买入点!(纯干货)

2022-07-29 mysql/stonedb慢SQL-Q17-分析

【软件工程之美 - 专栏笔记】31 | 软件测试要为产品质量负责吗?

Oblique document scanning and character recognition (opencv, coordinate transformation analysis)

2021年软件测试面试题大全

MySQL的on duplicate key update 的使用

LeetCode·23.合并K个升序链表·递归·迭代

【深度学习】目标检测|SSD原理与实现

这本记述40年前历史的游戏书,预言的却是当下的事
随机推荐
MySQL----多表查询
【限时福利】21天学习挑战赛 - MySQL从入门到精通
【Codeforces思维题】20220728
QUALITY-GATED CONVOLUTIONAL LSTM FOR ENHANCING COMPRESSED VIDEO
DPW-SDNet: Dual Pixel-Wavelet Domain Deep CNNs for Soft Decoding of JPEG-Compressed Images
C language: detailed explanation of operators
深度学习模型训练前的必做工作:总览模型信息
如何制作deb包
Network layer protocol------IP protocol
Swift RegexBuilder Vs. Raku Grammar
外包干了三年,废了...
Flink_CDC搭建及简单使用
对List集合中每个对象元素按时间顺序排序
深入浅出边缘云 | 3. 资源配置
awk notes
Mysql8创建用户以及赋权操作
MySQL 删除表数据,重置自增 id 为 0 的两个方式
MySQL的 DDL和DML和DQL的基本语法
MySQL笔记2(函数,约束,多表查询,事务)
ENS emoji domain name is on fire!Hype or opportunity?