1pc,one phase Commit, one stage commit
This is an ordinary transaction, only a single data source is involved.
The app communicates directly with the data source, starting with a transaction, then either commit, or rollback
2pc,two phase Commit, two phase commit
Transactions that address a distributed transaction that involves multiple data sources
Requires a TM (Transaction Managers, transaction manager, direct communication with the application) to participate with RM (Resource Manager, Resource Manager, which is the individual data source)
First stage: The TM requires the relevant RM to prepare the related resources (each RM has a 1PC transaction turned on and is in a commit/rollback state), and RM returns its status to the TM: Success/failure
Phase II: The TM receives feedback from each RM, and if all succeeds, the transaction can be executed correctly, sending a commit command to all RM, and if RM fails, sends the rollback command to all RM and rolls the entire transaction back
Problems that exist:
3pc,three phase Commit, three-phase commit
Improvements to the 2PC
Resources
Real-difference-between-one-phase-and-two-phase-xa-commit
1PC, 2PC, 3PC