← 返回刚才阅读的位置

知识卡片

结构图卡 · 10294.a.4.a.2.d.1.a.1 · 生成模型:未记录

两阶段提交全员同意

理解等级:中级

协调者先发送 Prepare,各参与者持久化准备情况后投票。全票同意才记录并通知 Commit,否则通知 Abort,各分片根据持久日志推进或撤销。准备成功意味着能够兑现后续提交指令,也意味着参与者要在等待期间保留必要的锁或状态。

参见 [[原子提交允许单点否决]]。

结构图:

sequenceDiagram
    participant C as 协调者
    participant A as 分片 A
    participant B as 分片 B
    C->>A: 准备
    C->>B: 准备
    A-->>C: 持久化后投票
    B-->>C: 持久化后投票
    alt 全部同意
      C->>A: 提交
      C->>B: 提交
    else 否决或未达成同意
      C->>A: 取消
      C->>B: 取消
    end
这张卡片看不懂?

已有反馈 · 0 条

    还没有人提交反馈。

    在整书笔记中的位置

    原书出处 · 1 处

    • Chapter 13. Distributed Transactions 两阶段提交 · 查看原书依据

      Operations within a transaction can change state across different partitions (each represented by a cohort). If even one of the cohorts votes to abort the transaction, the coordinator sends the Abort message to all of them. Only if all cohorts have voted positively does the coordinator send them

    参考来源

    - 位置:《Database Internals》Chapter 13. Distributed Transactions(book-source:extracted/Database Internals A deep-dive into how distributed data systems work (Alex Petrov)/_epub-src/OEBPS/ch13.html#two_phase_commit,段 29) - 结论依据:原文在第二阶段要求全票同意,并说明协调者和参与者逐步写耐久日志才能恢复。 - 原始内容:Operations within a transaction can change state across different partitions (each represented by a cohort). If even one of the cohorts votes to abort the transaction, the coordinator sends the Abort message to all of them. Only if all cohorts have voted positively does the coordinator send them