File tree Expand file tree Collapse file tree 3 files changed +11
-9
lines changed Expand file tree Collapse file tree 3 files changed +11
-9
lines changed Original file line number Diff line number Diff line change 5555#include "miscadmin.h"
5656#include "pgstat.h"
5757#include "postmaster/bgwriter.h"
58+ #include "replication/syncrep.h"
5859#include "storage/bufmgr.h"
5960#include "storage/fd.h"
6061#include "storage/ipc.h"
@@ -363,6 +364,9 @@ BackgroundWriterMain(void)
363364 if (RecoveryInProgress ())
364365 ThisTimeLineID = GetRecoveryTargetTLI ();
365366
367+ /* Do this once before starting the loop, then just at SIGHUP time. */
368+ SyncRepUpdateSyncStandbysDefined ();
369+
366370 /*
367371 * Loop forever
368372 */
@@ -389,6 +393,8 @@ BackgroundWriterMain(void)
389393 {
390394 got_SIGHUP = false;
391395 ProcessConfigFile (PGC_SIGHUP );
396+ /* update global shmem state for sync rep */
397+ SyncRepUpdateSyncStandbysDefined ();
392398 }
393399 if (checkpoint_requested )
394400 {
@@ -704,6 +710,8 @@ CheckpointWriteDelay(int flags, double progress)
704710 {
705711 got_SIGHUP = false;
706712 ProcessConfigFile (PGC_SIGHUP );
713+ /* update global shmem state for sync rep */
714+ SyncRepUpdateSyncStandbysDefined ();
707715 }
708716
709717 AbsorbFsyncRequests ();
Original file line number Diff line number Diff line change 4949#include "libpq/pqsignal.h"
5050#include "miscadmin.h"
5151#include "postmaster/walwriter.h"
52- #include "replication/syncrep.h"
5352#include "storage/bufmgr.h"
5453#include "storage/fd.h"
5554#include "storage/ipc.h"
@@ -217,9 +216,6 @@ WalWriterMain(void)
217216 */
218217 PG_SETMASK (& UnBlockSig );
219218
220- /* Do this once before starting the loop, then just at SIGHUP time. */
221- SyncRepUpdateSyncStandbysDefined ();
222-
223219 /*
224220 * Loop forever
225221 */
@@ -241,8 +237,6 @@ WalWriterMain(void)
241237 {
242238 got_SIGHUP = false;
243239 ProcessConfigFile (PGC_SIGHUP );
244- /* update global shmem state for sync rep */
245- SyncRepUpdateSyncStandbysDefined ();
246240 }
247241 if (shutdown_requested )
248242 {
Original file line number Diff line number Diff line change @@ -557,9 +557,9 @@ SyncRepWakeQueue(bool all)
557557}
558558
559559/*
560- * WAL writer calls this as needed to update the shared sync_standbys_defined
561- * flag, so that backends don't remain permanently wedged if
562- * synchronous_standby_names is unset. It's safe to check the current value
560+ * The background writer calls this as needed to update the shared
561+ * sync_standbys_defined flag, so that backends don't remain permanently wedged
562+ * if synchronous_standby_names is unset. It's safe to check the current value
563563 * without the lock, because it's only ever updated by one process. But we
564564 * must take the lock to change it.
565565 */
You can’t perform that action at this time.
0 commit comments