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

make it possible to change MYSQLD_STARTUP_TIMEOUT on Debian systems

    Details

    • Type: Task
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Fix Version/s: None
    • Component/s: Packaging, Platform Debian
    • Labels:
      None

      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

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

              Hide
              jb-boin Jean Weisbuch added a comment -

              I agree with that.

              As the dh_installinit execution is already overrided on "debian.rules" to set its "--name" parameter to "mysql", its possible to create the default file as "debian/mariadb-server-10.0.mysql.default" which would in turn be installed as "/etc/default/mysql".
              It would definitely be better to name it "/etc/default/mariadb", unfortunately i don't think that its possible to pass two different "--name" parameters to dh_installinit or to specify another filename than the package name or the one set with "--name".

              The change could also be ported to mysql-5.5 (including the use of the MYSQLD_STARTUP_TIMEOUT variable on the init script) which would makes sense as its not MariaDB specific and thus the same file would be used by both packages but it would become a problem if MariaDB specific changes were to be done on that file (but it shouldn't break anything as its only setting variables).

              I don't think that creating/modifying the file another way than using dh_installinit would be acceptable.

              Show
              jb-boin Jean Weisbuch added a comment - I agree with that. As the dh_installinit execution is already overrided on "debian.rules" to set its "--name" parameter to "mysql", its possible to create the default file as "debian/mariadb-server-10.0.mysql.default" which would in turn be installed as "/etc/default/mysql". It would definitely be better to name it "/etc/default/mariadb", unfortunately i don't think that its possible to pass two different "--name" parameters to dh_installinit or to specify another filename than the package name or the one set with "--name". The change could also be ported to mysql-5.5 (including the use of the MYSQLD_STARTUP_TIMEOUT variable on the init script) which would makes sense as its not MariaDB specific and thus the same file would be used by both packages but it would become a problem if MariaDB specific changes were to be done on that file (but it shouldn't break anything as its only setting variables). I don't think that creating/modifying the file another way than using dh_installinit would be acceptable.
              Hide
              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.

              Show
              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.
              Hide
              otto Otto Kekäläinen added a comment -

              Jean Weisbuch 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?

              Show
              otto Otto Kekäläinen added a comment - Jean Weisbuch 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?
              Hide
              jb-boin Jean Weisbuch added a comment -

              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).

              Show
              jb-boin Jean Weisbuch added a comment - 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).
              Hide
              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.

              Show
              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.

                People

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

                  Dates

                  • Created:
                    Updated: