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

OnPosSynced 事件 #956

Open
tonyhal opened this issue Dec 4, 2024 · 2 comments
Open

OnPosSynced 事件 #956

tonyhal opened this issue Dec 4, 2024 · 2 comments

Comments

@tonyhal
Copy link

tonyhal commented Dec 4, 2024

当数据库多次大批量更新时,比如 update A 1000W 条 update B 1000W 条, 这样 ROWS数据还没有处理完, 把gtid 保存到本地文件, 程序异常, 下次启动 就会充最新的 gtid 点开始 **
Uploading 截屏2024-12-04 14.58.00.png…
**

@tonyhal
Copy link
Author

tonyhal commented Dec 4, 2024

func (h *MyEventHandler) OnPosSynced(re *replication.EventHeader, pos mysql.Position, gtidSet mysql.GTIDSet, b bool) error {
// 这里保存读取到的GTID点
// 当程序异常关闭,大批量数据没有处理完时候,已经保存了后面新的GTID点,重启最新的开始点开始了 个人理解: 没有执行的这部分数据就会丢死
log.Infof("OnPosSynced:%v %v %v\n", re.LogPos, pos.String(), gtidSet.String())
return nil
}

@lance6716
Copy link
Collaborator

这样 ROWS数据还没有处理完, 把gtid 保存到本地文件

如果 rows 数据还没有处理完,就不要保存 gtid

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants