pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Don't initialize page in {vm,fsm}_extend(), not needed
5+ messages / 3 participants
[nested] [flat]

Commits from this thread:
  2023-04-06 fcdda1e4b5  Use ExtendBufferedRelTo() in {vm,fsm}_extend()
* pgsql: Don't initialize page in {vm,fsm}_extend(), not needed
@ 2023-04-05 16:21  Andres Freund <andres@anarazel.de>
  0 siblings, 1 reply; 5+ messages in thread

From: Andres Freund @ 2023-04-05 16:21 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Don't initialize page in {vm,fsm}_extend(), not needed

The read path needs to be able to initialize pages anyway, as relation
extensions are not durable. By avoiding initializing pages, we can, in a
future patch, extend the relation by multiple blocks at once.

Using smgrextend() for {vm,fsm}_extend() is not a good idea in general, as at
least one page of the VM/FSM will be read immediately after, always causing a
cache miss, requiring us to read content we just wrote.

Discussion: https://postgr.es/m/20230301223515.pucbj7nb54n4i4nv@awork3.anarazel.de

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/3d6a98457d8e21d85bed86cfd3e1d1df1b260721

Modified Files
--------------
src/backend/access/heap/visibilitymap.c   | 6 +-----
src/backend/storage/freespace/freespace.c | 5 +----
2 files changed, 2 insertions(+), 9 deletions(-)



^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: pgsql: Don't initialize page in {vm,fsm}_extend(), not needed
@ 2023-04-05 23:19  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Andres Freund <andres@anarazel.de>
  0 siblings, 2 replies; 5+ messages in thread

From: Tom Lane @ 2023-04-05 23:19 UTC (permalink / raw)
  To: Andres Freund <andres@anarazel.de>; +Cc: pgsql-committers@lists.postgresql.org

Andres Freund <andres@anarazel.de> writes:
> Don't initialize page in {vm,fsm}_extend(), not needed

Various buildfarm members are complaining about under-braced
initializations added by this commit.

visibilitymap.c: In function \342\200\230vm_extend\342\200\231:
visibilitymap.c:625:2: warning: missing braces around initializer [-Wmissing-braces]
  PGAlignedBlock pg = {0};
  ^
visibilitymap.c:625:2: warning: (near initialization for \342\200\230pg.data\342\200\231) [-Wmissing-braces]

freespace.c: In function \342\200\230fsm_extend\342\200\231:
freespace.c:611:2: warning: missing braces around initializer [-Wmissing-braces]
  PGAlignedBlock pg = {0};
  ^
freespace.c:611:2: warning: (near initialization for \342\200\230pg.data\342\200\231) [-Wmissing-braces]

This is from buri, similar from curculio, dragonet, idiacanthus,
xenodermus, etc

			regards, tom lane





^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: pgsql: Don't initialize page in {vm,fsm}_extend(), not needed
@ 2023-04-05 23:34  Michael Paquier <michael@paquier.xyz>
  parent: Tom Lane <tgl@sss.pgh.pa.us>
  1 sibling, 0 replies; 5+ messages in thread

From: Michael Paquier @ 2023-04-05 23:34 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Andres Freund <andres@anarazel.de>; pgsql-committers@lists.postgresql.org

On Wed, Apr 05, 2023 at 07:19:48PM -0400, Tom Lane wrote:
> freespace.c: In function \342\200\230fsm_extend\342\200\231:
> freespace.c:611:2: warning: missing braces around initializer [-Wmissing-braces]
>   PGAlignedBlock pg = {0};
>   ^
> freespace.c:611:2: warning: (near initialization for \342\200\230pg.data\342\200\231) [-Wmissing-braces]
> 
> This is from buri, similar from curculio, dragonet, idiacanthus,
> xenodermus, etc

That's the same as d937904, it seems, requiring a {{0}}.
--
Michael

Attachments:

  signature.asc (application/pgp-signature, 832B) download

^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: pgsql: Don't initialize page in {vm,fsm}_extend(), not needed
@ 2023-04-05 23:58  Andres Freund <andres@anarazel.de>
  parent: Tom Lane <tgl@sss.pgh.pa.us>
  1 sibling, 1 reply; 5+ messages in thread

