@@ -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