diff --git a/controller/controller.go b/controller/controller.go index 254f2b94..fabba113 100644 --- a/controller/controller.go +++ b/controller/controller.go @@ -84,6 +84,7 @@ type Controller struct { lives map[*liveBuffer]bool lcond *sync.Cond fcup bool // follow caught up + fcuponce bool // follow caught up once shrinking bool // aof shrinking flag shrinklog [][]string // aof shrinking log hooks map[string]*Hook // hook name @@ -492,7 +493,7 @@ func (c *Controller) handleInputCommand(conn *server.Conn, msg *server.Message, // read operations c.mu.RLock() defer c.mu.RUnlock() - if c.config.FollowHost != "" && !c.fcup { + if c.config.FollowHost != "" && !c.fcuponce { return writeErr(errors.New("catching up to leader")) } case "follow", "readonly", "config": diff --git a/controller/follow.go b/controller/follow.go index 85629cfc..c31978e4 100644 --- a/controller/follow.go +++ b/controller/follow.go @@ -218,6 +218,7 @@ func (c *Controller) followStep(host string, port int, followc uint64) error { if caughtUp { c.mu.Lock() c.fcup = true + c.fcuponce = true c.mu.Unlock() log.Info("caught up") } @@ -241,6 +242,7 @@ func (c *Controller) followStep(host string, port int, followc uint64) error { caughtUp = true c.mu.Lock() c.fcup = true + c.fcuponce = true c.mu.Unlock() log.Info("caught up") } diff --git a/controller/stats.go b/controller/stats.go index 9a0864ce..ffc0b460 100644 --- a/controller/stats.go +++ b/controller/stats.go @@ -80,6 +80,7 @@ func (c *Controller) cmdServer(msg *server.Message) (res string, err error) { if c.config.FollowHost != "" { m["following"] = fmt.Sprintf("%s:%d", c.config.FollowHost, c.config.FollowPort) m["caught_up"] = c.fcup + m["caught_up_once"] = c.fcuponce } m["http_transport"] = c.http m["pid"] = os.Getpid()