xlog.c: Use XLogCtl->ThisTimeLineID in various places.
authorRobert Haas <rhaas@postgresql.org>
Mon, 1 Nov 2021 15:42:55 +0000 (11:42 -0400)
committerRobert Haas <rhaas@postgresql.org>
Mon, 1 Nov 2021 16:45:31 +0000 (12:45 -0400)
commite5910978a754b3bfa9d2905584cc81a0cfb82cd8
tree6029e28d5b9757361b32921c6a3a6897edbfebdb
parentf905cfd9d2ee9962038ed00435eef47b0ced144c
xlog.c: Use XLogCtl->ThisTimeLineID in various places.

Where appropriate, instead of using ThisTimeLineID, use the value
from shared memory instead, to reduce dependencies on the global
variable. This is only safe after recovery is complete, because
prior to that, the global variable and the shared state don't
match.

This allows removal of some ugly logic in CreatRestartPoint() to
temporarily set ThisTimeLineID for purposes of tricking
RemoveOldXlogFiles and PreallocXlogFiles into doing the right thing,
and then clearing it again afterwards.
src/backend/access/transam/xlog.c