pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Alvaro Herrera <alvherre@2ndquadrant.com>
To: Antonin Houska <ah@cybertec.at>
Cc: Andres Freund <andres@anarazel.de>
Cc: Michael Paquier <michael@paquier.xyz>
Cc: pgsql-hackers@postgresql.org
Subject: Re: 2pc leaks fds
Date: Wed, 22 Apr 2020 13:57:54 -0400
Message-ID: <20200422175754.GA19858@alvherre.pgsql> (raw)
In-Reply-To: <20200421235422.GA28667@alvherre.pgsql>

Concretely, I propose to have a new struct like

typedef struct xlogReaderFuncs
{
	XLogPageReadCB read_page;
	XLogSegmentOpenCB open_segment;
	XLogSegmentCloseCB open_segment;
} xlogReaderFuncs;

#define XLOGREADER_FUNCS(...) &(xlogReaderFuncs){__VA_ARGS__}

and then invoke it something like

    xlogreader = XLogReaderAllocate(wal_segment_size, NULL,
                                    XLOGREADER_FUNCS(.readpage = &read_local_xlog_page,
                                              .opensegment = &wal_segment_open),
                                              .closesegment = &wal_segment_close),
                                    NULL);

(with suitable definitions for XLogSegmentOpenCB etc) so that the
support functions are all available at the xlogreader level, instead of
"open" being buried at the read-page level.  Any additional support
functions can be added easily.

This would give xlogreader a simpler interface.

If people like this, I could make this change for pg13 and avoid
changing the API again in pg14.

Thougths?

-- 
Álvaro Herrera                https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services





view thread (23+ messages)  latest in thread

Message-ID: <20200422175754.GA19858@alvherre.pgsql>
Permalink:  ../20200422175754.GA19858@alvherre.pgsql/
Also on:    postgresql.org/message-id/20200422175754.GA19858@alvherre.pgsql

 · 

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 using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: alvherre@2ndquadrant.com, ah@cybertec.at, andres@anarazel.de, michael@paquier.xyz
  Subject: Re: 2pc leaks fds
  In-Reply-To: <20200422175754.GA19858@alvherre.pgsql>

* 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