Re: Is element access after HASH_REMOVE ever OK?

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Is element access after HASH_REMOVE ever OK?
Дата
Msg-id 805065.1620691570@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Is element access after HASH_REMOVE ever OK?  (Thomas Munro <thomas.munro@gmail.com>)
Ответы Re: Is element access after HASH_REMOVE ever OK?  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
Thomas Munro <thomas.munro@gmail.com> writes:
> However, I noticed in passing that RemoveLocalLock() accesses
> *locallock after removing it from the hash table (in assertion builds
> only).  So one question I have is whether it's actually a programming
> rule that you can't do that (at most you can compare the pointer
> against NULL), or whether it's supposed to be
> safe-if-you-know-what-you're-doing, as the existing comments hints.

I'd say it's, at best, unwarranted familiarity with the dynahash
implementation ...

> Here also is a patch that does wipe_mem on removed elements, as
> threatened last time this topic came up[1], which reveals the problem.

... one good reason being that it'll fail under this sort of
entirely-reasonable debugging aid.  Can we get rid of the unsafe
access easily?

            regards, tom lane



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

Предыдущее
От: Thomas Munro
Дата:
Сообщение: Is element access after HASH_REMOVE ever OK?
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Is element access after HASH_REMOVE ever OK?