[systemd-devel] My experience with MySQL and systemctl

Tomasz Torcz tomek at pipebreaker.pl
Wed Apr 12 18:24:27 UTC 2017


On Wed, Apr 12, 2017 at 11:01:04AM -0700, Auke Kok wrote:
> 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.

  It wouldn't be good solution.  READY=1 means clients can connect and 
talk to the database. Signalling readiness prematurely would break functionality..
Other solution would be introducing mysql-recover.service unit, which
would be Requires= & After= of main mysql unit. Similarly to how SSH key generation
is handled.
  This recover unit could have infinit timeout, even.

> This, of course, means modifying mysql.

  Well, MariaDB implemented systemd support (sd_notify() and stuff), it's
high time to abandon MySQL.

-- 
Tomasz Torcz                 Morality must always be based on practicality.
xmpp: zdzichubg at chrome.pl                -- Baron Vladimir Harkonnen



More information about the systemd-devel mailing list