Hi Yves, On Fri, Apr 13, 2012 at 10:21:53AM -0400, Yves Trudeau wrote: > Hi Dejan, > here's my patch to the mysql agent in the commit version 4c18035.
This is a patch against your tree. It would be good to see patches based on the upstream. In the meantime, those interested in the latest about the mysql RA can take a look at this pull request: https://github.com/ClusterLabs/resource-agents/pull/67 > Sorry for being inept with git. No need to be sorry. I don't think I'm any better. Cheers, Dejan > > Regards, > > Yves > > --- mysql.old 2012-04-13 03:19:42.058422681 -0400 > +++ mysql 2012-04-13 01:36:07.000000000 -0400 > @@ -109,7 +109,7 @@ > : ${OCF_RESKEY_max_slave_lag=${OCF_RESKEY_max_slave_lag_default}} > : > ${OCF_RESKEY_evict_outdated_slaves=${OCF_RESKEY_evict_outdated_slaves_default}} > > -: ${OCF_RESKEY_reader_attribute=${OCF_RESKEY_evict_reader_attribute_default}} > +: ${OCF_RESKEY_reader_attribute=${OCF_RESKEY_reader_attribute_default}} > > ####################################################################### > > @@ -328,7 +328,7 @@ > </longdesc> > <shortdesc lang="en">Sets the node attribute that determines > whether a node is usable for clients to read from.</shortdesc> > -<content type="boolean" default="${OCF_RESKEY_reader_attribute_default}" /> > +<content type="string" default="${OCF_RESKEY_reader_attribute_default}" /> > </parameter> > </parameters> > > @@ -355,10 +355,12 @@ > MYSQL_OPTIONS_LOCAL="-S $OCF_RESKEY_socket --connect_timeout=10" > MYSQL_OPTIONS_REPL="$MYSQL_OPTIONS_LOCAL --user=$OCF_RESKEY_replication_user > --password=$OCF_RESKEY_replication_passwd" > MYSQL_OPTIONS_TEST="$MYSQL_OPTIONS_LOCAL --user=$OCF_RESKEY_test_user > --password=$OCF_RESKEY_test_passwd" > +MYSQL_TOO_MANY_CONN_ERR=1040 > > CRM_MASTER="${HA_SBIN_DIR}/crm_master -l reboot " > HOSTNAME=`uname -n` > CRM_ATTR="${HA_SBIN_DIR}/crm_attribute -N $HOSTNAME " > +CRM_ATTR_REPL_INFO="${HA_SBIN_DIR}/crm_attribute --type crm_config --name > replication_info -s mysql_replication --query -q" > INSTANCE_ATTR_NAME=`echo ${OCF_RESOURCE_INSTANCE}| awk -F : '{print $1}'` > > ####################################################################### > @@ -468,7 +470,7 @@ > > if [ $rc -eq 0 ]; then > # Did we receive an error other than max_connections? > - if [ $last_errno -ne 0 -a $last_errno -ne 1040 ]; then > + if [ $last_errno -ne 0 -a $last_errno -ne "$MYSQL_TOO_MANY_CONN_ERR" > ]; then > # Whoa. Replication ran into an error. This slave has > # diverged from its master. Make sure this resource > # doesn't restart in place. > @@ -484,7 +486,7 @@ > fi > > # If we got max_connections, let's remove the vip > - if [ $last_errno -eq 1040 ]; then > + if [ $last_errno -eq "$MYSQL_TOO_MANY_CONN_ERR" ]; then > set_reader_attr 0 > exit $OCF_SUCCESS > fi > @@ -496,7 +498,7 @@ > ocf_log warn "MySQL Slave IO threads currently not running." > > # Sanity check, are we at least on the right master > - new_master_IP=`${HA_SBIN_DIR}/crm_attribute --type crm_config > --name replication_info -s mysql_replication --query -q | cut -d'|' -f1` > + new_master_IP=`$CRM_ATTR_REPL_INFO | cut -d'|' -f1` > > if [ "$master_host" != "$new_master_IP" ]; then > # Not pointing to the right master, not good, removing the > VIPs > @@ -573,7 +575,7 @@ > local new_master_IP master_log_file master_log_pos > local master_params > > - new_master_IP=`${HA_SBIN_DIR}/crm_attribute --type crm_config --name > replication_info -s mysql_replication --query -q | cut -d'|' -f1` > + new_master_IP=`$CRM_ATTR_REPL_INFO | cut -d'|' -f1` > > # Keep replication position > get_slave_info > @@ -585,8 +587,8 @@ > rm -f $tmpfile > return > else > - master_log_file=`${HA_SBIN_DIR}/crm_attribute --type crm_config > --name replication_info -s mysql_replication --query -q | cut -d'|' -f2` > - master_log_pos=`${HA_SBIN_DIR}/crm_attribute --type crm_config > --name replication_info -s mysql_replication --query -q | cut -d'|' -f3` > + master_log_file=`$CRM_ATTR_REPL_INFO | cut -d'|' -f2` > + master_log_pos=`$CRM_ATTR_REPL_INFO | cut -d'|' -f3` > if [ -n "$master_log_file" -a -n "$master_log_pos" ]; then > master_params=", MASTER_LOG_FILE='$master_log_file', \ > MASTER_LOG_POS=$master_log_pos" > @@ -812,7 +814,7 @@ > status_loglevel="info" > fi > > - mysql_status $status_loglevel > + mysql_status > rc=$? > > # TODO: check max connections error > _______________________________________________________ > Linux-HA-Dev: [email protected] > http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev > Home Page: http://linux-ha.org/ _______________________________________________________ Linux-HA-Dev: [email protected] http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev Home Page: http://linux-ha.org/
