postgresql/src/backend/access
Robert Haas 4a92a1c3d1 Change ThisTimeLineID from a global variable to a local variable.
StartupXLOG() still has ThisTimeLineID as a local variable, but the
remaining code in xlog.c now needs to the relevant TimeLineID by some
other means. Mostly, this means that we now pass it as a function
parameter to a bunch of functions where we didn't previously.
However, a few cases require special handling:

- In functions that might be called by outside callers who
  wouldn't necessarily know what timeline to specify, we get
  the timeline ID from shared memory. XLogCtl->ThisTimeLineID
  can be used in most cases since recovery is known to have
  completed by the time those functions are called.  In
  xlog_redo(), we can use XLogCtl->replayEndTLI.

- XLogFileClose() needs to know the TLI of the open logfile.
  Do that with a new global variable openLogTLI. While
  someone could argue that this is just trading one global
  variable for another, the new one has a far more narrow
  purposes and is referenced in just a few places.

- read_backup_label() now returns the TLI that it obtains
  by parsing the backup_label file. Previously, ReadRecord()
  could be called to parse the checkpoint record without
  ThisTimeLineID having been initialized. Now, the timeline
  is passed down, and I didn't want to pass an uninitialized
  variable; this change lets us avoid that. The old coding
  didn't seem to have any practical consequences that we need
  to worry about, but this is cleaner.

- In BootstrapXLOG(), it's just a constant.

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:53:15 -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 Change ThisTimeLineID from a global variable to a local variable. 2021-11-05 12:53:15 -04:00
Makefile Introduce access/{table.h, relation.h}, for generic functions from heapam.h. 2019-01-21 10:51:36 -08:00