Further simplify a bit of logic in StartupXLOG().
authorThomas Munro <tmunro@postgresql.org>
Tue, 3 Aug 2021 02:11:55 +0000 (14:11 +1200)
committerThomas Munro <tmunro@postgresql.org>
Tue, 3 Aug 2021 02:16:58 +0000 (14:16 +1200)
Commit 7ff23c6d277d1d90478a51f0dd81414d343f3850 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

src/backend/access/transam/xlog.c

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