Re: refactoring relation extension and BufferAlloc(), faster COPY - Mailing list pgsql-hackers

From Alvaro Herrera
Subject Re: refactoring relation extension and BufferAlloc(), faster COPY
Date
Msg-id 20230221163331.7wxvu66kqzktbteb@alvherre.pgsql
Whole thread Raw
In response to Re: refactoring relation extension and BufferAlloc(), faster COPY  (Heikki Linnakangas <hlinnaka@iki.fi>)
Responses Re: refactoring relation extension and BufferAlloc(), faster COPY
Re: refactoring relation extension and BufferAlloc(), faster COPY
List pgsql-hackers
On 2023-Feb-21, Heikki Linnakangas wrote:

> > +static BlockNumber
> > +BulkExtendSharedRelationBuffered(Relation rel,
> > +                                 SMgrRelation smgr,
> > +                                 bool skip_extension_lock,
> > +                                 char relpersistence,
> > +                                 ForkNumber fork, ReadBufferMode mode,
> > +                                 BufferAccessStrategy strategy,
> > +                                 uint32 *num_pages,
> > +                                 uint32 num_locked_pages,
> > +                                 Buffer *buffers)
> 
> Ugh, that's a lot of arguments, some are inputs and some are outputs. I
> don't have any concrete suggestions, but could we simplify this somehow?
> Needs a comment at least.

Yeah, I noticed this too.  I think it would be easy enough to add a new
struct that can be passed as a pointer, which can be stack-allocated
by the caller, and which holds the input arguments that are common to
both functions, as is sensible.

-- 
Álvaro Herrera               48°01'N 7°57'E  —  https://www.EnterpriseDB.com/
"Update: super-fast reaction on the Postgres bugs mailing list. The report
was acknowledged [...], and a fix is under discussion.
The wonders of open-source !"
             https://twitter.com/gunnarmorling/status/1596080409259003906



pgsql-hackers by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: pgbench: using prepared BEGIN statement in a pipeline could cause an error
Next
From: Tom Lane
Date:
Subject: Re: Commitfest Manager