Re: refactoring relation extension and BufferAlloc(), faster COPY

From: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
To: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>
Cc: Andres Freund <andres(at)anarazel(dot)de>, vignesh C <vignesh21(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org, Thomas Munro <thomas(dot)munro(at)gmail(dot)com>, Melanie Plageman <melanieplageman(at)gmail(dot)com>, Yura Sokolov <y(dot)sokolov(at)postgrespro(dot)ru>, Robert Haas <robertmhaas(at)gmail(dot)com>
Subject: Re: refactoring relation extension and BufferAlloc(), faster COPY
Date: 2023-02-21 16:33:31
Message-ID: 20230221163331.7wxvu66kqzktbteb@alvherre.pgsql
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2023-02-21 17:29:17 Re: Commitfest Manager
Previous Message Alvaro Herrera 2023-02-21 16:32:49 Re: pgbench: using prepared BEGIN statement in a pipeline could cause an error