Re: 2pc leaks fds

From: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
To: Antonin Houska <ah(at)cybertec(dot)at>
Cc: Andres Freund <andres(at)anarazel(dot)de>, Michael Paquier <michael(at)paquier(dot)xyz>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: 2pc leaks fds
Date: 2020-04-22 17:57:54
Message-ID: 20200422175754.GA19858@alvherre.pgsql
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2020-04-22 18:06:29 Re: Do we need to handle orphaned prepared transactions in the server?
Previous Message Robert Haas 2020-04-22 17:46:22 Re: More efficient RI checks - take 2