Re: 2pc leaks fds - Mailing list pgsql-hackers

From Alvaro Herrera
Subject Re: 2pc leaks fds
Date
Msg-id 20200422190738.GA22207@alvherre.pgsql
Whole thread Raw
In response to Re: 2pc leaks fds  (Andres Freund <andres@anarazel.de>)
List 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



pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: design for parallel backup
Next
From: Corey Huinker
Date:
Subject: Re: More efficient RI checks - take 2