Re: TransactionIdIsInProgress() cache

Поиск
Список
Период
Сортировка
От Simon Riggs
Тема Re: TransactionIdIsInProgress() cache
Дата
Msg-id 1205256478.4285.11.camel@ebony.site
обсуждение исходный текст
Ответ на Re: TransactionIdIsInProgress() cache  ("Heikki Linnakangas" <heikki@enterprisedb.com>)
Ответы Re: TransactionIdIsInProgress() cache
Список pgsql-patches
On Tue, 2008-03-11 at 12:57 +0000, Heikki Linnakangas wrote:

> We could do this instead:
>
> >  if (TransactionIdDidCommit(xvac))
> >  {
> >      /* committed */
> >  }
> >  else if (!TransactionIdIsInProgress(xvac))
> >  {
> >     if (TransactionIdDidCommit(xvac))
> >     {
> >        /* committed */
> >     }
> >     else
> >     {
> >        /* aborted */
> >     }
> >  }
> >  else
> >  {
> >      /* in-progress */
> >  }
>
> (hopefully there would be a way to macroize that or something to avoid
> bloating the code any more.)
>
> For committed transactions, this would save the
> TransactionIdIsInProgress call completely, whether or not it's in the
> one-item cache. The tradeoff is that we would have to call
> TransactionIdDidCommit twice for aborted transactions.

I thought about doing it the way you suggest but
TransactionIdIsInProgress is the offending code, so thats the part I
tuned. TransactionIdDidCommit uses the single item cache so it seemed
easier to make isolated changes as proposed rather than touching tqual
code in multiple places to do exactly the same thing.

No, I haven't done any formal performance testing on it. It seemed an
obvious hole that everyone would agree we should avoid, since we can do
it so cheaply: one integer comparison against scanning the whole
procarray and taking an LWlock.

--
  Simon Riggs
  2ndQuadrant  http://www.2ndQuadrant.com

  PostgreSQL UK 2008 Conference: http://www.postgresql.org.uk


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

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: Re: actualised forgotten Magnus's patch for plpgsql MOVE statement
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Remove FATAL from pg_lzdecompress