Skip to content

Commit

Permalink
fix(dbm-services): enhance perfomance of dbha redis detect #2189
Browse files Browse the repository at this point in the history
  • Loading branch information
zyqlzr authored Nov 29, 2023
1 parent 4850bcf commit c61c591
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,24 +37,32 @@ func RedisClusterNewIns(instances []interface{},
// create detect instance by machine_type
if uIns.MetaType == constvar.RedisMetaType {
redisIns = append(redisIns, NewRedisDetectInstance(uIns, conf))
count, _ := GetInstancePass(constvar.RedisMetaType, redisIns, conf)
if count != len(redisIns) {
log.Logger.Errorf("RedisCluster redis passwd part failed,succ:%d,total:%d",
count, len(redisIns))
}
} else if uIns.MetaType == constvar.TwemproxyMetaType {
twemIns = append(twemIns, NewTwemproxyDetectInstance(uIns, conf))
count, _ := GetInstancePass(constvar.TwemproxyMetaType, twemIns, conf)
if count != len(twemIns) {
log.Logger.Errorf("RedisCluster twemproxy passwd part failed,succ:%d,total:%d",
count, len(twemIns))
}
} else {
log.Logger.Errorf("RedisCluster cluster is %s but meta type is invalid",
constvar.RedisCluster)
}
}

// get redis instance passwd
if len(redisIns) > 0 {
count, _ := GetInstancePass(constvar.RedisMetaType, redisIns, conf)
if count != len(redisIns) {
log.Logger.Errorf("RedisCluster redis passwd part failed,succ:%d,total:%d",
count, len(redisIns))
}
}

// get twemproxy instance passwd
if len(twemIns) > 0 {
count, _ := GetInstancePass(constvar.TwemproxyMetaType, twemIns, conf)
if count != len(twemIns) {
log.Logger.Errorf("RedisCluster twemproxy passwd part failed,succ:%d,total:%d",
count, len(twemIns))
}
}

ret = append(ret, redisIns...)
ret = append(ret, twemIns...)
return ret, err
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,24 +36,32 @@ func TendisClusterNewIns(instances []interface{},
// create detect instance by machine_type
if uIns.MetaType == constvar.TendisplusMetaType {
tendisIns = append(tendisIns, NewTendisplusDetectInstance(uIns, conf))
count, _ := GetInstancePass(constvar.TendisplusMetaType, tendisIns, conf)
if count != len(tendisIns) {
log.Logger.Errorf("TendisCluster tendisplus passwd part failed,succ:%d,total:%d",
count, len(tendisIns))
}
} else if uIns.MetaType == constvar.PredixyMetaType {
predixyIns = append(predixyIns, NewPredixyDetectInstance(uIns, conf))
count, _ := GetInstancePass(constvar.PredixyMetaType, predixyIns, conf)
if count != len(predixyIns) {
log.Logger.Errorf("TendisCluster predixy passwd part failed,succ:%d,total:%d",
count, len(predixyIns))
}
} else {
log.Logger.Errorf("TendisCluster cluster is %s but meta type is invalid",
constvar.TendisplusCluster)
}
}

// get tendisplus passwd
if len(tendisIns) > 0 {
count, _ := GetInstancePass(constvar.TendisplusMetaType, tendisIns, conf)
if count != len(tendisIns) {
log.Logger.Errorf("TendisCluster tendisplus passwd part failed,succ:%d,total:%d",
count, len(tendisIns))
}
}

// get predixy passwd
if len(predixyIns) > 0 {
count, _ := GetInstancePass(constvar.PredixyMetaType, predixyIns, conf)
if count != len(predixyIns) {
log.Logger.Errorf("TendisCluster predixy passwd part failed,succ:%d,total:%d",
count, len(predixyIns))
}
}

ret = append(ret, tendisIns...)
ret = append(ret, predixyIns...)
return ret, err
Expand Down

0 comments on commit c61c591

Please sign in to comment.