Re: Marking shared buffer lookup table as HASH_FIXED_SIZE

From: Andres Freund <andres(at)anarazel(dot)de>
To: Ashutosh Bapat <ashutosh(dot)bapat(dot)oss(at)gmail(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Marking shared buffer lookup table as HASH_FIXED_SIZE
Date: 2025-09-18 00:44:08
Message-ID: bxqdkvdaimaxwatzyprlvwlscec2dgebnvawqalsw6vft35ad5@7kd5smcgmgnk
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On 2025-08-26 19:55:21 +0530, Ashutosh Bapat wrote:
> StrategyInitialize() calls InitBufTable() passing the maximum number
> of possible entries in the shared buffer lookup table. The table can
> not have more entries than the number of available shared buffers +
> number of partitions as explained in the comment in
> StrategyInitialize(). If there are more than those entries something
> is wrong with the hash table like mapping two different pages to the
> same buffer. InitBufTable() invokes ShmemInitHash() with the same init
> and max size. This means that the maximum number of entries are
> allocated right from the beginning. So there should not be any need to
> allocate more entries after initial setup. Thus the hash table
> qualifies to be marked as HASH_FIXED_SIZE, so that we don't end up
> with a corrupted hash table in case of a bug.
>
> Here's a patch to do so.

Makes sense to me. Applied.

Thanks,

Andres

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Yugo Nagata 2025-09-18 01:22:18 Re: Suggestion to add --continue-client-on-abort option to pgbench
Previous Message Andres Freund 2025-09-18 00:43:22 Re: Parallel heap vacuum