3-Phase Commit (3PC)

In this lesson, we will look into how the 3-phase commit protocol solves the problem of the 2-phase commit protocol.

The problem with 2-phase commit protocol

As we described previously, the main bottleneck of the 2-phase commit protocol was failures of the coordinator leading the system to a blocked state.

Ideally, we would like the participants to be able to take the lead in some way and continue the execution of the protocol in this case, but this is not so easy.

The underlying reason is the fact that in the commit phase, the participants are not aware of the state of the other participants—only the coordinator is So, taking the lead without waiting for the coordinator can result in breaking the atomicity property.

For instance, imagine the following scenario: in the commit phase of the protocol, the coordinator manages to send a commit (or abort) message to one of the participants but then fails, and this participant also fails. If one of the other participants takes the lead, it will only be able to query the live participants. So, it will be unable to make the right decision without waiting for the failed participant (or the coordinator) to recover.

Get hands-on with 1400+ tech skills courses.