Distributed transaction
A transaction that changes data in 2 or more databases: either all commit, or all undo.
Example
A purchase charges in the payments database and lowers stock in another: 2 databases, 1 transaction.
Test yourself: Distributed transaction
Distributed transactions
What is a distributed transaction?
A purchase that charges in the payments database and lowers stock in another touches 2 databases.
Distributed transactions
A purchase committed in the payments database and failed in the stock one. What must happen?
Either both databases commit, or both undo: charging $50 without lowering stock breaks the data.
0/2
â–¶ Play