Rework WAL-reading supporting structs
The state-tracking of WAL reading in various places was pretty messy,
mostly because the ancient physical-replication WAL reading code wasn't
using the XLogReader abstraction. This led to some untidy code. Make
it prettier by creating two additional supporting structs,
WALSegmentContext and WALOpenSegment which keep track of WAL-reading
state. This makes code cleaner, as well as supports more future
cleanup.
Author: Antonin Houska
Reviewed-by: Álvaro Herrera and (older versions) Robert Haas
Discussion: https://postgr.es/m/14984.1554998742@spoje.net
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/709d003fbd98b975a4fbcb4c5750fa6efaf9ad87
Modified Files
--------------
src/backend/access/transam/twophase.c | 5 +-
src/backend/access/transam/xlog.c | 17 +++--
src/backend/access/transam/xlogreader.c | 73 +++++++++++-------
src/backend/access/transam/xlogutils.c | 30 ++++----
src/backend/replication/logical/logical.c | 2 +-
src/backend/replication/logical/logicalfuncs.c | 4 +-
src/backend/replication/walsender.c | 102 ++++++++++++-------------
src/bin/pg_rewind/parsexlog.c | 21 ++---
src/bin/pg_waldump/pg_waldump.c | 68 +++++++----------
src/include/access/xlogreader.h | 41 ++++++----
src/include/access/xlogutils.h | 3 +-
src/include/replication/logicalfuncs.h | 2 +-
12 files changed, 189 insertions(+), 179 deletions(-)