remove check hooks for GUCs that contribute to MaxBackends

From: Nathan Bossart <nathandbossart(at)gmail(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: remove check hooks for GUCs that contribute to MaxBackends
Date: 2024-06-19 19:04:58
Message-ID: ZnMr2k-Nk5vj7T7H@nathan
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

While working on an idea from another thread [0], I noticed that each of
max_connections, max_worker_process, max_autovacuum_workers, and
max_wal_senders have a check hook that verifies the sum of those GUCs does
not exceed a certain value. Then, in InitializeMaxBackends(), we do the
same check once more. Not only do the check hooks seem redundant, but I
think they might sometimes be inaccurate since some values might not yet be
initialized. Furthermore, the error message is not exactly the most
descriptive:

$ pg_ctl -D . start -o "-c max_connections=262100 -c max_wal_senders=10000"

FATAL: invalid value for parameter "max_wal_senders": 10000

The attached patch removes these hooks and enhances the error message to
look like this:

FATAL: too many backends configured
DETAIL: "max_connections" (262100) plus "autovacuum_max_workers" (3) plus "max_worker_processes" (8) plus "max_wal_senders" (10000) must be less than 262142.

The downside of this change is that server startup progresses a little
further before it fails, but that might not be too concerning given this
_should_ be a relatively rare occurrence.

Thoughts?

[0] https://postgr.es/m/20240618213331.ef2spg3nasksisbi%40awork3.anarazel.de

--
nathan

Attachment Content-Type Size
v1-0001-remove-check-hooks-for-GUCs-that-contribute-to-Ma.patch text/plain 4.9 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jelte Fennema-Nio 2024-06-19 19:06:01 Re: Extension security improvement: Add support for extensions with an owned schema
Previous Message Melanie Plageman 2024-06-19 18:20:59 Re: BitmapHeapScan streaming read user and prelim refactoring