1, any one technology, is to solve a problem, there is its use of the scene.
2, consider the following application scenario: A commander, a,b,c,d four generals in four directions, the commander set up a plan for the siege tomorrow. How to ensure that four generals execute siege commands at the same time?
The first stage: the commander sent to the general news, plans to siege tomorrow, four generals respectively reply is ready.
The second stage: The commander confirms whether the four generals are ready, if they are ready, issued orders, the siege tomorrow. If there is not ready, issued orders, give up the siege, four generals and then reply again said, know.
This is the two-phase commit, in order to resolve the distributed data consistency.
3, consider the following situation: General D because of something, did not reply to the Commander is ready, this time what problem?
Commander to wait, A,b,c also have to wait, and a,b,c can not arrange to do other things tomorrow (resources are occupied), how to solve this problem?
4, in the first phase, add a stage, the commander to check the general's reply is timed out, if the timeout, can be considered general D not ready, and then notify A,b,c abandon siege plan.
Two-phase commit and three-phase commit "distributed data consistency"