Skip to content

Commit

Permalink
fix(redis): dts分片变更时replace替换错误问题 #9153
Browse files Browse the repository at this point in the history
  • Loading branch information
OMG-By committed Jan 21, 2025
1 parent 171b953 commit c17103c
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -344,10 +344,12 @@ func (job *RedisDtsOnlineSwitch) NewProxyConfigFileForSameType() (err error) {
dstConfContent := job.params.DstProxyConfigContent
dstConfContent = strings.ReplaceAll(dstConfContent, job.getDstProxyAddr(), job.getSrcProxyAddr())
job.runtime.Logger.Info(fmt.Sprintf("replace dstConfContent dstProxyAddr:%s => srcProxyAddr:%s",
job.getDstProxyAddr(), job.getDstProxyAddr()))
job.getDstProxyAddr(), job.getSrcProxyAddr()))
// 增加上SrcProxyIP限制,避免出现类似backend seg 350000 被替换的情况
dstConfContent = strings.ReplaceAll(dstConfContent,
strconv.Itoa(job.params.DstProxyPort),
strconv.Itoa(job.params.SrcProxyPort))
job.params.SrcProxyIP+":"+strconv.Itoa(job.params.DstProxyPort),
job.params.SrcProxyIP+":"+strconv.Itoa(job.params.SrcProxyPort),
)
dstConfContent = strings.ReplaceAll(dstConfContent, "\\n", "\n")
if consts.IsTwemproxyClusterType(job.params.SrcClusterType) {
re := regexp.MustCompile(`\s\spassword\s*:\s*` + job.params.DstProxyPassword)
Expand Down

0 comments on commit c17103c

Please sign in to comment.