Skip to content

Commit 0cbd199

Browse files
committed
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.
1 parent ef18cb7 commit 0cbd199

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/backend/postmaster/postmaster.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1750,7 +1750,8 @@ ServerLoop(void)
17501750
}
17511751

17521752
/* If we have lost the stats collector, try to start a new one */
1753-
if (PgStatPID == 0 && pmState == PM_RUN)
1753+
if (PgStatPID == 0 &&
1754+
(pmState == PM_RUN || pmState == PM_HOT_STANDBY))
17541755
PgStatPID = pgstat_start();
17551756

17561757
/* If we have lost the archiver, try to start a new one. */
@@ -2946,7 +2947,7 @@ reaper(SIGNAL_ARGS)
29462947
if (!EXIT_STATUS_0(exitstatus))
29472948
LogChildExit(LOG, _("statistics collector process"),
29482949
pid, exitstatus);
2949-
if (pmState == PM_RUN)
2950+
if (pmState == PM_RUN || pmState == PM_HOT_STANDBY)
29502951
PgStatPID = pgstat_start();
29512952
continue;
29522953
}

0 commit comments

Comments
 (0)