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

make it possible to change MYSQLD_STARTUP_TIMEOUT on Debian systems

Details

    Description

      In some cases (think SST, large memory allocation) it takes longer than 30 seconds for the Database server to become available, in which case the init script will report failure. This is especially problematic on systems running systemd, since systemd will erroneously record the service as not started and might at some other time try to launch a second mysqld instance (stop/restart also won't work).

      There is already an environment variable referenced when launching (MYSQLD_STARTUP_TIMEOUT) but there seems to be no way to set it. The Debian way would be to specify it in /etc/default/mysql and have something like this inside the init script:

      [ -r /etc/default/$NAME ] && . /etc/default/$NAME

      This was already fixed for Redhat based distributions in MDEV-5068

      Attachments

        Issue Links

          Activity

            nils.meyer Nils Meyer added a comment -

            I think it's fine to keep it /etc/default/mysql in keeping with the naming of the init script since at least a derivative of it is used in all Debian based distributions and an empty file with helpful comments doesn't hurt.

            Only thing about your pull request, you should probably just comment out the MYSQLD_STARTUP_TIMEOUT variable since it defaults to 30 seconds anyways. My suggestion:

            +# The delay in seconds the init script waits for the server to be up and running after having started "mysqld_safe" to run the "/etc/mysql/debian-start" script.
            +# If the server is still not responding after the delay, the script won't be executed and an error will be thrown on the syslog.
            +# Default: 30
            +#MYSQLD_STARTUP_TIMEOUT=30

            It may also be worth mentioned the delay to mlock large areas of memory or the delay for galera SST in the comment.

            Notwithstanding, this pull request would solve the problems I had bootstraping a galera cluster with stock MariaDB.

            nils.meyer Nils Meyer added a comment - I think it's fine to keep it /etc/default/mysql in keeping with the naming of the init script since at least a derivative of it is used in all Debian based distributions and an empty file with helpful comments doesn't hurt. Only thing about your pull request, you should probably just comment out the MYSQLD_STARTUP_TIMEOUT variable since it defaults to 30 seconds anyways. My suggestion: +# The delay in seconds the init script waits for the server to be up and running after having started "mysqld_safe" to run the "/etc/mysql/debian-start" script. +# If the server is still not responding after the delay, the script won't be executed and an error will be thrown on the syslog. +# Default: 30 +#MYSQLD_STARTUP_TIMEOUT=30 It may also be worth mentioned the delay to mlock large areas of memory or the delay for galera SST in the comment. Notwithstanding, this pull request would solve the problems I had bootstraping a galera cluster with stock MariaDB.

            jb-boin Your pull request is merged in Debian packaging and will soon be uploaded to Debian unstable. Now when there is a /etc/default file, would you like to complete you idea in https://github.com/ottok/mariadb-10.0/issues/4 too?

            otto Otto Kekäläinen added a comment - jb-boin Your pull request is merged in Debian packaging and will soon be uploaded to Debian unstable. Now when there is a /etc/default file, would you like to complete you idea in https://github.com/ottok/mariadb-10.0/issues/4 too?
            jb-boin Jean Weisbuch added a comment - - edited

            I added a new pull request (https://github.com/ottok/mariadb-10.0/pull/27) that fix these :

            • The Debian default file for the mariadb-server-10.0 package is now "/etc/default/mysql" instead of "/etc/default/mariadb-server-10.0" (i think that the Debian "mysql" packages maintener should be notified)
            • The MYCHECK_RCPT variable can now be set from the default file.
            • The check_for_crashed_tables() function on the debian-start script has been fixed to be able to log (and email) the errors it encountered : Errors are sent to stderr by the CLI while only stdout was captured by the function (so errors werent logged to syslog as well).
            • The same function now also checks Aria tables along with MyISAM ones.
            • The function now exclude tables that are in the "INFORMATION_SCHEMA" or "PERFORMANCE_SCHEMA" virtual databases (that are created at the server start and thus cannot be improperly closed) (please not that i forgot to mention this change on the debian/changelog file).

            Please note that i havent tested the changes.

            An off-topic comment : The "check_for_crashed_tabels()" function is really... ugly : In its comment its noted that its not using CHECK TABLE because it wouldnt work on engines such as.. "HEAP" (MEMORY) while it was only checking MyISAM tables... by doing a COUNT(*) on them, which cannot be used on engines such as InnoDB or TokuDB as it would scan the whole table.
            Using directly "CHECK TABLE" or "mysqlcheck" would be cleaner and checking other table engines would also be a good idea as most users havent checked the script code to know that it only does MyISAM (and now Aria).

            jb-boin Jean Weisbuch added a comment - - edited I added a new pull request ( https://github.com/ottok/mariadb-10.0/pull/27 ) that fix these : The Debian default file for the mariadb-server-10.0 package is now "/etc/default/mysql" instead of "/etc/default/mariadb-server-10.0" (i think that the Debian "mysql" packages maintener should be notified) The MYCHECK_RCPT variable can now be set from the default file. The check_for_crashed_tables() function on the debian-start script has been fixed to be able to log (and email) the errors it encountered : Errors are sent to stderr by the CLI while only stdout was captured by the function (so errors werent logged to syslog as well). The same function now also checks Aria tables along with MyISAM ones. The function now exclude tables that are in the "INFORMATION_SCHEMA" or "PERFORMANCE_SCHEMA" virtual databases (that are created at the server start and thus cannot be improperly closed) ( please not that i forgot to mention this change on the debian/changelog file ). Please note that i havent tested the changes. An off-topic comment : The " check_for_crashed_tabels() " function is really... ugly : In its comment its noted that its not using CHECK TABLE because it wouldnt work on engines such as.. "HEAP" (MEMORY) while it was only checking MyISAM tables... by doing a COUNT(*) on them, which cannot be used on engines such as InnoDB or TokuDB as it would scan the whole table. Using directly " CHECK TABLE " or " mysqlcheck " would be cleaner and checking other table engines would also be a good idea as most users havent checked the script code to know that it only does MyISAM (and now Aria).
            jb-boin Jean Weisbuch added a comment - - edited

            I did forgot to put a followup on this bug here, i did pull other fixes and tested the 28 of July and validated that it worked as expected on my test environment (comments and examples on Github) : https://github.com/ottok/mariadb-10.0/pull/27

            I just noticed a detail today, the generic init script shipped with MariaDB (and MySQL) on "support-files/mysql.server.sh" already has a similar option as "MYSQLD_STARTUP_TIMEOUT" named "--service-startup-timeout" and the generic init script already reads "/etc/defaults/mysql" if it exists, maybe making it use the variable if set while the "--service-startup-timeout" option is not set could be a good idea for users installing/upgrading MariaDB debian packages while keeping their manually installed init script.

            jb-boin Jean Weisbuch added a comment - - edited I did forgot to put a followup on this bug here, i did pull other fixes and tested the 28 of July and validated that it worked as expected on my test environment (comments and examples on Github) : https://github.com/ottok/mariadb-10.0/pull/27 – I just noticed a detail today, the generic init script shipped with MariaDB (and MySQL) on " support-files/mysql.server.sh " already has a similar option as " MYSQLD_STARTUP_TIMEOUT " named " --service-startup-timeout " and the generic init script already reads " /etc/defaults/mysql " if it exists, maybe making it use the variable if set while the " --service-startup-timeout " option is not set could be a good idea for users installing/upgrading MariaDB debian packages while keeping their manually installed init script.
            otto Otto Kekäläinen added a comment - This was fixed in https://github.com/MariaDB/server/commit/73f1c655

            People

              otto Otto Kekäläinen
              nils.meyer Nils Meyer
              Votes:
              1 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

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