cluster: RHEL56 - cman: Reduce consensus value

Christine Caulfield chrissie at fedoraproject.org
Tue Jul 27 08:07:54 UTC 2010


Gitweb:        http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=52965892810bc1af110f18a891c09fc214f82cee
Commit:        52965892810bc1af110f18a891c09fc214f82cee
Parent:        06bcbf23e42365e420c1db891defae110c841f0d
Author:        Christine Caulfield <ccaulfie at redhat.com>
AuthorDate:    Tue Jul 27 09:06:18 2010 +0100
Committer:     Christine Caulfield <ccaulfie at redhat.com>
CommitterDate: Tue Jul 27 09:06:18 2010 +0100

cman: Reduce consensus value

Make consensus 1.2*totem under normal circumstances or
0.2*totem for a two_node cluster

rhbz#611391

Signed-off-by: Christine Caulfield <ccaulfie at redhat.com>
---
 cman/daemon/ais.c |   33 ++++++++++++++++++++++-----------
 1 files changed, 22 insertions(+), 11 deletions(-)

diff --git a/cman/daemon/ais.c b/cman/daemon/ais.c
index a88cbcd..efb2b44 100644
--- a/cman/daemon/ais.c
+++ b/cman/daemon/ais.c
@@ -52,6 +52,7 @@ extern char *key_filename;
 extern unsigned int quorumdev_poll;
 extern unsigned int ccsd_poll_interval;
 extern unsigned int shutdown_timeout;
+extern int two_node;
 extern int init_config(struct objdb_iface_ver0 *objdb);
 
 struct totem_ip_address mcast_addr[MAX_INTERFACES];
@@ -515,7 +516,7 @@ static int comms_init_ais(struct objdb_iface_ver0 *objdb)
 							"20", strlen("20")+1);
 		}
 
-		/* Extend consensus & join timeouts per bz#214290 */
+		/* Extend join timeout per bz#214290 */
 		if (objdb_get_string(objdb, object_handle, "join", &value)) {
 			global_objdb->object_key_create(object_handle, "join", strlen("join"),
 							"60", strlen("60")+1);
@@ -525,16 +526,26 @@ static int comms_init_ais(struct objdb_iface_ver0 *objdb)
 			global_objdb->object_key_create(object_handle, "fail_recv_const", strlen("fail_to_recv_const"),
 							"2500", strlen("2500")+1);
 		}
-		/* consensus should be 2*token, see bz#544482*/
-		if (objdb_get_string(objdb, object_handle, "consensus", &value)) {
-		        unsigned int token=0;
-			char calc_consensus[32];
-
-			objdb_get_int(objdb, object_handle, "token", &token);
-			sprintf(calc_consensus, "%d", token*2);
-			objdb->object_key_create(object_handle, "consensus", strlen("consensus"),
-						 calc_consensus, strlen(calc_consensus)+1);
-		}
+
+		/* bz#611391
+		 * consensus should be 1.2*token or for 0.2*token for two_node clusters
+		 */
+ 		if (objdb_get_string(objdb, object_handle, "consensus", &value)) {
+ 		        unsigned int token=0;
+			unsigned int consensus;
+ 			char calc_consensus[32];
+
+ 			objdb_get_int(objdb, object_handle, "token", &token);
+
+			if (two_node)
+				consensus = (float)token*0.2;
+			else
+				consensus = (float)token*1.2;
+
+			snprintf(calc_consensus, sizeof(calc_consensus), "%d", consensus);
+ 			objdb->object_key_create(object_handle, "consensus", strlen("consensus"),
+ 						 calc_consensus, strlen(calc_consensus)+1);
+ 		}
 
 		/* Set RRP mode appropriately */
 		if (num_interfaces > 1) {


More information about the cluster-commits mailing list