diff --git a/src/backend/postmaster/bgwriter.c b/src/backend/postmaster/bgwriter.c index 4df69c2f677eddd443a9796d3d69b5e156517fee..1b450a802baa90ffdeaa801b67b73928af11ab5c 100644 --- a/src/backend/postmaster/bgwriter.c +++ b/src/backend/postmaster/bgwriter.c @@ -55,6 +55,7 @@ #include "miscadmin.h" #include "pgstat.h" #include "postmaster/bgwriter.h" +#include "replication/syncrep.h" #include "storage/bufmgr.h" #include "storage/fd.h" #include "storage/ipc.h" @@ -363,6 +364,9 @@ BackgroundWriterMain(void) if (RecoveryInProgress()) ThisTimeLineID = GetRecoveryTargetTLI(); + /* Do this once before starting the loop, then just at SIGHUP time. */ + SyncRepUpdateSyncStandbysDefined(); + /* * Loop forever */ @@ -389,6 +393,8 @@ BackgroundWriterMain(void) { got_SIGHUP = false; ProcessConfigFile(PGC_SIGHUP); + /* update global shmem state for sync rep */ + SyncRepUpdateSyncStandbysDefined(); } if (checkpoint_requested) { @@ -704,6 +710,8 @@ CheckpointWriteDelay(int flags, double progress) { got_SIGHUP = false; ProcessConfigFile(PGC_SIGHUP); + /* update global shmem state for sync rep */ + SyncRepUpdateSyncStandbysDefined(); } AbsorbFsyncRequests(); diff --git a/src/backend/postmaster/walwriter.c b/src/backend/postmaster/walwriter.c index e97ac63ed09e024b627c04a154e94e91ca3c5e81..d0d7c9bebf03ea4f0a744710b77195fea3a61a71 100644 --- a/src/backend/postmaster/walwriter.c +++ b/src/backend/postmaster/walwriter.c @@ -49,7 +49,6 @@ #include "libpq/pqsignal.h" #include "miscadmin.h" #include "postmaster/walwriter.h" -#include "replication/syncrep.h" #include "storage/bufmgr.h" #include "storage/fd.h" #include "storage/ipc.h" @@ -217,9 +216,6 @@ WalWriterMain(void) */ PG_SETMASK(&UnBlockSig); - /* Do this once before starting the loop, then just at SIGHUP time. */ - SyncRepUpdateSyncStandbysDefined(); - /* * Loop forever */ @@ -241,8 +237,6 @@ WalWriterMain(void) { got_SIGHUP = false; ProcessConfigFile(PGC_SIGHUP); - /* update global shmem state for sync rep */ - SyncRepUpdateSyncStandbysDefined(); } if (shutdown_requested) { diff --git a/src/backend/replication/syncrep.c b/src/backend/replication/syncrep.c index 8aef998b47f057b16d263a5eedfd1cdfdb541d44..e99b43d8e0d2c3e3084a9e5201893905da51ef63 100644 --- a/src/backend/replication/syncrep.c +++ b/src/backend/replication/syncrep.c @@ -557,9 +557,9 @@ SyncRepWakeQueue(bool all) } /* - * WAL writer calls this as needed to update the shared sync_standbys_defined - * flag, so that backends don't remain permanently wedged if - * synchronous_standby_names is unset. It's safe to check the current value + * The background writer calls this as needed to update the shared + * sync_standbys_defined flag, so that backends don't remain permanently wedged + * if synchronous_standby_names is unset. It's safe to check the current value * without the lock, because it's only ever updated by one process. But we * must take the lock to change it. */