소스 검색

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 <edvin.torok@citrix.com>
Reviewed-by: Jan Friesse <jfriesse@redhat.com>
(cherry picked from commit 15383b3eb3e40969401bfdc467d47020ee2cd9c8)
Edwin Torok 8 년 전
부모
커밋
e85716d2d0
1개의 변경된 파일9개의 추가작업 그리고 1개의 파일을 삭제
  1. 9 1
      exec/votequorum.c

+ 9 - 1
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 = 0;
 static uint8_t wait_for_all_status = 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 lowest_node_id = -1;
 static int highest_node_id = -1;
 static int highest_node_id = -1;
 
 
@@ -1260,6 +1260,13 @@ static char *votequorum_readconfig(int runtime)
 	if (runtime) {
 	if (runtime) {
 		two_node = 0;
 		two_node = 0;
 		expected_votes = 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);
 	}
 	}
 
 
 	/*
 	/*
@@ -1338,6 +1345,7 @@ static char *votequorum_readconfig(int runtime)
 			parse_atb_string(atb_string);
 			parse_atb_string(atb_string);
 		}
 		}
 		free(atb_string);
 		free(atb_string);
+		initial_auto_tie_breaker = auto_tie_breaker;
 
 
 		/* allow_downscale requires ev_tracking */
 		/* allow_downscale requires ev_tracking */
 		if (allow_downscale) {
 		if (allow_downscale) {