Skip to content
This repository has been archived by the owner on Sep 9, 2020. It is now read-only.

Commit

Permalink
Merge pull request #83 from jrasell/gh-76
Browse files Browse the repository at this point in the history
cluster: fix a big where cluster state get overwritten on restart.
  • Loading branch information
jrasell authored Oct 25, 2019
2 parents 543384d + b1a894d commit 4c3377c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
7 changes: 3 additions & 4 deletions pkg/server/cluster/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,8 @@ func (m *Member) setupCluster() error {
// If existing state is found, check whether the operator passed cluster name matches the one
// found. If the passed one does not match the state, we will fail with an error.
if c.Name != "" && c.ID != uuid.Nil {
if err := m.verifyClusterName(c.Name); err != nil {
return err
}
m.logger.Debug().Msg("found existing Sherpa cluster state, verifying data")
return m.verifyClusterName(c.Name)
}

if err := m.generateClusterName(); err != nil {
Expand All @@ -49,7 +48,7 @@ func (m *Member) verifyClusterName(name string) error {
}
}

m.logger.Info().Msg("successfully found cluster state of existing cluster to join")
m.logger.Info().Msg("successfully verified state of existing cluster to join")
m.clusterName = name
return nil
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/server/cluster/member.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ type Member struct { // nolint:maligned
stateLock sync.RWMutex
logger zerolog.Logger

// clusterName
// clusterName represents the name of the cluster this Sherpa instance is a part of.
clusterName string

// standby is used to determine whether the Sherpa server in question is currently in standby
Expand Down

0 comments on commit 4c3377c

Please sign in to comment.