Bug #90042 systemd support for ndbmtd
Submitted: 13 Mar 2018 8:25 Modified: 14 Mar 2018 4:38
Reporter: Daniël van Eeden (OCA) Email Updates:
Status: Verified Impact on me:
Category:MySQL Server: Packaging Severity:S4 (Feature request)
Version:7.6.4 OS:Any
Assigned to: CPU Architecture:Any
Tags: ndbd, ndbmtd, systemd

[13 Mar 2018 8:25] Daniël van Eeden
ndbmtd is packaged in mysql-cluster-community-data-node and doesn't have a systemd unit file or rc script.

$ rpm -ql mysql-cluster-community-data-node-7.6.4-1.el7.x86_64

When I use salt to start ndbmtd on the data nodes it results in this:
 ps -o pid,comm,cgroup -C ndbmtd
28908 ndbmtd          1:name=systemd:/system.slice/salt-minion.service
28909 ndbmtd          1:name=systemd:/system.slice/salt-minion.service

A "systemctl status salt-minion" also shows ndbmtd as part of the cgroup.

This is not salt specific, but can happen with various other services.

systemd uses cgroups to group all processes of a specific service together and uses that
to ensure all processes are killed when restarting a service.

A salt-minion restart results in:
2018-03-12 22:40:44 [ndbd] INFO     -- Received signal 15. Performing stop.
2018-03-12 22:40:44 [ndbd] INFO     -- Received signal 15. Performing stop.
2018-03-12 22:40:44 [ndbd] INFO     -- The data node run-time environment has been stopped
2018-03-12 22:40:44 [ndbd] INFO     -- Shutdown initiated
2018-03-12 22:40:44 [ndbd] INFO     -- Shutdown completed - exiting
2018-03-12 22:41:01 [ndbd] INFO     -- Angel shutting down
2018-03-12 22:41:01 [ndbd] INFO     -- Node 4: Node shutdown completed. Initiated by signal 15.

How to repeat:
Use salt or other similar services to start ndbmtd on a systemd capable system (OEL7, CO7, RHEL7). And check in which cgroup it is placed. Then restart that service and see if it impacts ndbmtd.

Suggested fix:
Ship a unit file for systemd. This ensures ndbmtd is placed in its own cgroup.

Currently ndbmtd has two processes, an angel process and a worker process. It *might* make sense to not have the angel process but leave that function to systemd.
[13 Mar 2018 9:16] Daniël van Eeden
== Example ndbmtd.unit
Description=MySQL Cluster Data Node

ExecStart=/usr/sbin/ndbmtd $NDBMTD_OPTIONS


== Example sysconfig
[13 Mar 2018 9:17] Daniël van Eeden
Using --foreground might make sense to allow more integration with journald (e.g. journalctl -u ndbmtd)
[14 Mar 2018 4:38] MySQL Verification Team
Hello Daniël,

Thank you for the report and feature request!