Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support in nomad for supporting raft 3 protocol peers.json #5629

Merged
merged 1 commit into from
May 3, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)
Copy link
Contributor

@notnoop notnoop May 3, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now that I think about it - when running under version 3 - we may need to attempt to read in both formats. I'll double check the raft track - but I suspect at version 2 - it starts writing peers file in new format. Nevermind, this matches consul implementation in https://github.com/hashicorp/consul/pull/3007/files . Thanks!

}
if err != nil {
return fmt.Errorf("recovery failed to parse peers.json: %v", err)
}
Expand Down