[systemd-devel] My experience with MySQL and systemctl

Auke Kok auke-jan.h.kok at intel.com
Wed Apr 12 18:01:04 UTC 2017


On 04/11/2017 06:08 AM, Lennart Poettering wrote:
> On Tue, 11.04.17 13:41, Samuel Williams (space.ship.traveller at gmail.com) wrote:
>> - If a daemon fails to start up, trying to kill it.. may not be the
>> best option. It's probably a matter of the systemctl service file
>> detecting that a rollback is in progress and accepting that as a valid
>> startup state, but I'm not really sure. In any case, I ended up having
>> to do this process manually.
> 
> The timeouts for killing services that don't start up correctly are
> configurable per service, and by setting them to "infinity" you may
> even turn them off entirely. This is configurable precisely so that
> services that can take ages to start-up in real-life can increase or
> turn off the timeout the way they need. Or in other words: please make
> sure that your mysql.service carries the right
> StartTimeoutSec=/StopTimeoutSec= settings, and please contact your
> unit file vendor to fix this.

Actually, that seems as bad of a solution as the standard setting.

Recovery of a very large db could take days. You can't estimate a good
value for StartTimeoutSec=, since undoubtedly someone can come up with a
worse case.

The right (or, better) solution IMHO would be for mysqld to signal to
systemd that it's running OK before recovery starts, using type=notify.
This way recovery can take as long as needed, and if it fails, it could
signal this failure as normal back to systemd. Then systemd would retry
the recovery a few times this way and finally give up.

This, of course, means modifying mysql.

Cheers,

Auke



More information about the systemd-devel mailing list