From 43f28f4097df95898254716087c820746539d224 Mon Sep 17 00:00:00 2001 From: Ian Barwick Date: Mon, 18 Mar 2019 14:19:09 +0900 Subject: [PATCH] Clarify calls to check_primary_status() Use a constant rather than a magic number to indicate non-provision of elapsed degraded monitoring time. --- repmgr.h | 1 + repmgrd-physical.c | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/repmgr.h b/repmgr.h index 50c0f47f..aea72d20 100644 --- a/repmgr.h +++ b/repmgr.h @@ -63,6 +63,7 @@ #define ELECTION_RERUN_NOTIFICATION -2 #define VOTING_TERM_NOT_SET -1 #define ARCHIVE_STATUS_DIR_ERROR -1 +#define NO_DEGRADED_MONITORING_ELAPSED -1 #define BDR2_REPLICATION_SET_NAME "repmgr" diff --git a/repmgrd-physical.c b/repmgrd-physical.c index ecd3313e..9c0f0ec7 100644 --- a/repmgrd-physical.c +++ b/repmgrd-physical.c @@ -351,7 +351,7 @@ monitor_streaming_primary(void) * check that the local node is still primary, otherwise switch * to standby monitoring */ - if (check_primary_status(-1) == false) + if (check_primary_status(NO_DEGRADED_MONITORING_ELAPSED) == false) return; goto loop; @@ -423,7 +423,7 @@ monitor_streaming_primary(void) loop: /* check node is still primary, if not restart monitoring */ - if (check_primary_status(-1) == false) + if (check_primary_status(NO_DEGRADED_MONITORING_ELAPSED) == false) return; /* emit "still alive" log message at regular intervals, if requested */