cluster-devel.redhat.com archive mirror
 help / color / mirror / Atom feed
From: Lon Hohberger <lhh@redhat.com>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] [PATCH 2/5] rgmanager: Avoid duplicate restart of service (RHEL5)
Date: Thu,  5 Jan 2012 10:57:32 -0500	[thread overview]
Message-ID: <1325779055-1424-2-git-send-email-lhh@redhat.com> (raw)
In-Reply-To: <1325779055-1424-1-git-send-email-lhh@redhat.com>

If B depends on A and both A and B are running on
node 1 and node 1 fails, the stop events generated
will inadvertently cause B to be restarted after
the initial failover.

This patch resolves this issue by comparing the
start times in central_processing mode.

A known limitation to this patch is that in order
for this patch to work correctly, the cluster nodes'
time must be approximately in sync.

Resolves: rhbz#743214

Signed-off-by: Lon Hohberger <lhh@redhat.com>
---
 rgmanager/src/resources/default_event_script.sl |   19 ++++++++++++++++++-
 1 files changed, 18 insertions(+), 1 deletions(-)

diff --git a/rgmanager/src/resources/default_event_script.sl b/rgmanager/src/resources/default_event_script.sl
index cdde066..2d5503f 100644
--- a/rgmanager/src/resources/default_event_script.sl
+++ b/rgmanager/src/resources/default_event_script.sl
@@ -444,6 +444,8 @@ define default_service_event_handler()
 	variable tmp;
 	variable owner;
 	variable state;
+	variable d_trans, s_trans;
+	variable s_state;
 
 	debug("Executing default service event handler");
 
@@ -498,17 +500,32 @@ define default_service_event_handler()
 			continue;
 		}
 
-		(,,, owner, state) = service_status(services[x]);
+		(d_trans,,,, owner, state) = service_status(services[x], 1);
 		if ((service_state == "started") and (owner < 0) and
 		    (state == "stopped")) {
 			info("Dependency met; starting ", services[x]);
 			nodes = allowed_nodes(services[x]);
 			()=move_or_start(services[x], nodes);
+			continue;
 		}
 
 		% service died - stop service(s) that depend on the dead
 		if ((service_owner < 0) and (owner >= 0) and
 		    (depend_mode != "soft")) {
+
+			% grab the -current- state of the service here
+			% If the service is running, and its dependent service
+			% as above is running and the dependent service was
+			% started at or after the service, then stopping it
+			% will result in unwanted service outage.
+			(s_trans,,,, s_state) = service_status(service_name);
+			if ((s_state == "started") and (state == "started") and
+			    (d_trans >= s_trans)) {
+				debug("Skipping ", services[x],
+				      "; restart not needed");
+				continue;
+			}
+
 			info("Dependency lost; stopping ", services[x]);
 			()=service_stop(services[x]);
 		}
-- 
1.7.3.4



  reply	other threads:[~2012-01-05 15:57 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-05 15:57 [Cluster-devel] [PATCH 1/5] rgmanager: Add extra service status call (RHEL5) Lon Hohberger
2012-01-05 15:57 ` Lon Hohberger [this message]
2012-01-05 15:57 ` [Cluster-devel] [PATCH 3/5] rgmanager: Fix call to service_status() (RHEL5) Lon Hohberger
2012-01-05 15:57 ` [Cluster-devel] [PATCH 4/5] rgmanager: Fix tiny memory leak in sl_service_status (RHEL5) Lon Hohberger
2012-01-05 15:57 ` [Cluster-devel] [PATCH 5/5] rgmanager: Fix dependency issue related to ordering (RHEL5) Lon Hohberger
2012-01-05 16:34   ` Lon Hohberger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1325779055-1424-2-git-send-email-lhh@redhat.com \
    --to=lhh@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).