-
-
Notifications
You must be signed in to change notification settings - Fork 827
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
Add function for setting max query execution time to core #32231
base: master
Are you sure you want to change the base?
Conversation
🤖 Thank you for contributing to CiviCRM! ❤️ We will need to test and review this PR. 👷 Introduction for new contributors...
Quick links for reviewers...
|
Ooh, neat idea. |
a432a24
to
f3610b9
Compare
I've unsubscribed, but please ping me again if you think I can help. |
Cool doings, though, @eileenmcnaughton ! |
I tried this out (mariadb). It seems to work (DB Error thrown when query exceeds the time limit). One thing that my read of the docblock was off and I struggled for a bit trying to figure out that you have to assign the autoclean to a variable. Maybe the order of the wording in the docblock, e.g. change
to something like
|
public static function getMaxExecutionTime(): int { | ||
$version = CRM_Utils_SQL::getDatabaseVersion(); | ||
if (stripos($version, 'mariadb') !== FALSE) { | ||
$originalSql = 'SHOW VARIABLES LIKE "%MAX_STATEMENT_TIME%"'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this need percent signs? Similarly line 280.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@demeritcowboy I thought that - I took it from @twomice - Allan can you confirm?
Overview
Add function for setting max query execution time to core
Before
@twomice has figured out how to leverage mysql / mariaDB max execution variable in an extension but it is not available to core / other extensions
https://github.com/JoineryHQ/com.joineryhq.dupmon/blob/master/CRM/Dupmon/Util.php#L126-L131
After
New Core functions
CRM_Core_DAO::getMaxExecutionTime()
CRM_Core_DAO::setMaxExecutionTime()
With recommended usage being
Technical Details
We don't know if there are any non-handled edge cases - hopefully tests can try a few sql versions....
However, this currently has no core callers outside of the unit test so we can add it cautiously.
I propose we follow up by adding a core caller in
hook_civicrm_findExistingDuplicates()
- this core code currently has no users as it is only called when the new hidden, installed on upgrade and new installslegacydedupefinder
extension is enabled. This is allowing is to roll out less tested but more performant dedupe methodology.We would need to determine a core setting to replace the one in https://github.com/JoineryHQ/com.joineryhq.dupmon/blob/master/CRM/Dupmon/Util.php#L194C6-L194C27 and possibly think about managing the migration with @twomice - either a version check or cutting a new extension release for 6.1 would do it
Comments