pkgsrc-Changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

CVS commit: pkgsrc/databases/postgresql18-server



Module Name:    pkgsrc
Committed By:   gdt
Date:           Sun Oct  4 12:09:32 UTC 2026

Modified Files:
        pkgsrc/databases/postgresql18-server: Makefile
        pkgsrc/databases/postgresql18-server/files: pgsql.sh

Log Message:
databases/postgresql18-server: Warn about inadequate semaphores

When run on NetBSD (without kernel options or sysctl), and using
/etc/rc.d/pgsql start, this package fails to start, because Postgresql
18 needs many more semaphores than previous versions.  While there is
an error message in $PREFIX/pgsql/errlog, it seems helpful to give an
earlier, more precise clue.

This commit adds code to rc.d/pgsql, that, only on NetBSD, checks two
semaphore size sysctl variables, and if below the values believed
appropriate for pgsql, prints a warning, showing the current value and
the implied ok value.

This commit does not write sysctl values, on the theory that it's the
base system's call to set resource limits, and packages should not
override them.  (A proposal to increase semaphore limits from the
values used in 1993 drew an objection.)

It's likely that pgsql should use POSIX semaphores instead on NetBSD,
but that's a bigger change.  This code is really easy to remove, if
that happens.

As discussed on pkgsrc-users@ in July, without objection.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 pkgsrc/databases/postgresql18-server/Makefile
cvs rdiff -u -r1.2 -r1.3 pkgsrc/databases/postgresql18-server/files/pgsql.sh

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: pkgsrc/databases/postgresql18-server/Makefile
diff -u pkgsrc/databases/postgresql18-server/Makefile:1.4 pkgsrc/databases/postgresql18-server/Makefile:1.5
--- pkgsrc/databases/postgresql18-server/Makefile:1.4   Fri Oct  2 18:11:09 2026
+++ pkgsrc/databases/postgresql18-server/Makefile       Sun Oct  4 12:09:32 2026
@@ -1,7 +1,7 @@
-# $NetBSD: Makefile,v 1.4 2026/10/02 18:11:09 gdt Exp $
+# $NetBSD: Makefile,v 1.5 2026/10/04 12:09:32 gdt Exp $
 
 PKGNAME=       ${DISTNAME:S/-/18-server-/}
-PKGREVISION=   1
+PKGREVISION=   2
 COMMENT=       PostgreSQL database server programs
 
 # mips has no TAS implementation

Index: pkgsrc/databases/postgresql18-server/files/pgsql.sh
diff -u pkgsrc/databases/postgresql18-server/files/pgsql.sh:1.2 pkgsrc/databases/postgresql18-server/files/pgsql.sh:1.3
--- pkgsrc/databases/postgresql18-server/files/pgsql.sh:1.2     Fri Oct  2 18:11:09 2026
+++ pkgsrc/databases/postgresql18-server/files/pgsql.sh Sun Oct  4 12:09:32 2026
@@ -1,6 +1,6 @@
 #!@RCD_SCRIPTS_SHELL@
 #
-# $NetBSD: pgsql.sh,v 1.2 2026/10/02 18:11:09 gdt Exp $
+# $NetBSD: pgsql.sh,v 1.3 2026/10/04 12:09:32 gdt Exp $
 #
 # PostgreSQL database rc.d control script
 #
@@ -54,9 +54,27 @@ if [ -n "${pgsql_flags}" ]; then
        command_args_daemon="${command_args} -o \"${pgsql_flags}\""
 fi
 
+# If the sysctl named by the first arg is less than the second arg,
+# print a warning.
+check_sysctl()
+{
+    var=$1
+    limit=$2
+    value=`sysctl $var | @AWK@ '{print $3}'`
+    if [ "$value" -lt "$limit" ]; then
+       @ECHO@ "WARNING: pgsql: sysctl $var = $value IS LESS THAN $limit"
+    fi
+}
+
 pgsql_precmd()
 {
        ulimit -n ${pgsql_nfiles}
+       case `uname` in
+           NetBSD)
+               check_sysctl kern.ipc.semmni 32
+               check_sysctl kern.ipc.semmns 256
+               ;;
+       esac
        if [ ! -d ${pgsql_home}/data/base ]; then
                pgsql_initdb
        fi



Home | Main Index | Thread Index | Old Index