Merge branch 'collection-optz' of https://github.com/tidwall/tile38 into collection-optz

This commit is contained in:
tidwall 2019-02-13 17:18:11 -07:00
commit 8a5b842e3c
1 changed files with 23 additions and 13 deletions

View File

@ -227,21 +227,31 @@ func (c *Server) followStep(host string, port int, followc int) error {
} }
// Send the replication port to the leader // Send the replication port to the leader
v, err := conn.Do("replconf", "listening-port", c.port) if err := func() error {
if err != nil { v, err := conn.Do("replconf", "listening-port", c.port)
return err if err != nil {
} return err
if v.Error() != nil { }
return v.Error() if v.Error() != nil {
} return v.Error()
if v.String() != "OK" { }
return errors.New("invalid response to replconf request") if v.String() != "OK" {
} return errors.New("invalid response to replconf request")
if core.ShowDebugMessages { }
log.Debug("follow:", addr, ":replconf") return nil
}(); err != nil {
if strings.HasPrefix(err.Error(), "ERR unknown command") {
log.Warn("follow:", addr, ":replconf", "not available on leader")
} else {
return err
}
} else {
if core.ShowDebugMessages {
log.Debug("follow:", addr, ":replconf")
}
} }
v, err = conn.Do("aof", pos) v, err := conn.Do("aof", pos)
if err != nil { if err != nil {
return err return err
} }