From: Andres Freund @ 2023-04-05 23:58 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-committers@lists.postgresql.org

Hi,

On 2023-04-05 19:19:48 -0400, Tom Lane wrote:
> Andres Freund <andres@anarazel.de> writes:
> > Don't initialize page in {vm,fsm}_extend(), not needed
> 
> Various buildfarm members are complaining about under-braced
> initializations added by this commit.
> 
> visibilitymap.c: In function \342\200\230vm_extend\342\200\231:
> visibilitymap.c:625:2: warning: missing braces around initializer [-Wmissing-braces]
>   PGAlignedBlock pg = {0};
>   ^
> visibilitymap.c:625:2: warning: (near initialization for \342\200\230pg.data\342\200\231) [-Wmissing-braces]
> 
> freespace.c: In function \342\200\230fsm_extend\342\200\231:
> freespace.c:611:2: warning: missing braces around initializer [-Wmissing-braces]
>   PGAlignedBlock pg = {0};
>   ^
> freespace.c:611:2: warning: (near initialization for \342\200\230pg.data\342\200\231) [-Wmissing-braces]
> 
> This is from buri, similar from curculio, dragonet, idiacanthus,
> xenodermus, etc

I really don't see the point of placating old compilers for things like
this. It's just inflicting pain on ourselves without any reward. Just to be
clear: I didn't knowingly trigger the warning.

Either way, an upcoming commit will implement vm_extend() / fsm_extend() with
generic code, then the warning will be gone.

Greetings,

Andres Freund





^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: pgsql: Don't initialize page in {vm,fsm}_extend(), not needed
@ 2023-04-06 00:55  Andres Freund <andres@anarazel.de>
  parent: Andres Freund <andres@anarazel.de>
  0 siblings, 0 replies; 5+ messages in thread

From: Andres Freund @ 2023-04-06 00:55 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-committers@lists.postgresql.org

Hi,

On 2023-04-05 16:58:41 -0700, Andres Freund wrote:
> On 2023-04-05 19:19:48 -0400, Tom Lane wrote:
> > Andres Freund <andres@anarazel.de> writes:
> > > Don't initialize page in {vm,fsm}_extend(), not needed
> > 
> > Various buildfarm members are complaining about under-braced
> > initializations added by this commit.
> > 
> > visibilitymap.c: In function \342\200\230vm_extend\342\200\231:
> > visibilitymap.c:625:2: warning: missing braces around initializer [-Wmissing-braces]
> >   PGAlignedBlock pg = {0};
> >   ^
> > visibilitymap.c:625:2: warning: (near initialization for \342\200\230pg.data\342\200\231) [-Wmissing-braces]
> > 
> > freespace.c: In function \342\200\230fsm_extend\342\200\231:
> > freespace.c:611:2: warning: missing braces around initializer [-Wmissing-braces]
> >   PGAlignedBlock pg = {0};
> >   ^
> > freespace.c:611:2: warning: (near initialization for \342\200\230pg.data\342\200\231) [-Wmissing-braces]
> > 
> > This is from buri, similar from curculio, dragonet, idiacanthus,
> > xenodermus, etc
> 
> I really don't see the point of placating old compilers for things like
> this. It's just inflicting pain on ourselves without any reward. Just to be
> clear: I didn't knowingly trigger the warning.
> 
> Either way, an upcoming commit will implement vm_extend() / fsm_extend() with
> generic code, then the warning will be gone.

Done as of fcdda1e4b50249c344e510ea93d4bd74d2743430

- Andres





^ permalink  raw  reply  [nested|flat] 5+ messages in thread


end of thread, other threads:[~2023-04-06 00:55 UTC | newest]

Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2023-04-05 16:21 pgsql: Don't initialize page in {vm,fsm}_extend(), not needed Andres Freund <andres@anarazel.de>
2023-04-05 23:19 ` Tom Lane <tgl@sss.pgh.pa.us>
2023-04-05 23:34   ` Michael Paquier <michael@paquier.xyz>
2023-04-05 23:58   ` Andres Freund <andres@anarazel.de>
2023-04-06 00:55     ` Andres Freund <andres@anarazel.de>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox