Checkpointer starts before bgwriter to avoid missing fsync requests.

Noted while testing Hot Standby startup.
This commit is contained in:
Simon Riggs 2012-06-01 08:25:17 +01:00
parent 1ec6a2bbc9
commit a297d64d92

View File

@ -1378,10 +1378,10 @@ ServerLoop(void)
if (pmState == PM_RUN || pmState == PM_RECOVERY || if (pmState == PM_RUN || pmState == PM_RECOVERY ||
pmState == PM_HOT_STANDBY) pmState == PM_HOT_STANDBY)
{ {
if (BgWriterPID == 0)
BgWriterPID = StartBackgroundWriter();
if (CheckpointerPID == 0) if (CheckpointerPID == 0)
CheckpointerPID = StartCheckpointer(); CheckpointerPID = StartCheckpointer();
if (BgWriterPID == 0)
BgWriterPID = StartBackgroundWriter();
} }
/* /*
@ -2372,10 +2372,10 @@ reaper(SIGNAL_ARGS)
* when we entered consistent recovery state. It doesn't matter * when we entered consistent recovery state. It doesn't matter
* if this fails, we'll just try again later. * if this fails, we'll just try again later.
*/ */
if (BgWriterPID == 0)
BgWriterPID = StartBackgroundWriter();
if (CheckpointerPID == 0) if (CheckpointerPID == 0)
CheckpointerPID = StartCheckpointer(); CheckpointerPID = StartCheckpointer();
if (BgWriterPID == 0)
BgWriterPID = StartBackgroundWriter();
if (WalWriterPID == 0) if (WalWriterPID == 0)
WalWriterPID = StartWalWriter(); WalWriterPID = StartWalWriter();
@ -4239,10 +4239,10 @@ sigusr1_handler(SIGNAL_ARGS)
* Crank up the background tasks. It doesn't matter if this fails, * Crank up the background tasks. It doesn't matter if this fails,
* we'll just try again later. * we'll just try again later.
*/ */
Assert(BgWriterPID == 0);
BgWriterPID = StartBackgroundWriter();
Assert(CheckpointerPID == 0); Assert(CheckpointerPID == 0);
CheckpointerPID = StartCheckpointer(); CheckpointerPID = StartCheckpointer();
Assert(BgWriterPID == 0);
BgWriterPID = StartBackgroundWriter();
pmState = PM_RECOVERY; pmState = PM_RECOVERY;
} }