Re: [HACKERS] PG10 transition tables, wCTEs and multiple operations on the same table

Поиск
Список
Период
Сортировка
От Andrew Gierth
Тема Re: [HACKERS] PG10 transition tables, wCTEs and multiple operations on the same table
Дата
Msg-id 87lgoyql2z.fsf@news-spur.riddles.org.uk
обсуждение исходный текст
Ответ на Re: [HACKERS] PG10 transition tables, wCTEs and multiple operationson the same table  (Robert Haas <robertmhaas@gmail.com>)
Ответы Re: [HACKERS] PG10 transition tables, wCTEs and multiple operationson the same table  (Thomas Munro <thomas.munro@enterprisedb.com>)
Список pgsql-hackers
>>>>> "Robert" == Robert Haas <robertmhaas@gmail.com> writes:
Robert> I don't see a reason why MakeTransitionCaptureState needs toRobert> force the tuplestores into
TopTransactionContextor make themRobert> owned by TopTransactionResourceOwner.
 

Nor do I, and I'm pretty sure it's leaking memory wholesale within a
transaction if you have aborted subxacts.

e.g. a few iterations of this, on a table with an appropriate trigger:

savepoint s1;
insert into foo select i, case when i < 100000 then repeat('a',100)           else repeat('a',1/(i-100000)) end   from
generate_series(1,100000)i;
 
rollback to s1;

This is a bit contrived of course but it shows that there's missing
cleanup somewhere, either in the form of poor choice of context or
missing code in the subxact cleanup.
Robert> I mean, it was like that before, but afterTriggers is a globalRobert> variable and, potentially, there could
stillbe a pointerRobert> accessible through it to a tuplestore linked from it even afterRobert> the corresponding
subtransactionaborted, possibly causing someRobert> cleanup code to trip and fall over.  But that can't be used
toRobert>justify this case, because the TransitionCaptureState is onlyRobert> reached through the PlanState tree; if
thatgoes away, how isRobert> anybody going to accidentally follow a pointer to theRobert> now-absent tuplestore?
 

For per-row triggers with transition tables, a pointer to the transition
capture state ends up in the shared-data record in the event queue?

-- 
Andrew.



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

Предыдущее
От: Tom Lane
Дата:
Сообщение: [HACKERS] Transactional sequence stuff breaks pg_upgrade
Следующее
От: Álvaro Hernández Tortosa
Дата:
Сообщение: Re: [HACKERS] SCRAM in the PG 10 release notes