HASH_FIXED_SIZE flag gets lost when attaching to existing hash table

Поиск
Список
Период
Сортировка
От Aidar Imamov
Тема HASH_FIXED_SIZE flag gets lost when attaching to existing hash table
Дата
Msg-id 4d0cb35ff01c5c74d2b9a582ecb73823@postgrespro.ru
обсуждение исходный текст
Ответы Re: HASH_FIXED_SIZE flag gets lost when attaching to existing hash table
Список pgsql-hackers
Hi hackers,

Recently, while working with hash tables in dynahash.c, I noticed 
something weird.
When a hash table is already created in shared memory, and the another 
process
calls hash_create attempting to attach to it, it seems like the 
HASH_FIXED_SIZE
flag gets lost.

For example, if you start the server compiled with the EXEC_BACKEND 
option, and a
hash table with a fixed size is created at the beginning in shared 
memory, any
other process started by the postmaster then tries to initialize its 
hash table
pointer by calling hash_create with HASH_ATTACH flag. But the table 
structure it
points to has 'isfixed' flag set to false, even though the original 
table was
created with a HASH_FIXED_SIZE provided.

This could lead to the situation where, when the table's capacity limit 
is reached
(which was specified when the table was created), the process will 
silently occupy
more of the shared memory (up to a certain point?). Then, another insert 
could
trigger an out of shared memory error.

Any thoughts?


Regards,
Aidar Imamov
Вложения

В списке pgsql-hackers по дате отправления: