From 15383b3eb3e40969401bfdc467d47020ee2cd9c8 Mon Sep 17 00:00:00 2001 From: Edwin Torok Date: Fri, 22 Sep 2017 17:28:54 +0100 Subject: [PATCH] votequorum: make atb consistent on nodelist reload When the cluster changes from even sized to odd sized corosync disables auto-tie-breaker if wait_for_all is not enabled. However when changing from odd sized to even sized it doesn't reenable it, causing auto_tie_breaker to be inconsistent across the cluster: the newly added node and any nodes that restart corosync will have it, but all the previously running nodes won't. Signed-off-by: Edwin Torok Reviewed-by: Jan Friesse --- exec/votequorum.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/exec/votequorum.c b/exec/votequorum.c index cb73e9a3..c912a346 100644 --- a/exec/votequorum.c +++ b/exec/votequorum.c @@ -81,7 +81,7 @@ static uint8_t two_node = 0; static uint8_t wait_for_all = 0; static uint8_t wait_for_all_status = 0; -static enum {ATB_NONE, ATB_LOWEST, ATB_HIGHEST, ATB_LIST} auto_tie_breaker = ATB_NONE; +static enum {ATB_NONE, ATB_LOWEST, ATB_HIGHEST, ATB_LIST} auto_tie_breaker = ATB_NONE, initial_auto_tie_breaker = ATB_NONE; static int lowest_node_id = -1; static int highest_node_id = -1; @@ -1253,6 +1253,13 @@ static char *votequorum_readconfig(int runtime) if (runtime) { two_node = 0; expected_votes = 0; + /* auto_tie_breaker cannot be changed by config reload, but + * we automatically disable it on odd-sized clusters without + * wait_for_all. + * We may need to re-enable it when membership changes to ensure + * that auto_tie_breaker is consistent across all nodes */ + auto_tie_breaker = initial_auto_tie_breaker; + icmap_set_uint32("runtime.votequorum.atb_type", auto_tie_breaker); } /* @@ -1331,6 +1338,7 @@ static char *votequorum_readconfig(int runtime) parse_atb_string(atb_string); } free(atb_string); + initial_auto_tie_breaker = auto_tie_breaker; /* allow_downscale requires ev_tracking */ if (allow_downscale) {