postgresql/src/backend/access
Robert Haas e997a0c642 Remove all use of ThisTimeLineID global variable outside of xlog.c
All such code deals with this global variable in one of three ways.
Sometimes the same functions use it in more than one of these ways
at the same time.

First, sometimes it's an implicit argument to one or more functions
being called in xlog.c or elsewhere, and must be set to the
appropriate value before calling those functions lest they
misbehave. In those cases, it is now passed as an explicit argument
instead.

Second, sometimes it's used to obtain the current timeline after
the end of recovery, i.e. the timeline to which WAL is being
written and flushed. Such code now calls GetWALInsertionTimeLine()
or relies on the new out parameter added to GetFlushRecPtr().

Third, sometimes it's used during recovery to store the current
replay timeline. That can change, so such code must generally
update the value before each use. It can still do that, but must
now use a local variable instead.

The net effect of these changes is to reduce by a fair amount the
amount of code that is directly accessing this global variable.
That's good, because history has shown that we don't always think
clearly about which timeline ID it's supposed to contain at any
given point in time, or indeed, whether it has been or needs to
be initialized at any given point in the code.

Patch by me, reviewed and tested by Michael Paquier, Amul Sul, and
Álvaro Herrera.

Discussion: https://postgr.es/m/CA+TgmobfAAqhfWa1kaFBBFvX+5CjM=7TE=n4r4Q1o2bjbGYBpA@mail.gmail.com
2021-11-05 12:50:01 -04:00
..
brin Replace unicode characters in comments with ascii 2021-11-01 22:42:49 +01:00
common Revert analyze support for partitioned tables 2021-08-16 17:27:52 -04:00
gin Clean up some code using "(expr) ? true : false" 2021-09-08 09:44:04 +09:00
gist Clean up more code using "(expr) ? true : false" 2021-10-11 09:36:42 +09:00
hash Clean up some code using "(expr) ? true : false" 2021-09-08 09:44:04 +09:00
heap Add hardening to catch invalid TIDs in indexes. 2021-11-04 19:54:05 -07:00
index Add hardening to catch invalid TIDs in indexes. 2021-11-04 19:54:05 -07:00
nbtree Add hardening to catch invalid TIDs in indexes. 2021-11-04 19:54:05 -07:00
rmgrdesc Fix WAL replay in presence of an incomplete record 2021-09-29 11:21:51 -03:00
spgist Count SP-GiST index scans in pg_stat statistics. 2021-08-27 19:53:05 -04:00
table Replace RelationOpenSmgr() with RelationGetSmgr(). 2021-07-12 17:01:36 -04:00
tablesample Update copyright for 2021 2021-01-02 13:06:25 -05:00
transam Remove all use of ThisTimeLineID global variable outside of xlog.c 2021-11-05 12:50:01 -04:00
Makefile Introduce access/{table.h, relation.h}, for generic functions from heapam.h. 2019-01-21 10:51:36 -08:00