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

如果--stop-pos和MySQL最新position一样,且MySQL binlog只有DDL、没有其他更新,会导致bingo2sql无法正常结束 #23

Open
wxl356 opened this issue Oct 17, 2023 · 0 comments

Comments

@wxl356
Copy link

wxl356 commented Oct 17, 2023

如何复现:
1 flush logs生成新的binlog,该binlog只执行DDL,show master status; 得到binlog file和position
flush logs;
create table t2(id int);
show master status; -- | mysql-bin.004720 | 402 |
---后续不再执行其他SQL、binlog保持不变。

2 bingo2sql解析时,--stop-file --stop-pos使用第一步获取的binlog file和position。由于MySQL binlog 一直没有更新,bingo2sql将无法结束,需要Ctrl+C kill:
./bingo2sql -h=xxx -P 3306 -uxxx -p'xxx' -d monitor --start-file="mysql-bin.004720" --start-pos=4 --stop-file="mysql-bin.004720" --stop-pos=402 -B

[2023/10/17 07:00:08] [info] binlogsyncer.go:392 begin to sync binlog from position (mysql-bin.004720, 4)
[2023/10/17 07:00:08] [info] binlogsyncer.go:808 rotate to (mysql-bin.004720, 4)
INFO[2023-10-17T07:00:08Z] 超出最新binlog位置 file=parser.go line=571 当前位置=402 当前文件=mysql-bin.004720 结束位置=402 结束文件=mysql-bin.004720

原因:
checkFinish(https://github.com/hanchuanchuan/bingo2sql/blob/master/core/parser.go#L523) 和finishFlag(https://github.com/hanchuanchuan/bingo2sql/blob/master/core/parser.go#L2271) 可能需要对只有DDL的场景做处理?

@wxl356 wxl356 changed the title 如果--stop-pos和MySQL最新position一样,且MySQL binlog没有更新,会导致bingo2sql无法正常结束 如果--stop-pos和MySQL最新position一样,且MySQL binlog只有DDL、没有其他更新,会导致bingo2sql无法正常结束 Oct 17, 2023
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

1 participant