[ClusterLabs] [Question] Question about mysql RA.
Ken Gaillot
kgaillot at redhat.com
Wed Nov 4 16:44:02 CET 2015
On 11/04/2015 04:36 AM, renayama19661014 at ybb.ne.jp wrote:
> Hi All,
>
> I contributed a patch several times about mysql, too.
>
> I did not mind it very much before, but mysql RA makes next move.
>
> Step1) Constitute a cluster using mysql in Pacemaker.
> Step2) The mysql process kill by signal SIGKILL.
> Step3) Stop Pacemaker before monitor error occurs and stop mysql
>
> As a result, mysql RA causes trouble in stop.
> By this trouble, Pacemaker does not stop until escalation.
>
>
> The cause is processing unlike pgsql RA.
> When a process of pid does not exist, in the case of a stop not to go by way of monitor trouble, mysql RA produces ERR_GENERIC.
> When a process of pid does not exist, pgsql becomes the success of the stop.
>
> ---------------------------------------------------------
> * mysql
> (snip)
> mysql_monitor() {
> local rc
> local status_loglevel="err"
>
> # Set loglevel to info during probe
> if ocf_is_probe; then
> status_loglevel="info"
> fi
>
> mysql_common_status $status_loglevel
>
> rc=$?
>
> # TODO: check max connections error
>
> # If status returned an error, return that immediately
> if [ $rc -ne $OCF_SUCCESS ]; then
> return $rc
> fi
> (snip)
> mysql_stop() {
> if ocf_is_ms; then
> # clear preference for becoming master
> $CRM_MASTER -D
>
> # Remove VIP capability
> set_reader_attr 0
> fi
>
> mysql_common_stop
> }
> (snip)
>
> * mysql-common.sh
> (snip)
> mysql_common_status() {
> local loglevel=$1
> local pid=$2
> if [ -z "$pid" ]; then
> if [ ! -e $OCF_RESKEY_pid ]; then
> ocf_log $loglevel "MySQL is not running"
> return $OCF_NOT_RUNNING;
> fi
>
> pid=`cat $OCF_RESKEY_pid`;
> fi
> if [ -d /proc -a -d /proc/1 ]; then
> [ "u$pid" != "u" -a -d /proc/$pid ]
> else
> kill -s 0 $pid >/dev/null 2>&1
> fi
>
> if [ $? -eq 0 ]; then
> return $OCF_SUCCESS;
> else
> ocf_log $loglevel "MySQL not running: removing old PID file"
> rm -f $OCF_RESKEY_pid
> return $OCF_NOT_RUNNING;
> fi
> }
> (snip)
> mysql_common_stop()
> {
> local pid
> local rc
>
> if [ ! -f $OCF_RESKEY_pid ]; then
> ocf_log info "MySQL is not running"
> return $OCF_SUCCESS
> fi
>
> pid=`cat $OCF_RESKEY_pid 2> /dev/null `
> /bin/kill $pid > /dev/null
I think before this line, the RA should do a "kill -0" to check whether
the PID is running, and return $OCF_SUCCESS if not. That way, we can
still return an error if the real kill fails.
> rc=$?
> if [ $rc != 0 ]; then
> ocf_exit_reason "MySQL couldn't be stopped"
> return $OCF_ERR_GENERIC
> fi
> (snip)
> ---------------------------------------------------------
>
> The mysql RA does such a code from old days.
> * http://hg.linux-ha.org/agents/file/67234f982ab7/heartbeat/mysql
>
> Does mysql RA know the reason becoming this made?
> Possibly is it a factor to be conscious of mysql cluster?
>
> I think about a patch of this movement of mysql RA.
> I want to know the detailed reason.
>
> Best Regards,
> Hideo Yamauchi.
More information about the Users
mailing list