Re: Modernizing our GUC infrastructure

Pavel Stehule <pavel.stehule@gmail.com>

From: Pavel Stehule <pavel.stehule@gmail.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Robert Haas <robertmhaas@gmail.com>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>, Julien Rouhaud <rjuju123@gmail.com>
Date: 2022-09-06T14:33:36Z
Lists: pgsql-hackers
Hi


> I think a large part of the reason the schema-variables patch
> has gone sideways for so many years is that it's an ambitious
> overdesign.
>

Last two  weeks this patch is shorter and shorter. I removed a large part
related to check of type consistency, because I can do this check more
easily - and other work is done by dependencies.

Big thanks to Julien - it does a lot of work and he shows me a lot of
issues and possibilities on how to fix it. With Julien work this patch
moved forward. Years before it was just a prototype.

This patch is not too complex - important part is session_variable.c with
1500 lines , and it is almost simple code - store value to hashtab, and
cleaning hash tab on sinval or on transaction end or abort + debug routine.

[pavel@localhost commands]$ cloc session_variable.c
       1 text file.
       1 unique file.
       0 files ignored.

github.com/AlDanial/cloc v 1.90  T=0.02 s (50.0 files/s, 77011.1 lines/s)
-------------------------------------------------------------------------------
Language                     files          blank        comment
code
-------------------------------------------------------------------------------
C                                1            257            463
 820
-------------------------------------------------------------------------------

In other files there are +/- mechanical code





>
>                         regards, tom lane
>
>
>

Commits

  1. Add auxiliary lists to GUC data structures for better performance.

  2. Replace the sorted array of GUC variables with a hash table.

  3. Store GUC data in a memory context, instead of using malloc().

  4. Make some minor improvements in memory-context infrastructure.