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

update: 增加检测SQL的超时时间,避免真实影响行数检测对实例造成影响 #304

Closed

Conversation

hhyo
Copy link
Contributor

@hhyo hhyo commented Feb 21, 2021

背景:
针对需要开启真实影响行数检测的场景,由于大多数审核检测还是在主库进行,这等同于是开放了在主库执行任意查询语句的权限,可能由于提交用户的不当操作对生产实例造成影响

调整:

  • 增加配置项check_max_execution_time,用于配置审核检测的会话执行时间
  • 在检测过程中设置该变量
  • 忽略获取真实影响行数超时的问题,超时后依然走explain判断

不足和风险:

  • 全局设置改变量不太合理,实际应该在获取真实影响行数时设置更友好
  • 对于获取真实影响行数执行超时的场景判断和处理,现在直接判断AffectedRows > 0不合理(不太会改)

个人的想法,看是否有必要调整和合并

关于max_execution_time参数的版本:https://dev.mysql.com/doc/relnotes/mysql/5.7/en/news-5-7-8.html

@hhyo hhyo force-pushed the feature-check-max-execution-time branch from 9dded36 to 28101bb Compare February 21, 2021 05:47
@hanchuanchuan
Copy link
Owner

能否拆分成两个需求来做,可能更灵活一点:

  1. 添加参数max_execution_time的设置,来控制DML语句的最大执行时间,正好群里有提这个需求
  2. 添加新的参数real_row_count_timeout来控制真实影响行数检测功能的超时,用context实现就可以了

@stale
Copy link

stale bot commented Mar 16, 2021

由于此问题没有最近的活动,因此已被自动标记为陈旧。如果没有进一步的活动,会作为不活跃issue关闭。感谢你对本项目的贡献。 This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix This will not be worked on label Mar 16, 2021
@stale stale bot closed this Mar 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wontfix This will not be worked on
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants