• ADADADADAD

    如何解释show engine innodb status中锁部分的内容[ mysql数据库 ]

    mysql数据库 时间:2024-11-26 22:11:31

    作者:文/会员上传

    简介:

    LOCKWAIT2lockstruct(s),heapsize1136,1rowlock(s)MySQLthreadid4,OSthreadhandle140665176164096,queryid575localhostrootupdateinsertintotestprivalues(13,10)-------TR

    以下为本文的正文内容,内容仅供参考!本站为公益性网站,复制本文以及下载DOC文档全部免费。

    LOCKWAIT2lockstruct(s),heapsize1136,1rowlock(s)
    MySQLthreadid4,OSthreadhandle140665176164096,queryid575localhostrootupdate
    insertintotestprivalues(13,10)
    -------TRXHASBEENWAITING9SECFORTHISLOCKTOBEGRANTED:
    RECORDLOCKSspaceid723pageno3nbits80indexPRIMARYoftable`test`.`testpri`trxid6953526lock_modeXlocksgapbeforerecinsertintentionwaiting
    Recordlock,heapno5PHYSICALRECORD:n_fields4;compactformat;infobits0
    0:len4;hex8000000f;asc;;
    1:len6;hex0000006a1a29;ascj);;
    2:len7;hexba000040370110;asc@7;;
    3:len4;hex80000014;asc;;


    如上:
    lockstruct内存结构一个事物可以包含多个锁结构包含表锁和行锁结构对应lock_rec_t和lock_table_t结构体,LOCKWAIT 为锁的一种状态
    为此我修改了源代码关于锁打印部分如下能够看到各个锁结构体的类容:
    ---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;;

    heapsize这些内存结构体占用的堆内存大小
    1rowlock(s)行锁结构锁定一行数据,一个lock_rec_t包含了pageno同时包含了行数+64位的一个位图,每一位对应
    page中heapno的位置。
    RECORDLOCKSspaceid723pageno3:就是tablespaceid和page号
    nbits80:和这个page相关的锁位图的大小我的表为9条数据 还包含2个起始和结束虚拟列 及64+11 bits,及75bits但是必须被8整除为一个字节就是80bits
    heapno5:此行在page中的heapnoheapno存储在fixed_extrasize中,heapno为物理存储填充的序号,页的空闲空间挂载在pagefree链表中(头插法)可以重用,但是重用此heapno不变,
    如果一直是insert则heapno不断增加,并非按照KEY大小排序的逻辑链表顺序,而是物理填充顺序

    0:len4;hex8000000f;asc;;聚合索引实际KEY 0XF 158位最高位为符号位1为正数
    1:len6;hex0000006a1a29;ascj);;transactionid虚拟行
    2:len7;hexba000040370110;asc@7;;rollpointer虚拟行
    3:len4;hex80000014;asc;;行中其他数据这里只有一个 0x14 20

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

    将本文的Word文档下载到电脑

    推荐度:

    下载
    热门标签: engineinnodbshow