diff options
author | Robert Haas <rhaas@postgresql.org> | 2021-11-05 12:50:01 -0400 |
---|---|---|
committer | Robert Haas <rhaas@postgresql.org> | 2021-11-05 12:50:01 -0400 |
commit | e997a0c642860a96df0151cbeccfecbdf0450d08 (patch) | |
tree | c869dbcbe3a67ddc6a7c2ad5cd0029bc1af0c233 /src/include/access/xlogutils.h | |
parent | caf1f675b88d1aa67ea3fb642e8f38b470cc911e (diff) | |
download | postgresql-e997a0c642860a96df0151cbeccfecbdf0450d08.tar.gz postgresql-e997a0c642860a96df0151cbeccfecbdf0450d08.zip |
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
Diffstat (limited to 'src/include/access/xlogutils.h')
-rw-r--r-- | src/include/access/xlogutils.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/include/access/xlogutils.h b/src/include/access/xlogutils.h index a5cb3d322c5..eebc91f3a50 100644 --- a/src/include/access/xlogutils.h +++ b/src/include/access/xlogutils.h @@ -98,7 +98,9 @@ extern void wal_segment_open(XLogReaderState *state, extern void wal_segment_close(XLogReaderState *state); extern void XLogReadDetermineTimeline(XLogReaderState *state, - XLogRecPtr wantPage, uint32 wantLength); + XLogRecPtr wantPage, + uint32 wantLength, + TimeLineID currTLI); extern void WALReadRaiseError(WALReadError *errinfo); |