Browse Source

Merge "Fix race condition for primary component bootstrap"

changes/02/462502/1
Jenkins 2 years ago
parent
commit
3452880880
1 changed files with 6 additions and 7 deletions
  1. 6
    7
      files/fuel-ha-utils/ocf/mysql-wss

+ 6
- 7
files/fuel-ha-utils/ocf/mysql-wss View File

@@ -503,6 +503,7 @@ check_if_galera_pc() {
503 503
                     fi
504 504
                     if [ ${pcnum} -gt 1 ]; then
505 505
                         ocf_log err "${LH} But I'm running a new cluster, PID:${pid}, this is a split-brain!"
506
+                        clear_node_pc
506 507
                         exit $OCF_ERR_GENERIC
507 508
                     fi
508 509
                 done
@@ -676,8 +677,6 @@ mysql_start() {
676 677
     local rc
677 678
     local dir
678 679
     local mysql_extra_params
679
-    local set_pc=0
680
-
681 680
 
682 681
     if mysql_status info 1; then
683 682
         ocf_log info "${LH} MySQL already running"
@@ -729,12 +728,13 @@ mysql_start() {
729 728
         rc=$?
730 729
 
731 730
         if [ $rc -eq 0 ]; then
732
-            mysql_extra_params="$mysql_extra_params --wsrep-new-cluster"
733
-            set_pc=1
731
+           mysql_extra_params="$mysql_extra_params --wsrep-new-cluster"
732
+           update_node_pc
733
+        else
734
+           clear_node_pc
734 735
         fi
735 736
     fi
736 737
 
737
-    clear_node_pc
738 738
     ocf_log info "${LH} Starting MySQL"
739 739
     ${OCF_RESKEY_binary} \
740 740
         --pid-file=$OCF_RESKEY_pid \
@@ -746,6 +746,7 @@ mysql_start() {
746 746
 
747 747
     if [ $rc -ne 0 ]; then
748 748
         ocf_log err "${LH} MySQL start command failed: $rc"
749
+        clear_node_pc
749 750
         return $rc
750 751
     fi
751 752
 
@@ -763,8 +764,6 @@ mysql_start() {
763 764
     done
764 765
 
765 766
     ocf_log info "${LH} MySQL started"
766
-    [ ${set_pc} -eq 1 ] && update_node_pc
767
-    [ $rc -ne $OCF_SUCCESS ] && update_node_gtid
768 767
     return $OCF_SUCCESS
769 768
 }
770 769
 

Loading…
Cancel
Save