fix_smart_shutdown_in_recovery_v4_fujii.patch
application/octet-stream
Filename: fix_smart_shutdown_in_recovery_v4_fujii.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 v4
| File | + | − |
|---|---|---|
| src/backend/access/transam/xlog.c | 9 | 0 |
| src/backend/postmaster/postmaster.c | 4 | 0 |
*** a/src/backend/access/transam/xlog.c
--- b/src/backend/access/transam/xlog.c
***************
*** 8975,8980 **** CancelBackup(void)
--- 8975,8989 ----
{
struct stat stat_buf;
+ /*
+ * During recovery, we don't rename the "backup_label" file since
+ * it might be required for subsequent recovery. Don't bother with
+ * lock to access XLogCtl->SharedRecoveryInProgress, because there
+ * should be no other processes running when this code is reached.
+ */
+ if (XLogCtl->SharedRecoveryInProgress)
+ return;
+
/* if the file is not there, return */
if (stat(BACKUP_LABEL_FILE, &stat_buf) < 0)
return;
*** a/src/backend/postmaster/postmaster.c
--- b/src/backend/postmaster/postmaster.c
***************
*** 2168,2174 **** pmdie(SIGNAL_ARGS)
(errmsg("received smart shutdown request")));
if (pmState == PM_RUN || pmState == PM_RECOVERY ||
! pmState == PM_HOT_STANDBY)
{
/* autovacuum workers are told to shut down immediately */
SignalAutovacWorkers(SIGTERM);
--- 2168,2174 ----
(errmsg("received smart shutdown request")));
if (pmState == PM_RUN || pmState == PM_RECOVERY ||
! pmState == PM_HOT_STANDBY || pmState == PM_STARTUP)
{
/* autovacuum workers are told to shut down immediately */
SignalAutovacWorkers(SIGTERM);
***************
*** 4208,4214 **** sigusr1_handler(SIGNAL_ARGS)
}
if (CheckPostmasterSignal(PMSIGNAL_START_WALRECEIVER) &&
! WalReceiverPID == 0)
{
/* Startup Process wants us to start the walreceiver process. */
WalReceiverPID = StartWalReceiver();
--- 4208,4216 ----
}
if (CheckPostmasterSignal(PMSIGNAL_START_WALRECEIVER) &&
! WalReceiverPID == 0 &&
! (pmState == PM_STARTUP || pmState == PM_RECOVERY ||
! pmState == PM_HOT_STANDBY || pmState == PM_WAIT_READONLY))
{
/* Startup Process wants us to start the walreceiver process. */
WalReceiverPID = StartWalReceiver();