Skip to content

Commit a297d64

Browse files
Checkpointer starts before bgwriter to avoid missing fsync requests.
Noted while testing Hot Standby startup.
1 parent 1ec6a2b commit a297d64

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/backend/postmaster/postmaster.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1378,10 +1378,10 @@ ServerLoop(void)
13781378
if (pmState == PM_RUN || pmState == PM_RECOVERY ||
13791379
pmState == PM_HOT_STANDBY)
13801380
{
1381-
if (BgWriterPID == 0)
1382-
BgWriterPID = StartBackgroundWriter();
13831381
if (CheckpointerPID == 0)
13841382
CheckpointerPID = StartCheckpointer();
1383+
if (BgWriterPID == 0)
1384+
BgWriterPID = StartBackgroundWriter();
13851385
}
13861386

13871387
/*
@@ -2372,10 +2372,10 @@ reaper(SIGNAL_ARGS)
23722372
* when we entered consistent recovery state. It doesn't matter
23732373
* if this fails, we'll just try again later.
23742374
*/
2375-
if (BgWriterPID == 0)
2376-
BgWriterPID = StartBackgroundWriter();
23772375
if (CheckpointerPID == 0)
23782376
CheckpointerPID = StartCheckpointer();
2377+
if (BgWriterPID == 0)
2378+
BgWriterPID = StartBackgroundWriter();
23792379
if (WalWriterPID == 0)
23802380
WalWriterPID = StartWalWriter();
23812381

@@ -4239,10 +4239,10 @@ sigusr1_handler(SIGNAL_ARGS)
42394239
* Crank up the background tasks. It doesn't matter if this fails,
42404240
* we'll just try again later.
42414241
*/
4242-
Assert(BgWriterPID == 0);
4243-
BgWriterPID = StartBackgroundWriter();
42444242
Assert(CheckpointerPID == 0);
42454243
CheckpointerPID = StartCheckpointer();
4244+
Assert(BgWriterPID == 0);
4245+
BgWriterPID = StartBackgroundWriter();
42464246

42474247
pmState = PM_RECOVERY;
42484248
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy