pg13: xlogreader API adjust

From: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
To: Pg Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Cc: Antonin Houska <ah(at)cybertec(dot)at>, Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>, Andres Freund <andres(at)anarazel(dot)de>
Subject: pg13: xlogreader API adjust
Date: 2020-05-11 20:33:36
Message-ID: 20200511203336.GA9913@alvherre.pgsql
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello

Per discussion in thread [1], I propose the following patch to give
another adjustment to the xlogreader API. This results in a small but
not insignificat net reduction of lines of code. What this patch does
is adjust the signature of these new xlogreader callbacks, making the
API simpler. The changes are:

* the segment_open callback installs the FD in xlogreader state itself,
instead of passing the FD back. This was suggested by Kyotaro
Horiguchi in that thread[2].

* We no longer pass segcxt to segment_open; it's in XLogReaderState,
which is already an argument.

* We no longer pass seg/segcxt to WALRead; instead, that function takes
them from XLogReaderState, which is already an argument.
(This means XLogSendPhysical has to drink more of the fake_xlogreader
kool-aid.)

I claim the reason to do it now instead of pg14 is to make it simpler
for third-party xlogreader callers to adjust.

(Some might be thinking that I do this to avoid an API change later, but
my guts tell me that we'll adjust xlogreader again in pg14 for the
encryption stuff and other reasons, so.)

[1] https://postgr.es/m/20200406025651.fpzdb5yyb7qyhqko@alap3.anarazel.de
[2] https://postgr.es/m/20200508.114228.963995144765118400.horikyota.ntt@gmail.com

--
Álvaro Herrera Developer, https://www.PostgreSQL.org/

Attachment Content-Type Size
xlogreader-api-adjust.patch text/x-diff 11.9 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Gurjeet Singh 2020-05-11 20:42:41 Re: JSON output from psql
Previous Message Antonin Houska 2020-05-11 20:26:23 Re: No core file generated after PostgresNode->start