* [Cluster-devel] [PATCH] rgmanager: Don't duplicate configuration change events
@ 2013-02-26 16:40 Ryan McCabe
  2013-02-27 18:31 ` Lon Hohberger
  0 siblings, 1 reply; 2+ messages in thread
From: Ryan McCabe @ 2013-02-26 16:40 UTC (permalink / raw)
  To: cluster-devel.redhat.com
If a cluster configuration change is detected while there are events
on the event queue that take some time to process, a large number of
duplicate configuration update events are put onto the event queue.
With a large number of services and a small status poll interval,
thousands of duplicate events can be put onto the queue.
This patch causes rgmanager to queue only one config event per detected
configuration change.
This applies only to the RHEL5 branch.
Signed-off-by: Ryan McCabe <rmccabe@redhat.com>
---
 rgmanager/src/daemons/main.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/rgmanager/src/daemons/main.c b/rgmanager/src/daemons/main.c
index 1c7f746..59150c3 100644
--- a/rgmanager/src/daemons/main.c
+++ b/rgmanager/src/daemons/main.c
@@ -73,6 +73,7 @@ static int port = RG_PORT;
 static char *rgmanager_lsname = "rgmanager"; /* XXX default */
 static int status_poll_interval = DEFAULT_CHECK_INTERVAL;
 static int stops_queued = 0;
+static int lastqver = 0;
 
 int next_node_id(cluster_member_list_t *membership, int me);
 
@@ -750,7 +751,7 @@ dump_internal_state(int fd)
 int
 event_loop(msgctx_t *localctx, msgctx_t *clusterctx)
 {
-	int n = 0, max, ret, oldver, newver;
+	int n = 0, max, ret, oldver = 0, newver = 0;
 	fd_set rfds;
 	msgctx_t *newctx;
 	struct timeval tv;
@@ -826,9 +827,14 @@ event_loop(msgctx_t *localctx, msgctx_t *clusterctx)
 		return 0;
 
 	if (need_reconfigure || check_config_update(&oldver, &newver)) {
+		/* Only queue configuration events once per detected config update */
+		if (!need_reconfigure && newver <= lastqver)
+			return 0;
+
 		need_reconfigure = 0;
 		configure_rgmanager(-1, 0, NULL);
 		config_event_q(oldver, newver);
+		lastqver = newver;
 		return 0;
 	}
 
-- 
1.8.1.2
^ permalink raw reply related	[flat|nested] 2+ messages in thread
* [Cluster-devel] [PATCH] rgmanager: Don't duplicate configuration change events
  2013-02-26 16:40 [Cluster-devel] [PATCH] rgmanager: Don't duplicate configuration change events Ryan McCabe
@ 2013-02-27 18:31 ` Lon Hohberger
  0 siblings, 0 replies; 2+ messages in thread
From: Lon Hohberger @ 2013-02-27 18:31 UTC (permalink / raw)
  To: cluster-devel.redhat.com
On 02/26/2013 11:40 AM, Ryan McCabe wrote:
> If a cluster configuration change is detected while there are events
> on the event queue that take some time to process, a large number of
> duplicate configuration update events are put onto the event queue.
> With a large number of services and a small status poll interval,
> thousands of duplicate events can be put onto the queue.
> 
> This patch causes rgmanager to queue only one config event per detected
> configuration change.
Good catch there.
Ack /
Reviewed-by: Lon Hohberger <lhh@redhat.com>
-- Lon
> 
> This applies only to the RHEL5 branch.
> 
> Signed-off-by: Ryan McCabe <rmccabe@redhat.com>
> ---
>  rgmanager/src/daemons/main.c | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/rgmanager/src/daemons/main.c b/rgmanager/src/daemons/main.c
> index 1c7f746..59150c3 100644
> --- a/rgmanager/src/daemons/main.c
> +++ b/rgmanager/src/daemons/main.c
> @@ -73,6 +73,7 @@ static int port = RG_PORT;
>  static char *rgmanager_lsname = "rgmanager"; /* XXX default */
>  static int status_poll_interval = DEFAULT_CHECK_INTERVAL;
>  static int stops_queued = 0;
> +static int lastqver = 0;
>  
>  int next_node_id(cluster_member_list_t *membership, int me);
>  
> @@ -750,7 +751,7 @@ dump_internal_state(int fd)
>  int
>  event_loop(msgctx_t *localctx, msgctx_t *clusterctx)
>  {
> -	int n = 0, max, ret, oldver, newver;
> +	int n = 0, max, ret, oldver = 0, newver = 0;
>  	fd_set rfds;
>  	msgctx_t *newctx;
>  	struct timeval tv;
> @@ -826,9 +827,14 @@ event_loop(msgctx_t *localctx, msgctx_t *clusterctx)
>  		return 0;
>  
>  	if (need_reconfigure || check_config_update(&oldver, &newver)) {
> +		/* Only queue configuration events once per detected config update */
> +		if (!need_reconfigure && newver <= lastqver)
> +			return 0;
> +
>  		need_reconfigure = 0;
>  		configure_rgmanager(-1, 0, NULL);
>  		config_event_q(oldver, newver);
> +		lastqver = newver;
>  		return 0;
>  	}
>  
> 
^ permalink raw reply	[flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-02-27 18:31 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-26 16:40 [Cluster-devel] [PATCH] rgmanager: Don't duplicate configuration change events Ryan McCabe
2013-02-27 18:31 ` Lon Hohberger
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).