Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

starting mysql: slave is started twice in a row? #8

Open
FrankVanDamme opened this issue Jun 21, 2013 · 3 comments
Open

starting mysql: slave is started twice in a row? #8

FrankVanDamme opened this issue Jun 21, 2013 · 3 comments

Comments

@FrankVanDamme
Copy link

Not sure about this, but I'm reading through the resource script to get a better understanding of how it works and I notice this in the function "start":
on both lines 832 and 847, there is code that picks the uname of the master out of the crm's notifications ($OCF_RESKEY_CRM_meta_notify_master_uname), checks if it's a different node than the host the script is being ran on, and then sets the master to that node. There are two differences:

  • first time around, spaces in OCF_RESKEY_CRM_meta_notify_master_uname are trimmed
  • first time, the slave is started with simply runnign the query "START SLAVE;"
    second time the function "start_slave" is used which also clears the $master_host-log-file-${INSTANCE_ATTR_NAME} and $master_host-log-pos-${INSTANCE_ATTR_NAME} attributes in the crm config

Why this difference?? Looks to me like both pieces are executed each time the script starts a mysql server.

@y-trudeau
Copy link
Collaborator

Hi,
I can't find the matching lines numbers, to which file are you referring to? Also the prm repo has moved to https://github.com/percona/percona-pacemaker-agents, Looks like I forgot cleanup here.

Regards,

Yves

@FrankVanDamme
Copy link
Author

OK never mind, that was a pretty stupid mistake on my part. I was referring to the mysql_prm resource agent, but it turns out I had accidentally opened the old heartbeat mysql resource. No wonder. Most pointers on the web are still to this repo, so I guess the new one is still less than obvious to find. I will use it instead. Thanks for the pointer.

I'm reading through it now and can't help but notice a few things that may be incorrect. I'll attach comments as a patch:

diff --git a/agents/mysql_prm b/agents/mysql_prm
index ca8d649..c37eba3 100755
--- a/agents/mysql_prm
+++ b/agents/mysql_prm
@@ -671,7 +671,7 @@ check_slave() {
set_reader_attr 0
exit $OCF_ERR_INSTALLED
fi

  •        elif ocf_is_ms; then
    
  •    elif ocf_is_ms; then
         # Even if we're not set to evict lagging slaves, we can
         # still use the seconds behind master value to set our
         # master preference.
    

    @@ -1427,7 +1427,7 @@ mysql_notify() {

         demote_host=`echo $OCF_RESKEY_CRM_meta_notify_demote_uname|tr -d " "`
         if [ $demote_host = ${HOSTNAME} ]; then
    
  •            ocf_log info "post-demote notification for $demote_host"
    
  •            ocf_log info "pre-demote notification for $demote_host"
             set_read_only on
             if [ $? -ne 0 ]; then
                 ocf_log err "Failed to set read-only";
    

    @@ -1448,7 +1448,7 @@ mysql_notify() {
    done
    rm -f $tmpfile
    else

  •           ocf_log info "Ignoring post-demote notification execpt for my own demotion."
    
  •           ocf_log info "Ignoring pre-demote notification execpt for my own demotion."
         fi
         return $OCF_SUCCESS
     ;;
    

@y-trudeau
Copy link
Collaborator

Hi,
which pointers are you referring to? I want to remove this repo and
adjust the pointers. I'll correct the ones I find but that would be
good if you send me the ones you have in case I missed some.

Regards,

Yves

Le 2013-06-24 07:22, FrankVanDamme a écrit :

Most pointers on the web are still to this repo, so I guess the new one
is still less than obvious to find. I will use it instead. Thanks for
the pointer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants