Skip to content

Commit

Permalink
remove Candidate field from pre-vote request
Browse files Browse the repository at this point in the history
  • Loading branch information
dhiaayachi committed Apr 2, 2024
1 parent 4f6fc13 commit 1912201
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 7 deletions.
3 changes: 0 additions & 3 deletions commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,6 @@ type RequestPreVoteRequest struct {
// Provide the term and our id
Term uint64

// Deprecated: use RPCHeader.Addr instead
Candidate []byte

// Used to ensure safety
LastLogIndex uint64
LastLogTerm uint64
Expand Down
6 changes: 2 additions & 4 deletions raft.go
Original file line number Diff line number Diff line change
Expand Up @@ -2059,10 +2059,8 @@ func (r *Raft) preElectSelf() <-chan *preVoteResult {
// Construct the request
lastIdx, lastTerm := r.getLastEntry()
req := &RequestPreVoteRequest{
RPCHeader: r.getRPCHeader(),
Term: newTerm,
// this is needed for retro compatibility, before RPCHeader.Addr was added
Candidate: r.trans.EncodePeer(r.localID, r.localAddr),
RPCHeader: r.getRPCHeader(),
Term: newTerm,
LastLogIndex: lastIdx,
LastLogTerm: lastTerm,
}
Expand Down

0 comments on commit 1912201

Please sign in to comment.