Skip to content

Commit f15538c

Browse files
committed
postmaster: Adjust which processes we expect to have exited
Comments and code stated that we expect checkpointer to have been signalled in case of immediate shutdown / fatal errors, but didn't treat archiver and walsenders the same. That doesn't seem right. I had started digging through the history to see where this oddity was introduced, but it's not the fault of a single commit. Instead treat archiver, checkpointer, and walsenders the same. Reviewed-by: Bertrand Drouvot <bertranddrouvot.pg@gmail.com> Discussion: https://postgr.es/m/kgng5nrvnlv335evmsuvpnh354rw7qyazl73kdysev2cr2v5zu@m3cfzxicm5kp
1 parent 463a2eb commit f15538c

File tree

1 file changed

+18
-10
lines changed

1 file changed

+18
-10
lines changed

src/backend/postmaster/postmaster.c

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2919,16 +2919,20 @@ PostmasterStateMachine(void)
29192919

29202920
/*
29212921
* If we are doing crash recovery or an immediate shutdown then we
2922-
* expect the checkpointer to exit as well, otherwise not.
2922+
* expect archiver, checkpointer and walsender to exit as well,
2923+
* otherwise not.
29232924
*/
29242925
if (FatalError || Shutdown >= ImmediateShutdown)
2925-
targetMask = btmask_add(targetMask, B_CHECKPOINTER);
2926+
targetMask = btmask_add(targetMask,
2927+
B_CHECKPOINTER,
2928+
B_ARCHIVER,
2929+
B_WAL_SENDER);
29262930

29272931
/*
2928-
* Walsenders and archiver will continue running; they will be
2929-
* terminated later after writing the checkpoint record. We also let
2930-
* dead-end children to keep running for now. The syslogger process
2931-
* exits last.
2932+
* Normally walsenders and archiver will continue running; they will
2933+
* be terminated later after writing the checkpoint record. We also
2934+
* let dead-end children to keep running for now. The syslogger
2935+
* process exits last.
29322936
*
29332937
* This assertion checks that we have covered all backend types,
29342938
* either by including them in targetMask, or by noting here that they
@@ -2939,13 +2943,17 @@ PostmasterStateMachine(void)
29392943
BackendTypeMask remainMask = BTYPE_MASK_NONE;
29402944

29412945
remainMask = btmask_add(remainMask,
2942-
B_WAL_SENDER,
2943-
B_ARCHIVER,
29442946
B_DEAD_END_BACKEND,
29452947
B_LOGGER);
29462948

2947-
/* checkpointer may or may not be in targetMask already */
2948-
remainMask = btmask_add(remainMask, B_CHECKPOINTER);
2949+
/*
2950+
* Archiver, checkpointer and walsender may or may not be in
2951+
* targetMask already.
2952+
*/
2953+
remainMask = btmask_add(remainMask,
2954+
B_ARCHIVER,
2955+
B_CHECKPOINTER,
2956+
B_WAL_SENDER);
29492957

29502958
/* these are not real postmaster children */
29512959
remainMask = btmask_add(remainMask,

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