[MDEV-8509] make it possible to change MYSQLD_STARTUP_TIMEOUT on Debian systems Created: 2015-07-20 Updated: 2016-11-25 Resolved: 2016-11-25 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Packaging, Platform Debian |
| Fix Version/s: | 10.2.3 |
| Type: | Task | Priority: | Minor |
| Reporter: | Nils Meyer | Assignee: | Otto Kekäläinen |
| Resolution: | Fixed | Votes: | 1 |
| Labels: | None | ||
| Issue Links: |
|
||||||||||||||||||||||||
| 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 |
| Comments |
| Comment by Otto Kekäläinen [ 2015-07-21 ] | ||||
|
I think this is fixed in the Debian packaging: https://anonscm.debian.org/cgit/pkg-mysql/mariadb-10.0.git/tree/debian/mariadb-server-10.0.mysql.init#n112 Does it look what you expect it to be? | ||||
| Comment by Nils Meyer [ 2015-07-21 ] | ||||
|
The problem is that the env var MYSQLD_STARTUP_TIMEOUT in line is always not set, at least when using Debian stable (jessie), even when I set it on the command line and thus the timeout always defaults to 30 seconds. The solution for Redhat based distributions is to set the value in /etc/sysconfig/mysql (see | ||||
| Comment by Otto Kekäläinen [ 2015-07-21 ] | ||||
|
nils.meyer OK, I now see what you mean. Indeed if would make sense to be able to permanently set such a variable in /etc/default/mariadb Since you seem to know how to solve it and probably have time to test that the solution also works as expected, would you like to open a pull request at github and have your contribution logged in git history? The Debian packaging repo http://git.debian.org/?p=pkg-mysql/mariadb-10.0.git is mirrored at https://github.com/ottok/mariadb-10.0 Your contribution would be soon available in Debian unstable and given some time in all Debian and Ubuntu releases and also the mariadb.org repositories. | ||||
| Comment by Jean Weisbuch [ 2015-07-22 ] | ||||
|
I made a pull request for it : https://github.com/ottok/mariadb-10.0/pull/26 As specified on the pull request : I haven't tested the modifications. For more infos about the ".default" file : https://www.debian.org/doc/manuals/maint-guide/dother.html#initd | ||||
| Comment by Nils Meyer [ 2015-07-22 ] | ||||
|
I'll create a pull request of my own if time permits, however Jean, consider that the default file SHOULD be generic between release, that is you'll expect it to behave the same on subsequent releases. Therefore you'd go with /etc/default/$(basename). This point will of course be rendered moot once the systemd integration is merged. . | ||||
| Comment by Jean Weisbuch [ 2015-07-22 ] | ||||
|
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". 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. | ||||
| Comment by Nils Meyer [ 2015-07-22 ] | ||||
|
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:
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. | ||||
| Comment by Otto Kekäläinen [ 2015-07-24 ] | ||||
|
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? | ||||
| Comment by Jean Weisbuch [ 2015-07-25 ] | ||||
|
I added a new pull request (https://github.com/ottok/mariadb-10.0/pull/27) that fix these :
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. | ||||
| Comment by Jean Weisbuch [ 2015-08-21 ] | ||||
|
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. | ||||
| Comment by Otto Kekäläinen [ 2016-11-25 ] | ||||
|
This was fixed in https://github.com/MariaDB/server/commit/73f1c655 |