[PATCH 2/3] votequorum: fix auto_tie_breaker design and simplify code a lot

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: "Fabio M. Di Nitto" <fdinitto@xxxxxxxxxx>

auto_tie_breaker requires to know the lowest node id in the currently
quorate partition and not of the whole cluster.

this allow us to determine the lowest node id as soon as we are quorate
and remove the complexity to read it from WFA or nodelist. Add
the same time it adds the flexibility for dynamic nodeids in a cluster.

drop requirement on WFA if nodelist is not specified

update man page

Signed-off-by: Fabio M. Di Nitto <fdinitto@xxxxxxxxxx>
---
 exec/votequorum.c |   38 +++++++-------------------------------
 man/votequorum.5  |   37 -------------------------------------
 2 files changed, 7 insertions(+), 68 deletions(-)

diff --git a/exec/votequorum.c b/exec/votequorum.c
index 98451ab..47132d6 100644
--- a/exec/votequorum.c
+++ b/exec/votequorum.c
@@ -447,7 +447,8 @@ static void get_lowest_node_id(void)
 
 	list_iterate(tmp, &cluster_members_list) {
 		node = list_entry(tmp, struct cluster_node, list);
-		if (node->node_id < lowest_node_id) {
+		if ((node->state == NODESTATE_MEMBER) &&
+		    (node->node_id < lowest_node_id)) {
 			lowest_node_id = node->node_id;
 		}
 	}
@@ -466,10 +467,9 @@ static int check_low_node_id_partition(void)
 
 	list_iterate(tmp, &cluster_members_list) {
 		node = list_entry(tmp, struct cluster_node, list);
-		if (node->state == NODESTATE_MEMBER) {
-			if (node->node_id == lowest_node_id) {
+		if ((node->state == NODESTATE_MEMBER) &&
+		    (node->node_id == lowest_node_id)) {
 				found = 1;
-			}
 		}
 	}
 
@@ -573,13 +573,13 @@ static void are_we_quorate(unsigned int total_votes)
 			return;
 		}
 		wait_for_all_status = 0;
-		get_lowest_node_id();
 	}
 
 	if (quorum > total_votes) {
 		quorate = 0;
 	} else {
 		quorate = 1;
+		get_lowest_node_id();
 	}
 
 	if ((auto_tie_breaker) &&
@@ -664,8 +664,8 @@ static int votequorum_read_nodelist_configuration(uint32_t *votes,
 	char tmp_key[ICMAP_KEYNAME_MAXLEN];
 	uint32_t our_pos, node_pos;
 	uint32_t nodelist_expected_votes = 0;
-	uint32_t nodeid, node_votes = 0;
-	int res = 0, nodeid_found = 1;
+	uint32_t node_votes = 0;
+	int res = 0;
 
 	ENTER();
 
@@ -698,26 +698,6 @@ static int votequorum_read_nodelist_configuration(uint32_t *votes,
 		if (node_pos == our_pos) {
 			*votes = node_votes;
 		}
-
-		if (nodeid_found == 0) {
-			continue;
-		}
-
-		snprintf(tmp_key, ICMAP_KEYNAME_MAXLEN, "nodelist.node.%u.nodeid", node_pos);
-		if (icmap_get_uint32(tmp_key, &nodeid) != CS_OK) {
-			nodeid_found = 0;
-			lowest_node_id = -1;
-			continue;
-		}
-
-		if (lowest_node_id == -1) {
-			lowest_node_id = nodeid;
-			continue;
-		}
-
-		if (nodeid < lowest_node_id) {
-			lowest_node_id = nodeid;
-		}
 	}
 
 	*expected_votes = nodelist_expected_votes;
@@ -760,10 +740,6 @@ static int votequorum_readconfig_static(void)
 		return -1;
 	}
 
-	if ((auto_tie_breaker) && (lowest_node_id == -1)) {
-		wait_for_all = 1;
-	}
-
 	if (wait_for_all) {
 		wait_for_all_status = 1;
 	}
diff --git a/man/votequorum.5 b/man/votequorum.5
index 132334e..e275a99 100644
--- a/man/votequorum.5
+++ b/man/votequorum.5
@@ -260,12 +260,6 @@ at the same time, in a deterministic fashion. The cluster partition, or the
 set of nodes that are still in contact with the node that has the lowest
 nodeid will remain quorate. The other nodes will be inquorate.
 .PP
-NOTES: For ATB to work, the lowest nodeid in the cluster needs to be known.
-corosync can automatically generate a nodeid or it can be overridden manually.
-If nodeids are not known at startup, ATB will automatically enable WFA.
-WFA will guarantee that all nodeids in the cluster are known before ATB can
-operate correctly.
-.PP
 Example configuration 1:
 .nf
 
@@ -276,37 +270,6 @@ quorum {
 }
 
 .fi
-this will also automatically enable WFA.
-.PP
-Example configuration 2:
-.nf
-
-quorum {
-    provider: corosync_votequorum
-    auto_tie_breaker: 1
-}
-
-nodelist {
-    node {
-        ring0_addr: 192.168.1.1
-        nodeid: 1
-    }
-    node {
-        ring0_addr: 192.168.1.2
-        nodeid: 2
-    }
-    node {
-        ring0_addr: 192.168.1.3
-        nodeid: 3
-    }
-    node {
-        ring0_addr: 192.168.1.4
-        nodeid: 4
-    }
-}
-
-.fi
-this will allow ATB to work without WFA as all nodeids are known at startup.
 .SH VARIOUS NOTES
 .PP
 * WFA / LMS / ATB can be used combined together.
-- 
1.7.7.6

_______________________________________________
discuss mailing list
discuss@xxxxxxxxxxxx
http://lists.corosync.org/mailman/listinfo/discuss


[Index of Archives]     [Linux Clusters]     [Corosync Project]     [Linux USB Devel]     [Linux Audio Users]     [Photo]     [Yosemite News]    [Yosemite Photos]    [Linux Kernel]     [Linux SCSI]     [X.Org]

  Powered by Linux