Details
-
Task
-
Status: Closed (View Workflow)
-
Minor
-
Resolution: Not a Bug
Description
MariaDB(.org) packages on Systemd have the following option in the unit service file:
ExecStartPost=/bin/sh -c "systemctl unset-environment _WSREP_START_POSITION"
What can happen is that MariaDB is started but not yet accepting connections(for example due to some internal maintenance) so any tool that relies on the information provided by Systemd whether MariaDB is started or not to do some operation (think of containers or any automation tool) can fail because of this.
CentOS/RHEL packages have:
ExecStartPost=mariadb-wait-ready
The mariadb-wait-ready script does a mysqladmin ping basically.
Would it be better to declare started MariaDB only when already accepting connection?
The use of ExecStartPost=mariadb-wait-ready was from a time when the systemd service Type was forking. Since its been Type=notify from the very beginning in mariadb packages the ugly hack of mariadb-wait-readly isn't needed (they are catching on https://src.fedoraproject.org/rpms/mariadb/c/2caa773538c1d27e10cb86e15d76c39c20339cf9).
With Type=notify mariadb tells systemd its ready https://github.com/MariaDB/server/blob/10.3/sql/mysqld.cc#L6679, when the listening ports are already setup and just before we check those have any connections pending. As such systemd has the perfect understanding of the mariadb availability.
So services that depend on mariadb in systemd will start at the correct time when mariadb is available.
Not sure of the relevance of ExecStartPost=.. (an also ugly hack that I'd like to remove
MDEV-14707).If you have some logs showing this isn't the case I'd be interested to resolve this but as far as I can see this isn't a problem.