pg13: xlogreader API adjust - Mailing list pgsql-hackers

From Alvaro Herrera
Subject pg13: xlogreader API adjust
Date
Msg-id 20200511203336.GA9913@alvherre.pgsql
Whole thread Raw
Responses Re: pg13: xlogreader API adjust
List 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

pgsql-hackers by date:

Previous
From: Antonin Houska
Date:
Subject: Re: No core file generated after PostgresNode->start
Next
From: Gurjeet Singh
Date:
Subject: Re: JSON output from psql