diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 7f4f784c0e..0ae699cfd3 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -6361,14 +6361,13 @@ StartupXLOG(void) else ereport(LOG, (errmsg("starting archive recovery"))); - } - - /* - * Take ownership of the wakeup latch if we're going to sleep during - * recovery. - */ - if (ArchiveRecoveryRequested) + + /* + * Take ownership of the wakeup latch if we're going to sleep during + * recovery. + */ OwnLatch(&XLogCtl->recoveryWakeupLatch); + } /* Set up XLOG reader facility */ MemSet(&private, 0, sizeof(XLogPageReadPrivate)); @@ -7251,7 +7250,7 @@ StartupXLOG(void) * Wake up any walsenders to notice that we are on a new * timeline. */ - if (switchedTLI && AllowCascadeReplication()) + if (AllowCascadeReplication()) WalSndWakeup(); } @@ -9354,7 +9353,7 @@ KeepLogSeg(XLogRecPtr recptr, XLogSegNo *logSegNo) XLByteToSeg(keep, slotSegNo, wal_segment_size); - if (slotSegNo <= 0) + if (slotSegNo == 0) segno = 1; else if (slotSegNo < segno) segno = slotSegNo;