DWQA QuestionsCategory: DatabaseThe raft algorithm confirms that the save is successful with more than half of the writes. How can the consistency be guaranteed if the accessed node is the node that has not been written
policeman asked 3 months ago

Suppose there are five nodes a, B, C, D and E (the current status is x), the client sends a status update request X – > y, writes three nodes a, B and C, and is confirmed to be saved (a, B and C are committed)

  1. If D and E are not synchronized to y (there is no uncommitted state in D and E), the client goes to D to get the state. At this time, the state of D is still X. how to ensure consistency at this time?
  2. If the Y state in D is still uncommitted, and the client goes to D to get the state, how do you deal with it?

Add two questions:
3. A is the leader, and the data of the five nodes are: a (0), B (0), C (0), D (0), e (0);
Write 3 and confirm. Nodes: a (0, 3), B (0, 3), C (0, 3), D (0), e (0);
If a hangs up and re elects in B, C, D and E, will D and e become new leaders? What if e becomes a leader and E’s data is not complete?4. A is the leader, and the data of the five nodes are: a (0), B (0), C (0), D (0), e (0);
Write 3 and confirm. Nodes: a (0,3), B (0,3), C (0,3), D (0,3-uncommitted), e (0,3-uncommitted);
If a hangs up at this time, will D and e become new leaders? If e becomes a leader, how to deal with e’s uncommitted data?

,Raft is a strong leader model. Only the leader handles the client request. Even if the client connects to the follower, the follower will forward the request to the leader for processing.Raft paper section 5.1:

The leader handles all client requests (if a client contacts a follower, the follower redirects it to theleader).

Question 3: D and e will not become leaders because their logs are older than those of B and C. B and C will not vote for D and E. Look at the last sentence:
image

1 Answers
oraoto answered 3 months ago

Raft is a strong leader model. Only the leader handles the client request. Even if the client connects to the follower, the follower will forward the request to the leader for processing.Raft paper section 5.1:

The leader handles all client requests (if a client contacts a follower, the follower redirects it to theleader).

Question 3: D and e will not become leaders because their logs are older than those of B and C. B and C will not vote for D and E. Look at the last sentence:
image

policeman replied 3 months ago

I see. Thank you