pgsql: Rework XLogReader callback system

From: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Rework XLogReader callback system
Date: 2020-05-08 19:53:58
Message-ID: E1jX94I-0001nv-GN@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Rework XLogReader callback system

Code review for 0dc8ead46363, prompted by a bug closed by 91c40548d5f7.

XLogReader's system for opening and closing segments had gotten too
complicated, with callbacks being passed at both the XLogReaderAllocate
level (read_page) as well as at the WALRead level (segment_open). This
was confusing and hard to follow, so restructure things so that these
callbacks are passed together at XLogReaderAllocate time, and add
another callback to the set (segment_close) to make it a coherent whole.
Also, ensure XLogReaderState is an argument to all the callbacks, so
that they can grab at the ->private data if necessary.

Document the whole arrangement more clearly.

Author: Álvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
Reviewed-by: Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>
Discussion: https://postgr.es/m/20200422175754.GA19858@alvherre.pgsql

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/b060dbe0001a1d6bf26cd294710f3cb203868d46

Modified Files
--------------
src/backend/access/transam/twophase.c | 5 +-
src/backend/access/transam/xlog.c | 10 ++-
src/backend/access/transam/xlogreader.c | 51 ++++++-----
src/backend/access/transam/xlogutils.c | 24 +++--
src/backend/replication/logical/logical.c | 20 +++--
src/backend/replication/logical/logicalfuncs.c | 4 +-
src/backend/replication/slotfuncs.c | 10 ++-
src/backend/replication/walsender.c | 36 +++++---
src/bin/pg_rewind/parsexlog.c | 9 +-
src/bin/pg_waldump/pg_waldump.c | 30 +++++--
src/include/access/xlogreader.h | 119 ++++++++++++++++---------
src/include/access/xlogutils.h | 5 ++
src/include/replication/logical.h | 4 +-
13 files changed, 214 insertions(+), 113 deletions(-)

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2020-05-08 20:40:35 pgsql: First-draft release notes for 12.3.
Previous Message Peter Eisentraut 2020-05-08 18:44:30 pgsql: Improve use of prepositions in messages