diff options
author | Pavan Deolasee | 2016-03-01 11:53:05 +0000 |
---|---|---|
committer | Pavan Deolasee | 2016-10-18 10:00:18 +0000 |
commit | 7d79d90991a81d227cb9ba45edc57f28c8e20ca8 (patch) | |
tree | bd3dd4c025530fccd019528fa69bc80f5c6d9397 | |
parent | ba374d3ce8b100c688c99876377af057693f4b80 (diff) |
Report state to the GTM no more frequently than defined by
CLUSTER_MONITOR_NAPTIME
Otherwise we have danger of flooding the GTM with messages in an infinite loop,
if the GTM is reporting back errors
-rw-r--r-- | src/backend/postmaster/clustermon.c | 71 |
1 files changed, 36 insertions, 35 deletions
diff --git a/src/backend/postmaster/clustermon.c b/src/backend/postmaster/clustermon.c index ad2bc94b5a..0eb0392863 100644 --- a/src/backend/postmaster/clustermon.c +++ b/src/backend/postmaster/clustermon.c @@ -197,6 +197,42 @@ ClusterMonitorInit(void) int rc; /* + * Repeat at CLUSTER_MONITOR_NAPTIME seconds interval + */ + nap.tv_sec = CLUSTER_MONITOR_NAPTIME; + nap.tv_usec = 0; + + /* + * Wait until naptime expires or we get some type of signal (all the + * signal handlers will wake us by calling SetLatch). + */ + rc = WaitLatch(MyLatch, + WL_LATCH_SET | WL_TIMEOUT | WL_POSTMASTER_DEATH, + (nap.tv_sec * 1000L) + (nap.tv_usec / 1000L)); + + ResetLatch(MyLatch); + + /* Process sinval catchup interrupts that happened while sleeping */ + ProcessCatchupInterrupt(); + + /* + * Emergency bailout if postmaster has died. This is to avoid the + * necessity for manual cleanup of all postmaster children. + */ + if (rc & WL_POSTMASTER_DEATH) + proc_exit(1); + + /* the normal shutdown case */ + if (got_SIGTERM) + break; + + if (got_SIGHUP) + { + got_SIGHUP = false; + ProcessConfigFile(PGC_SIGHUP); + } + + /* * Compute RecentGlobalXmin, report it to the GTM and sleep for the set * interval. Keep doing this forever */ @@ -255,41 +291,6 @@ ClusterMonitorInit(void) ClusterMonitorSetReportingGlobalXmin(InvalidGlobalTransactionId); - /* - * Repeat at every 30 seconds - */ - nap.tv_sec = CLUSTER_MONITOR_NAPTIME; - nap.tv_usec = 0; - - /* - * Wait until naptime expires or we get some type of signal (all the - * signal handlers will wake us by calling SetLatch). - */ - rc = WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | WL_POSTMASTER_DEATH, - (nap.tv_sec * 1000L) + (nap.tv_usec / 1000L)); - - ResetLatch(MyLatch); - - /* Process sinval catchup interrupts that happened while sleeping */ - ProcessCatchupInterrupt(); - - /* - * Emergency bailout if postmaster has died. This is to avoid the - * necessity for manual cleanup of all postmaster children. - */ - if (rc & WL_POSTMASTER_DEATH) - proc_exit(1); - - /* the normal shutdown case */ - if (got_SIGTERM) - break; - - if (got_SIGHUP) - { - got_SIGHUP = false; - ProcessConfigFile(PGC_SIGHUP); - } } /* Normal exit from the cluster monitor is here */ |