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

Commit20961ce

Browse files
committed
Make crash recovery ignore restore_command and recovery_end_command settings.
In v11 or before, those settings could not take effect in crash recoverybecause they are specified in recovery.conf and crash recovery alwaysstarts without recovery.conf. But commit2dedf4d integratedrecovery.conf into postgresql.conf and which unexpectedly allowedthose settings to take effect even in crash recovery. This is definitelynot good behavior.To fix the issue, this commit makes crash recovery always ignorerestore_command and recovery_end_command settings.Back-patch to v12 where the issue was added.Author: Fujii MasaoReviewed-by: Peter EisentrautDiscussion:https://postgr.es/m/e445616d-023e-a268-8aa1-67b8b335340c@pgmasters.net
1 parent06a367c commit20961ce

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7610,18 +7610,18 @@ StartupXLOG(void)
76107610
}
76117611
else
76127612
CreateCheckPoint(CHECKPOINT_END_OF_RECOVERY |CHECKPOINT_IMMEDIATE);
7613+
}
76137614

7615+
if (ArchiveRecoveryRequested)
7616+
{
76147617
/*
76157618
* And finally, execute the recovery_end_command, if any.
76167619
*/
76177620
if (recoveryEndCommand&&strcmp(recoveryEndCommand,"")!=0)
76187621
ExecuteRecoveryCommand(recoveryEndCommand,
76197622
"recovery_end_command",
76207623
true);
7621-
}
76227624

7623-
if (ArchiveRecoveryRequested)
7624-
{
76257625
/*
76267626
* We switched to a new timeline. Clean up segments on the old
76277627
* timeline.

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,13 @@ RestoreArchivedFile(char *path, const char *xlogfname,
6464
XLogRecPtrrestartRedoPtr;
6565
TimeLineIDrestartTli;
6666

67+
/*
68+
* Ignore restore_command when not in archive recovery (meaning
69+
* we are in crash recovery).
70+
*/
71+
if (!ArchiveRecoveryRequested)
72+
gotonot_available;
73+
6774
/* In standby mode, restore_command might not be supplied */
6875
if (recoveryRestoreCommand==NULL||strcmp(recoveryRestoreCommand,"")==0)
6976
gotonot_available;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp