]> git.ipfire.org Git - thirdparty/postgresql.git/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:54:39 +0000 (14:54 -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 5db878f9b4701e66d341152b1fe7354b6fa409a8..cfc50fb8fd2af402084d5370b63d0942dc17b518 100644 (file)
@@ -1750,7 +1750,8 @@ ServerLoop(void)
                }
 
                /* 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 have lost the archiver, try to start a new one. */
@@ -2946,7 +2947,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;
                }