From 4641ddcc3f135c62c4226fceee0b3625f49c2038 Mon Sep 17 00:00:00 2001 From: Jaime Casanova Date: Sat, 23 Oct 2010 20:19:09 -0500 Subject: [PATCH] Teach repmgrd that if the node is promoted it should exit --- repmgrd.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/repmgrd.c b/repmgrd.c index befa06c4..721a37aa 100644 --- a/repmgrd.c +++ b/repmgrd.c @@ -197,6 +197,15 @@ MonitorExecute(void) unsigned long long int lsn_standby_received; unsigned long long int lsn_standby_applied; + /* Check if we still are a standby, we could be promoted */ + if (!is_standby(myLocalConn)) + { + fprintf(stderr, "\n%s: seems like we have been promoted, so exit from monitoring...\n", + progname); + CloseConnections(); + exit(1); + } + /* * first check if there is a command being executed, * and if that is the case, cancel the query so i can