summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Haas <rhaas@postgresql.org>2016-10-27 14:27:40 -0400
committerRobert Haas <rhaas@postgresql.org>2016-10-27 14:56:37 -0400
commit4a8cfbdcbe8447e4226b2ebdb155e0acc1167db5 (patch)
tree86c540c67f435ff7f91d2a1b55689b498a4e089f
parentd1e9c8269bb1b8eae595c48b67f11e3fd4658170 (diff)
If the stats collector dies during Hot Standby, restart it.
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.
-rw-r--r--src/backend/postmaster/postmaster.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/backend/postmaster/postmaster.c b/src/backend/postmaster/postmaster.c
index 5489f239cc4..56c0c493449 100644
--- a/src/backend/postmaster/postmaster.c
+++ b/src/backend/postmaster/postmaster.c
@@ -1749,7 +1749,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 */
@@ -2929,7 +2930,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;
}