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

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