新聞中心
本篇文章給大家分享的是有關(guān)如何解釋show engine innodb status中鎖部分的內(nèi)容,小編覺得挺實(shí)用的,因此分享給大家學(xué)習(xí),希望大家閱讀完這篇文章后可以有所收獲,話不多說,跟著小編一起來看看吧。
LOCK WAIT 2 lock struct(s), heap size 1136, 1 row lock(s)
MySQL thread id 4, OS thread handle 140665176164096, query id 575 localhost root update
insert into testpri values(13,10)
------- TRX HAS BEEN WAITING 9 SEC FOR THIS LOCK TO BE GRANTED:
RECORD LOCKS space id 723 page no 3 n bits 80 index PRIMARY of table `test`.`testpri` trx id 6953526 lock_mode X locks gap before rec insert intention waiting
Record lock, heap no 5 PHYSICAL RECORD: n_fields 4; compact format; info bits 0
0: len 4; hex 8000000f; asc ;;
1: len 6; hex 0000006a1a29; asc j );;
2: len 7; hex ba000040370110; asc @7 ;;
3: len 4; hex 80000014; asc ;;
如上:
lock struct 內(nèi)存結(jié)構(gòu) 一個(gè)事物可以包含多個(gè)鎖結(jié)構(gòu) 包含表鎖和行鎖結(jié)構(gòu) 對(duì)應(yīng)lock_rec_t和lock_table_t結(jié)構(gòu)體, LOCK WAIT 為鎖的一種狀態(tài)
為此我修改了源代碼關(guān)于鎖打印部分如下能夠看到各個(gè)鎖結(jié)構(gòu)體的類容:
---TRANSACTION 173210, ACTIVE 8 sec
2 lock struct(s), heap size 1160, 1 row lock(s)
MySQL thread id 2, OS thread handle 140737154311936, query id 174 localhost root cleaning up
---lock strcut(1):(Add by gaopeng) In modify Version I force check all REC_LOCK/TAB_LOCK chain! for this Trx
TABLE LOCK table `test`.`testmmm` trx id 173210 lock mode IX
---lock strcut(2):(Add by gaopeng) In modify Version I force check all REC_LOCK/TAB_LOCK chain! for this Trx
RECORD LOCKS space id 253 page no 3 n bits 80 index PRIMARY of table `test`.`testmmm` trx id 173210 lock_mode X locks rec but not gap
Record lock, heap no 9 PHYSICAL RECORD: n_fields 4; compact format; info bits 0
0: len 4; hex 80000023; asc #;;
1: len 6; hex 0000000298ee; asc ;;
2: len 7; hex d90000023d0110; asc = ;;
3: len 7; hex 67616f70656e67; asc gaopeng;;
heap size 這些內(nèi)存結(jié)構(gòu)體占用的堆內(nèi)存大小
1 row lock(s) 行鎖結(jié)構(gòu)鎖定一行數(shù)據(jù),一個(gè)lock_rec_t包含了page no同時(shí) 包含了行數(shù)+64 位的一個(gè)位圖,每一位對(duì)應(yīng)
page中heap no的位置。
RECORD LOCKS space id 723 page no 3:就是tablespace id和page 號(hào)
n bits 80:和這個(gè)page相關(guān)的鎖位圖的大小我的表為9條數(shù)據(jù) 還包含2個(gè)起始和結(jié)束虛擬列 及 64+11 bits,及75bits但是必須被8整除為一個(gè)字節(jié)就是80 bits
heap no 5:此行在page中的heap no heap no存儲(chǔ)在fixed_extrasize 中,heap no 為物理存儲(chǔ)填充的序號(hào),頁(yè)的空閑空間掛載在page free鏈表中(頭插法)可以重用,但是重用此heap no不變,
如果一直是insert 則heap no 不斷增加,并非按照KEY大小排序的邏輯鏈表順序,而是物理填充順序
0: len 4; hex 8000000f; asc ;; 聚合索引實(shí)際KEY 0XF 15 8位最高位為符號(hào)位1為正數(shù)
1: len 6; hex 0000006a1a29; asc j );;transaction id 虛擬行
2: len 7; hex ba000040370110; asc @7 ;;roll pointer 虛擬行
3: len 4; hex 80000014; asc ;; 行中其他數(shù)據(jù) 這里只有一個(gè) 0x14 20
以上就是如何解釋show engine innodb status中鎖部分的內(nèi)容,小編相信有部分知識(shí)點(diǎn)可能是我們?nèi)粘9ぷ鲿?huì)見到或用到的。希望你能通過這篇文章學(xué)到更多知識(shí)。更多詳情敬請(qǐng)關(guān)注創(chuàng)新互聯(lián)-成都網(wǎng)站建設(shè)公司行業(yè)資訊頻道。
文章題目:如何解釋showengineinnodbstatus中鎖部分的內(nèi)容-創(chuàng)新互聯(lián)
瀏覽地址:http://www.ef60e0e.cn/article/cdsgpc.html