community.mysql icon indicating copy to clipboard operation
community.mysql copied to clipboard

Support MAX_STATEMENT_TIME resource limit on MariaDB for mysql_user

Open joekeilty-oub opened this issue 4 years ago • 1 comments

SUMMARY

Currently, the following resource limits are supported in mysql_user module for resource_limits parameter:

MAX_QUERIES_PER_HOUR: num, MAX_UPDATES_PER_HOUR: num, MAX_CONNECTIONS_PER_HOUR: num, MAX_USER_CONNECTIONS: num.

MariaDB supports another resource limit: MAX_STATEMENT_TIME. As seen: https://mariadb.com/kb/en/grant/#resource-limit-options

ISSUE TYPE
  • Feature Idea
COMPONENT NAME

mysql_user module, I think https://github.com/ansible-collections/community.mysql/blob/663590689f3fe9aa94d223ccec527399c383480a/plugins/module_utils/user.py#L775 is where the code is

ADDITIONAL INFORMATION

My use case is I have a backup user that performs tasks with mysqldump and mysql bin logs who would like to have a greater max_statement_time than what I have default limit globally.

I would like to adjust the max statement time resource limit just for this user.


joekeilty-oub avatar Aug 26 '21 15:08 joekeilty-oub

@joekeilty-oub hi, thanks for the issue! It seems that the option was introduced in 10.1.1 https://mariadb.com/kb/en/aborting-statements/. So we should consider 1) implementation (mysql/mariadb) and 2) mariadb version. It shouldn't be hard. The logic roughly:

  1. if mysql, use this query / this function
  2. if mariadb of version 10.1.1, use that SQL / that function

I could take a look but would be nice to have more people involved. If anyone wants to pick it up

  1. grep through the files with impl and you'll find how to similar things work
  2. also there are files in plugins/module_utils that have functions that use version to identify if a feature is supported or not
  3. they are used in the module, it's not hard to find
  4. we have a quick start dev guide that helps setup everything needed quickly and submit a PR https://github.com/ansible/community-docs/blob/main/create_pr_quick_start_guide.rst

I'd be happy to review / help.

If anyone wants to fix it, please put it here explicitly to avoid parallel work.

If there are no volunteers, I'll probably take it in a month or so.

Andersson007 avatar Aug 27 '21 05:08 Andersson007

closed via https://github.com/ansible-collections/community.mysql/pull/523

Andersson007 avatar Apr 07 '23 09:04 Andersson007