Ensure bootstrap-pxc mysqld not in unit cgroup

The bootstrap process for percona-xtradb-cluster requires execution
of a non-standard init.d scrip target to start the mysqld in wsrep
new cluster mode.

The processes started by the operation where ending up in the cgroup
associated with the Juju unit daemon, which on restart (as a result
of a upgrade to juju for example) would result in the mysql daemon
being killed and not restarted.

Use systemd-run to ensure that the bootstrap-pxc operation ends up
in a distinct cgroup so that this does not happen.

Change-Id: Iff998c4c23fcad71cffe9bbee60df7f00d2c9893
Closes-Bug: 1664025
This commit is contained in:
James Page 2017-02-28 11:57:43 +01:00
parent 2efdae7dad
commit fddc1b78f4
1 changed files with 6 additions and 1 deletions

View File

@ -386,7 +386,12 @@ def bootstrap_pxc():
bootstrapped = service('bootstrap-pxc', 'mysql')
if not bootstrapped:
try:
cmd = ['service', 'mysql', 'bootstrap-pxc']
# NOTE(jamespage): execute under systemd-run to ensure
# that the bootstrap-pxc mysqld does
# not end up in the juju unit daemons
# cgroup scope.
cmd = ['systemd-run', '-t', '--service-type=forking',
'service', 'mysql', 'bootstrap-pxc']
subprocess.check_call(cmd)
except subprocess.CalledProcessError as e:
msg = 'Bootstrap PXC failed'