topom: invalid HA cache in func GroupPromoteServer
@@ -230,7 +230,7 @@ func (s *Topom) GroupPromoteServer(gid int, addr string) error {
defer s.dirtyGroupCache(g.Id)
- log.Warnf("group-[%d] will promote index = %s", g.Id, index)
+ log.Warnf("group-[%d] will promote index = %d", g.Id, index)
g.Promoting.Index = index
g.Promoting.State = models.ActionPreparing
@@ -275,6 +275,9 @@ func (s *Topom) GroupPromoteServer(gid int, addr string) error {
if err := sentinel.Unmonitor(groupIds, time.Second*5, p.Servers...); err != nil {
log.WarnErrorf(err, "group-[%d] unmonitor sentinels failed", g.Id)
}
+ if s.ha.masters != nil {
+ delete(s.ha.masters, gid)
+ }
}
defer s.dirtyGroupCache(g.Id)
