一、并行复制主库涉及到三个部分
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阶段更新,和