Versions Compared

Key

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

...

type

zxid

data

notation

meaning

SERVERINFO(11) aka FOLLOWERINFO

last zxid accepted

Info

SERVERINFO(lastZxid, info)

The follower has accepted up to lastZxid.

NEWEPOCH(9)

newEpoch << 32

n/a

NEWEPOCH(newEpoch)

A proposal to move to a new epoch.

DIFF(13)

last committed zxid

n/a

DIFF(lastCommittedZxid)

lastCommittedZxid is the last zxid committed by the leader.

TRUNC(14)

truncZxid

n/a

TRUNC(truncZxid)

Truncate the history to truncZxid

SNAP(15)

n/a

n/a

SNAP

A state transfer (aka snapshot) will be sent to the follower. this will be a fuzzy state transfer that may include zxids being sent to the follower. The state transfer will immediately follow this packet.

OBSERVERINFO(16)

last zxid accepted

n/a

OBSERVERINFO(lastZxid)

The observer has accepted up to lastZxid.

NEWLEADER(10)

lastZxid

n/a

NEWLEADER(lastZxid)

Accept this leader as the leader of the epoch of lastZxid.

UPTODATE(12)

n/a

n/a

UPTODATE

The follower is now uptodate enough to begin serving clients.

PROPOSAL(2)

zxid of proposal

proposed message

PROPOSAL(zxid, data)

Propose a message. (Request that it be accepted into a followers history.)

ACK(3)

zxid of proposal to ack

n/a

ACK(zxid)

Everything sent to the follower by the leader up to zxid has been accepted into its history (logged to disk).

COMMIT(4)

zxid of proposal to commit

n/a

COMMIT(zxid)

Everything in the followers history up to zxid should be committed (aka delivered).

INFORM(8)

zxid of proposal

data of proposal

INFORM(zxid, data)

Deliver the data. (Only used with observers.) i

Zab servers have the following state:

Name

Meaning

history

an on disk log of proposals accepted

lastZxid

zxid of the last proposal in the history

acceptedEpoch

the epoch number of the last NEWEPOCH packet accepted

currentEpoch

the epoch number of the last NEWLEADER packet accepted

Implementation assumptions

...

  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 The leader waits for a quorum of followers to connect all of whom has:
    • f.currentEpoch <= l.currentEpoch
    • if f.currentEpoch == l.currentEpoch, then f.lastZxid < l.lastZxid
  5. 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.
  6. f Followers send ACK(e<<32) if e > f.acceptedEpoch. (If e < f.acceptedEpoch, the follower will abandon the leader. If e == f.acceptedEpoch, the follower will not send ACK(e<<32), but will still maintain the connection to the leader.)
  7. l The leader waits for all followers to ack NEWEPOCH(e)

...