3

Suppose a 3-member raft cluster a[master],b,c

Client sends the log to a, a replicates it to b and c, a apply the log to the status machine and response to client. Then a crashes before b and c have a chance to replicate the committed state to b and c.

b replaces a as cluster leader. What will happen to the uncommitted log while the log has been responded to the client?

Will it be replicated by b again or just discarded?

Then suppose a 4-member raft cluster a[master],b,c,d

Client sends a log to a, a replicates it to b and c (not to d), a applies the log to the status machine and responds to client, then a crashes before replication of the committed state to b and c and d.

d replaces a to be the cluster leader. Then what will happen to the uncommitted log while the log has been responded to the client? will it be just discarded?

Rakis
  • 7,779
  • 24
  • 25
bigwesthorse
  • 225
  • 2
  • 8

2 Answers2

3

I think you are confusing "committed" with "applied". The entry is considered committed because it was saved in the majority of servers, although not applied yet. B gets leader because its log is up to date and when it manages to apply one entry from its own term, will apply also that entry from A.

In your second scenario, D cannot be leader because its log is not up to date and B and C won't grant their vote.

vtortola
  • 34,709
  • 29
  • 161
  • 263
1

Section 5.4.2 and figure 8 in 《In Search of an Understandable Consensus Algorithm (Extended Version)》 has talk about a more complicated situation.

Q1. Any uncommitted log with different term from leader's CurrentTerm can be applied only when a new log (log's term equal leader's CurrentTerm) is commited. Or they will stay uncommited.

Q2. d will fail to be a leader.(just like S5 in figure 8.e)

owent
  • 118
  • 4