Re: [HACKERS] CIC and deadlocks

Поиск
Список
Период
Сортировка
От Pavan Deolasee
Тема Re: [HACKERS] CIC and deadlocks
Дата
Msg-id 2e78013d0704102329t19110847r819369df13cf7d30@mail.gmail.com
обсуждение исходный текст
Ответы Re: [HACKERS] CIC and deadlocks  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-patches

On 4/1/07, Tom Lane <tgl@sss.pgh.pa.us> wrote:

Good point.  I'm envisioning a procarray.c function along the
lines of
        bool TransactionHasSnapshot(xid)
which returns true if the xid is currently listed in PGPROC
and has a nonzero xmin.  CIC's cleanup wait loop would check
this and ignore the xid if it returns false.  Your point means
that this function would have to take exclusive not shared lock
while scanning the procarray, which is kind of annoying, but
it seems not fatal since CIC isn't done all that frequently.


When I looked at the code, it occurred to me that possibly we are
OK with just taking shared lock on the procarray. That means that
some other transaction can concurrently set its serializable snapshot
while we are scanning the procarray. But that should not harm us:
if we see the snapshot set, we wait for the transaction. A transaction
which is setting its serializable snapshot NOW, can not see the
tuples that we did not index, isn't it ?

A patch based on the discussion is attached.

Thanks,
Pavan

--

EnterpriseDB     http://www.enterprisedb.com
Вложения

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

Предыдущее
От: Hannu Krosing
Дата:
Сообщение: Re: [HACKERS] Full page writes improvement, code update
Следующее
От: Tom Lane
Дата:
Сообщение: Re: [HACKERS] CIC and deadlocks