Fix bogus log message when starting from a cleanly shut down state.
In commit 70e81861fa to split xlog.c, I moved the startup code that updates the state in the control file and prints out the "database system was not properly shut down" message to the log, but I accidentally removed the "if (InRecovery)" check around it. As a result, that message was printed even if the system was cleanly shut down, also during 'initdb'. Discussion: https://www.postgresql.org/message-id/3357075.1645031062@sss.pgh.pa.us
This commit is contained in:
parent
01ad1c9530
commit
4620892344
@ -840,11 +840,16 @@ InitWalRecovery(ControlFileData *ControlFile, bool *wasShutdown_ptr,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Update pg_control to show that we are recovering and to show the
|
* If recovery is needed, update our in-memory copy of pg_control to show
|
||||||
* selected checkpoint as the place we are starting from. We also mark
|
* that we are recovering and to show the selected checkpoint as the place
|
||||||
* pg_control with any minimum recovery stop point obtained from a backup
|
* we are starting from. We also mark pg_control with any minimum recovery
|
||||||
* history file.
|
* stop point obtained from a backup history file.
|
||||||
|
*
|
||||||
|
* We don't write the changes to disk yet, though. Only do that after
|
||||||
|
* initializing various subsystems.
|
||||||
*/
|
*/
|
||||||
|
if (InRecovery)
|
||||||
|
{
|
||||||
if (InArchiveRecovery)
|
if (InArchiveRecovery)
|
||||||
{
|
{
|
||||||
ControlFile->state = DB_IN_ARCHIVE_RECOVERY;
|
ControlFile->state = DB_IN_ARCHIVE_RECOVERY;
|
||||||
@ -878,16 +883,16 @@ InitWalRecovery(ControlFileData *ControlFile, bool *wasShutdown_ptr,
|
|||||||
* Set backupStartPoint if we're starting recovery from a base backup.
|
* Set backupStartPoint if we're starting recovery from a base backup.
|
||||||
*
|
*
|
||||||
* Also set backupEndPoint and use minRecoveryPoint as the backup end
|
* Also set backupEndPoint and use minRecoveryPoint as the backup end
|
||||||
* location if we're starting recovery from a base backup which was taken
|
* location if we're starting recovery from a base backup which was
|
||||||
* from a standby. In this case, the database system status in pg_control
|
* taken from a standby. In this case, the database system status in
|
||||||
* must indicate that the database was already in recovery. Usually that
|
* pg_control must indicate that the database was already in recovery.
|
||||||
* will be DB_IN_ARCHIVE_RECOVERY but also can be
|
* Usually that will be DB_IN_ARCHIVE_RECOVERY but also can be
|
||||||
* DB_SHUTDOWNED_IN_RECOVERY if recovery previously was interrupted before
|
* DB_SHUTDOWNED_IN_RECOVERY if recovery previously was interrupted
|
||||||
* reaching this point; e.g. because restore_command or primary_conninfo
|
* before reaching this point; e.g. because restore_command or
|
||||||
* were faulty.
|
* primary_conninfo were faulty.
|
||||||
*
|
*
|
||||||
* Any other state indicates that the backup somehow became corrupted and
|
* Any other state indicates that the backup somehow became corrupted
|
||||||
* we can't sensibly continue with recovery.
|
* and we can't sensibly continue with recovery.
|
||||||
*/
|
*/
|
||||||
if (haveBackupLabel)
|
if (haveBackupLabel)
|
||||||
{
|
{
|
||||||
@ -905,6 +910,7 @@ InitWalRecovery(ControlFileData *ControlFile, bool *wasShutdown_ptr,
|
|||||||
ControlFile->backupEndPoint = ControlFile->minRecoveryPoint;
|
ControlFile->backupEndPoint = ControlFile->minRecoveryPoint;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* remember these, so that we know when we have reached consistency */
|
/* remember these, so that we know when we have reached consistency */
|
||||||
backupStartPoint = ControlFile->backupStartPoint;
|
backupStartPoint = ControlFile->backupStartPoint;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user