Add some functions to get the current TLI.
authorRobert Haas <rhaas@postgresql.org>
Wed, 27 Oct 2021 20:20:46 +0000 (16:20 -0400)
committerRobert Haas <rhaas@postgresql.org>
Thu, 28 Oct 2021 18:55:18 +0000 (14:55 -0400)
commit7cb3ea89563896941681806e70f8b305dd1196dc
tree4f1a78589c798fa6ff6d0a0e48f465dbabc5e4b0
parentf06ced35cd9efd54056516f03b3680976dfa74bd
Add some functions to get the current TLI.

Having lots of code that relies on the ThisTimeLineID global variable
is problematic, but to have any chance of fixing that, we must provide
another way for code outside xlog.c to get the relevant value. This
commit adds a GetCurrentTimeLineID() function for that purpose, and
also modifies GetFlushRecPtr() to return the same value via an output
parameter, since that looks like it will be convenient in some places.

This commit doesn't actually reduce use of ThisTimeLineID at all; it
just provides infrastructure that future commits can choose to use
for that purpose.
src/backend/access/transam/xlog.c
src/backend/access/transam/xlogfuncs.c
src/backend/access/transam/xlogutils.c
src/backend/replication/logical/logicalfuncs.c
src/backend/replication/logical/worker.c
src/backend/replication/slotfuncs.c
src/backend/replication/walsender.c
src/include/access/xlog.h