bootstrap-pxc and start does not check if mysqld is already running
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
MySQL patches by Codership |
Opinion
|
Undecided
|
Unassigned | ||
Percona XtraDB Cluster moved to https://jira.percona.com/projects/PXC |
Fix Released
|
Undecided
|
Raghavendra D Prabhu |
Bug Description
"/etc/init.d/mysql start" and "/etc/init.d/mysql bootstrap-pxc" doesn't check if mysqld is already running before start the process and return "Success" always.
-----------------
How to reproduce:
-----------------
[root@node1 vagrant]# ps xa | grep mysqld
3908 pts/0 S 0:00 /bin/sh /usr/bin/
4134 pts/0 Sl 0:00 /usr/sbin/mysqld --basedir=/usr --datadir=
[root@node1 vagrant]# /etc/init.d/mysql start
Starting MySQL (Percona XtraDB Cluster) SUCCESS!
[root@node1 vagrant]# echo $?
0
[root@node1 vagrant]# /etc/init.d/mysql bootstrap-pxc
Bootstrapping PXC (Percona XtraDB Cluster)Starting MySQL (Percona XtraDB Cluster) SUCCESS!
[root@node1 vagrant]# echo $?
0
-----------
How to fix
-----------
Check if mysql is already running before start the server:
# diff /etc/init.
285,293d284
< # Check if mysqld is already running
< if test -s "$mysqld_
< read mysqld_pid < "$mysqld_
< if kill -0 $mysqld_pid 2>/dev/null ; then
< log_failure_msg "MySQL (Percona XtraDB Cluster) is already running ($mysqld_pid)"
< exit 1
< fi
< fi
<
[root@node1 vagrant]# /etc/init.
Bootstrapping PXC (Percona XtraDB Cluster) ERROR! MySQL (Percona XtraDB Cluster) is already running (4134)
[root@node1 vagrant]# echo $?
1
[root@node1 vagrant]# /etc/init.
ERROR! MySQL (Percona XtraDB Cluster) is already running (4134)
[root@node1 vagrant]# echo $?
1
This will only check for the pid file, we can also add another check for the mysqld process.
Regards,
Martin.
Related branches
Changed in percona-xtradb-cluster: | |
status: | Fix Committed → Fix Released |
Yes, the CentOS init script didn't check that whereas the debian one did. Fixing it.