diff options
| author | Robert Haas | 2011-03-19 01:43:45 +0000 |
|---|---|---|
| committer | Robert Haas | 2011-03-19 01:43:45 +0000 |
| commit | 727589995a3e027046f0da7af6ba665b0b47f89f (patch) | |
| tree | 674784df889b69812b61a6ae4adb375da3808a1c /src/backend/postmaster | |
| parent | f78ba0a73a60f40270b21c4582f6a7d52fe16739 (diff) | |
Move synchronous_standbys_defined updates from WAL writer to BG writer.
This is advantageous because the BG writer is alive until much later in
the shutdown sequence than WAL writer; we want to make sure that it's
possible to shut off synchronous replication during a smart shutdown,
else it might not be possible to complete the shutdown at all.
Per very reasonable gripes from Fujii Masao and Simon Riggs.
Diffstat (limited to 'src/backend/postmaster')
| -rw-r--r-- | src/backend/postmaster/bgwriter.c | 8 | ||||
| -rw-r--r-- | src/backend/postmaster/walwriter.c | 6 |
2 files changed, 8 insertions, 6 deletions
diff --git a/src/backend/postmaster/bgwriter.c b/src/backend/postmaster/bgwriter.c index 4df69c2f677..1b450a802ba 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 e97ac63ed09..d0d7c9bebf0 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) { |
