Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-16228

System variables retentive setting (a.k.a. SET PERSIST)

Details

    • New Feature
    • Status: Open (View Workflow)
    • Critical
    • Resolution: Unresolved
    • None
    • None

    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.

      Attachments

        Issue Links

          Activity

            balta Tadas Balaišis created issue -
            serg Sergei Golubchik made changes -
            Field Original Value New Value
            Summary System variables retentive setting System variables retentive setting (a.k.a. SET PERSIST)
            serg Sergei Golubchik made changes -
            greenman Ian Gilfillan made changes -
            Labels Compatibility
            greenman Ian Gilfillan added a comment -

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

            greenman Ian Gilfillan added a comment - Added Compatibility label, as MySQL 8.0 has SET PERSIST (and SET PERSIST_ONLY).
            denji Denis Denisov added a comment -

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

            RESET PERSIST [[IF EXISTS] system_var_name]

            denji Denis Denisov added a comment - https://dev.mysql.com/doc/refman/8.0/en/reset-persist.html RESET PERSIST [ [IF EXISTS] system_var_name]
            maxmether Max Mether made changes -
            Priority Major [ 3 ] Critical [ 2 ]
            ralf.gebhardt Ralf Gebhardt made changes -
            Assignee Oleksandr Byelkin [ sanja ]
            ralf.gebhardt Ralf Gebhardt made changes -
            Assignee Oleksandr Byelkin [ sanja ]

            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

            sanja Oleksandr Byelkin added a comment - 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

            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

            balta Tadas Balaišis added a comment - 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

            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)

            sanja Oleksandr Byelkin added a comment - 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)
            julien.fritsch Julien Fritsch made changes -
            Fix Version/s 10.5 [ 23123 ]
            julien.fritsch Julien Fritsch made changes -
            Assignee Ralf Gebhardt [ ralf.gebhardt@mariadb.com ]
            serg Sergei Golubchik made changes -
            Fix Version/s 10.5 [ 23123 ]
            greenman Ian Gilfillan added a comment -

            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:

            greenman Ian Gilfillan added a comment - 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: https://dev.mysql.com/doc/refman/8.0/en/persisted-system-variables.html https://mysqlserverteam.com/mysql-8-0-persisting-configuration-variables/ https://www.percona.com/blog/2019/08/13/set-persist-in-mysql/

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

            sanja Oleksandr Byelkin added a comment - no I am strictly against ability of the server to write any configuration file
            julien.fritsch Julien Fritsch made changes -
            Priority Critical [ 2 ] Major [ 3 ]
            ralf.gebhardt Ralf Gebhardt made changes -
            Priority Major [ 3 ] Critical [ 2 ]
            ralf.gebhardt Ralf Gebhardt made changes -
            Assignee Ralf Gebhardt [ ralf.gebhardt@mariadb.com ]

            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.

            f_razzoli Federico Razzoli added a comment - 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.
            serg Sergei Golubchik made changes -
            Workflow MariaDB v3 [ 87358 ] MariaDB v4 [ 130830 ]
            AirFocus AirFocus made changes -
            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.
            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.
            greenman Ian Gilfillan made changes -
            greenman Ian Gilfillan added a comment -

            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.

            greenman Ian Gilfillan added a comment - 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.

            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

            monty Michael Widenius added a comment - 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

            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.

            f_razzoli Federico Razzoli added a comment - 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.
            julien.fritsch Julien Fritsch made changes -
            Issue Type Task [ 3 ] New Feature [ 2 ]

            Good configuration management overwrites 'unknown' configuration files like 'persistent.cnf', so this is compatible with what @monty proposed.

            Check https://gitlab.com/de-groot-consultancy-ansible-roles/mariadb-mysql-galera/-/blob/beta/tasks/configure-mariadb.yml for an example.

            michaeldg Michaël de groot added a comment - Good configuration management overwrites 'unknown' configuration files like 'persistent.cnf', so this is compatible with what @monty proposed. Check https://gitlab.com/de-groot-consultancy-ansible-roles/mariadb-mysql-galera/-/blob/beta/tasks/configure-mariadb.yml for an example.

            People

              Unassigned Unassigned
              balta Tadas Balaišis
              Votes:
              2 Vote for this issue
              Watchers:
              14 Start watching this issue

              Dates

                Created:
                Updated:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.