pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Alvaro Herrera <alvherre@alvh.no-ip.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Rework XLogReader callback system
Date: Fri, 08 May 2020 19:53:58 +0000
Message-ID: <E1jX94I-0001nv-GN@gemulon.postgresql.org> (raw)

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@alvh.no-ip.org>
Reviewed-by: Kyotaro Horiguchi <horikyota.ntt@gmail.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(-)



view thread (2+ messages)  latest in thread

Message-ID: <E1jX94I-0001nv-GN@gemulon.postgresql.org>
Permalink:  ../E1jX94I-0001nv-GN@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1jX94I-0001nv-GN@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: alvherre@alvh.no-ip.org
  Subject: Re: pgsql: Rework XLogReader callback system
  In-Reply-To: <E1jX94I-0001nv-GN@gemulon.postgresql.org>
  References: <E1jX94I-0001nv-GN@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox