Re: Modernizing our GUC infrastructure
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-hackers@lists.postgresql.org
Date: 2022-10-07T19:31:26Z
Lists: pgsql-hackers
Attachments
- 0001-memory-management-preliminaries-3.patch (text/x-diff) patch 0001
- 0002-keep-guc-data-in-a-context-3.patch (text/x-diff) patch 0002
- 0003-use-dynahash-instead-of-array-3.patch (text/x-diff) patch 0003
- 0004-add-auxiliary-lists-3.patch (text/x-diff) patch 0004
I wrote: >> Attached is a patch series that attempts to modernize our GUC >> infrastructure, in particular removing the performance bottlenecks >> it has when there are lots of GUC variables. > Rebased over 0a20ff54f. Here's a v3 rebased up to HEAD. The only real change is that I added a couple of "Assert(GetMemoryChunkContext(ptr) == GUCMemoryContext)" checks in hopes of improving detection of not-updated code that is still using malloc/free where it should be using guc_malloc/guc_free. This is per the nearby discussion of whether the mcxt.c infrastructure could recognize that [1]. I experimented a bit with leaving out parts of the 0002 patch to simulate such mistakes, and at least on a Linux box that seems to produce fairly intelligible errors now. In the case of free'ing a palloc'd pointer, what you get is a message from glibc followed by abort(), so their error detection is pretty solid too. I'm feeling pretty good about this patchset now. Does anyone want to review it further? regards, tom lane [1] https://postgr.es/m/2910981.1665080361%40sss.pgh.pa.us
Commits
-
Add auxiliary lists to GUC data structures for better performance.
- f13b2088fa2d 16.0 landed
-
Replace the sorted array of GUC variables with a hash table.
- 3057465acfbe 16.0 landed
-
Store GUC data in a memory context, instead of using malloc().
- 407b50f2d421 16.0 landed
-
Make some minor improvements in memory-context infrastructure.
- 9c911ec065df 16.0 landed