Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitecb01e6

Browse files
committed
Un-revert "Disable STARTUP_PROGRESS_TIMEOUT in standby mode."
This reverts commit1eadfbdand thus reinstates commit98e7234.It's a better time to commit this now that the release is over.Discussion:http://postgr.es/m/3509384.1675878203@sss.pgh.pa.us
1 parent2ee703c commitecb01e6

File tree

3 files changed

+51
-6
lines changed

3 files changed

+51
-6
lines changed

‎src/backend/access/transam/xlogrecovery.c

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

386+
staticvoidEnableStandbyMode(void);
386387
staticvoidreadRecoverySignalFile(void);
387388
staticvoidvalidateRecoveryParameters(void);
388389
staticboolread_backup_label(XLogRecPtr*checkPointLoc,
@@ -467,6 +468,24 @@ XLogRecoveryShmemInit(void)
467468
ConditionVariableInit(&XLogRecoveryCtl->recoveryNotPausedCV);
468469
}
469470

471+
/*
472+
* A thin wrapper to enable StandbyMode and do other preparatory work as
473+
* needed.
474+
*/
475+
staticvoid
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+
470489
/*
471490
* Prepare the system for WAL recovery, if needed.
472491
*
@@ -600,7 +619,7 @@ InitWalRecovery(ControlFileData *ControlFile, bool *wasShutdown_ptr,
600619
*/
601620
InArchiveRecovery= true;
602621
if (StandbyModeRequested)
603-
StandbyMode= true;
622+
EnableStandbyMode();
604623

605624
/*
606625
* When a backup_label file is present, we want to roll forward from
@@ -737,7 +756,7 @@ InitWalRecovery(ControlFileData *ControlFile, bool *wasShutdown_ptr,
737756
{
738757
InArchiveRecovery= true;
739758
if (StandbyModeRequested)
740-
StandbyMode= true;
759+
EnableStandbyMode();
741760
}
742761

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

31203139
SwitchIntoArchiveRecovery(xlogreader->EndRecPtr,replayTLI);
31213140
minRecoveryPoint=xlogreader->EndRecPtr;

‎src/backend/postmaster/startup.c

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -314,27 +314,51 @@ 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+
317328
/*
318329
* Set the start timestamp of the current operation and enable the timeout.
319330
*/
320331
void
321-
begin_startup_progress_phase(void)
332+
enable_startup_progress_timeout(void)
322333
{
323334
TimestampTzfin_time;
324335

325336
/* Feature is disabled. */
326337
if (log_startup_progress_interval==0)
327338
return;
328339

329-
disable_timeout(STARTUP_PROGRESS_TIMEOUT, false);
330-
startup_progress_timer_expired= false;
331340
startup_progress_phase_start_time=GetCurrentTimestamp();
332341
fin_time=TimestampTzPlusMilliseconds(startup_progress_phase_start_time,
333342
log_startup_progress_interval);
334343
enable_timeout_every(STARTUP_PROGRESS_TIMEOUT,fin_time,
335344
log_startup_progress_interval);
336345
}
337346

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+
338362
/*
339363
* Report whether startup progress timeout has occurred. Reset the timer flag
340364
* if it did, set the elapsed time to the out parameters and return true,

‎src/include/postmaster/startup.h

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

35+
externvoidenable_startup_progress_timeout(void);
36+
externvoiddisable_startup_progress_timeout(void);
3537
externvoidbegin_startup_progress_phase(void);
3638
externvoidstartup_progress_timeout_handler(void);
3739
externboolhas_startup_progress_timeout_expired(long*secs,int*usecs);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp