travisjeffery/proglog

TestMultipleNodes

Opened this issue · 2 comments

Hey im working through the book. I've been stuck debugging the coordinate your services with consensus test.

    distributed_test.go:50: 
                Error Trace:    /Users/arishaller/proglog/internal/log/distributed_test.go:50
                Error:          Received unexpected error:
                                node is not the leader
                Test:           TestMultipleNodes
FAIL
2022-09-15T11:52:01.697-0400 [DEBUG] raft: calculated votes needed: needed=2 term=3
2022-09-15T11:52:01.697-0400 [DEBUG] raft: vote granted: from=0 term=3 tally=1
2022-09-15T11:52:01.697-0400 [DEBUG] raft: lost leadership because received a requestVote with a newer term
2022-09-15T11:52:01.370-0400 [INFO]  raft: added peer, starting replication: peer=1
2022-09-15T11:52:01.421-0400 [WARN]  raft: failed to contact: server-id=1 time=51.047208ms
2022-09-15T11:52:01.421-0400 [WARN]  raft: failed to contact quorum of nodes, stepping down
2022-09-15T11:52:01.421-0400 [INFO]  raft: entering follower state: follower="Node at 127.0.0.1:20241 [Follower]" leader-address= leader-id=
2022-09-15T11:52:01.463-0400 [WARN]  raft: failed to get previous log: previous-index=3 last-index=0 error="rpc error: code = Code(404) desc = offet out of range 3"
2022-09-15T11:52:01.464-0400 [WARN]  raft: no known peers, aborting election
2022-09-15T11:52:01.465-0400 [WARN]  raft: appendEntries rejected, sending older logs: peer="{Voter 1 127.0.0.1:20242}" next=1
2022-09-15T11:52:01.504-0400 [WARN]  raft: heartbeat timeout reached, starting election: last-leader-addr= last-leader-id=
2022-09-15T11:52:01.504-0400 [INFO]  raft: entering candidate state: node="Node at 127.0.0.1:20241 [Candidate]" term=3
2022-09-15T11:52:01.587-0400 [DEBUG] raft: voting for self: term=3 id=0
2022-09-15T11:52:01.643-0400 [INFO]  raft: initial configuration: index=0 servers=[]
2022-09-15T11:52:01.643-0400 [INFO]  raft: entering follower state: follower="Node at 127.0.0.1:20243 [Follower]" leader-address= leader-id=

It maybe seems that raft cluster has not elected a leader successuly within the time duration. Maybe you can set the require.Eventually ‘s param waitFor longger.