Re: commiting transaction from outside

Поиск
Список
Период
Сортировка
От Kevin Grittner
Тема Re: commiting transaction from outside
Дата
Msg-id 4E89B12F02000025000419BD@gw.wicourts.gov
обсуждение исходный текст
Ответ на commiting transaction from outside  (Julius Tuskenis <julius@nsoft.lt>)
Ответы Re: commiting transaction from outside
Список pgsql-admin
Julius Tuskenis <julius@nsoft.lt> wrote:

> my question my sound strange, but because of a bug in an
> application I see the transaction was started and not commited
> (connection state is IDLE in transaction). Is there a way to
> commit this transaction? I don't want to loose data. I think if I
> close the application the transaction would get  rollbacked.

I can't think of any way to issue the commit, unless the application
is running in an unusual environment which lets you break in and
issue ad hoc commands on its connection.  There is a way you could
fish out the effects of the transaction, although it might be a fair
bit of work.  Each tuple inserted or updated has the transaction ID
set as its xmin in the new tuple, and every tuple deleted or updated
has the transaction ID set as its xmax.  The old and new are
guaranteed not to go away until the transaction completes, one way
or the other.  With some clever programming you could capture the
net effect of the transaction, and duplicate that effect after the
transaction is rolled back.

Be aware that while the transaction is stuck "idle in transaction"
the cleanup of old tuples can't proceed normally; so if you're
continuing to modify any database in the cluster, it could be
accumulating bloat until you resolve this.

-Kevin

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

Предыдущее
От: Julien Rouhaud
Дата:
Сообщение: Re: commiting transaction from outside
Следующее
От: Kevin Ricords
Дата:
Сообщение: index bloat on partial index 8.4