diff options
author | Robert Haas <rhaas@postgresql.org> | 2016-10-27 14:27:40 -0400 |
---|---|---|
committer | Robert Haas <rhaas@postgresql.org> | 2016-10-27 14:27:40 -0400 |
commit | 4f714b2fd2a580d909607de889ac822956eb8299 (patch) | |
tree | 8c4f3d472b5e69f74388ae912d14bab8436ec5b4 /src | |
parent | f267c1c2447bb8da6e4a6b2fcbb612762c3579a8 (diff) | |
download | postgresql-4f714b2fd2a580d909607de889ac822956eb8299.tar.gz postgresql-4f714b2fd2a580d909607de889ac822956eb8299.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.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/backend/postmaster/postmaster.c b/src/backend/postmaster/postmaster.c index 2d43506cd0e..24add74512f 100644 --- a/src/backend/postmaster/postmaster.c +++ b/src/backend/postmaster/postmaster.c @@ -1753,7 +1753,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. */ @@ -2963,7 +2964,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; } |