Bug 1155700

Summary: systemctl start mysqld returns before socket is ready
Product: [Fedora] Fedora Reporter: Pavel Sedlák <psedlak>
Component: mariadbAssignee: Jan Staněk <jstanek>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 21CC: hhorak, jdornak, jstanek, mmuzila
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: mariadb-10.0.14-7.fc21 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-11-13 18:12:44 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Pavel Sedlák 2014-10-22 16:22:27 UTC
When mariadb is started via mysqld service name, it does not blocks until it gets ready.

> systemctl stop mysqld; systemctl start mysqld; mysql -u root -S/var/lib/mysql/mysql.sock
fails with
> ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2 "No such file or directory")

unlike when doing it via mariadb service name:
> systemctl stop mariadb; systemctl start mariadb; mysql -u root -S/var/lib/mysql/mysql.sock
results in
> Welcome to the MariaDB monitor.  Commands end with ; or \g.
> Your MariaDB connection id is 3
> Server version: 10.0.14-MariaDB MariaDB Server
> ...

Happens with mariadb-server-10.0.14-6.fc21.x86_64.
As possible fix/workaround seems it's enough to add
After=mariadb.service to mysqld.service file, like:
> --- /usr/lib/systemd/system/mysqld.service      2014-10-22 16:20:26.475000000 +0000
> +++ /usr/lib/systemd/system/mysqld-fix.service  2014-10-22 16:20:24.042000000 +0000
> @@ -1,6 +1,7 @@
>  [Unit]
>  Description=MySQL compatibility service (another name for mariadb.service; you should use mariadb.service instead)
>  BindsTo=mariadb.service
> +After=mariadb.service
>  
>  [Service]
>  Type=oneshot
then do systemctl daemon-reload, and even version with "mysqld" as service name works.

Comment 1 Jan Staněk 2014-10-24 12:27:34 UTC
I appplied your proposed fix and can confirm that it is working.

Comment 2 Fedora Update System 2014-10-27 08:23:36 UTC
mariadb-10.0.14-7.fc21 has been submitted as an update for Fedora 21.
https://admin.fedoraproject.org/updates/mariadb-10.0.14-7.fc21

Comment 3 Fedora Update System 2014-10-28 10:07:17 UTC
Package mariadb-10.0.14-7.fc21:
* should fix your issue,
* was pushed to the Fedora 21 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing mariadb-10.0.14-7.fc21'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2014-13817/mariadb-10.0.14-7.fc21
then log in and leave karma (feedback).

Comment 4 Fedora Update System 2014-11-13 18:12:44 UTC
mariadb-10.0.14-7.fc21 has been pushed to the Fedora 21 stable repository.  If problems still persist, please make note of it in this bug report.