Re: Shared memory size computation oversight?

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Julien Rouhaud <rjuju123(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Georgios <gkokolatos(at)protonmail(dot)com>, Julien Rouhaud <julien(dot)rouhaud(at)free(dot)fr>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, "robertmhaas(at)gmail(dot)com" <robertmhaas(at)gmail(dot)com>
Subject: Re: Shared memory size computation oversight?
Date: 2021-03-04 08:21:35
Message-ID: YECYj2KORHb06xbA@paquier.xyz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Mar 04, 2021 at 03:23:33PM +0800, Julien Rouhaud wrote:
> I was also considering adding new (add|mull)_*_size functions to avoid having
> too messy code. I'm not terribly happy with xxx_shm_size(), as not all call to
> those functions would require an alignment. Maybe (add|mull)shmemalign_size?
>
> But before modifying dozens of calls, should we really fix those or only
> increase a bit the "slop factor", or a mix of it?
>
> For instance, I can see that for instance BackendStatusShmemSize() never had
> any padding consideration, while others do.
>
> Maybe only fixing contribs, some macro like PredXactListDataSize that already
> do a MAXALIGN, SimpleLruShmemSize and hash_estimate_size() would be a short
> patch and should significantly improve the estimation.

The lack of complaints in this area looks to me like a sign that we
may not really need to backpatch something, so I would not be against
a precise chirurgy, with a separate set of {add,mul}_size() routines
that are used where adapted, so as it is easy to track down which size
estimations expect an extra padding. I would be curious to hear more
thoughts from others here.

Saying that, calling a new routine something like add_shmem_align_size
makes it clear what's its purpose.
--
Michael

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Georgios 2021-03-04 08:43:51 Re: Shared memory size computation oversight?
Previous Message Kyotaro Horiguchi 2021-03-04 08:17:15 Re: PITR promote bug: Checkpointer writes to older timeline