mysql xid_解析MYSQL BINLOG 二进制格式(7)--Xid_log_event/XID_EVENT

原创:转载请说明出处谢谢!

上接

http://blog.itpub.net/7728585/viewspace-2133188/ 解析MYSQL BINLOG 二进制格式(1)--准备工作

http://blog.itpub.net/7728585/viewspace-2133189/ 解析MYSQL BINLOG 二进制格式(2)--FORMAT_DESCRIPTION_EVENT

http://blog.itpub.net/7728585/viewspace-2133321/ 解析MYSQL BINLOG 二进制格式(3)--QUERY_EVENT

http://blog.itpub.net/7728585/viewspace-2133429/ 解析MYSQL BINLOG 二进制格式(4)--TABLE_MAP_EVENT

http://blog.itpub.net/7728585/viewspace-2133463/ 解析MYSQL BINLOG 二进制格式(5)--WRITE_ROW_EVENT

http://blog.itpub.net/7728585/viewspace-2133469/ 解析MYSQL BINLOG 二进制格式(6)--UPDATE_ROW_EVENT/DELETE_ROW_EVENT

class:Xid_log_event

event:XID_EVENT

event_code:16

这个事件是支持事物的存储引擎事物进行了commit,他会生成一个xid 号

但是源码的注释上也说明如下:

This is the subclass of Xid_event defined in libbinlogevent,

An XID event is generated for a commit of a transaction that modifies one or

more tables of an XA-capable storage engine

Logs xid of the transaction-to-be-committed in the 2pc protocol.

Has no meaning in replication, slaves ignore it

The inheritance structure in the current design for the classes is

as follows

文档中说明了他生成的方式

thd->transaction.xid_stae.xid.get_mysq_xid()

注意这个event并不是 row 格式特有的,statement模式也会有

这个event的解析很简单

--fixed data

empty

--variable data part

8 bytes:XID号,但是注意这个是和平台相关的也就是和操作系统使用的little-endian和

big-endian有关,和其他event的数字使用little-endian不一样这里特别说明

Xid_event

解析:

# at 445

#170214  3:38:37 server id 93157  end_log_pos 476 CRC32 0x70cfaab6

# Position  Timestamp   Type   Master ID        Size      Master Pos    Flags

#      1bd 3d 0b a2 58   10   e5 6b 01 00   1f 00 00 00   dc 01 00 00   00 00

#      1d0 c7 00 00 00 00 00 00 00  b6 aa cf 70             |...........p|

#       Xid = 199

COMMIT/*!*/;

c7 00 00 00 00 00 00 00 :linux little-endian显示,0XC7也就是XID=199

可以看到和mysqlbinlog出来的Xid = 199 一致,一旦出现了这个event代表事物

已经提交了

到此XID_EVENT解析完成

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/7728585/viewspace-2133502/,如需转载,请注明出处,否则将追究法律责任。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值