CodisLabs / codis

Proxy based Redis cluster solution supporting pipeline and scaling dynamically
MIT License
13.17k stars 2.69k forks source link

发现了一处可能是代码bug #1728

Open donniezhangzq opened 3 years ago

donniezhangzq commented 3 years ago
func (ctx *context) toReplicaGroups(gid int, p *models.Proxy) [][]string {
    g := ctx.group[gid]
    switch {
    case g == nil:
        return nil
    case g.Promoting.State != models.ActionNothing:
        return nil
    case len(g.Servers) <= 1:
        return nil
    }

这里的g.Promoting.State != models.ActionNothing: 会导致停写状态是,主得到的读拓扑是空的,会导致所以的读流量都到主上,这里是出于什么考虑写的呢,有特殊用意吗

spinlock commented 3 years ago

没记错的话,数据迁移过程中,流量都打给主,因为迁移动作是主在执行,访问从可能会访问到更多的不一致数据

hiqsociety commented 3 years ago

https://github.com/CodisLabs/codis/issues/1721 can do pull request to this?