Force restart cluster monitor process if the GTM restarts
authorPavan Deolasee <[email protected]>
Fri, 31 Aug 2018 09:42:42 +0000 (15:12 +0530)
committerPavan Deolasee <[email protected]>
Thu, 6 Sep 2018 09:57:07 +0000 (15:27 +0530)
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

index 0eb039286358863899dae26df670b879ae05d61a..633e0e961631d5c67c7e49a55dd4c520e23aa051 100644 (file)
@@ -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
                {