Re: patch: fix race in SSI's CheckTargetForConflictsIn

Поиск
Список
Период
Сортировка
Искать
От
Dan Ports
Тема
Re: patch: fix race in SSI's CheckTargetForConflictsIn
Дата
в 23:49:42
Msg-id
20110507024922.GA53228@csail.mit.edu
Ответ на
Список
Дерево обсуждения
patch: fix race in SSI's CheckTargetForConflictsIn Dan Ports <drkp@csail.mit.edu>
Re: patch: fix race in SSI's CheckTargetForConflictsIn "Kevin Grittner" <Kevin.Grittner@wicourts.gov>
Re: patch: fix race in SSI's CheckTargetForConflictsIn Robert Haas <robertmhaas@gmail.com>
Re: patch: fix race in SSI's CheckTargetForConflictsIn Dan Ports <drkp@csail.mit.edu>
Re: patch: fix race in SSI's CheckTargetForConflictsIn Dan Ports <drkp@csail.mit.edu>
Re: patch: fix race in SSI's CheckTargetForConflictsIn Robert Haas <robertmhaas@gmail.com>
On Fri, May 06, 2011 at 09:35:39PM -0400, Robert Haas wrote:
> Why does this HASH_FIND the applicable hash table entries and then
> HASH_REMOVE it as a separate step, instead of just HASH_REMOVE-ing it
> in one go?

For PredicateLockHash, we need to find the lock entry first so that we
can call SHMQueueDelete on its targetLink and xactLink fields. 

For LocalPredicateLockHash, we check the resulting entry to decide
whether to remove it. Having looked at the code some more, however, we do
always remove it because we only apply this optimization to heap tuple
locks, which are not parents of other locks. So we can simplify this
down to a HASH_REMOVE.


> Doesn't this fail to release the locks if rmpredlock == NULL?

Yikes. Indeed it does.

> I believe it's project style to test (rmpredlock != NULL) rather than
> just (rmpredlock).

That works for me (I prefer the != NULL myself). I believe I've seen
both elsewhere, though...

Will update the patch.

Dan

-- 
Dan R. K. Ports              MIT CSAIL                http://drkp.net/

В списке pgsql-hackers по дате отправления
От: Robert Haas
Дата:
От: Shiv
Дата:
Сообщение: Re: improvements to pgtune
FAQ