Просмотр исходного кода

Add token_coefficient option

Token coefficient is used only when nodelist is specified and contains
at least 3 nodes. If so, real token timeout is then computed as
token + (number_of_nodes - 2) * token_coefficient. This allows cluster
to scale without manually changing token timeout every time new
node is added. This value can be set to 0 resulting in effective
removal of this feature.

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Reviewed-by: Christine Caulfield <ccaulfie@redhat.com>
Jan Friesse 12 лет назад
Родитель
Сommit
58176d6779
3 измененных файлов с 21 добавлено и 0 удалено
  1. 1 0
      exec/coroparse.c
  2. 8 0
      exec/totemconfig.c
  3. 12 0
      man/corosync.conf.5

+ 1 - 0
exec/coroparse.c

@@ -541,6 +541,7 @@ static int main_config_parser_cb(const char *path,
 			    (strcmp(path, "totem.nodeid") == 0) ||
 			    (strcmp(path, "totem.threads") == 0) ||
 			    (strcmp(path, "totem.token") == 0) ||
+			    (strcmp(path, "totem.token_coefficient") == 0) ||
 			    (strcmp(path, "totem.token_retransmit") == 0) ||
 			    (strcmp(path, "totem.hold") == 0) ||
 			    (strcmp(path, "totem.token_retransmits_before_loss_const") == 0) ||

+ 8 - 0
exec/totemconfig.c

@@ -62,6 +62,7 @@
 
 #define TOKEN_RETRANSMITS_BEFORE_LOSS_CONST	4
 #define TOKEN_TIMEOUT				1000
+#define TOKEN_COEFFICIENT			650
 #define JOIN_TIMEOUT				50
 #define MERGE_TIMEOUT				200
 #define DOWNCHECK_TIMEOUT			1000
@@ -157,12 +158,19 @@ static void totem_volatile_config_set_value (struct totem_config *totem_config,
  */
 static void totem_volatile_config_read (struct totem_config *totem_config, const char *deleted_key)
 {
+	uint32_t u32;
 
 	totem_volatile_config_set_value(totem_config, "totem.token_retransmits_before_loss_const", deleted_key,
 	    TOKEN_RETRANSMITS_BEFORE_LOSS_CONST, 0);
 
 	totem_volatile_config_set_value(totem_config, "totem.token", deleted_key, TOKEN_TIMEOUT, 0);
 
+	if (totem_config->interface_count > 0 && totem_config->interfaces[0].member_count > 2) {
+		u32 = TOKEN_COEFFICIENT;
+		icmap_get_uint32("totem.token_coefficient", &u32);
+		totem_config->token_timeout += (totem_config->interfaces[0].member_count - 2) * u32;
+	}
+
 	totem_volatile_config_set_value(totem_config, "totem.max_network_delay", deleted_key, MAX_NETWORK_DELAY, 0);
 
 	totem_volatile_config_set_value(totem_config, "totem.window_size", deleted_key, WINDOW_SIZE, 0);

+ 12 - 0
man/corosync.conf.5

@@ -299,6 +299,18 @@ milliseconds in addition to this timeout.
 
 The default is 1000 milliseconds.
 
+.TP
+token_coefficient
+This value is used only when
+.B nodelist
+section is specified and contains at least 3 nodes. If so, real token timeout
+is then computed as token + (number_of_nodes - 2) * token_coefficient.
+This allows cluster to scale without manually changing token timeout
+every time new node is added. This value can be set to 0 resulting
+in effective removal of this feature.
+
+The default is 650 milliseconds.
+
 .TP
 token_retransmit
 This timeout specifies in milliseconds after how long before receiving a token