[patch] Adding an assertion to report too long hash table name

From: Xiaoran Wang <wxiaoran(at)vmware(dot)com>
To: "pgsql-hackers(at)lists(dot)postgresql(dot)org" <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: [patch] Adding an assertion to report too long hash table name
Date: 2022-09-29 01:37:59
Message-ID: SN6PR05MB4462E92F19E927AF41AC468FBA579@SN6PR05MB4462.namprd05.prod.outlook.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

The max size for the shmem hash table name is SHMEM_INDEX_KEYSIZE - 1.
but when the caller uses a longer hash table name, it doesn't report any error, instead
it just uses the first SHMEM_INDEX_KEYSIZE -1 chars as the hash table name.

I created some shmem hash tables with the same prefix which was longer than
SHMEM_INDEX_KEYSIZE - 1, and the size of those hash tables were the same,
then only one hash table was created. But I thought those hash tables were created
successfully.

I know this is a corner case, but it's difficult to figure it out when run into it. So I add
an assertion to prevent it.

Thanks,
Xiaoran

Attachment Content-Type Size
Adding-an-assertion-to-report-too-long-hash-table-name.patch application/octet-stream 1.3 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2022-09-29 02:10:47 Re: longfin and tamandua aren't too happy but I'm not sure why
Previous Message Peter Geoghegan 2022-09-29 01:31:42 Re: A potential memory leak on Merge Join when Sort node is not below Materialize node