pg13: xlogreader API adjust
Alvaro Herrera <alvherre@2ndquadrant.com>
From: Alvaro Herrera <alvherre@2ndquadrant.com>
To: Pg Hackers <pgsql-hackers@lists.postgresql.org>
Cc: Antonin Houska <ah@cybertec.at>, Kyotaro Horiguchi <horikyota.ntt@gmail.com>, Andres Freund <andres@anarazel.de>
Date: 2020-05-11T20:33:36Z
Lists: pgsql-hackers
Attachments
- xlogreader-api-adjust.patch (text/x-diff) patch
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/
Commits
-
Fix walsender error cleanup code
- 1d3743023ef8 13.0 landed
-
Adjust walsender usage of xlogreader, simplify APIs
- 850196b610d2 13.0 landed