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

Commit1d35f70

Browse files
committed
Add more LOG messages when starting and ending recovery from a backup
Three LOG messages are added in the recovery code paths, providinginformation that can be useful to track corruption issues depending onthe state of the cluster, telling that:- Recovery has started from a backup_label.- Recovery is restarting from a backup start LSN, without abackup_label.- Recovery has completed from a backup.Author: Andres FreundReviewed-by: David Steele, Laurenz Albe, Michael PaquierDiscussion:https://postgr.es/m/20231117041811.vz4vgkthwjnwp2pp@awork3.anarazel.de
1 parentc393308 commit1d35f70

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

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

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -603,6 +603,22 @@ InitWalRecovery(ControlFileData *ControlFile, bool *wasShutdown_ptr,
603603
if (StandbyModeRequested)
604604
EnableStandbyMode();
605605

606+
/*
607+
* Omitting backup_label when creating a new replica, PITR node etc.
608+
* unfortunately is a common cause of corruption. Logging that
609+
* backup_label was used makes it a bit easier to exclude that as the
610+
* cause of observed corruption.
611+
*
612+
* Do so before we try to read the checkpoint record (which can fail),
613+
* as otherwise it can be hard to understand why a checkpoint other
614+
* than ControlFile->checkPoint is used.
615+
*/
616+
ereport(LOG,
617+
(errmsg("starting backup recovery with redo LSN %X/%X, checkpoint LSN %X/%X, on timeline ID %u",
618+
LSN_FORMAT_ARGS(RedoStartLSN),
619+
LSN_FORMAT_ARGS(CheckPointLoc),
620+
CheckPointTLI)));
621+
606622
/*
607623
* When a backup_label file is present, we want to roll forward from
608624
* the checkpoint it identifies, rather than using pg_control.
@@ -742,6 +758,16 @@ InitWalRecovery(ControlFileData *ControlFile, bool *wasShutdown_ptr,
742758
EnableStandbyMode();
743759
}
744760

761+
/*
762+
* For the same reason as when starting up with backup_label present,
763+
* emit a log message when we continue initializing from a base
764+
* backup.
765+
*/
766+
if (!XLogRecPtrIsInvalid(ControlFile->backupStartPoint))
767+
ereport(LOG,
768+
(errmsg("restarting backup recovery with redo LSN %X/%X",
769+
LSN_FORMAT_ARGS(ControlFile->backupStartPoint))));
770+
745771
/* Get the last valid checkpoint record. */
746772
CheckPointLoc=ControlFile->checkPoint;
747773
CheckPointTLI=ControlFile->checkPointCopy.ThisTimeLineID;
@@ -2155,6 +2181,9 @@ CheckRecoveryConsistency(void)
21552181
if (!XLogRecPtrIsInvalid(backupEndPoint)&&
21562182
backupEndPoint <=lastReplayedEndRecPtr)
21572183
{
2184+
XLogRecPtrsaveBackupStartPoint=backupStartPoint;
2185+
XLogRecPtrsaveBackupEndPoint=backupEndPoint;
2186+
21582187
elog(DEBUG1,"end of backup reached");
21592188

21602189
/*
@@ -2165,6 +2194,11 @@ CheckRecoveryConsistency(void)
21652194
backupStartPoint=InvalidXLogRecPtr;
21662195
backupEndPoint=InvalidXLogRecPtr;
21672196
backupEndRequired= false;
2197+
2198+
ereport(LOG,
2199+
(errmsg("completed backup recovery with redo LSN %X/%X and end LSN %X/%X",
2200+
LSN_FORMAT_ARGS(saveBackupStartPoint),
2201+
LSN_FORMAT_ARGS(saveBackupEndPoint))));
21682202
}
21692203

21702204
/*

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp