MySQL逻辑并行复制的实现

一、并行复制主库涉及到三个部分1、binlog类保持两个值/* Committed transactions timestamp */Logical_clock max_committed_transaction;/* "Prepared" transactions timestamp */Logical_clock transaction_counter;
摘要由CSDN通过智能技术生成
一、并行复制主库涉及到三个部分
1、binlog类保持两个值
/* Committed transactions timestamp */
Logical_clock max_committed_transaction;
/* "Prepared" transactions timestamp */
Logical_clock transaction_counter;

Logical_clock{offset state}
offset表示上一个binlog最后一个事务的序号
flush logs的时候,在MYSQL_BIN_LOG::open_binlog切换binlog生成新的binlog的时候,以下部分更新
max_committed_transaction和transaction_counter的offset
  /*
    At every rotate memorize the last transaction counter state to use it as
    offset at logging the transaction logical timestamps.
  */
  max_committed_transaction.update_offset(transaction_counter.get_timestamp());
  transaction_counter.update_offset(transaction_counter.get_timestamp());
max_committed_transaction:表示binlog最近提交的事务,每次组提交完成以后在,finish_commit调用update_max_committed更新max_committed_transaction值
transaction_counter:表示一个序列号,保持binlog中最新的提交事务

2、每个事务保持两个值
int64 last_committed;
int64 sequence_number;
last commit:本次组提交之前上次commit的事务,在事务commit 的binlog prepare 阶段调用store_commit_parent,保存last_committed为binlog的max_committed_transaction
sequence_number:事务在binlog内的序列号,在组提交的flush阶段更新,和
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值