Skip to content

Commit

Permalink
Merge pull request #5629 from hbasappa/peersjon
Browse files Browse the repository at this point in the history
Add support in nomad for supporting raft 3 protocol peers.json
  • Loading branch information
Mahmood Ali committed May 3, 2019
2 parents 01c267b + 8d87ae3 commit 0e21642
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion nomad/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -1169,7 +1169,12 @@ func (s *Server) setupRaft() error {
}
} else if _, err := os.Stat(peersFile); err == nil {
s.logger.Info("found peers.json file, recovering Raft configuration...")
configuration, err := raft.ReadPeersJSON(peersFile)
var configuration raft.Configuration
if s.config.RaftConfig.ProtocolVersion < 3 {
configuration, err = raft.ReadPeersJSON(peersFile)
} else {
configuration, err = raft.ReadConfigJSON(peersFile)
}
if err != nil {
return fmt.Errorf("recovery failed to parse peers.json: %v", err)
}
Expand Down

0 comments on commit 0e21642

Please sign in to comment.