cluster: RHEL510 - rgmanager: Don't duplicate configuration change events
Ryan McCabe
rmccabe at fedoraproject.org
Fri Apr 12 15:05:52 UTC 2013
Gitweb: http://git.fedorahosted.org/git/?p=cluster.git;a=commitdiff;h=02ae12174d1c1908acb53c67cb04d26a3d19b536
Commit: 02ae12174d1c1908acb53c67cb04d26a3d19b536
Parent: efdb438ad868b447e28cde5959530b5dc763186f
Author: Ryan McCabe <rmccabe at redhat.com>
AuthorDate: Tue Feb 26 11:36:04 2013 -0500
Committer: Ryan McCabe <rmccabe at redhat.com>
CommitterDate: Fri Apr 12 11:05:46 2013 -0400
rgmanager: Don't duplicate configuration change events
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.
Signed-off-by: Ryan McCabe <rmccabe at redhat.com>
---
rgmanager/src/daemons/main.c | 8 +++++++-
1 files changed, 7 insertions(+), 1 deletions(-)
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;
}
More information about the cluster-commits
mailing list