Skip to content

Commit

Permalink
修复mysql input 数据源开启了gtid功能,但实际没采用gtid方式同步,重启后又自动gtid模式同步的bug
Browse files Browse the repository at this point in the history
  • Loading branch information
jc3wish committed Oct 27, 2022
1 parent 680d785 commit 7ff900a
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion server/recovery.go
Original file line number Diff line number Diff line change
Expand Up @@ -543,6 +543,13 @@ func SaveDBInfoToFileData() interface{} {
data = make(map[string]dbSaveInfo, 0)
for k, db := range DbList {
db.Lock()
// 假如数据源是mysql,没有开启gtid同步功能,但是又有gtid信息的情况下,但是后端又能获取到gtid信息,启退的时候,还是会获取到gtid进行保留
// db.isGtid 是在启动的时候判断是否有gtid
// 所以在退出保存配置的时候,也应该判断在启动数据源的时候,是否有真正gtid信息,否则直接为空,防止中间被自动,导致重启后使用不了
var gtid string
if db.isGtid {
gtid = db.gtid
}
data[k] = dbSaveInfo{
Name: db.Name,
InputType: db.InputType,
Expand All @@ -552,7 +559,7 @@ func SaveDBInfoToFileData() interface{} {
BinlogDumpFileName: db.binlogDumpFileName,
BinlogDumpPosition: db.binlogDumpPosition,
IsGtid: db.isGtid,
Gtid: db.gtid,
Gtid: gtid,
LastEventID: db.lastEventID,
BinlogDumpTimestamp: db.binlogDumpTimestamp,
MaxBinlogDumpFileName: db.maxBinlogDumpFileName,
Expand Down

0 comments on commit 7ff900a

Please sign in to comment.