Blame SOURCES/bz1891835-galera-set-bootstrap-attribute-before-promote.patch

030326
From ac213f158ff851422d78ae8f56b022e8e30751bc Mon Sep 17 00:00:00 2001
030326
From: Damien Ciabrini <damien.ciabrini@gmail.com>
030326
Date: Mon, 26 Oct 2020 14:54:05 +0100
030326
Subject: [PATCH] galera: set bootstrap attribute before promote
030326
030326
When the master detection takes place, the node chosen for
030326
becoming the master is given two attributes in the CIB:
030326
a master score and a bootstrap flag. The master score makes
030326
pacemaker schedule a promote operation, and the bootstrap flag
030326
drives how the galera server is started.
030326
030326
The order in which we set the attributes is racy; it may happen
030326
that a promote operation is started before the current master
030326
detection function has set the bootstrap flag, in which case
030326
the promotion will fail.
030326
030326
Reverse the order in which we set the attributes on a bootstrap
030326
node to close the race.
030326
---
030326
 heartbeat/galera | 2 +-
030326
 1 file changed, 1 insertion(+), 1 deletion(-)
030326
030326
diff --git a/heartbeat/galera b/heartbeat/galera
030326
index d2f4faa86..b4d7e187d 100755
030326
--- a/heartbeat/galera
030326
+++ b/heartbeat/galera
030326
@@ -587,8 +587,8 @@ detect_first_master()
030326
     fi
030326
 
030326
     ocf_log info "Promoting $best_node to be our bootstrap node"
030326
-    set_master_score $best_node
030326
     set_bootstrap_node $best_node
030326
+    set_master_score $best_node
030326
 }
030326
 
030326
 detect_safe_to_bootstrap()