Re: Xact end leaves CurrentMemoryContext = TopMemoryContext
Andres Freund <andres@anarazel.de>
From: Andres Freund <andres@anarazel.de>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: David Rowley <dgrowleyml@gmail.com>, pgsql-hackers@lists.postgresql.org
Date: 2024-06-18T20:23:36Z
Lists: pgsql-hackers
Hi, On 2024-06-18 15:28:03 -0400, Tom Lane wrote: > After awhile I had an epiphany: what we should do is make > CommitTransactionCommand restore the memory context that was active > before StartTransactionCommand. That's what we want in every place > that was cognizant of this issue, and it seems to be the case in every > place that wasn't doing anything explicit about it, either. I like it. I wonder if there's an argument the "persistent" TopTransactionContext should live under a different name outside of transactions, to avoid references to it working in a context where it's not valid? It's probably not worth it, but not sure. > The 0001 patch attached does that, and seems to work nicely. > I made it implement the idea of recycling TopTransactionContext, > too Nice. I think there might be some benefit to doing that for some more things, later/separately. E.g. the allocation of TopTransactionResourceOwner shows up in profiles for workloads with small transactions. Which got a bit worse with 17 (largely bought back in other places by the advantages of the new resowner system). > At this point I'd be inclined to wait for the branch to be made, > and then apply 0001 in HEAD/v18 only and 0002 in v17 and before. > While 0001 seems fairly straightforward, it's still a nontrivial > change and I'm hesitant to shove it in at this late stage of the > v17 cycle. Seems reasonable. Greetings, Andres Freund
Commits
-
Split vacuumdb to create vacuuming.c/h
- c4067383cb2c 19 (unreleased) cited
-
Preserve CurrentMemoryContext across notify and sinval interrupts.
- 8565fb6fbb69 12.20 landed
- 5f86cd70d801 13.16 landed
- 54a7b21b3a9d 16.4 landed
- 4df767cf906d 15.8 landed
- 31f8d620b287 17.0 landed
- 1608902fc3a7 14.13 landed
-
Preserve CurrentMemoryContext across Start/CommitTransactionCommand.
- 1afe31f03cd2 18.0 landed