Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 8f7c8e2

Browse files
committed
Further simplify a bit of logic in StartupXLOG().
Commit 7ff23c6 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
1 parent db632fb commit 8f7c8e2

File tree

1 file changed

+14
-20
lines changed
  • src/backend/access/transam

1 file changed

+14
-20
lines changed

src/backend/access/transam/xlog.c

Lines changed: 14 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -7890,28 +7890,22 @@ StartupXLOG(void)
78907890
* after we're fully out of recovery mode and already accepting
78917891
* queries.
78927892
*/
7893-
if (ArchiveRecoveryRequested && IsUnderPostmaster)
7893+
if (ArchiveRecoveryRequested && IsUnderPostmaster &&
7894+
LocalPromoteIsTriggered)
78947895
{
7895-
if (LocalPromoteIsTriggered)
7896-
{
7897-
promoted = true;
7896+
promoted = true;
78987897

7899-
/*
7900-
* Insert a special WAL record to mark the end of recovery,
7901-
* since we aren't doing a checkpoint. That means that the
7902-
* checkpointer process may likely be in the middle of a
7903-
* time-smoothed restartpoint and could continue to be for
7904-
* minutes after this. That sounds strange, but the effect is
7905-
* roughly the same and it would be stranger to try to come
7906-
* out of the restartpoint and then checkpoint. We request a
7907-
* checkpoint later anyway, just for safety.
7908-
*/
7909-
CreateEndOfRecoveryRecord();
7910-
}
7911-
else
7912-
RequestCheckpoint(CHECKPOINT_END_OF_RECOVERY |
7913-
CHECKPOINT_IMMEDIATE |
7914-
CHECKPOINT_WAIT);
7898+
/*
7899+
* Insert a special WAL record to mark the end of recovery, since
7900+
* we aren't doing a checkpoint. That means that the checkpointer
7901+
* process may likely be in the middle of a time-smoothed
7902+
* restartpoint and could continue to be for minutes after this.
7903+
* That sounds strange, but the effect is roughly the same and it
7904+
* would be stranger to try to come out of the restartpoint and
7905+
* then checkpoint. We request a checkpoint later anyway, just for
7906+
* safety.
7907+
*/
7908+
CreateEndOfRecoveryRecord();
79157909
}
79167910
else
79177911
{

0 commit comments

Comments
 (0)