]> granicus.if.org Git - postgresql/commitdiff
If the stats collector dies during Hot Standby, restart it.
authorRobert Haas <rhaas@postgresql.org>
Thu, 27 Oct 2016 18:27:40 +0000 (14:27 -0400)
committerRobert Haas <rhaas@postgresql.org>
Thu, 27 Oct 2016 18:56:53 +0000 (14:56 -0400)
This bug exists as far back as 9.0, when Hot Standby was introduced,
so back-patch to all supported branches.

Report and patch by Takayuki Tsunakawa, reviewed by Michael Paquier
and Kuntal Ghosh.

src/backend/postmaster/postmaster.c

index 99248f57579613a0e2c2f7313c45224ce5a5bf17..4b7068756ec3d1f150d664a5e4d51606c7d63d1b 100644 (file)
@@ -1517,7 +1517,8 @@ ServerLoop(void)
                        PgArchPID = pgarch_start();
 
                /* If we have lost the stats collector, try to start a new one */
-               if (PgStatPID == 0 && pmState == PM_RUN)
+               if (PgStatPID == 0 &&
+                       (pmState == PM_RUN || pmState == PM_HOT_STANDBY))
                        PgStatPID = pgstat_start();
 
                /* If we need to signal the autovacuum launcher, do so now */
@@ -2690,7 +2691,7 @@ reaper(SIGNAL_ARGS)
                        if (!EXIT_STATUS_0(exitstatus))
                                LogChildExit(LOG, _("statistics collector process"),
                                                         pid, exitstatus);
-                       if (pmState == PM_RUN)
+                       if (pmState == PM_RUN || pmState == PM_HOT_STANDBY)
                                PgStatPID = pgstat_start();
                        continue;
                }