1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-28 23:42:10 +03:00

Further simplify a bit of logic in StartupXLOG().

Commit 7ff23c6d27 left us with two
identical cases. Collapse them.

Author: Robert Haas <robertmhaas@gmail.com>
Discussion: https://postgr.es/m/CA%2BhUKGJ8NRsqgkZEnsnRc2MFROBV-jCnacbYvtpptK2A9YYp9Q%40mail.gmail.com
This commit is contained in:
Thomas Munro
2021-08-03 14:11:55 +12:00
parent db632fbca3
commit 8f7c8e2bef

View File

@ -7890,28 +7890,22 @@ StartupXLOG(void)
* after we're fully out of recovery mode and already accepting * after we're fully out of recovery mode and already accepting
* queries. * queries.
*/ */
if (ArchiveRecoveryRequested && IsUnderPostmaster) if (ArchiveRecoveryRequested && IsUnderPostmaster &&
LocalPromoteIsTriggered)
{ {
if (LocalPromoteIsTriggered) promoted = true;
{
promoted = true;
/* /*
* Insert a special WAL record to mark the end of recovery, * Insert a special WAL record to mark the end of recovery, since
* since we aren't doing a checkpoint. That means that the * we aren't doing a checkpoint. That means that the checkpointer
* checkpointer process may likely be in the middle of a * process may likely be in the middle of a time-smoothed
* time-smoothed restartpoint and could continue to be for * restartpoint and could continue to be for minutes after this.
* minutes after this. That sounds strange, but the effect is * That sounds strange, but the effect is roughly the same and it
* roughly the same and it would be stranger to try to come * would be stranger to try to come out of the restartpoint and
* out of the restartpoint and then checkpoint. We request a * then checkpoint. We request a checkpoint later anyway, just for
* checkpoint later anyway, just for safety. * safety.
*/ */
CreateEndOfRecoveryRecord(); CreateEndOfRecoveryRecord();
}
else
RequestCheckpoint(CHECKPOINT_END_OF_RECOVERY |
CHECKPOINT_IMMEDIATE |
CHECKPOINT_WAIT);
} }
else else
{ {