Explorar el Código

Force consensus timer to be at minimum 1.2 * token to prevent one group of
nodes from executing a token timeout in the COMMIT state while another node
executes a consensus timeout, showing to applications as a temporary network
partition.


git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@2567 fd59a12c-fef9-0310-b244-a6a79926bd2f

Steven Dake hace 16 años
padre
commit
b3e19b2905
Se han modificado 2 ficheros con 12 adiciones y 4 borrados
  1. 8 2
      exec/totemconfig.c
  2. 4 2
      man/corosync.conf.5

+ 8 - 2
exec/totemconfig.c

@@ -71,7 +71,6 @@
 #define TOKEN_RETRANSMIT_TIMEOUT		(int)(TOKEN_TIMEOUT / (TOKEN_RETRANSMITS_BEFORE_LOSS_CONST + 0.2))
 #define TOKEN_HOLD_TIMEOUT			(int)(TOKEN_RETRANSMIT_TIMEOUT * 0.8 - (1000/(int)HZ))
 #define JOIN_TIMEOUT				50
-#define CONSENSUS_TIMEOUT			800
 #define MERGE_TIMEOUT				200
 #define DOWNCHECK_TIMEOUT			1000
 #define FAIL_TO_RECV_CONST			50
@@ -550,7 +549,7 @@ int totem_config_validate (
 	}
 
 	if (totem_config->consensus_timeout == 0) {
-		totem_config->consensus_timeout = CONSENSUS_TIMEOUT;
+		totem_config->consensus_timeout = (int)(float)(1.2 * totem_config->token_timeout);
 	}
 
 	if (totem_config->consensus_timeout < MINIMUM_TIMEOUT) {
@@ -560,6 +559,13 @@ int totem_config_validate (
 		goto parse_error;
 	}
 
+	if (totem_config->consensus_timeout <= 1.2 * totem_config->token_timeout) {
+		snprintf (local_error_reason, sizeof(local_error_reason),
+			"The consensus timeout parameter (%d ms) must be atleast 1.2 * token (%d ms).",
+			totem_config->consensus_timeout, (int) ((float)1.2 * totem_config->token_timeout));
+		goto parse_error;
+	}
+
 	if (totem_config->merge_timeout == 0) {
 		totem_config->merge_timeout = MERGE_TIMEOUT;
 	}

+ 4 - 2
man/corosync.conf.5

@@ -325,9 +325,11 @@ The default is 0 milliseconds.
 .TP
 consensus
 This timeout specifies in milliseconds how long to wait for consensus to be
-achieved before starting a new round of membership configuration.
+achieved before starting a new round of membership configuration.  The minimum
+value for consensus must be 1.2 * token.  This value will be automatically
+calculated at 1.2 * token if the user doesn't specify a consensus value.
 
-The default is 800 milliseconds.
+The default is 1200 milliseconds.
 
 .TP
 merge