2段提交
Note left of Coordinator: Voting phase
Coordinator->Cohort1: query
Coordinator->Cohort2: query
Cohort1-->Coordinator: yes/no
Note right of Cohort1: prepare/abort
Cohort2-->Coordinator: yes/no
Note right of Cohort2: prepare/abort
Note left of Coordinator: Commit phase
Coordinator->Cohort1: commit/rollback
Coordinator->Cohort2: commit/rollback
Cohort1-->Coordinator: acknowledgment
Note right of Cohort1: commit/abort
Cohort2-->Coordinator: acknowledgment
Note right of Cohort2: commit/abort
提交请求阶段
- 协作者给各个执行者发送提交请求;
- 执行者接收到提交请求,开始执行事务,双方记录回滚和重试日志;
- 执行者执行完事务,通知协作者是否可以执行提交,挂起资源等待协作者的通知;
提交阶段
- 协作者接收到所有的执行者的通知以决定发起提交或回滚请求;
- 每个执行者完成协作者的指令,释放资源;
- 协作者等待所有的执行者的 ack 后完成事务;
3段提交
时间: 2024-10-23 03:51:50