GTID 的生命周期

本文详细阐述了MySQL的Global Transaction Identifier (GTID)的生命周期,包括从源服务器的分配、事务提交、binlog记录、在replica上的应用与验证,以及在不同情况下的持久化过程,确保复制过程中事务的一致性和可靠性。
摘要由CSDN通过智能技术生成

GTID 的生命周期

1,A transaction is executed and committed on the replication source server. This client transaction is assigned a GTID composed of the source's UUID and the smallest nonzero transaction sequence number not yet used on this server. The GTID is written to the source's binary log (immediately preceding the transaction itself in the log). If a client transaction is not written to the binary log (for example, because the transaction was filtered out, or the transaction was read-only), it is not assigned a GTID

一个事务执行且提交后,会分配一个GTID(包含server_uuid和一个最小的非0事务序列号),如果事务被过滤或者只读,是不会分配GTID的。

2,If a GTID was assigned for the transaction, the GTID is persisted atomically at commit time by writing it to the binary log at the beginning of the transaction (as a Gtid_log_event). Whenever the binary log is rotated or the server is shut down, the server writes GTIDs for all transactions that were written into the previous binary log file into the mysql.gtid_executed table.

在commit之后,GTID会在写在binlog日志文件中(Gtid_log_event),当binlog切换或者mysql关闭后,gtid会被写到mysql.gtid_executed 表中。

 3,If a GTID was assigned for the transaction, the GTID is externalized non-atomically (very shortly after the transaction is committed) by adding it to the set of GTIDs in the gtid_executed system variable (@@GLOBAL.gtid_executed)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值