The two phase commit protocol is a distributed algorithm which lets all sites in a distributed system agree to commit a transaction.
The protocol results in either all nodes committing the transaction or aborting, even in the case of site failures and message losses.
https://martinfowler.com/articles/patterns-of-distributed-systems/two-phase-commit.html