aboutsummaryrefslogtreecommitdiff
path: root/src
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:54:39 -0400
commit0cbd199fd93ed01b0b2c3e120c5603b7f101efdf (patch)
treea8c076fced98c6503746ff0f09743d54bd2142f4 /src
parentef18cb7da6ab0bde676ad8f7b17452d7cd8f7970 (diff)
downloadpostgresql-0cbd199fd93ed01b0b2c3e120c5603b7f101efdf.tar.gz
postgresql-0cbd199fd93ed01b0b2c3e120c5603b7f101efdf.zip
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.
Diffstat (limited to 'src')
-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 5db878f9b47..cfc50fb8fd2 100644
--- a/src/backend/postmaster/postmaster.c
+++ b/src/backend/postmaster/postmaster.c
@@ -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;
}