Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. l The leader starts accepting connections from followers.
  2. f Followers connect the the leader and send SERVERINFO(lastZxid, info).
  3. l The leader sends SERVERINFO(lastZxid, info) to followers that connect.
  4. l Once the leader has quorum, it stops accepting connections, and sends NEWEPOCH(e) to all followers, where e is greater than all f.acceptedEpoch in the quorum.
  5. f When the follower receives NEWEPOCH(e) it will do one of the following:
    • if e > f.acceptedEpoch, the the follower sets f.acceptedEpoch = e and sends ACK(e<<32);
    • if e == f.acceptedEpoch, the follower does not send ACK(e<<32), but continues to next step;
    • if e < f.acceptedEpoch, the follower closes the connection to the leader and goes back to leader election;
  6. l The leader waits for all a quorum of followers to ack NEWEPOCH(e)
  7. l If the following conditions are not met for all connected followers, the leader disconnects followers and goes back to leader election:
    • f.currentEpoch <= l.currentEpoch
    • if f.currentEpoch == l.currentEpoch, then f.lastZxid <= l.lastZxid

...

  1. l The leader does the following with each follower connected to it:
    1. adds the follower to the list of connections to send new proposals, so while the server is performing the next steps, it is queuing up any new proposals sent to the follower.
    2. does one of the following:
      • SNAP if the follower is so far behind that it is better to do a state transfer than send missing transactions.
      • TRUNC(zxid) if the follower has transactions that the leader has chosen to skip. The leader sets zxid to the last zxid in its history for the epoch of the follower.
      • DIFF if the leader is sending transactions that the follower is missing. The leader sends missing messages to the follower.
    3. sends a NEWLEADER(e);
    4. The leader releases any queued messages to the follower.
  2. f The follower syncs with the leader, but doesn't modify its state until it receives the NEWLEADER(e) packet. Once it does has received the new state it atomically applies any changes and the new state and sets f.currentEpoch = _e_e. It then sends ACK(e << 32).
  3. l Once the leader has received an acknowledgements from a quorum of followers, it takes leadership of epoch e and queues UPTODATE to all followers.
  4. f When a follower receives the UPDATE message, it starts accepting client connections and serving new state.
  5. l Leader starts accepting connections from followers again.

...