[MDEV-16228] System variables retentive setting (a.k.a. SET PERSIST) Created: 2018-05-21  Updated: 2023-11-30

Status: Open
Project: MariaDB Server
Component/s: None
Fix Version/s: None

Type: New Feature Priority: Critical
Reporter: Tadas Balaišis Assignee: Unassigned
Resolution: Unresolved Votes: 2
Labels: Compatibility

Issue Links:
Duplicate
duplicates MDEV-19036 SET PERSIST Closed
PartOf
is part of MDEV-28906 MySQL 8.0 desired compatibility Open

 Description   

I use 0 for autocommit variable. I was surprised a bit to find that setting

SET global AUTOCOMMIT=0;

is valid only until service restart. Then I get default (1) value again. To make it persistent I wrote it into my.cfg/my.ini file. Now it works.
But I would like to ask possibility to set the variable usind "SET" command with some keyword to make it retentive.



 Comments   
Comment by Ian Gilfillan [ 2019-05-03 ]

Added Compatibility label, as MySQL 8.0 has SET PERSIST (and SET PERSIST_ONLY).

Comment by Denis Denisov [ 2019-08-12 ]

https://dev.mysql.com/doc/refman/8.0/en/reset-persist.html

RESET PERSIST [[IF EXISTS] system_var_name]

Comment by Oleksandr Byelkin [ 2019-10-15 ]

1) what if there is no any config file?
2) what if there is write rights to the file?
3) command line option will still prevail, so it will be the same effect in case of command line options
4) allow server to write to setup looks (for me) like a security risk

Comment by Tadas Balaišis [ 2019-10-16 ]

I hope these questions are not for me.
But I can drop an opinion:
1) create the file and fill it
2) inform with "Unknown error" or something
3) that's OK if command line option prevail, it desired to work in no command line option mode like SET tells
4) the same user can drop tables, users, so it's OK for him to rule the settings of the database

Comment by Oleksandr Byelkin [ 2019-10-16 ]

4) is about having code which rewrite config in the server.

5) rewriting confing is far from be atomic so you can just destroy config (tables looks way better at least aria are crash safe)

Comment by Ian Gilfillan [ 2019-11-26 ]

To answer sanja's questions according to how MySQL does it:

1) It creates a separate file, mysqld-auto.cnf
2) It doesn't attempt to write to any other config file, so this should not be an issue
3) No, until RESET PERSIST... is run, this takes precedence over options set on the command-line.
4) This is written in the data directory only
5) Agree, which is an argument for writing in a system table instead

More info:

Comment by Oleksandr Byelkin [ 2019-11-26 ]

no I am strictly against ability of the server to write any configuration file

Comment by Federico Razzoli [ 2021-04-06 ]

As far as I understand, the only practical effect of this MySQL feature on real-world environments is bringing uncertainty about the actual servers configuration. It allows to change a variable and make the change survive a restart without changing my.cnf: this is strictly against the modern way to handle systems (infrastructure as code paradigm, devops, SRE, whatever).

I agree that an SQL command should not modify a configuration file. That could even worsen the situation, because the actual configuration file on a server wouldn't match the one you have in your repository.

Please, don't implement this command or any variant.

Comment by Ian Gilfillan [ 2023-03-08 ]

Even though it's unclear whether this will be implemented, since it's still open, I'm linking it to the parent list of MySQL-8 compatibility tasks.

Comment by Michael Widenius [ 2023-09-29 ]

We could have a special, always included 'persistent.cnf' file in that is modified with SET PERSISTENT ...
This would always be loaded last from my.cnf.
At least, the behavior of this feature would be easy to document and understand

Comment by Federico Razzoli [ 2023-09-29 ]

This would still cause inconsistencies between (for example) a user's Ansible repository and MariaDB configuration. Even if the repository contains persistent.cnf, it will be different from the one on the server.

Generated at Thu Feb 08 08:27:20 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.