I'm currently exploring worst case scenarios of atomic commit protocols like 2PC and 3PC and am stuck at the point that I can't find out why 3PC can guarantee atomicity. That is, how does it guarantee that if cohort A commits, cohort B also commits?
Here's the simplified 3PC from the Wikipedia article:
Now let's assume the following case:
The results:
And there you have it: One cohort committed, another aborted. The transaction is screwed.
So what am I missing here? In my understanding, if the automatic commit on timeout (in precommit state) was replaced by infinitely waiting for a coordinator command, that case should work fine.
The article you quoted seems to cover this eventuality quite accurately: "The main disadvantage to this algorithm is that it cannot recover in the event the network is segmented in any manner." The case you've noted, where "A" simply goes off-line, translates to the "the network has been segmented" -- i.e. "A" is now in one segment, while "B" and the "Coordinator" are in another segment.
Various enhanced 3PC protocols to deal with this problem are discussed (among other places) in a paper by Kempster, Stirling and Thannish.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With