Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(redis): dbha切换忽略状态不对的proxy 对比 #8567 #8568

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -423,8 +423,11 @@ func (ins *RedisSwitch) TwemproxySwitchM2S(masterIp string, masterPort int, slav
ins.ReportLogs(constvar.InfoResult,
fmt.Sprintf("twemproxy switch: from master[%s] -> slave[%s] begin, proxies{%d}.",
masterAddr, slaveAddr, len(ins.Proxy)))

notRunningCnt := 0
for _, proxy := range ins.Proxy {
if proxy.Status != "running" {
notRunningCnt++
}
wg.Add(1)
go func(proxyInfo dbutil.ProxyInfo) {
defer wg.Done()
Expand Down Expand Up @@ -459,6 +462,13 @@ func (ins *RedisSwitch) TwemproxySwitchM2S(masterIp string, masterPort int, slav
masterAddr, slaveAddr, len(ins.Proxy), successSwitchNum))
return nil
}
// ignore status !=running
if int(successSwitchNum)+notRunningCnt >= len(ins.Proxy) {
ins.ReportLogs(constvar.FailResult,
fmt.Sprintf("twemproxy switch: partly proxy switched [tota:%d, succ:%d , norunning:%d]",
len(ins.Proxy), successSwitchNum, notRunningCnt))
return nil
}

ins.ReportLogs(constvar.FailResult,
fmt.Sprintf("twemproxy switch: partly proxy switched [tota:%d != succ:%d]", len(ins.Proxy), successSwitchNum))
Expand Down
Loading