Back to Module 7 notes

These problems practise the five safety properties: reading log states, running elections and commits by hand, and locating the step of a proof that a bad execution would break. Logs are written as lists of terms, index 1 first.

Problem 1

Problem 7.1 (Up-to-date logs and the commit rule).
  1. Order these five logs from most to least up-to-date: , , , (empty), .
  2. A leader of term 5 in a cluster of has the log and . The matchIndex values of its four followers are . What does the commit rule allow? What changes when the follower with matchIndex 3 acknowledges index 4?
  3. True or false, with a reason: “An entry that is stored on every server is committed.”

Problem 2

Problem 7.2 (Three servers after three terms).

Three servers have these logs, written as (term, command): A has ; B has ; C has . (This is Kleppmann’s exercise 18 in the paper’s notation (1).)

  1. Describe a sequence of elections, appends and crashes that produces these logs.
  2. Which values can have on each server?
  3. Which servers can win an election for term 4, and with whose votes?
  4. Suppose B wins term 4. List the AppendEntries requests B sends to C until C’s log matches, and say when B can commit anything.

Problem 3

Problem 7.3 (Figure 8 with three servers).

Consider a variant of Raft whose commit rule omits the condition .

  1. Give an execution with three servers A, B, C in which two servers apply different commands at index 2. For every election, name the voters and check the up-to-date test.
  2. Point to the first step of your execution that correct Raft would not perform, and explain why the rest of the execution is then harmless.

Problem 4

Problem 7.4 (What the up-to-date test does and does not say).

For a log let , with for the empty log, and write if lexicographically (” is at least as up-to-date as ”). All logs below occur in one Raft execution.

  1. Prove that is reflexive, transitive and total. Give two lists of terms with the same key that are different, and explain why two logs of one Raft execution with the same key are equal (use part 4).
  2. Prove: if is a prefix of , then .
  3. Give two logs with such that is not a prefix of . Which step of the Leader Completeness proof deals with this case, and how?
  4. Prove: if and , then is a prefix of .

Problem 5

Problem 7.5 (Is this state possible?).

Five servers S1 to S5. For each situation, say whether it can occur in correct Raft. If not, name the property of paper Figure 3 it violates (and the rule that prevents it); if yes, describe how it arises.

  1. S1 and S2 are both leaders of term 3 (at different times).
  2. S1’s log is and S2’s log is .
  3. S2, as leader of term 2, set with log . Later S1 is leader of term 4 with log .
  4. S1 is leader of term 3 with log and ; S2 has log and .
  5. S1 has applied the term-2 entry at index 2, and S5 has applied the term-3 entry at index 2.
1.
Kleppmann M. Distributed Systems: Lecture Notes [Internet]. University of Cambridge, Computer Science Tripos Part IB; 2021. Available from: https://www.cl.cam.ac.uk/teaching/2122/ConcDisSys/dist-sys-notes.pdf