Hi,
On Wed, Feb 24, 2010 at 04:16:57PM +0100, Florian Haas wrote:
> Marian,
>
> I suggest we continue this discussion on the -dev list. :)
>
> On 2010-02-24 01:27, Marian Marinov wrote:
> > Hello,
> > this is a cleaned up revision of my patch to the mysql RA.
> > I'm changing only 2 commands from the old RA simply to remove one
> > unnecessary
> > echo to the mysql command.
> >
> > I didn't split it into multiple patches, yet, since I'm sure that there is
> > more work to be done. After I'm finished I'll publish it as several
> > sequential
> > patches.
>
> [...]
>
> > +is_slave() {
> > + slave_info=($(mysql \
> > + --user=$OCF_RESKEY_replication_user \
> > + --password=$OCF_RESKEY_replication_passwd \
> > + --socket=$OCF_RESKEY_socket -O connect_timeout=1 \
> > + -e 'SHOW SLAVE STATUS\G'|awk '/Running/ || /Master_[UHP]/{print
> > $2}'))
> > +
> > + if [ "$?" != 0 ]; then
> > + ocf_log err "Unable to get local slave status"
> > + return 1
> > + fi
> > +
> > + if [ -z "${slave_info[*]}" ]; then
> > + # no slave configuration, can not be slave
> > + return 1;
> > + fi
> > +
> > + if [ -z "${slave_info[3]}" ] || [ -z "${slave_info[4]}" ] || [ -z
> > "${slave_info[0]}" ] || [ -z "${slave_info[0]}" ]; then
slave_info[0] twice?
> > + ocf_log err "Unable to get slave status"
> > + return 1
> > + fi
>
> As Dejan has already pointed out, arrays may not be available in
> non-bash shells, and it's a potential regression to rely on bash
> features in an RA that was previously Bourne shell clean. Can you come
> of with a different way of handling this?
Yes. There is a tool on Debian which checks script for bashisms,
forgot its name.
> [...]
>
> > + return $OCF_ERR_GENERIC
> > + fi
> > + if [ "$OCF_RESKEY_CRM_meta_notify_promote_uname" == "$HOSTNAME " ]; then
> > + echo "Should not connect to my self(promote)" >>
> > /tmp/replica.log
> > + return $OCF_ERR_GENERIC
> > + else
> > + search_uname=$OCF_RESKEY_CRM_meta_notify_promote_uname
> > + fi
> > + if [ "$OCF_RESKEY_CRM_meta_notify_master_uname" == "$HOSTNAME " ]; then
Extra space after HOSTNAME?
> > + echo "Should not connect to my self(master)" >> /tmp/replica.log
> > + return $OCF_ERR_GENERIC
> > + else
> > + search_uname=$OCF_RESKEY_CRM_meta_notify_master_uname
> > + fi
> > +
> > + if ( ! mysql_status ); then
> > + return $OCF_NOT_RUNNING
> > fi
>
> If you're not running, then you shouldn't be promoted. So this is
> another "shouldn't happen", if I'm not mistaken. In which case I would
> error out here. Maybe Dejan or Andrew can correct me if I'm wrong.
Isn't this the demote action? If it is possible for CRM to try
to demote a non-promoted resource, then you should return
OCF_ERR_GENERIC here. Andrew: Is that possible?
> [...]
> > + MASTER_CONNECT_RETRY=4"
> > + mysql --socket=$OCF_RESKEY_socket -O connect_timeout=1 -e
> > 'START SLAVE';
> > + if [ $? == $OCF_ERR_GENERIC ]; then
mysql exit code is not related to the OCF error codes. No idea
what mysql may return, but I guess that [ $? != 0 ] should work.
> > + case "$OCF_RESKEY_CRM_meta_notify_operation" in
> > + 'promote')
> > + if [ "$OCF_RESKEY_CRM_meta_notify_promote_uname" !=
> > "$HOSTNAME " ] &&
Again extra space? Probably elsewhere too.
> One more question: how do you update your master preference? You'll have
> to figure out a way how to tell Pacemaker which node to promote in case
> the master fails. I have my own ideas about this, but would like to hear
> yours so I don't poison your ideas with mine, in case mine are stupid. :)
Many thanks to both :)
Cheers,
Dejan
_______________________________________________________
Linux-HA-Dev: [email protected]
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/