]> git.ipfire.org Git - thirdparty/postgresql.git/commitdiff
Make the standby server promptly handle interrupt signals.
authorFujii Masao <fujii@postgresql.org>
Mon, 16 Nov 2020 09:27:51 +0000 (18:27 +0900)
committerFujii Masao <fujii@postgresql.org>
Sun, 25 Jul 2021 02:16:26 +0000 (11:16 +0900)
This commit changes the startup process in the standby server so that
it handles the interrupt signals after waiting for wal_retrieve_retry_interval
on the latch and resetting it, before entering another wait on the latch.
This change causes the standby server to promptly handle interrupt signals.

Otherwise, previously, there was the case where the standby needs to
wait extra five seconds to shutdown when the shutdown request arrived
while the startup process was waiting for wal_retrieve_retry_interval
on the latch.

Author: Fujii Masao, but implementation idea is from Soumyadeep Chakraborty
Reviewed-by: Soumyadeep Chakraborty
Discussion: https://postgr.es/m/9d7e6ab0-8a53-ddb9-63cd-289bcb25fe0e@oss.nttdata.com

Per discussion of BUG #17073, back-patch to all supported versions.
Discussion: https://postgr.es/m/17073-1a5fdaed0fa5d4d0@postgresql.org

src/backend/access/transam/xlog.c

index b3cc055bab8257bf4f51ccb44fdb10dd5695a1da..056d5ca9bae523d20aeeb374a986930035c0c78c 100644 (file)
@@ -12050,6 +12050,9 @@ WaitForWALToBecomeAvailable(XLogRecPtr RecPtr, bool randAccess,
                                                                  wait_time, WAIT_EVENT_RECOVERY_WAL_STREAM);
                                                ResetLatch(&XLogCtl->recoveryWakeupLatch);
                                                now = GetCurrentTimestamp();
+
+                                               /* Handle interrupt signals of startup process */
+                                               HandleStartupProcInterrupts();
                                        }
                                        last_fail_time = now;
                                        currentSource = XLOG_FROM_ARCHIVE;