...

/

Failures in the Two-Phase Commit Protocol

Failures in the Two-Phase Commit Protocol

Learn how 2PC behaves under node or network faults.

In a distributed system, nodes (coordinators or cohorts) can fail anywhere midway through the 2PC transaction. The network can delay or lose messages, or the network can partition the participants. In this lesson, we will learn how 2PC behaves when different faults occur.

Cohort failure

Let's analyze a few failure scenarios. For instance, in the illustration below, if one of the cohorts fails in the prepare phase, the coordinator cannot commit because it needs affirmative votes from all cohorts. So, the coordinator will terminate the transaction if any cohort is unavailable (does not respond before timeout). This requirement adversely affects the system's availability, as the failure of a single node can prevent transactions from taking place.

Access this course and 1400+ top-rated courses and projects.