Imagine moving money between two banks, or booking a flight and a hotel in one click. The change has to happen everywhere or nowhere — half a transfer, with money leaving one account but never arriving in the other, is a disaster. Computer scientists call this property atomicity: all of it commits, or all of it is undone.
That is easy on a single machine. But when the data lives on several machines that can crash or lose messages at any moment, getting them to agree becomes surprisingly delicate. How do you make independent computers either all say "yes, it's done" or all roll back together?
The classic answer, designed in the 1970s and still running inside databases today, is the two-phase commit protocol (2PC): first everyone votes, then everyone acts on the unanimous result.
Comments
Loading comments...