summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVladimir Kuklin <vkuklin@mirantis.com>2017-04-28 13:43:49 +0300
committerSergii Golovatiuk <sgolovatiuk@mirantis.com>2017-04-28 20:20:43 +0000
commitc8373d4aea13b881bfbd17ff060516ca35055b49 (patch)
treeb6c162b96743695b12c7701074f3bbcb291eb18e
parent7453b8bf9dde97427b6e4bd80be4974413bee411 (diff)
Fix race condition for primary component bootstrap
Create node is_pc flag before starting to check if there is more than one of those flags. Thus, we avoid race condition when there is 0 is_pc flags and galera starts with --wsrep-new-cluster on 2 nodes. We set it before the check and, as setting them is synchronous through Pacemaker CIB, in that case when >1 nodes attempt to bootstrap with --wsrep-new-cluster, only one node will see <= 1 is_pc flags. Others will see more than one and fail and reattempt to start. At that point one of the nodes will already be bootstrapped, thus reelection will not be triggered and the section of bootstrap will be skipped Change-Id: I82a71132eef7877ac7ab1ed04263044b3b1e8d9b Closes-bug: #1617400 Signed-off-by: Sergii Golovatiuk <sgolovatiuk@mirantis.com>
Notes
Notes (review): Verified+1: Fuel CI <fuel-ci-bot@mirantis.com> Code-Review+1: Michael Polenchuk <mpolenchuk@mirantis.com> Code-Review+2: Sergii Golovatiuk <sgolovatiuk@mirantis.com> Workflow+1: Sergii Golovatiuk <sgolovatiuk@mirantis.com> Verified+2: Jenkins Submitted-by: Jenkins Submitted-at: Wed, 03 May 2017 12:51:12 +0000 Reviewed-on: https://review.openstack.org/460948 Project: openstack/fuel-library Branch: refs/heads/master
-rwxr-xr-xfiles/fuel-ha-utils/ocf/mysql-wss13
1 files changed, 6 insertions, 7 deletions
diff --git a/files/fuel-ha-utils/ocf/mysql-wss b/files/fuel-ha-utils/ocf/mysql-wss
index be06079..77067ac 100755
--- a/files/fuel-ha-utils/ocf/mysql-wss
+++ b/files/fuel-ha-utils/ocf/mysql-wss
@@ -503,6 +503,7 @@ check_if_galera_pc() {
503 fi 503 fi
504 if [ ${pcnum} -gt 1 ]; then 504 if [ ${pcnum} -gt 1 ]; then
505 ocf_log err "${LH} But I'm running a new cluster, PID:${pid}, this is a split-brain!" 505 ocf_log err "${LH} But I'm running a new cluster, PID:${pid}, this is a split-brain!"
506 clear_node_pc
506 exit $OCF_ERR_GENERIC 507 exit $OCF_ERR_GENERIC
507 fi 508 fi
508 done 509 done
@@ -676,8 +677,6 @@ mysql_start() {
676 local rc 677 local rc
677 local dir 678 local dir
678 local mysql_extra_params 679 local mysql_extra_params
679 local set_pc=0
680
681 680
682 if mysql_status info 1; then 681 if mysql_status info 1; then
683 ocf_log info "${LH} MySQL already running" 682 ocf_log info "${LH} MySQL already running"
@@ -729,12 +728,13 @@ mysql_start() {
729 rc=$? 728 rc=$?
730 729
731 if [ $rc -eq 0 ]; then 730 if [ $rc -eq 0 ]; then
732 mysql_extra_params="$mysql_extra_params --wsrep-new-cluster" 731 mysql_extra_params="$mysql_extra_params --wsrep-new-cluster"
733 set_pc=1 732 update_node_pc
733 else
734 clear_node_pc
734 fi 735 fi
735 fi 736 fi
736 737
737 clear_node_pc
738 ocf_log info "${LH} Starting MySQL" 738 ocf_log info "${LH} Starting MySQL"
739 ${OCF_RESKEY_binary} \ 739 ${OCF_RESKEY_binary} \
740 --pid-file=$OCF_RESKEY_pid \ 740 --pid-file=$OCF_RESKEY_pid \
@@ -746,6 +746,7 @@ mysql_start() {
746 746
747 if [ $rc -ne 0 ]; then 747 if [ $rc -ne 0 ]; then
748 ocf_log err "${LH} MySQL start command failed: $rc" 748 ocf_log err "${LH} MySQL start command failed: $rc"
749 clear_node_pc
749 return $rc 750 return $rc
750 fi 751 fi
751 752
@@ -763,8 +764,6 @@ mysql_start() {
763 done 764 done
764 765
765 ocf_log info "${LH} MySQL started" 766 ocf_log info "${LH} MySQL started"
766 [ ${set_pc} -eq 1 ] && update_node_pc
767 [ $rc -ne $OCF_SUCCESS ] && update_node_gtid
768 return $OCF_SUCCESS 767 return $OCF_SUCCESS
769} 768}
770 769