中文字幕av专区_日韩电影在线播放_精品国产精品久久一区免费式_av在线免费观看网站

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

MySQL InnoDB設置死鎖檢測的方法

發布時間:2020-08-11 00:03:41 來源:ITPUB博客 閱讀:309 作者:chenfeng 欄目:MySQL數據庫
死鎖是指兩個或兩個以上的進程在執行過程中,因爭奪資源而造成的一種互相等待的現象,可以認為如果一個資源被鎖定,它總會在以后某個時間被釋放。而死鎖發生在當多個進程訪問同一數據庫時,其中每個進程擁有的鎖都是其他進程所需的,由此造成每個進程都無法繼續下去。
InnoDB的并發寫操作會觸發死鎖,InnoDB也提供了死鎖檢測機制,可以通過設置innodb_deadlock_detect參數可以打開或關閉死鎖檢測:


innodb_deadlock_detect = on  打開死鎖檢測,數據庫發生死鎖時自動回滾(默認選項)
innodb_deadlock_detect = off  關閉死鎖檢測,發生死鎖的時候,用鎖超時來處理,通過設置鎖超時參數innodb_lock_wait_timeout可以在超時發生時回滾被阻塞的事務


還可以通過設置InnDB Monitors來進一步觀察鎖沖突詳細信息
設置InnoDB Monitors方法
建立test庫
mysql>create database test;
Query OK, 1 row affected (0.20 sec)
mysql> use test
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A


Database changed
mysql> create table innodb_monitor(a INT) engine=innodb;
Query OK, 0 rows affected (1.04 sec)


mysql> create table innodb_tablespace_monitor(a INT) engine=innodb;
Query OK, 0 rows affected (0.70 sec)


mysql> create table innodb_lock_monitor(a INT) engine=innodb;
Query OK, 0 rows affected (0.36 sec)


mysql> create table innodb_table_monitor(a INT) engine=innodb;
Query OK, 0 rows affected (0.08 sec)


可以通過show engine innodb status命令查看死鎖信息
mysql> show engine innodb status \G
*************************** 1. row ***************************
  Type: InnoDB
  Name: 
Status: 
=====================================
2018-05-10 09:17:10 0x7f1fbc21a700 INNODB MONITOR OUTPUT
=====================================
Per second averages calculated from the last 46 seconds
-----------------
BACKGROUND THREAD
-----------------
srv_master_thread loops: 53 srv_active, 0 srv_shutdown, 240099 srv_idle
srv_master_thread log flush and writes: 0
----------
SEMAPHORES
----------
OS WAIT ARRAY INFO: reservation count 2007
OS WAIT ARRAY INFO: signal count 1987
RW-shared spins 3878, rounds 5594, OS waits 1735
RW-excl spins 3, rounds 91, OS waits 4
RW-sx spins 1, rounds 30, OS waits 1
Spin rounds per wait: 1.44 RW-shared, 30.33 RW-excl, 30.00 RW-sx
------------
TRANSACTIONS
------------
Trx id counter 78405
Purge done for trx's n:o < 78404 undo n:o < 10 state: running but idle
History list length 21
LIST OF TRANSACTIONS FOR EACH SESSION:
---TRANSACTION 421249967052640, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
--------
FILE I/O
--------
I/O thread 0 state: waiting for completed aio requests (insert buffer thread)
I/O thread 1 state: waiting for completed aio requests (log thread)
I/O thread 2 state: waiting for completed aio requests (read thread)
.............................................................................
.............................................................................
.............................................................................

向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

黄骅市| 青冈县| 慈利县| 弥渡县| 奇台县| 万盛区| 无为县| 赤水市| 海林市| 广汉市| 兴安盟| 晴隆县| 红桥区| 莒南县| 梅州市| 伊吾县| 遵化市| 南安市| 乐清市| 桦南县| 施甸县| 梧州市| 阳春市| 汉寿县| 武夷山市| 汝阳县| 胶州市| 崇仁县| 沂水县| 育儿| 龙里县| 吉首市| 灵丘县| 错那县| 尚志市| 靖边县| 鹰潭市| 榆林市| 巨鹿县| 新泰市| 昌宁县|