We used to set it to the current recovery target timeline, but the recovery
target timeline can change during recovery, leaving ThisTimeLineID at an
old value. That seems worse than always leaving it at zero to begin with.
AFAICS there was no good reason to set it in the first place. ThisTimeLineID
is not needed in checkpointer or bgwriter process, until it's time to write
the end-of-recovery checkpoint, and at that point ThisTimeLineID is updated
anyway.
errmsg("could not open transaction log directory \"%s\": %m",
XLOGDIR)));
- XLogFileName(lastoff, ThisTimeLineID, segno);
+ /*
+ * Construct a filename of the last segment to be kept. The timeline ID
+ * doesn't matter, we ignore that in the comparison. (During recovery,
+ * ThisTimeLineID isn't set, so we can't use that.)
+ */
+ XLogFileName(lastoff, 0, segno);
elog(DEBUG2, "attempting to remove WAL segments older than log file %s",
lastoff);
*/
PG_SETMASK(&UnBlockSig);
- /*
- * Use the recovery target timeline ID during recovery
- */
- if (RecoveryInProgress())
- ThisTimeLineID = GetRecoveryTargetTLI();
-
/*
* Reset hibernation state after any error.
*/
*/
PG_SETMASK(&UnBlockSig);
- /*
- * Use the recovery target timeline ID during recovery
- */
- if (RecoveryInProgress())
- ThisTimeLineID = GetRecoveryTargetTLI();
-
/*
* Ensure all shared memory values are set correctly for the config. Doing
* this here ensures no race conditions from other concurrent updaters.