Skip to content

Commit

Permalink
Fix cluster list connected status and improve version output. Fixes #…
Browse files Browse the repository at this point in the history
  • Loading branch information
plorenz committed Nov 20, 2023
1 parent 2571929 commit c0f3ba1
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions controller/raft/raft.go
Original file line number Diff line number Diff line change
Expand Up @@ -683,6 +683,7 @@ func (self *Controller) addConfiguredBootstrapMembers() error {

if id, addr, err := self.Mesh.GetPeerInfo(bootstrapMember, time.Second*5); err != nil {
pfxlog.Logger().WithError(err).Errorf("unable to get id for bootstrap member [%v]", bootstrapMember)
go self.retryBootstrapMember(bootstrapMember)
} else {
self.addBootstrapServer(raft.Server{
Suffrage: raft.Voter,
Expand All @@ -694,6 +695,34 @@ func (self *Controller) addConfiguredBootstrapMembers() error {
return nil
}

func (self *Controller) retryBootstrapMember(bootstrapMember string) {
ticker := time.NewTicker(6 * time.Second)
defer ticker.Stop()

for {
<-ticker.C

// If we've bootstrapped, exit out
if self.bootstrapped.Load() {
return
}

if id, addr, err := self.Mesh.GetPeerInfo(bootstrapMember, time.Second*5); err != nil {
pfxlog.Logger().WithError(err).Errorf("unable to get id for bootstrap member [%v]", bootstrapMember)
} else {
req := &cmd_pb.AddPeerRequest{
Addr: string(addr),
Id: string(id),
IsVoter: true,
}

if err = self.Join(req); err == nil {
return
}
}
}
}

// Join adds the given node to the raft cluster
func (self *Controller) Join(req *cmd_pb.AddPeerRequest) error {
self.clusterLock.Lock()
Expand Down

0 comments on commit c0f3ba1

Please sign in to comment.