Versions Compared

Key

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

...

The following structures are used for the initial handshake between client and server:

Code Block

    class LearnerInfo {
        int protocolVersion;
        int serverid;
    }

The actual proposals are communicated between follower and leader using a single data structure:

Code Block

class QuorumPacket {
    int type; // Request, Ack, Commit, Ping, etc
    long zxid;
    buffer data;
    vector<org.apache.zookeeper.data.Id> authinfo; // only used for requests
}

...

  1. l The leader starts accepting connections from followers.
  2. f Followers connect the the leader and send FOLLOWERINFO.
  3. l Once the leader has quorum, it stops accepting connections, and sends LEADERINFO(e) to all followers, where e is greater than all f.acceptedEpoch in the quorum.
  4. f When the follower receives LEADERINFO(e) it will do one of the following:
    • if e > f.acceptedEpoch, the the follower sets f.acceptedEpoch = e and sends ACKEPOCH(e);
    • if e == f.acceptedEpoch, the follower does not send ACKEPOCH, but continues to next step;
    • if e < f.acceptedEpoch, the follower closes the connection to the leader and goes back to leader election;
  5. l The leader waits for a quorum of followers to send ACKEPOCH.
  6. 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

...