From: Alvaro Herrera <alvherre@alvh.no-ip.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Adjust walsender usage of xlogreader, simplify APIs
Date: Wed, 13 May 2020 16:25:45 +0000
Message-ID: <E1jYuCX-0003Gd-K0@gemulon.postgresql.org> (raw)
Adjust walsender usage of xlogreader, simplify APIs
* Have both physical and logical walsender share a 'xlogreader' state
struct for tracking state. This replaces the existing globals sendSeg
and sendCxt.
* Change WALRead not to receive XLogReaderState->seg and ->segcxt as
separate arguments anymore; just use the ones from 'state'. This is
made possible by the above change.
* have the XLogReader segment_open contract require the callbacks to
install the file descriptor in the state struct themselves instead of
returning it. xlogreader was already ignoring any possible failed
return from the callbacks, relying solely on them never returning.
(This point is not altogether excellent, as it means the callbacks
have to know more of XLogReaderState; but to really improve on that
we would have to pass back error info from the callbacks to
xlogreader. And the complexity would not be saved but instead just
transferred to the callers of WALRead, which would have to learn how
to throw errors from the open_segment callback in addition of, as
currently, from pg_pread.)
* segment_open no longer receives the 'segcxt' as a separate argument,
since it's part of the XLogReaderState argument.
Per comments from Kyotaro Horiguchi.
Author: Álvaro Herrera <alvherre@alvh.no-ip.org>
Discussion: https://postgr.es/m/20200511203336.GA9913@alvherre.pgsql
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/850196b610d2a1802b4ed7f9f608153a949eda34
Modified Files
--------------
src/backend/access/transam/xlogreader.c | 35 ++++++------
src/backend/access/transam/xlogutils.c | 16 ++----
src/backend/replication/walsender.c | 98 ++++++++++++++++-----------------
src/bin/pg_waldump/pg_waldump.c | 16 ++----
src/include/access/xlogreader.h | 20 ++-----
src/include/access/xlogutils.h | 3 +-
6 files changed, 83 insertions(+), 105 deletions(-)
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: Adjust walsender usage of xlogreader, simplify APIs
In-Reply-To: <E1jYuCX-0003Gd-K0@gemulon.postgresql.org>
References: <E1jYuCX-0003Gd-K0@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