giaosame / mit-6.5840-distributed-system

0 stars 0 forks source link

The "majority" should be out of all servers #19

Closed giaosame closed 1 year ago

giaosame commented 1 year ago

In the Raft consensus algorithm, "majority" refers to a majority of all configured servers in the system, regardless of whether they are currently connected or not.

giaosame commented 1 year ago

After I set the majority to be strictly out of all the servers, including those disconnected servers, it was quite hard to pass the unit test TestManyElections2A of Lab2a. It usually failed because of the split vote. The following logs show an example:

=== RUN   TestManyElections2A
2023/05/13 08:54:28 [config.disconnect] disconnect the raft server 0
2023/05/13 08:54:28 [config.disconnect] disconnect the raft server 1
2023/05/13 08:54:28 [config.disconnect] disconnect the raft server 2
2023/05/13 08:54:28 [config.disconnect] disconnect the raft server 3
2023/05/13 08:54:28 [config.disconnect] disconnect the raft server 4
2023/05/13 08:54:28 [config.disconnect] disconnect the raft server 5
2023/05/13 08:54:28 [config.disconnect] disconnect the raft server 6
2023/05/13 08:54:28 [config.connect] connect the raft server 0
2023/05/13 08:54:28 [config.connect] connect the raft server 1
2023/05/13 08:54:28 [config.connect] connect the raft server 2
2023/05/13 08:54:28 [config.connect] connect the raft server 3
2023/05/13 08:54:28 [config.connect] connect the raft server 4
2023/05/13 08:54:28 [config.connect] connect the raft server 5
2023/05/13 08:54:28 [config.connect] connect the raft server 6
Test (2A): multiple elections ...
2023/05/13 08:54:29 [Raft.startElection] raft server 5 starts the election!
2023/05/13 08:54:29 [Raft.sendRequestVote] candidate 5 sends RequestVote to the raft server 0
2023/05/13 08:54:29 [Raft.sendRequestVote] candidate 5 sends RequestVote to the raft server 1
2023/05/13 08:54:29 [Raft.sendRequestVote] candidate 5 sends RequestVote to the raft server 2
2023/05/13 08:54:29 [Raft.sendRequestVote] candidate 5 sends RequestVote to the raft server 3
2023/05/13 08:54:29 [Raft.sendRequestVote] candidate 5 sends RequestVote to the raft server 4
2023/05/13 08:54:29 [Raft.sendRequestVote] candidate 5 sends RequestVote to the raft server 6
2023/05/13 08:54:29 [Raft.RequestVote] raft server 4 receives RequestVote from the candidate 5
2023/05/13 08:54:29 [Raft.RequestVote] raft server 4 voted for -1 previously, votes for the candidate 5
2023/05/13 08:54:29 [Raft.RequestVote] raft server 3 receives RequestVote from the candidate 5
2023/05/13 08:54:29 [Raft.RequestVote] raft server 3 voted for -1 previously, votes for the candidate 5
2023/05/13 08:54:29 [Raft.RequestVote] raft server 6 receives RequestVote from the candidate 5
2023/05/13 08:54:29 [Raft.RequestVote] raft server 6 voted for -1 previously, votes for the candidate 5
2023/05/13 08:54:29 [Raft.RequestVote] raft server 2 receives RequestVote from the candidate 5
2023/05/13 08:54:29 [Raft.RequestVote] raft server 2 voted for -1 previously, votes for the candidate 5
2023/05/13 08:54:29 [Raft.RequestVote] raft server 1 receives RequestVote from the candidate 5
2023/05/13 08:54:29 [Raft.RequestVote] raft server 1 voted for -1 previously, votes for the candidate 5
2023/05/13 08:54:29 [Raft.RequestVote] raft server 0 receives RequestVote from the candidate 5
2023/05/13 08:54:29 [Raft.RequestVote] raft server 0 voted for -1 previously, votes for the candidate 5
2023/05/13 08:54:29 [Raft.startElection] raft server 5 got 7 votes
2023/05/13 08:54:29 [Raft.sendHeartBeat] raft server 5 begins to send heartbeat...
2023/05/13 08:54:29 [Raft.AppendEntries] raft server 6 received heartbeat from the leader 5
2023/05/13 08:54:29 [Raft.AppendEntries] raft server 0 received heartbeat from the leader 5
2023/05/13 08:54:29 [Raft.AppendEntries] raft server 3 received heartbeat from the leader 5
2023/05/13 08:54:29 [Raft.AppendEntries] raft server 4 received heartbeat from the leader 5
2023/05/13 08:54:29 [Raft.AppendEntries] raft server 1 received heartbeat from the leader 5
2023/05/13 08:54:29 [Raft.AppendEntries] raft server 2 received heartbeat from the leader 5
2023/05/13 08:54:29 [TestManyElections2A] ========= iter {1} =========
2023/05/13 08:54:29 [config.disconnect] disconnect the raft server 6
2023/05/13 08:54:29 [config.disconnect] disconnect the raft server 0
2023/05/13 08:54:29 [config.disconnect] disconnect the raft server 5
2023/05/13 08:54:29 [Raft.startElection] raft server 2 starts the election!
2023/05/13 08:54:29 [Raft.sendRequestVote] candidate 2 sends RequestVote to the raft server 6
2023/05/13 08:54:29 [Raft.sendRequestVote] candidate 2 sends RequestVote to the raft server 1
2023/05/13 08:54:29 [Raft.sendRequestVote] candidate 2 sends RequestVote to the raft server 5
2023/05/13 08:54:29 [Raft.sendRequestVote] candidate 2 sends RequestVote to the raft server 0
2023/05/13 08:54:29 [Raft.sendRequestVote] candidate 2 sends RequestVote to the raft server 4
2023/05/13 08:54:29 [Raft.sendRequestVote] candidate 2 sends RequestVote to the raft server 3
2023/05/13 08:54:29 [Raft.RequestVote] raft server 4 receives RequestVote from the candidate 2
2023/05/13 08:54:29 [Raft.RequestVote] raft server 1 receives RequestVote from the candidate 2
2023/05/13 08:54:29 [Raft.RequestVote] raft server 3 receives RequestVote from the candidate 2
2023/05/13 08:54:29 [Raft.startElection] raft server 3 starts the election!
2023/05/13 08:54:29 [Raft.sendRequestVote] candidate 3 sends RequestVote to the raft server 1
2023/05/13 08:54:29 [Raft.sendRequestVote] candidate 3 sends RequestVote to the raft server 2
2023/05/13 08:54:29 [Raft.RequestVote] raft server 1 receives RequestVote from the candidate 3
2023/05/13 08:54:29 [Raft.RequestVote] raft server 2 receives RequestVote from the candidate 3
2023/05/13 08:54:29 [Raft.sendRequestVote] candidate 3 sends RequestVote to the raft server 0
2023/05/13 08:54:29 [Raft.sendRequestVote] candidate 3 sends RequestVote to the raft server 6
2023/05/13 08:54:29 [Raft.sendRequestVote] candidate 3 sends RequestVote to the raft server 4
2023/05/13 08:54:29 [Raft.sendRequestVote] candidate 3 sends RequestVote to the raft server 5
2023/05/13 08:54:29 [Raft.RequestVote] raft server 4 receives RequestVote from the candidate 3
2023/05/13 08:54:29 [Raft.startElection] raft server 2 got 1 votes
2023/05/13 08:54:29 [Raft.startElection] raft server 6 got 1 votes
2023/05/13 08:54:29 [Raft.startElection] raft server 1 starts the election!
2023/05/13 08:54:29 [Raft.sendRequestVote] candidate 1 sends RequestVote to the raft server 6
2023/05/13 08:54:29 [Raft.sendRequestVote] candidate 1 sends RequestVote to the raft server 0
2023/05/13 08:54:29 [Raft.sendRequestVote] candidate 1 sends RequestVote to the raft server 2
2023/05/13 08:54:29 [Raft.sendRequestVote] candidate 1 sends RequestVote to the raft server 3
2023/05/13 08:54:29 [Raft.sendRequestVote] candidate 1 sends RequestVote to the raft server 4
2023/05/13 08:54:29 [Raft.RequestVote] raft server 2 receives RequestVote from the candidate 1
2023/05/13 08:54:29 [Raft.RequestVote] raft server 2 voted for -1 previously, votes for the candidate 1
2023/05/13 08:54:29 [Raft.RequestVote] raft server 3 receives RequestVote from the candidate 1
2023/05/13 08:54:29 [Raft.RequestVote] raft server 4 receives RequestVote from the candidate 1
2023/05/13 08:54:29 [Raft.sendRequestVote] candidate 1 sends RequestVote to the raft server 5
2023/05/13 08:54:29 [Raft.startElection] raft server 3 got 1 votes
2023/05/13 08:54:29 [Raft.sendHeartBeat] raft server 5 begins to send heartbeat...
2023/05/13 08:54:30 [Raft.startElection] raft server 1 got 2 votes
2023/05/13 08:54:30 [Raft.startElection] raft server 4 starts the election!
2023/05/13 08:54:30 [Raft.sendRequestVote] candidate 4 sends RequestVote to the raft server 6
2023/05/13 08:54:30 [Raft.sendRequestVote] candidate 4 sends RequestVote to the raft server 0
2023/05/13 08:54:30 [Raft.sendRequestVote] candidate 4 sends RequestVote to the raft server 1
2023/05/13 08:54:30 [Raft.sendRequestVote] candidate 4 sends RequestVote to the raft server 3
2023/05/13 08:54:30 [Raft.RequestVote] raft server 1 receives RequestVote from the candidate 4
2023/05/13 08:54:30 [Raft.RequestVote] raft server 1 voted for -1 previously, votes for the candidate 4
2023/05/13 08:54:30 [Raft.sendRequestVote] candidate 4 sends RequestVote to the raft server 5
2023/05/13 08:54:30 [Raft.RequestVote] raft server 3 receives RequestVote from the candidate 4
2023/05/13 08:54:30 [Raft.RequestVote] raft server 3 voted for -1 previously, votes for the candidate 4
2023/05/13 08:54:30 [Raft.sendRequestVote] candidate 4 sends RequestVote to the raft server 2
2023/05/13 08:54:30 [Raft.RequestVote] raft server 2 receives RequestVote from the candidate 4
2023/05/13 08:54:30 [Raft.sendHeartBeat] raft server 5 begins to send heartbeat...
2023/05/13 08:54:30 [Raft.startElection] raft server 0 got 1 votes
2023/05/13 08:54:30 [Raft.startElection] raft server 4 got 3 votes
2023/05/13 08:54:30 [Raft.startElection] raft server 2 starts the election!
2023/05/13 08:54:30 [Raft.sendRequestVote] candidate 2 sends RequestVote to the raft server 6
2023/05/13 08:54:30 [Raft.sendRequestVote] candidate 2 sends RequestVote to the raft server 4
2023/05/13 08:54:30 [Raft.sendRequestVote] candidate 2 sends RequestVote to the raft server 3
2023/05/13 08:54:30 [Raft.RequestVote] raft server 4 receives RequestVote from the candidate 2
2023/05/13 08:54:30 [Raft.RequestVote] raft server 4 voted for -1 previously, votes for the candidate 2
2023/05/13 08:54:30 [Raft.sendRequestVote] candidate 2 sends RequestVote to the raft server 0
2023/05/13 08:54:30 [Raft.sendRequestVote] candidate 2 sends RequestVote to the raft server 1
2023/05/13 08:54:30 [Raft.sendRequestVote] candidate 2 sends RequestVote to the raft server 5
2023/05/13 08:54:30 [Raft.RequestVote] raft server 3 receives RequestVote from the candidate 2
2023/05/13 08:54:30 [Raft.RequestVote] raft server 1 receives RequestVote from the candidate 2
2023/05/13 08:54:30 [Raft.startElection] raft server 2 got 2 votes
2023/05/13 08:54:30 [Raft.startElection] raft server 1 starts the election!
2023/05/13 08:54:30 [Raft.sendRequestVote] candidate 1 sends RequestVote to the raft server 6
2023/05/13 08:54:30 [Raft.sendRequestVote] candidate 1 sends RequestVote to the raft server 0
2023/05/13 08:54:30 [Raft.sendRequestVote] candidate 1 sends RequestVote to the raft server 5
2023/05/13 08:54:30 [Raft.sendRequestVote] candidate 1 sends RequestVote to the raft server 3
2023/05/13 08:54:30 [Raft.sendRequestVote] candidate 1 sends RequestVote to the raft server 4
2023/05/13 08:54:30 [Raft.sendRequestVote] candidate 1 sends RequestVote to the raft server 2
2023/05/13 08:54:30 [Raft.RequestVote] raft server 3 receives RequestVote from the candidate 1
2023/05/13 08:54:30 [Raft.RequestVote] raft server 2 receives RequestVote from the candidate 1
2023/05/13 08:54:30 [Raft.RequestVote] raft server 2 voted for -1 previously, votes for the candidate 1
2023/05/13 08:54:30 [Raft.RequestVote] raft server 4 receives RequestVote from the candidate 1
2023/05/13 08:54:30 [Raft.startElection] raft server 3 starts the election!
2023/05/13 08:54:30 [Raft.sendRequestVote] candidate 3 sends RequestVote to the raft server 6
2023/05/13 08:54:30 [Raft.sendRequestVote] candidate 3 sends RequestVote to the raft server 2
2023/05/13 08:54:30 [Raft.sendRequestVote] candidate 3 sends RequestVote to the raft server 4
2023/05/13 08:54:30 [Raft.sendRequestVote] candidate 3 sends RequestVote to the raft server 0
2023/05/13 08:54:30 [Raft.sendRequestVote] candidate 3 sends RequestVote to the raft server 5
2023/05/13 08:54:30 [Raft.RequestVote] raft server 2 receives RequestVote from the candidate 3
2023/05/13 08:54:30 [Raft.sendRequestVote] candidate 3 sends RequestVote to the raft server 1
2023/05/13 08:54:30 [Raft.RequestVote] raft server 4 receives RequestVote from the candidate 3
2023/05/13 08:54:30 [Raft.RequestVote] raft server 1 receives RequestVote from the candidate 3
2023/05/13 08:54:30 [Raft.startElection] raft server 1 got 2 votes
2023/05/13 08:54:30 [Raft.startElection] raft server 3 got 1 votes
2023/05/13 08:54:31 [Raft.startElection] raft server 1 starts the election!
2023/05/13 08:54:31 [Raft.sendRequestVote] candidate 1 sends RequestVote to the raft server 6
2023/05/13 08:54:31 [Raft.sendRequestVote] candidate 1 sends RequestVote to the raft server 3
2023/05/13 08:54:31 [Raft.sendRequestVote] candidate 1 sends RequestVote to the raft server 5
2023/05/13 08:54:31 [Raft.sendRequestVote] candidate 1 sends RequestVote to the raft server 2
2023/05/13 08:54:31 [Raft.RequestVote] raft server 3 receives RequestVote from the candidate 1
2023/05/13 08:54:31 [Raft.RequestVote] raft server 3 voted for -1 previously, votes for the candidate 1
2023/05/13 08:54:31 [Raft.RequestVote] raft server 2 receives RequestVote from the candidate 1
2023/05/13 08:54:31 [Raft.RequestVote] raft server 2 voted for 1 previously, votes for the candidate 1
2023/05/13 08:54:31 [Raft.sendRequestVote] candidate 1 sends RequestVote to the raft server 4
2023/05/13 08:54:31 [Raft.sendRequestVote] candidate 1 sends RequestVote to the raft server 0
2023/05/13 08:54:31 [Raft.RequestVote] raft server 4 receives RequestVote from the candidate 1
2023/05/13 08:54:31 [Raft.startElection] raft server 4 starts the election!
2023/05/13 08:54:31 [Raft.sendRequestVote] candidate 4 sends RequestVote to the raft server 6
2023/05/13 08:54:31 [Raft.sendRequestVote] candidate 4 sends RequestVote to the raft server 0
2023/05/13 08:54:31 [Raft.sendRequestVote] candidate 4 sends RequestVote to the raft server 3
2023/05/13 08:54:31 [Raft.sendRequestVote] candidate 4 sends RequestVote to the raft server 2
2023/05/13 08:54:31 [Raft.sendRequestVote] candidate 4 sends RequestVote to the raft server 5
2023/05/13 08:54:31 [Raft.sendRequestVote] candidate 4 sends RequestVote to the raft server 1
2023/05/13 08:54:31 [Raft.RequestVote] raft server 2 receives RequestVote from the candidate 4
2023/05/13 08:54:31 [Raft.RequestVote] raft server 1 receives RequestVote from the candidate 4
2023/05/13 08:54:31 [Raft.RequestVote] raft server 3 receives RequestVote from the candidate 4
2023/05/13 08:54:31 [Raft.startElection] raft server 1 got 3 votes
2023/05/13 08:54:31 [Raft.startElection] raft server 4 got 1 votes
2023/05/13 08:54:31 [Raft.startElection] raft server 3 starts the election!
2023/05/13 08:54:31 [Raft.sendRequestVote] candidate 3 sends RequestVote to the raft server 6
2023/05/13 08:54:31 [Raft.sendRequestVote] candidate 3 sends RequestVote to the raft server 1
2023/05/13 08:54:31 [Raft.sendRequestVote] candidate 3 sends RequestVote to the raft server 5
2023/05/13 08:54:31 [Raft.sendRequestVote] candidate 3 sends RequestVote to the raft server 4
2023/05/13 08:54:31 [Raft.sendRequestVote] candidate 3 sends RequestVote to the raft server 2
2023/05/13 08:54:31 [Raft.sendRequestVote] candidate 3 sends RequestVote to the raft server 0
2023/05/13 08:54:31 [Raft.RequestVote] raft server 2 receives RequestVote from the candidate 3
2023/05/13 08:54:31 [Raft.RequestVote] raft server 4 receives RequestVote from the candidate 3
2023/05/13 08:54:31 [Raft.RequestVote] raft server 4 voted for -1 previously, votes for the candidate 3
2023/05/13 08:54:31 [Raft.RequestVote] raft server 1 receives RequestVote from the candidate 3
2023/05/13 08:54:31 [Raft.RequestVote] raft server 1 voted for -1 previously, votes for the candidate 3
2023/05/13 08:54:31 [Raft.startElection] raft server 3 got 3 votes
2023/05/13 08:54:31 [Raft.startElection] raft server 1 starts the election!
2023/05/13 08:54:31 [Raft.sendRequestVote] candidate 1 sends RequestVote to the raft server 6
2023/05/13 08:54:31 [Raft.sendRequestVote] candidate 1 sends RequestVote to the raft server 3
2023/05/13 08:54:31 [Raft.sendRequestVote] candidate 1 sends RequestVote to the raft server 4
2023/05/13 08:54:31 [Raft.sendRequestVote] candidate 1 sends RequestVote to the raft server 2
2023/05/13 08:54:31 [Raft.sendRequestVote] candidate 1 sends RequestVote to the raft server 5
2023/05/13 08:54:31 [Raft.RequestVote] raft server 3 receives RequestVote from the candidate 1
2023/05/13 08:54:31 [Raft.RequestVote] raft server 3 voted for -1 previously, votes for the candidate 1
2023/05/13 08:54:31 [Raft.sendRequestVote] candidate 1 sends RequestVote to the raft server 0
2023/05/13 08:54:31 [Raft.RequestVote] raft server 4 receives RequestVote from the candidate 1
2023/05/13 08:54:31 [Raft.RequestVote] raft server 2 receives RequestVote from the candidate 1
2023/05/13 08:54:31 [Raft.RequestVote] raft server 2 voted for 1 previously, votes for the candidate 1
2023/05/13 08:54:31 [Raft.startElection] raft server 0 got 1 votes
2023/05/13 08:54:31 [Raft.startElection] raft server 4 starts the election!
2023/05/13 08:54:31 [Raft.sendRequestVote] candidate 4 sends RequestVote to the raft server 6
2023/05/13 08:54:31 [Raft.sendRequestVote] candidate 4 sends RequestVote to the raft server 0
2023/05/13 08:54:31 [Raft.sendRequestVote] candidate 4 sends RequestVote to the raft server 2
2023/05/13 08:54:31 [Raft.sendRequestVote] candidate 4 sends RequestVote to the raft server 1
2023/05/13 08:54:31 [Raft.sendRequestVote] candidate 4 sends RequestVote to the raft server 3
2023/05/13 08:54:31 [Raft.sendRequestVote] candidate 4 sends RequestVote to the raft server 5
2023/05/13 08:54:31 [Raft.RequestVote] raft server 1 receives RequestVote from the candidate 4
2023/05/13 08:54:31 [Raft.RequestVote] raft server 3 receives RequestVote from the candidate 4
2023/05/13 08:54:31 [Raft.RequestVote] raft server 2 receives RequestVote from the candidate 4
2023/05/13 08:54:31 [Raft.startElection] raft server 1 got 3 votes
2023/05/13 08:54:31 [Raft.startElection] raft server 4 got 1 votes
2023/05/13 08:54:32 [Raft.startElection] raft server 3 starts the election!
2023/05/13 08:54:32 [Raft.sendRequestVote] candidate 3 sends RequestVote to the raft server 6
2023/05/13 08:54:32 [Raft.sendRequestVote] candidate 3 sends RequestVote to the raft server 2
2023/05/13 08:54:32 [Raft.sendRequestVote] candidate 3 sends RequestVote to the raft server 5
2023/05/13 08:54:32 [Raft.sendRequestVote] candidate 3 sends RequestVote to the raft server 0
2023/05/13 08:54:32 [Raft.sendRequestVote] candidate 3 sends RequestVote to the raft server 1
2023/05/13 08:54:32 [Raft.sendRequestVote] candidate 3 sends RequestVote to the raft server 4
2023/05/13 08:54:32 [Raft.RequestVote] raft server 2 receives RequestVote from the candidate 3
2023/05/13 08:54:32 [Raft.RequestVote] raft server 1 receives RequestVote from the candidate 3
2023/05/13 08:54:32 [Raft.RequestVote] raft server 1 voted for -1 previously, votes for the candidate 3
2023/05/13 08:54:32 [Raft.RequestVote] raft server 4 receives RequestVote from the candidate 3
2023/05/13 08:54:32 [Raft.RequestVote] raft server 4 voted for -1 previously, votes for the candidate 3
2023/05/13 08:54:32 [Raft.startElection] raft server 0 starts the election!
2023/05/13 08:54:32 [Raft.sendRequestVote] candidate 0 sends RequestVote to the raft server 6
2023/05/13 08:54:32 [Raft.sendRequestVote] candidate 0 sends RequestVote to the raft server 2
2023/05/13 08:54:32 [Raft.sendRequestVote] candidate 0 sends RequestVote to the raft server 5
2023/05/13 08:54:32 [Raft.sendRequestVote] candidate 0 sends RequestVote to the raft server 1
2023/05/13 08:54:32 [Raft.sendRequestVote] candidate 0 sends RequestVote to the raft server 4
2023/05/13 08:54:32 [Raft.sendRequestVote] candidate 0 sends RequestVote to the raft server 3
2023/05/13 08:54:32 [Raft.startElection] raft server 3 got 3 votes
2023/05/13 08:54:32 [Raft.startElection] raft server 0 got 1 votes
2023/05/13 08:54:32 [Raft.startElection] raft server 2 starts the election!
2023/05/13 08:54:32 [Raft.sendRequestVote] candidate 2 sends RequestVote to the raft server 6
2023/05/13 08:54:32 [Raft.sendRequestVote] candidate 2 sends RequestVote to the raft server 3
2023/05/13 08:54:32 [Raft.sendRequestVote] candidate 2 sends RequestVote to the raft server 1
2023/05/13 08:54:32 [Raft.sendRequestVote] candidate 2 sends RequestVote to the raft server 0
2023/05/13 08:54:32 [Raft.RequestVote] raft server 3 receives RequestVote from the candidate 2
2023/05/13 08:54:32 [Raft.RequestVote] raft server 3 voted for -1 previously, votes for the candidate 2
2023/05/13 08:54:32 [Raft.sendRequestVote] candidate 2 sends RequestVote to the raft server 4
2023/05/13 08:54:32 [Raft.RequestVote] raft server 1 receives RequestVote from the candidate 2
2023/05/13 08:54:32 [Raft.sendRequestVote] candidate 2 sends RequestVote to the raft server 5
2023/05/13 08:54:32 [Raft.RequestVote] raft server 4 receives RequestVote from the candidate 2
2023/05/13 08:54:32 [Raft.startElection] raft server 2 got 2 votes
2023/05/13 08:54:32 [Raft.startElection] raft server 4 starts the election!
2023/05/13 08:54:32 [Raft.sendRequestVote] candidate 4 sends RequestVote to the raft server 6
2023/05/13 08:54:32 [Raft.sendRequestVote] candidate 4 sends RequestVote to the raft server 0
2023/05/13 08:54:32 [Raft.sendRequestVote] candidate 4 sends RequestVote to the raft server 2
2023/05/13 08:54:32 [Raft.sendRequestVote] candidate 4 sends RequestVote to the raft server 3
2023/05/13 08:54:32 [Raft.sendRequestVote] candidate 4 sends RequestVote to the raft server 1
2023/05/13 08:54:32 [Raft.sendRequestVote] candidate 4 sends RequestVote to the raft server 5
2023/05/13 08:54:32 [Raft.RequestVote] raft server 3 receives RequestVote from the candidate 4
2023/05/13 08:54:32 [Raft.RequestVote] raft server 2 receives RequestVote from the candidate 4
2023/05/13 08:54:32 [Raft.RequestVote] raft server 2 voted for -1 previously, votes for the candidate 4
2023/05/13 08:54:32 [Raft.RequestVote] raft server 1 receives RequestVote from the candidate 4
2023/05/13 08:54:32 [Raft.startElection] raft server 1 starts the election!
2023/05/13 08:54:32 [Raft.sendRequestVote] candidate 1 sends RequestVote to the raft server 6
2023/05/13 08:54:32 [Raft.sendRequestVote] candidate 1 sends RequestVote to the raft server 0
2023/05/13 08:54:32 [Raft.sendRequestVote] candidate 1 sends RequestVote to the raft server 3
2023/05/13 08:54:32 [Raft.sendRequestVote] candidate 1 sends RequestVote to the raft server 5
2023/05/13 08:54:32 [Raft.sendRequestVote] candidate 1 sends RequestVote to the raft server 2
2023/05/13 08:54:32 [Raft.sendRequestVote] candidate 1 sends RequestVote to the raft server 4
2023/05/13 08:54:32 [Raft.RequestVote] raft server 4 receives RequestVote from the candidate 1
2023/05/13 08:54:32 [Raft.RequestVote] raft server 3 receives RequestVote from the candidate 1
2023/05/13 08:54:32 [Raft.RequestVote] raft server 2 receives RequestVote from the candidate 1
2023/05/13 08:54:32 [Raft.startElection] raft server 4 got 2 votes
2023/05/13 08:54:32 [Raft.startElection] raft server 1 got 1 votes
2023/05/13 08:54:32 [Raft.startElection] raft server 3 starts the election!
2023/05/13 08:54:32 [Raft.sendRequestVote] candidate 3 sends RequestVote to the raft server 6
2023/05/13 08:54:32 [Raft.sendRequestVote] candidate 3 sends RequestVote to the raft server 4
2023/05/13 08:54:32 [Raft.sendRequestVote] candidate 3 sends RequestVote to the raft server 5
2023/05/13 08:54:32 [Raft.sendRequestVote] candidate 3 sends RequestVote to the raft server 2
2023/05/13 08:54:32 [Raft.sendRequestVote] candidate 3 sends RequestVote to the raft server 1
2023/05/13 08:54:32 [Raft.sendRequestVote] candidate 3 sends RequestVote to the raft server 0
2023/05/13 08:54:32 [Raft.RequestVote] raft server 2 receives RequestVote from the candidate 3
2023/05/13 08:54:32 [Raft.RequestVote] raft server 4 receives RequestVote from the candidate 3
2023/05/13 08:54:32 [Raft.RequestVote] raft server 1 receives RequestVote from the candidate 3
2023/05/13 08:54:32 [Raft.RequestVote] raft server 1 voted for -1 previously, votes for the candidate 3
2023/05/13 08:54:32 [Raft.RequestVote] raft server 4 voted for -1 previously, votes for the candidate 3
2023/05/13 08:54:33 [Raft.startElection] raft server 3 got 3 votes
2023/05/13 08:54:33 [Raft.startElection] raft server 2 starts the election!
2023/05/13 08:54:33 [Raft.sendRequestVote] candidate 2 sends RequestVote to the raft server 6
2023/05/13 08:54:33 [Raft.sendRequestVote] candidate 2 sends RequestVote to the raft server 0
2023/05/13 08:54:33 [Raft.sendRequestVote] candidate 2 sends RequestVote to the raft server 1
2023/05/13 08:54:33 [Raft.RequestVote] raft server 1 receives RequestVote from the candidate 2
2023/05/13 08:54:33 [Raft.sendRequestVote] candidate 2 sends RequestVote to the raft server 4
2023/05/13 08:54:33 [Raft.sendRequestVote] candidate 2 sends RequestVote to the raft server 5
2023/05/13 08:54:33 [Raft.sendRequestVote] candidate 2 sends RequestVote to the raft server 3
2023/05/13 08:54:33 [Raft.RequestVote] raft server 4 receives RequestVote from the candidate 2
2023/05/13 08:54:33 [Raft.RequestVote] raft server 3 receives RequestVote from the candidate 2
2023/05/13 08:54:33 [Raft.RequestVote] raft server 3 voted for -1 previously, votes for the candidate 2
2023/05/13 08:54:33 [Raft.startElection] raft server 2 got 2 votes
2023/05/13 08:54:33 [Raft.startElection] raft server 1 starts the election!
2023/05/13 08:54:33 [Raft.sendRequestVote] candidate 1 sends RequestVote to the raft server 6
2023/05/13 08:54:33 [Raft.sendRequestVote] candidate 1 sends RequestVote to the raft server 0
2023/05/13 08:54:33 [Raft.sendRequestVote] candidate 1 sends RequestVote to the raft server 5
2023/05/13 08:54:33 [Raft.sendRequestVote] candidate 1 sends RequestVote to the raft server 2
2023/05/13 08:54:33 [Raft.sendRequestVote] candidate 1 sends RequestVote to the raft server 3
2023/05/13 08:54:33 [Raft.sendRequestVote] candidate 1 sends RequestVote to the raft server 4
2023/05/13 08:54:33 [Raft.RequestVote] raft server 2 receives RequestVote from the candidate 1
2023/05/13 08:54:33 [Raft.RequestVote] raft server 4 receives RequestVote from the candidate 1
2023/05/13 08:54:33 [Raft.RequestVote] raft server 2 voted for -1 previously, votes for the candidate 1
2023/05/13 08:54:33 [Raft.RequestVote] raft server 3 receives RequestVote from the candidate 1
2023/05/13 08:54:33 [Raft.startElection] raft server 3 starts the election!
2023/05/13 08:54:33 [Raft.sendRequestVote] candidate 3 sends RequestVote to the raft server 6
2023/05/13 08:54:33 [Raft.sendRequestVote] candidate 3 sends RequestVote to the raft server 0
2023/05/13 08:54:33 [Raft.sendRequestVote] candidate 3 sends RequestVote to the raft server 5
2023/05/13 08:54:33 [Raft.sendRequestVote] candidate 3 sends RequestVote to the raft server 1
2023/05/13 08:54:33 [Raft.sendRequestVote] candidate 3 sends RequestVote to the raft server 4
2023/05/13 08:54:33 [Raft.sendRequestVote] candidate 3 sends RequestVote to the raft server 2
2023/05/13 08:54:33 [Raft.RequestVote] raft server 1 receives RequestVote from the candidate 3
2023/05/13 08:54:33 [Raft.RequestVote] raft server 2 receives RequestVote from the candidate 3
2023/05/13 08:54:33 [Raft.RequestVote] raft server 4 receives RequestVote from the candidate 3
2023/05/13 08:54:33 [Raft.RequestVote] raft server 4 voted for 3 previously, votes for the candidate 3
2023/05/13 08:54:33 [Raft.startElection] raft server 1 got 2 votes
2023/05/13 08:54:33 [Raft.startElection] raft server 3 got 2 votes
2023/05/13 08:54:34 [Raft.startElection] raft server 3 starts the election!
2023/05/13 08:54:34 [Raft.sendRequestVote] candidate 3 sends RequestVote to the raft server 6
2023/05/13 08:54:34 [Raft.sendRequestVote] candidate 3 sends RequestVote to the raft server 0
2023/05/13 08:54:34 [Raft.sendRequestVote] candidate 3 sends RequestVote to the raft server 2
2023/05/13 08:54:34 [Raft.sendRequestVote] candidate 3 sends RequestVote to the raft server 5
2023/05/13 08:54:34 [Raft.sendRequestVote] candidate 3 sends RequestVote to the raft server 4
2023/05/13 08:54:34 [Raft.sendRequestVote] candidate 3 sends RequestVote to the raft server 1
2023/05/13 08:54:34 [Raft.RequestVote] raft server 4 receives RequestVote from the candidate 3
2023/05/13 08:54:34 [Raft.RequestVote] raft server 4 voted for 3 previously, votes for the candidate 3
2023/05/13 08:54:34 [Raft.RequestVote] raft server 1 receives RequestVote from the candidate 3
2023/05/13 08:54:34 [Raft.RequestVote] raft server 1 voted for -1 previously, votes for the candidate 3
2023/05/13 08:54:34 [Raft.RequestVote] raft server 2 receives RequestVote from the candidate 3
2023/05/13 08:54:34 [Raft.startElection] raft server 2 starts the election!
2023/05/13 08:54:34 [Raft.sendRequestVote] candidate 2 sends RequestVote to the raft server 3
2023/05/13 08:54:34 [Raft.sendRequestVote] candidate 2 sends RequestVote to the raft server 6
2023/05/13 08:54:34 [Raft.sendRequestVote] candidate 2 sends RequestVote to the raft server 4
2023/05/13 08:54:34 [Raft.sendRequestVote] candidate 2 sends RequestVote to the raft server 0
2023/05/13 08:54:34 [Raft.sendRequestVote] candidate 2 sends RequestVote to the raft server 1
2023/05/13 08:54:34 [Raft.RequestVote] raft server 3 receives RequestVote from the candidate 2
2023/05/13 08:54:34 [Raft.RequestVote] raft server 1 receives RequestVote from the candidate 2
2023/05/13 08:54:34 [Raft.RequestVote] raft server 4 receives RequestVote from the candidate 2
2023/05/13 08:54:34 [Raft.sendRequestVote] candidate 2 sends RequestVote to the raft server 5
2023/05/13 08:54:34 [Raft.startElection] raft server 3 got 3 votes
2023/05/13 08:54:34 [Raft.startElection] raft server 2 got 1 votes
    config.go:452: expected one leader, got none
--- FAIL: TestManyElections2A (5.49s)
giaosame commented 1 year ago

This one is fixed in the PR https://github.com/giaosame/mit-6.5840-distributed-system/pull/20.