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

votequorum: Do not process events during reload

During reload, local_node_pos is deleted and reinstation is handled in
totemconfig after reload is finished. votequorum handles this events and
tries to reload it's configuration. This led to logging a little scary
messages (even nothing bad is happening, because after local_node_pos
reinstation everything back to normal).

Solution is to stop processing events during reload. Sadly, simple
tracking of config.reload_in_progress doesn't work because LibQB events
triggering order is undefined so votequorum reload handler can be called
before totemconfig (and before local_node_pos is reinstatied).

So new config.totemconfig_reload_in_progress key is defined with very
similar semanthic as config.reload_in_progress but set inside
totem_reload_notify function. Votequorum then use this new key.

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Reviewed-by: Christine Caulfield <ccaulfie@redhat.com>
Jan Friesse 11 лет назад
Родитель
Сommit
72cf15af27
4 измененных файлов с 32 добавлено и 0 удалено
  1. 1 0
      exec/main.c
  2. 6 0
      exec/totemconfig.c
  3. 16 0
      exec/votequorum.c
  4. 9 0
      man/cmap_keys.8

+ 1 - 0
exec/main.c

@@ -1052,6 +1052,7 @@ static void set_icmap_ro_keys_flag (void)
 	icmap_set_ro_access("totem.netmtu", CS_FALSE, CS_TRUE);
 	icmap_set_ro_access("qb.ipc_type", CS_FALSE, CS_TRUE);
 	icmap_set_ro_access("config.reload_in_progress", CS_FALSE, CS_TRUE);
+	icmap_set_ro_access("config.totemconfig_reload_in_progress", CS_FALSE, CS_TRUE);
 }
 
 static void main_service_ready (void)

+ 6 - 0
exec/totemconfig.c

@@ -912,6 +912,8 @@ extern int totem_config_read (
 	 */
 	totem_volatile_config_read(totem_config, NULL);
 
+	icmap_set_uint8("config.totemconfig_reload_in_progress", 0);
+
 	add_totem_config_notification(totem_config);
 
 	return 0;
@@ -1264,6 +1266,10 @@ static void totem_reload_notify(
 		if (local_node_pos != -1) {
 			icmap_set_uint32("nodelist.local_node_pos", local_node_pos);
 		}
+
+		icmap_set_uint8("config.totemconfig_reload_in_progress", 0);
+	} else {
+		icmap_set_uint8("config.totemconfig_reload_in_progress", 1);
 	}
 }
 

+ 16 - 0
exec/votequorum.c

@@ -1477,9 +1477,18 @@ static void votequorum_refresh_config(
 	void *user_data)
 {
 	int old_votes, old_expected_votes;
+	uint8_t reloading;
 
 	ENTER();
 
+	/*
+	 * If a full reload is in progress then don't do anything until it's done and
+	 * can reconfigure it all atomically
+	 */
+	if (icmap_get_uint8("config.totemconfig_reload_in_progress", &reloading) == CS_OK && reloading) {
+		return ;
+	}
+
 	old_votes = us->votes;
 	old_expected_votes = us->expected_votes;
 
@@ -1509,6 +1518,7 @@ static void votequorum_exec_add_config_notification(void)
 {
 	icmap_track_t icmap_track_nodelist = NULL;
 	icmap_track_t icmap_track_quorum = NULL;
+	icmap_track_t icmap_track_reload = NULL;
 
 	ENTER();
 
@@ -1524,6 +1534,12 @@ static void votequorum_exec_add_config_notification(void)
 		NULL,
 		&icmap_track_quorum);
 
+	icmap_track_add("config.totemconfig_reload_in_progress",
+		ICMAP_TRACK_ADD | ICMAP_TRACK_MODIFY,
+		votequorum_refresh_config,
+		NULL,
+		&icmap_track_reload);
+
 	LEAVE();
 }
 

+ 9 - 0
man/cmap_keys.8

@@ -276,6 +276,15 @@ and set to 0 when the reload is completed. This allows interested subsystems
 to do atomic reconfiguration rather than changing each key. Note that 
 individual add/change/delete notifications will still be sent during a reload.
 
+.TP
+config.totemconfig_reload_in_progress
+This key is similar to
+.B config.totemconfig_reload_in_progress
+but changed after totem config trigger is processed. It is useful (mainly)
+for situations when
+.B nodelist.local_node_pos
+must be first correctly reinstated.
+
 .SH DYNAMIC CHANGE USER/GROUP PERMISSION TO USE COROSYNC IPC
 Is very same as in configuration file. To add UID 500 use