Course contentsShow
← System Design
Lesson 569 of 1,91916. Distributed TransactionsFree lesson

The Coordinator Role in 2PC

How a single coordinator orchestrates the commit decision across all participant nodes.

The Coordinator Role in 2PC

What you'll learn: How one special node acts as the "conductor" orchestrating a distributed transaction across all participants.


In Two-Phase Commit (2PC), the coordinator is a single node responsible for driving the entire transaction to completion or rollback. Think of it like a wedding officiant who asks "does anyone object?" and only proceeds when everyone agrees—or cancels the ceremony if anyone says no.

How the Coordinator Works

The coordinator maintains the authoritative decision about whether a transaction commits or aborts. Here's its job:

  1. Initiate the transaction: The coordinator receives the transaction request from a client or application.

  2. Prepare phase: It sends a PREPARE message to all participant nodes, asking "Can you commit this transaction?" Each participant checks if it can succeed (has resources, no conflicts, etc.) and responds YES or NO.

  3. Decision point: The coordinator collects all responses. If every participant votes YES, the coordinator decides to COMMIT. If any participant votes NO (or times out), it decides to ABORT.

  4. Commit phase: The coordinator sends the final decision (COMMIT or ABORT) to all participants, who then execute it.

  5. Persistence: The coordinator writes its decision to durable storage before announcing it, ensuring recovery is possible if it crashes.

Why a Single Coordinator?

Having one coordinator creates a single source of truth for the transaction outcome. This prevents split-brain scenarios where some nodes commit while others abort. However, it's also a single point of failure—if the coordinator crashes after deciding but before informing participants, the transaction blocks until recovery.

Key Takeaway: The coordinator in 2PC is the single authority that collects votes from all participants and makes the binding commit/abort decision, ensuring atomicity across distributed nodes.