pingcap / tidb-dev-guide

A comprehensive development guide to help you be more and more familiar with the TiDB community and become an expert finally.
https://pingcap.github.io/tidb-dev-guide/
118 stars 61 forks source link

Write down the first version of 1PC #118

Closed you06 closed 2 years ago

you06 commented 3 years ago

https://github.com/pingcap/tidb-dev-guide/blob/master/src/understand-tidb/1pc.md cc @MyonKeminta @tisonkun

tisonkun commented 3 years ago

@you06 an interesting question:

If I have 3 regions which leaders in one node, and now a transaction related to all these 3 regions, will TiDB apply it in 1PC or 2PC? In either way, how?

MyonKeminta commented 3 years ago

@you06 an interesting question:

If I have 3 regions which leaders in one node, and now a transaction related to all these 3 regions, will TiDB apply it in 1PC or 2PC? In either way, how?

2PC (either old 2PC or async commit). That's because our current implementation of 1PC depends on the atomicity of single write batch on a single region. If there are multiple regions involved, we can't provide the atomicity.