Re: TransactionIdIsInProgress() cache

Поиск
Список
Период
Сортировка
От Alvaro Herrera
Тема Re: TransactionIdIsInProgress() cache
Дата
Msg-id 20080311141545.GE9116@alvh.no-ip.org
обсуждение исходный текст
Ответ на Re: TransactionIdIsInProgress() cache  ("Heikki Linnakangas" <heikki@enterprisedb.com>)
Список pgsql-patches
Heikki Linnakangas wrote:

> Nope, that's not good. Per comments in tqual.c, you have to call
> TransactionIdIsInProgress *before* TransactionIdDidCommit, to avoid this
> race condition:
>
> 1. Xact A inserts a record
> 2. Xact B does TransactionIdDidCommit, which retuns false because it's
> still in progress
> 3. Xact B commits
> 4. Xact B does TransactionIdIsInProgress to see if A is still in
> progress. It returns false. We conclude that A aborted, while it
> actually committed.

Ah, right -- I knew there was a reason for the other coding, I just
didn't remember what it was and based my transformation purely on the
snippet you posted.

--
Alvaro Herrera                                http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support

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

Предыдущее
От: "Heikki Linnakangas"
Дата:
Сообщение: Re: [PERFORM] Very slow (2 tuples/second) sequentialscan after bulk insert; speed returns to ~500 tuples/second aftercommit
Следующее
От: Larry Rosenman
Дата:
Сообщение: Re: [HACKERS] Fix for large file support (nonsegment mode support)