Re: fix a bogus line in dynahash.c

Поиск
Список
Период
Сортировка
От Qingqing Zhou
Тема Re: fix a bogus line in dynahash.c
Дата
Msg-id d70q77$21aq$1@news.hub.org
обсуждение исходный текст
Ответ на fix a bogus line in dynahash.c  ("Qingqing Zhou" <zhouqq@cs.toronto.edu>)
Список pgsql-patches
"Neil Conway" <neilc@samurai.com>writes
> Well, element_alloc() uses the hash table's alloc function pointer. In
> theory, that could be malloc() or anything else, although I notice this
> abstraction is not consistently maintained (e.g. dir_realloc assumes
> pfree() is sufficient to free an allocation).
>

Yes, in theory it could do so. But in fact element_alloc() uses
DynaHashAlloc() for ordinary hash table or uses ShmemAlloc() for shared
memory case. The problem is that both of these could elog(ERROR) themselves.

> I think it would be a good idea to change dynahash.c to assume that the
> hash table's allocation function will elog(ERROR) on out-of-memory,

DynaHashAlloc() looks like this. ShmemAlloc() just elog(WARNING), we could
revise it ... but if you do so, how to rewrite

if (!hash_search(HASH_ENTER))    /* for example: RememberFsyncRequest() */
    elog(FATAL/PANIC);

Use critical_section?

Regards,
Qingqing



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

Предыдущее
От: Neil Conway
Дата:
Сообщение: Re: fix a bogus line in dynahash.c
Следующее
От: Tom Lane
Дата:
Сообщение: Re: [PATCH] pg_autovacuum commandline password hiding.