如何解释show engine innodb status中锁部分的内容

69次阅读
没有评论

共计 2313 个字符,预计需要花费 6 分钟才能阅读完成。

本篇文章给大家分享的是有关如何解释 show engine innodb status 中锁部分的内容,丸趣 TV 小编觉得挺实用的,因此分享给大家学习,希望大家阅读完这篇文章后可以有所收获,话不多说,跟着丸趣 TV 小编一起来看看吧。

 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  内存结构   一个事物可以包含多个锁结构   包含表锁和行锁结构   对应 lock_rec_t 和 lock_table_t 结构体, LOCK WAIT 为锁的一种状态
为此我修改了源代码关于锁打印部分如下能够看到各个锁结构体的类容:
—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  这些内存结构体占用的堆内存大小
 1 row lock(s)  行锁结构锁定一行数据,一个 lock_rec_t 包含了 page no 同时   包含了行数 +64  位的一个位图,每一位对应
 page 中 heap no 的位置。
 RECORD LOCKS space id 723 page no 3:就是 tablespace id 和 page  号
 n bits 80:和这个 page 相关的锁位图的大小我的表为 9 条数据 还包含 2 个起始和结束虚拟列 及  64+11 bits,及 75bits 但是必须被 8 整除为一个字节就是 80 bits
 heap no 5:此行在 page 中的 heap no heap no 存储在 fixed_extrasize  中,heap no  为物理存储填充的序号,页的空闲空间挂载在 page free 链表中(头插法) 可以重用,但是重用此 heap no 不变,
  如果一直是 insert  则 heap no  不断增加,并非按照 KEY 大小排序的逻辑链表顺序,而是物理填充顺序  
 
 0: len 4; hex 8000000f; asc ;;  聚合索引实际 KEY 0XF 15   8 位最高位为符号位 1 为正数
 1: len 6; hex 0000006a1a29; asc j );;transaction id  虚拟行
 2: len 7; hex ba000040370110; asc @7 ;;roll pointer  虚拟行
 3: len 4; hex 80000014; asc ;;  行中其他数据   这里只有一个 0x14 20 

以上就是如何解释 show engine innodb status 中锁部分的内容,丸趣 TV 小编相信有部分知识点可能是我们日常工作会见到或用到的。希望你能通过这篇文章学到更多知识。更多详情敬请关注丸趣 TV 行业资讯频道。

正文完
 
丸趣
版权声明:本站原创文章,由 丸趣 2023-07-19发表,共计2313字。
转载说明:除特殊说明外本站除技术相关以外文章皆由网络搜集发布,转载请注明出处。
评论(没有评论)