pgsql: Rework WAL-reading supporting structs

From: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Rework WAL-reading supporting structs
Date: 2019-09-24 19:46:52
Message-ID: E1iCqlw-0006U7-4b@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

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(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Alexander Korotkov 2019-09-24 22:56:02 pgsql: Fix bug in pairingheap_SpGistSearchItem_cmp()
Previous Message Tom Lane 2019-09-24 16:11:39 pgsql: Prevent bogus pullup of constant-valued functions returning comp