Open junli0411 opened 5 years ago
This was fixed in latest release.
Or... actually I haven’t released since the fix has been merged! So it’s fixed in master branch. Release to follow.
I'm not sure why , but I still get the same error sql in the master branch.
double checked the v3.1.2 , it's still there. ^_^
func ReplaceClusterName(oldClusterName string, newClusterName string) error {
if oldClusterName == "" {
return log.Errorf("replaceClusterName: skipping empty oldClusterName")
}
if newClusterName == "" {
return log.Errorf("replaceClusterName: skipping empty newClusterName")
}
writeFunc := func() error {
_, err := db.ExecOrchestrator(\`
update
database_instance
set
cluster_name=?
where
**and** cluster_name=?
\`, newClusterName, oldClusterName,
)
if err != nil {
return log.Errore(err)
}
AuditOperation("replace-cluster-name", nil, fmt.Sprintf("replaxced %s with %s", oldClusterName, newClusterName))
return nil
}
return ExecDBWriteFunc(writeFunc)
}
Maybe it missed some columns before the 'and' or we need to remove the 'and'.
@junli0411 -- oh, the code is still there -- but no one is using it. Do you still see the error in your log?
BTW, pro tip: use markdown. Use three backtics to format your code. See how I've edited your previous comment.
the log is only there when it's doing failover , I will check it when there's a failover next time. I will use markdown next time
Hi, I got the following error in orchestrator.log 2019-08-21 08:22:33 ERROR Error 1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'and cluster_name='xxxxxx:3306'' at line 6
the function ReplaceClusterName in file instancedao.go , there's a sql error : , err := db.ExecOrchestrator(` update database_instance set cluster_name=? where and cluster_name=? `, newClusterName, oldClusterName, )