Why not align item size in dshash_table?

From: Hao Zhang <zhrt1446384557(at)gmail(dot)com>
To: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Why not align item size in dshash_table?
Date: 2024-08-13 09:45:21
Message-ID: CALY6Dr9pm0KYOvEbQMA8DHSgjOc=eO-4WQkK=ehv=SiQkyAPZQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi hackers,
I found that the entry size is not aligned with MAXALIGN, but
dshash_table_item did that in dshash_table. IMHO, both entry size and
dshash_table_item should be aligned with MAXALIGN.

static dshash_table_item *
insert_into_bucket(dshash_table *hash_table,
const void *key,
dsa_pointer *bucket)
{
dsa_pointer item_pointer;
dshash_table_item *item;

item_pointer = dsa_allocate(hash_table->area,
hash_table->params.entry_size +
MAXALIGN(sizeof(dshash_table_item)));
item = dsa_get_address(hash_table->area, item_pointer);
copy_key(hash_table, ENTRY_FROM_ITEM(item), key);
insert_item_into_bucket(hash_table, item_pointer, item, bucket);
return item;
}

With regards,
Hao Zhang

Browse pgsql-hackers by date

  From Date Subject
Next Message Ajay Pal 2024-08-13 09:52:43 Re: SQL Property Graph Queries (SQL/PGQ)
Previous Message Ilia Evdokimov 2024-08-13 09:40:00 Re: change regexp_substr first argument make tests more easier to understand.