Skip to content

Commit 1eadfbd

Browse files
committed
Revert "Disable STARTUP_PROGRESS_TIMEOUT in standby mode."
This reverts commit 98e7234. I forgot that we're about to wrap a release, and this fix isn't critical enough to justify committing it right before we wrap a release. Discussion: http://postgr.es/m/2676424.1675700113@sss.pgh.pa.us
1 parent 98e7234 commit 1eadfbd

File tree

3 files changed

+6
-51
lines changed

3 files changed

+6
-51
lines changed

src/backend/access/transam/xlogrecovery.c

Lines changed: 3 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,6 @@ static bool recoveryStopAfter;
383383
/* prototypes for local functions */
384384
static void ApplyWalRecord(XLogReaderState *xlogreader, XLogRecord *record, TimeLineID *replayTLI);
385385

386-
static void EnableStandbyMode(void);
387386
static void readRecoverySignalFile(void);
388387
static void validateRecoveryParameters(void);
389388
static bool read_backup_label(XLogRecPtr *checkPointLoc,
@@ -468,24 +467,6 @@ XLogRecoveryShmemInit(void)
468467
ConditionVariableInit(&XLogRecoveryCtl->recoveryNotPausedCV);
469468
}
470469

471-
/*
472-
* A thin wrapper to enable StandbyMode and do other preparatory work as
473-
* needed.
474-
*/
475-
static void
476-
EnableStandbyMode(void)
477-
{
478-
StandbyMode = true;
479-
480-
/*
481-
* To avoid server log bloat, we don't report recovery progress in a
482-
* standby as it will always be in recovery unless promoted. We disable
483-
* startup progress timeout in standby mode to avoid calling
484-
* startup_progress_timeout_handler() unnecessarily.
485-
*/
486-
disable_startup_progress_timeout();
487-
}
488-
489470
/*
490471
* Prepare the system for WAL recovery, if needed.
491472
*
@@ -619,7 +600,7 @@ InitWalRecovery(ControlFileData *ControlFile, bool *wasShutdown_ptr,
619600
*/
620601
InArchiveRecovery = true;
621602
if (StandbyModeRequested)
622-
EnableStandbyMode();
603+
StandbyMode = true;
623604

624605
/*
625606
* When a backup_label file is present, we want to roll forward from
@@ -756,7 +737,7 @@ InitWalRecovery(ControlFileData *ControlFile, bool *wasShutdown_ptr,
756737
{
757738
InArchiveRecovery = true;
758739
if (StandbyModeRequested)
759-
EnableStandbyMode();
740+
StandbyMode = true;
760741
}
761742

762743
/* Get the last valid checkpoint record. */
@@ -3134,7 +3115,7 @@ ReadRecord(XLogPrefetcher *xlogprefetcher, int emode,
31343115
(errmsg_internal("reached end of WAL in pg_wal, entering archive recovery")));
31353116
InArchiveRecovery = true;
31363117
if (StandbyModeRequested)
3137-
EnableStandbyMode();
3118+
StandbyMode = true;
31383119

31393120
SwitchIntoArchiveRecovery(xlogreader->EndRecPtr, replayTLI);
31403121
minRecoveryPoint = xlogreader->EndRecPtr;

src/backend/postmaster/startup.c

Lines changed: 3 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -314,51 +314,27 @@ startup_progress_timeout_handler(void)
314314
startup_progress_timer_expired = true;
315315
}
316316

317-
void
318-
disable_startup_progress_timeout(void)
319-
{
320-
/* Feature is disabled. */
321-
if (log_startup_progress_interval == 0)
322-
return;
323-
324-
disable_timeout(STARTUP_PROGRESS_TIMEOUT, false);
325-
startup_progress_timer_expired = false;
326-
}
327-
328317
/*
329318
* Set the start timestamp of the current operation and enable the timeout.
330319
*/
331320
void
332-
enable_startup_progress_timeout(void)
321+
begin_startup_progress_phase(void)
333322
{
334323
TimestampTz fin_time;
335324

336325
/* Feature is disabled. */
337326
if (log_startup_progress_interval == 0)
338327
return;
339328

329+
disable_timeout(STARTUP_PROGRESS_TIMEOUT, false);
330+
startup_progress_timer_expired = false;
340331
startup_progress_phase_start_time = GetCurrentTimestamp();
341332
fin_time = TimestampTzPlusMilliseconds(startup_progress_phase_start_time,
342333
log_startup_progress_interval);
343334
enable_timeout_every(STARTUP_PROGRESS_TIMEOUT, fin_time,
344335
log_startup_progress_interval);
345336
}
346337

347-
/*
348-
* A thin wrapper to first disable and then enable the startup progress
349-
* timeout.
350-
*/
351-
void
352-
begin_startup_progress_phase(void)
353-
{
354-
/* Feature is disabled. */
355-
if (log_startup_progress_interval == 0)
356-
return;
357-
358-
disable_startup_progress_timeout();
359-
enable_startup_progress_timeout();
360-
}
361-
362338
/*
363339
* Report whether startup progress timeout has occurred. Reset the timer flag
364340
* if it did, set the elapsed time to the out parameters and return true,

src/include/postmaster/startup.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,6 @@ extern void PostRestoreCommand(void);
3232
extern bool IsPromoteSignaled(void);
3333
extern void ResetPromoteSignaled(void);
3434

35-
extern void enable_startup_progress_timeout(void);
36-
extern void disable_startup_progress_timeout(void);
3735
extern void begin_startup_progress_phase(void);
3836
extern void startup_progress_timeout_handler(void);
3937
extern bool has_startup_progress_timeout_expired(long *secs, int *usecs);

0 commit comments

Comments
 (0)