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

Add support for enable_load_data_local_infile variable

Open jpiron opened this issue 3 years ago • 9 comments

SUMMARY

Add support for setting enable_load_data_local_infile variable

ISSUE TYPE
  • Feature Pull Request
COMPONENT NAME

proxysql role

jpiron avatar Sep 09 '22 14:09 jpiron

@jpiron thanks for your contribution.

The variable mysql-enable_load_data_local_infile was introduced with proxysql 2.3.0. So when you use this role with proxysql_version: 2.2.2, the installation will fail

failed: [localhost] (item={'key': 'enable_load_data_local_infile', 'value': {'variable': 'enable_load_data_local_infile', 'variable_value': False}}) => {"ansible_loop_var": "item", "changed": false, "item": {"key": "enable_load_data_local_infile", "value": {"variable": "enable_load_data_local_infile", "variable_value": false}}, "msg": "The variable \"mysql-enable_load_data_local_infile\" was not found"}

unfortunately, we have no compliance how long we support proxysql versions < 2.3.0.
Can you please cover this like you did the last time?

markuman avatar Sep 09 '22 15:09 markuman

Sure I'll add this on monday

jpiron avatar Sep 10 '22 09:09 jpiron

It's updated

jpiron avatar Sep 12 '22 08:09 jpiron

@jpiron I still got an error when trying to install 2.2.2 e.g.

---
- hosts: localhost
  become: yes

  vars:
    proxysql_version: 2.2.2

  roles:
    - proxysql

results in

RUNNING HANDLER [proxysql : proxysql | handler | manage mysql config] *****
...
failed: [localhost] (item={'key': 'enable_load_data_local_infile', 'value': {'variable': 'enable_load_data_local_infile', 'variable_value': False}}) => {"ansible_loop_var": "item", "changed": false, "item": {"key": "enable_load_data_local_infile", "value": {"variable": "enable_load_data_local_infile", "variable_value": false}}, "msg": "The variable \"mysql-enable_load_data_local_infile\" was not found"}
....

markuman avatar Sep 12 '22 18:09 markuman

I might be wrong but my understanding of the issue is that the default /etc/proxysql.cnf that ships with the 2.2.2 proxysql version doesn't contain the enable_load_data_local_infile` variable. Therefore the variable isn't loaded into proxysql runtime.

The manage mysql config handler calls the proxysql_global_variables that only performs updates on already proxysql-runtime-loaded variables.

As a result, it fails here: https://github.com/ansible-collections/community.proxysql/blob/main/plugins/modules/proxysql_global_variables.py#L232

Shouldn't the module perform an INSERT if the get_config returns False ?

jpiron avatar Sep 14 '22 14:09 jpiron

@jpiron sorry for the late reply, I was out of office.

Shouldn't the module perform an INSERT if the get_config returns False ?

That might work I think. Are we sure that there are not side-effects when inserting new global variables to proxysql?

markuman avatar Sep 28 '22 07:09 markuman

I suppose, I need to check

jpiron avatar Oct 11 '22 12:10 jpiron

That might work I think. Are we sure that there are not side-effects when inserting new global variables to proxysql?

I've inserted a random name variable. It looks like that it doesn't made any problems...

markuman avatar Dec 22 '22 07:12 markuman

Sorry for the late answer, I didn't get the time to work on this lately. I'll try to manage some time to implement this.

jpiron avatar Jan 24 '23 07:01 jpiron