Course contentsShow
← System Design
Lesson 613 of 1,91917. Consensus AlgorithmsFree lesson

The Prepare Phase

How a proposer sends a prepare request and gathers promises from a majority of acceptors.

The Prepare Phase

What You'll Learn

You'll learn exactly how a proposer in Paxos initiates consensus by sending a prepare request and collecting promises from a majority of acceptors.

Core Idea

In the Paxos two-phase protocol, the Prepare Phase is where a proposer tries to reserve the right to make a proposal. Here's how it works:

  1. The proposer generates a unique proposal number (higher than any it's used before)
  2. It sends a prepare request with this proposal number to all acceptors
  3. Each acceptor responds with a promise not to accept any proposals numbered lower than this one
  4. If an acceptor has already accepted a previous proposal, it includes that proposal's value in its promise
  5. The proposer waits until it receives promises from a majority (quorum) of acceptors

Think of it like bidding at an auction: Before you can actually bid, you raise your paddle (prepare request) and wait for the auctioneer to acknowledge you. The auctioneer promises not to recognize anyone with a lower-numbered paddle, and tells you what the current highest bid is if one exists.

Why the Majority Matters

The prepare phase only succeeds if more than half of the acceptors respond with promises. This quorum requirement ensures that any two successful prepare phases must overlap in at least one acceptor. That overlapping acceptor guarantees information flows between competing proposers, which is essential for Paxos safety.

If the proposer can't get a majority, it must retry with a higher proposal number or give up.

Key Takeaway: The Prepare Phase lets a proposer "reserve" the right to propose by getting promises from a majority of acceptors, ensuring coordination even when multiple proposers compete simultaneously.