From 909be73f40cbf814f35cea5c981a24794bbead5c Mon Sep 17 00:00:00 2001 From: Pavan Deolasee Date: Fri, 31 Aug 2018 15:12:42 +0530 Subject: [PATCH] Force restart cluster monitor process if the GTM restarts If GTM loses node registration information and returns GTM_ERRCODE_NODE_NOT_REGISTERED to the coordinator/datanode, restart the cluster monitor process (by simply exiting with exit code 0). This would ensure that the cluster monitor re-registers with the GTM and start cleanly. Per report by Virendra Kumar --- src/backend/postmaster/clustermon.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/backend/postmaster/clustermon.c b/src/backend/postmaster/clustermon.c index 0eb0392863..633e0e9616 100644 --- a/src/backend/postmaster/clustermon.c +++ b/src/backend/postmaster/clustermon.c @@ -275,6 +275,17 @@ ClusterMonitorInit(void) continue; } } + else if (status == GTM_ERRCODE_NODE_NOT_REGISTERED) + { + /* + * If we're not registered on the GTM, it could be because the + * GTM is restarted. Just exit and let the cluster monitor be + * restarted again. + */ + elog(WARNING, "ClusterMonitor process exiting - node not " + "registered on the GTM"); + proc_exit(0); + } } else { -- 2.39.5