fix(standby_server): able to join the cluster containing itself

Standby server will switch to peer server if it finds that
it has been contained in the cluster.
This commit is contained in:
Yicheng Qin
2014-05-30 13:53:41 -07:00
parent 98ff4af7f2
commit 4bebb538eb
2 changed files with 66 additions and 0 deletions

View File

@@ -235,6 +235,13 @@ func (s *StandbyServer) syncCluster(peerURLs []string) error {
}
func (s *StandbyServer) join(peer string) error {
for _, url := range s.ClusterURLs() {
if s.Config.PeerURL == url {
s.joinIndex = 0
return nil
}
}
// Our version must match the leaders version
version, err := s.client.GetVersion(peer)
if err != nil {