← Back to team overview

maria-discuss team mailing list archive

Re: mysqld-wait-ready -> Re: start mariadb randomly fails or answers with wrong response to systemd


Hi, Reindl!

On Jan 20, Reindl Harald wrote:
> "there are no time-consuming operations in-between" is not enough
> in case of systemd and as-soon-as-possible parallel startup

Okay, I suppose we can change that and start accepting connections
before reporting "ready"...

> in fact systemd calls "ExecStart" and get the zero-return-value from
> "/usr/libexec/mysqld" *before* the service really accepts connections
> that's why "/usr/libexec/mysqld-wait-ready" was needed

This is something I don't understand.

As far as I remember, /usr/libexec/mysqld does not return until you
shutdown the server. It doesn't daemonize itself, the caller is supposed
to start it in the background.

Perhaps - just guessing - systemd looks for a PIDFile and assumes that
the service is ready as soon as the PIDFile is created?

> ________________________________
> [Service]
> Type=simple
> PIDFile=/var/run/mysqld/mysqld.pid
> ExecStart=/usr/libexec/mysqld --defaults-file=/etc/my.cnf --pid-file=/var/run/mysqld/mysqld.pid
> --socket=/var/lib/mysql/mysql.sock --open-files-limit=750000 --basedir=/usr --user=mysql
> ExecStartPost=/usr/libexec/mysqld-wait-ready $MAINPID
> ________________________________


Follow ups