sigusr1_kicks_state_machine_v1.patch
application/octet-stream
Filename: sigusr1_kicks_state_machine_v1.patch
Type: application/octet-stream
Part: 0
Patch
Same data as JSON:
GET /api/v1/attachments/:id/patch
the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes.
API reference →
Format: context
Series: patch v1
| File | + | − |
|---|---|---|
| src/backend/postmaster/postmaster.c | 9 | 0 |
| src/backend/replication/walsender.c | 1 | 0 |
| src/include/storage/pmsignal.h | 1 | 0 |
*** a/src/backend/postmaster/postmaster.c
--- b/src/backend/postmaster/postmaster.c
***************
*** 2890,2897 **** LogChildExit(int lev, const char *procname, int pid, int exitstatus)
/*
* Advance the postmaster's state machine and take actions as appropriate
*
! * This is common code for pmdie() and reaper(), which receive the signals
! * that might mean we need to change state.
*/
static void
PostmasterStateMachine(void)
--- 2890,2897 ----
/*
* Advance the postmaster's state machine and take actions as appropriate
*
! * This is common code for pmdie(), reaper() and sigusr1_handler(), which
! * receive the signals that might mean we need to change state.
*/
static void
PostmasterStateMachine(void)
***************
*** 4284,4289 **** sigusr1_handler(SIGNAL_ARGS)
--- 4284,4296 ----
WalReceiverPID = StartWalReceiver();
}
+ if (CheckPostmasterSignal(PMSIGNAL_ADVANCE_STATE_MACHINE) &&
+ (pmState == PM_WAIT_BACKUP || pmState == PM_WAIT_BACKENDS))
+ {
+ /* Advance postmaster's state machine */
+ PostmasterStateMachine();
+ }
+
if (CheckPromoteSignal() && StartupPID != 0 &&
(pmState == PM_STARTUP || pmState == PM_RECOVERY ||
pmState == PM_HOT_STANDBY || pmState == PM_WAIT_READONLY))
*** a/src/backend/replication/walsender.c
--- b/src/backend/replication/walsender.c
***************
*** 361,366 **** StartReplication(StartReplicationCmd * cmd)
--- 361,367 ----
* after this.
*/
MarkPostmasterChildWalSender();
+ SendPostmasterSignal(PMSIGNAL_ADVANCE_STATE_MACHINE);
/*
* Check that we're logging enough information in the WAL for
*** a/src/include/storage/pmsignal.h
--- b/src/include/storage/pmsignal.h
***************
*** 29,34 **** typedef enum
--- 29,35 ----
PMSIGNAL_START_AUTOVAC_LAUNCHER, /* start an autovacuum launcher */
PMSIGNAL_START_AUTOVAC_WORKER, /* start an autovacuum worker */
PMSIGNAL_START_WALRECEIVER, /* start a walreceiver */
+ PMSIGNAL_ADVANCE_STATE_MACHINE, /* advance postmaster's state machine */
NUM_PMSIGNALS /* Must be last value of enum! */
} PMSignalReason;