How to support the 2pc with tikv go-client?

I want to know how the client support the 2pc flow. I read the example in the file txnkv.go with the link
client-go/txnkv.go at tidb-5.2 · tikv/client-go (
In the function ‘puts’ execute the ‘begin()’, then tx.set() , last tx.Commit().

Is this ‘puts()’ function support the 2pc flow? This function is just similar with putting ‘kv’ with transation. but I dont know how it implements the following flow in the red rectangle:

I think the 2PC happens in tx.Commit(). See for details, there is a twoPhaseCommitter to help commit the transaction:

1 Like