Re: Marking shared buffer lookup table as HASH_FIXED_SIZE - Mailing list pgsql-hackers

From Andres Freund
Subject Re: Marking shared buffer lookup table as HASH_FIXED_SIZE
Date
Msg-id bxqdkvdaimaxwatzyprlvwlscec2dgebnvawqalsw6vft35ad5@7kd5smcgmgnk
Whole thread Raw
In response to Marking shared buffer lookup table as HASH_FIXED_SIZE  (Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>)
Responses Re: Marking shared buffer lookup table as HASH_FIXED_SIZE
List 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



pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: Parallel heap vacuum
Next
From: Yugo Nagata
Date:
Subject: Re: Suggestion to add --continue-client-on-abort option to pgbench