diff options
author | Tom Lane | 2024-12-28 16:48:13 +0000 |
---|---|---|
committer | Tom Lane | 2024-12-28 16:48:13 +0000 |
commit | a46311ed7214741ad0d38893da4285b2c2b468ad (patch) | |
tree | 4dd8bbdddc3c9da2bf597560c92b8ae4068b9fe0 /src | |
parent | fa6131377054d04f7c938b196b39eeb22784951b (diff) |
Try to avoid semaphore-related test failures on NetBSD/OpenBSD.
These two platforms have a remarkably tight default limit on the
number of SysV semaphores in the system: SEMMNS is only 60
out-of-the-box. Unless manual action is taken to raise that,
we'll only be able to allocate 3 sets of 16 usable semaphores
each, leading to initdb setting max_connections to just 20.
That's problematic because the core regression tests expect
to be able to launch 20 concurrent sessions, leaving us with
no headroom. This seems to be the cause of intermittent
buildfarm failures on some machines.
While there's no getting around the fact that you'd better raise
SEMMNS for production use on these platforms, it does seem desirable
for "make check" to pass reliably without that. We can make that
happen, at least for awhile longer, with two small changes:
* Change sysv_sema.c's SEMAS_PER_SET to 19, so that we can eat up
all of the available semas not just most of them.
* Change initdb to make the smallest max_connections value it will
consider be 25 not 20.
This is a back-patch of recent HEAD commit 38da05346 into v17.
The motivation for doing this now is that an upcoming bug-fix
patch will give the new-in-17 slotsync worker process its own
reserved PGPROC and hence also semaphore. With that patch but
without this change, v17 would fail to start at all under the
default SEMMNS on these platforms.
Discussion: https://postgr.es/m/db2773a2-aca0-43d0-99c1-060efcd9954e@gmail.com
Discussion: https://postgr.es/m/1808397.1735156190@sss.pgh.pa.us
Diffstat (limited to 'src')
-rw-r--r-- | src/backend/port/sysv_sema.c | 8 | ||||
-rw-r--r-- | src/bin/initdb/initdb.c | 2 |
2 files changed, 8 insertions, 2 deletions
diff --git a/src/backend/port/sysv_sema.c b/src/backend/port/sysv_sema.c index 1454f96b5f3..aafd44c866e 100644 --- a/src/backend/port/sysv_sema.c +++ b/src/backend/port/sysv_sema.c @@ -50,8 +50,14 @@ typedef int IpcSemaphoreId; /* semaphore ID returned by semget(2) */ * we allocate. It must be *less than* your kernel's SEMMSL (max semaphores * per set) parameter, which is often around 25. (Less than, because we * allocate one extra sema in each set for identification purposes.) + * + * The present value of 19 is chosen with one eye on NetBSD/OpenBSD's default + * SEMMNS setting of 60. Remembering the extra sema per set, this lets us + * allocate three sets with 57 useful semaphores before exceeding that, which + * is enough to run our core regression tests. Users of those systems will + * still want to raise SEMMNS for any sort of production work, though. */ -#define SEMAS_PER_SET 16 +#define SEMAS_PER_SET 19 #define IPCProtection (0600) /* access/modify by user only */ diff --git a/src/bin/initdb/initdb.c b/src/bin/initdb/initdb.c index b050355ca91..f2c61bc5637 100644 --- a/src/bin/initdb/initdb.c +++ b/src/bin/initdb/initdb.c @@ -1119,7 +1119,7 @@ test_config_settings(void) #define MIN_BUFS_FOR_CONNS(nconns) ((nconns) * 10) static const int trial_conns[] = { - 100, 50, 40, 30, 20 + 100, 50, 40, 30, 25 }; static const int trial_bufs[] = { 16384, 8192, 4096, 3584, 3072, 2560, 2048, 1536, |