From: Pavan Deolasee Date: Tue, 1 Mar 2016 11:53:05 +0000 (+0530) Subject: Report state to the GTM no more frequently than defined by X-Git-Tag: XL9_5_R1BETA2~46 X-Git-Url: http://git.postgresql.org/gitweb/static/gitweb.js?a=commitdiff_plain;h=031c0c5424bd18bdc2e4b4014396f44acfb17a65;p=postgres-xl.git 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 --- 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 @@ -196,6 +196,42 @@ ClusterMonitorInit(void) struct timeval nap; 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 */