postgresql/src
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
..
backend Remove all use of ThisTimeLineID global variable outside of xlog.c 2021-11-05 12:50:01 -04:00
bin Introduce 'bbstreamer' abstraction to modularize pg_basebackup. 2021-11-05 10:26:18 -04:00
common Fix memory leak in pg_hmac 2021-10-01 22:47:05 +02:00
fe_utils Replace unicode characters in comments with ascii 2021-11-01 22:42:49 +01:00
include Remove all use of ThisTimeLineID global variable outside of xlog.c 2021-11-05 12:50:01 -04:00
interfaces Fix check for trapping exit() calls in libpq 2021-10-04 21:04:11 +02:00
makefiles Add NO_INSTALL option to pgxs 2021-05-27 13:58:29 +02:00
pl plpgsql: report proper line number for errors in variable initialization. 2021-10-31 12:43:47 -04:00
port Speed up printing of integers in snprintf.c. 2021-10-28 13:39:57 -04:00
template Further tweaking of PG_SYSROOT heuristics for macOS. 2021-01-20 12:07:23 -05:00
test Update alternative expected output file. 2021-11-03 19:38:17 +02:00
timezone Update time zone data files to tzdata release 2021e. 2021-10-29 11:38:18 -04:00
tools pgcrypto: Remove non-OpenSSL support 2021-11-05 14:06:59 +01:00
tutorial doc: Prefer explicit JOIN syntax over old implicit syntax in tutorial 2021-04-08 10:51:26 +02:00
.gitignore
DEVELOPERS
Makefile Remove the option to build thread_test.c outside configure. 2020-10-21 12:08:48 -04:00
Makefile.global.in Add support for LZ4 compression in pg_receivewal 2021-11-05 11:33:25 +09:00
Makefile.shlib AIX: Fix missing libpq symbols by respecting SHLIB_EXPORTS. 2021-09-06 11:27:59 -07:00
nls-global.mk Add errhint_plural() function and make use of it 2021-03-31 09:16:25 +02:00