mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-12-27 08:39:28 +08:00
Don't set ThisTimeLineID in checkpointer & bgwriter during recovery.
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.
This commit is contained in:
parent
345fb82f16
commit
1a11d4609e
@ -2901,7 +2901,12 @@ RemoveOldXlogFiles(XLogSegNo segno, XLogRecPtr endptr)
|
||||
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);
|
||||
|
@ -224,12 +224,6 @@ BackgroundWriterMain(void)
|
||||
*/
|
||||
PG_SETMASK(&UnBlockSig);
|
||||
|
||||
/*
|
||||
* Use the recovery target timeline ID during recovery
|
||||
*/
|
||||
if (RecoveryInProgress())
|
||||
ThisTimeLineID = GetRecoveryTargetTLI();
|
||||
|
||||
/*
|
||||
* Reset hibernation state after any error.
|
||||
*/
|
||||
|
@ -346,12 +346,6 @@ CheckpointerMain(void)
|
||||
*/
|
||||
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.
|
||||
|
Loading…
Reference in New Issue
Block a user