internal subtransactions, memory contexts, resource owners

Поиск
Список
Период
Сортировка
От Chapman Flack
Тема internal subtransactions, memory contexts, resource owners
Дата
Msg-id 619EA06D.9070806@anastigmatix.net
обсуждение исходный текст
Ответы Re: internal subtransactions, memory contexts, resource owners  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
Hi,

By inspection of plperl and plpython, it looks like the canonical pattern
for a PL using internal subtransactions is:

save CurrentMemoryContext
save CurrentResourceOwner
BeginInternalSubTransaction
reimpose the saved memory context
// but not the saved resource owner

...
(RollbackAnd)?ReleaseCurrentSubTransaction
reimpose the saved memory context
and the saved resource owner


Therefore, during the subtransaction, its newly-established memory context
is accessible as CurTransactionMemoryContext, but the caller can still use
CurrentMemoryContext to refer to the same context it already expected.

By contrast, the newly established resource owner is both the
CurTransactionResourceOwner and the CurrentResourceOwner within the scope
of the subtransaction.

Is there more explanation of this pattern written somewhere than I have
managed to find, and in particular of the motivation for treating the memory
context and the resource owner in these nearly-but-not-quite matching
ways?

Regards,
-Chap



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

Предыдущее
От: Robert Haas
Дата:
Сообщение: Re: Post-CVE Wishlist
Следующее
От: "Bossart, Nathan"
Дата:
Сообщение: Re: XMAX_LOCK_ONLY and XMAX_COMMITTED (fk/multixact code)