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

my2sql解析binlog程序bug #1634

Closed
1 task
lidonghai11 opened this issue Jun 19, 2022 · 5 comments · Fixed by #1653
Closed
1 task

my2sql解析binlog程序bug #1634

lidonghai11 opened this issue Jun 19, 2022 · 5 comments · Fixed by #1653
Labels
bug Something isn't working

Comments

@lidonghai11
Copy link

lidonghai11 commented Jun 19, 2022

问题是否已经被报告?

  • 我已经搜索了当前存在的问题

重现步骤

sql/binlog.py 中代码错误

for line in iter(p.stdout.readline, ''):
logger.error('bkf')
if n <= num and isinstance(line, str):
if line[0:6].upper() in ('INSERT', 'DELETE', 'UPDATE'):
n = n + 1
row_info = {}
try:
row_info['sql'] = line + ';'
except IndexError:
row_info['sql'] = line + ';'
rows.append(row_info)
else:
break

注释:p.stdout.readline 在解析的日志中回滚语句总数量少于num(默认30)时,陷入阻塞状态永不退出,可以直接flush下mysql然后插入2-3条语句,解析下最新binlog 的INSERT类型的回滚语句

预期外的结果

不需要

日志文本

不需要

版本

1.8.5

部署方式

手工部署

是否还有其他可以辅助定位问题的信息?比如数据库、浏览器、goInception等

不需要

@lidonghai11 lidonghai11 added the bug Something isn't working label Jun 19, 2022
@lidonghai11
Copy link
Author

image

@lidonghai11
Copy link
Author

如上命令就会阻塞,如果阻塞并且 if n <= num and isinstance(line, str): 这里不成立,就永远无法退出了

@nick2wang
Copy link
Collaborator

nick2wang commented Jun 20, 2022

不指定stop-file的话确实会存在这种情况,基于工具插件的定位是对历史binlog进行解析,后面可以修改为强制选择终止点

@peng19832
Copy link
Contributor

不指定stop-file的话确实会存在这种情况,基于工具插件的定位是对历史binlog进行解析,后面可以修改为强制选择终止点

大佬,建议给个默认值,页面没有指定日志文件时,默认最近一个日志是stop-file

@nick2wang
Copy link
Collaborator

不指定stop-file的话确实会存在这种情况,基于工具插件的定位是对历史binlog进行解析,后面可以修改为强制选择终止点

大佬,建议给个默认值,页面没有指定日志文件时,默认最近一个日志是stop-file

以起始文件作为默认终止文件更合适些,控制默认解析范围为选择的那个文件的结束位置

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants