1
0
mirror of https://github.com/redis/go-redis.git synced 2025-07-28 06:42:00 +03:00

Remove Redis Cluster state check

This commit is contained in:
Vladimir Mihailenco
2018-11-24 13:16:21 +02:00
parent 78a66f0e5f
commit 17e8439f2f
3 changed files with 30 additions and 42 deletions

View File

@ -49,8 +49,6 @@ func (s *clusterScenario) addrs() []string {
}
func (s *clusterScenario) clusterClient(opt *redis.ClusterOptions) *redis.ClusterClient {
var errBadState = fmt.Errorf("cluster state is not consistent")
opt.Addrs = s.addrs()
client := redis.NewClusterClient(opt)
@ -65,27 +63,7 @@ func (s *clusterScenario) clusterClient(opt *redis.ClusterOptions) *redis.Cluste
}
if !state.IsConsistent() {
return errBadState
}
if len(state.Masters) < 3 {
return errBadState
}
for _, master := range state.Masters {
s := master.Client.Info("replication").Val()
if !strings.Contains(s, "role:master") {
return errBadState
}
}
if len(state.Slaves) < 3 {
return errBadState
}
for _, slave := range state.Slaves {
s := slave.Client.Info("replication").Val()
if !strings.Contains(s, "role:slave") {
return errBadState
}
return fmt.Errorf("cluster state is not consistent")
}
return nil