Re: what happens if a failed transaction is not rolled back?

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: what happens if a failed transaction is not rolled back?
Дата
Msg-id 548096.1682371213@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: what happens if a failed transaction is not rolled back?  ("David G. Johnston" <david.g.johnston@gmail.com>)
Ответы Re: what happens if a failed transaction is not rolled back?  (Merlin Moncure <mmoncure@gmail.com>)
Список pgsql-general
"David G. Johnston" <david.g.johnston@gmail.com> writes:
> On Mon, Apr 24, 2023 at 12:56 PM David Wheeler <hippysoyboy@gmail.com>
> wrote:
>> Now I’m curious. Does it have the same impact on performance that an idle
>> in transaction connection has? Eg does it prevent vacuum? Does it still
>> hold locks?

> Absent documentation to the contrary I would expect the system to at best
> be in an idle-in-transaction state as-if the failed command never was
> executed.

A quick experiment will show you that we release locks as soon as the
transaction is detected to have failed.  I believe the same is true of
other interesting resources such as snapshots (which'd be what affects
vacuum) but it's less easy to observe that from the SQL level.  At least
by intention, a failed transaction won't hold any resources that would
impact other sessions.

> The concept of savepoints, whether in use in a particular
> transaction, would require at least that much state be preserved.

Of course, we can't release resources that were acquired by a still-live
subtransaction, a/k/a savepoint.

            regards, tom lane



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

Предыдущее
От: "David G. Johnston"
Дата:
Сообщение: Re: what happens if a failed transaction is not rolled back?
Следующее
От: Arquimedes Aguirre
Дата:
Сообщение: RE: FW: Error!