Re: 2pc leaks fds

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

On 2020-Apr-22, Andres Freund wrote:

> On 2020-04-22 13:57:54 -0400, Alvaro Herrera wrote:
> > 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__}
>
> Not sure I quite see the point of that helper macro...

Avoid the ugly cast -- same discussion we had for ARCHIVE_OPTS in
pg_dump code in commit f831d4accda0.

> ISTM that we should:
> - have the three callbacks you mention above
> - change WALSegmentOpen to also get the XLogReaderState
> - add private state to WALOpenSegment, so it can be used even when not
> accessing data in files / when one needs more information to close the
> file.
> - disambiguate between WALOpenSegment (struct describing an open
> segment) and WALSegmentOpen (callback to open a segment) (note that
> the read page callback uses a *CB naming, why not follow?)

Sounds good.

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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Corey Huinker 2020-04-22 19:13:19 Re: More efficient RI checks - take 2
Previous Message Andres Freund 2020-04-22 19:03:24 Re: design for parallel backup