
Two-Phase Commit Protocol
The Two-Phase Commit Protocol is a method used in computer systems to ensure all parts of a distributed database either commit (save) or abort (cancel) a transaction together, maintaining data consistency. In the first phase, the coordinator asks all involved systems if they are ready to save changes. If all agree, the process moves to the second phase, and everyone commits simultaneously. If any system cannot commit, the coordinator instructs all to cancel the operation. This way, the protocol guarantees that either all systems successfully complete the transaction or none do, preventing data conflicts.