Thursday, October 13, 2022

Early look: PostgreSQL 15.0

Here's a diff to upgrade PostgreSQL from 14.5 to 15.0, not including
dependent ports (except postgresql-previous). Not currently intended for
commit, that won't happen until 15.1 at the earliest. Release notes at:
https://www.postgresql.org/about/news/postgresql-15-released-2526/

When I have time, I'll run a partial bulk of the PostgreSQL ports and
try to fix any breakage. Hopefully I can complete that work by the
release of PostgreSQL 15.1.

The main part I want feedback on is a new patch that silently treats the
dynamic_shared_memory_type = posix as dynamic_shared_memory_type = shm.
Since 15beta1, I had an issue where the PostgreSQL server would stop
working after a week. I traced that issue to OpenBSD deleting the
shared memory files in /tmp that shm_open(3) creates, since they were
more than a week old. Possibly this is only an issue on lightly loaded
servers, but unless daily(8) skips deleting these files automatically, I
consider the approach the patch uses necessary for reliable operation.

Thanks,
Jeremy

Index: postgresql/Makefile
===================================================================
RCS file: /cvs/ports/databases/postgresql/Makefile,v
retrieving revision 1.289
diff -u -p -r1.289 Makefile
--- postgresql/Makefile 15 Aug 2022 18:07:16 -0000 1.289
+++ postgresql/Makefile 13 Oct 2022 14:46:13 -0000
@@ -5,8 +5,8 @@ COMMENT-contrib=PostgreSQL RDBMS contrib
COMMENT-plpython=Python procedural language for PostgreSQL
COMMENT-pg_upgrade=Support for upgrading PostgreSQL data from previous version

-VERSION= 14.5
-PREV_MAJOR= 13
+VERSION= 15.0
+PREV_MAJOR= 14
DISTNAME= postgresql-${VERSION}
PKGNAME-main= postgresql-client-${VERSION}

@@ -16,7 +16,7 @@ CATEGORIES= databases
SHARED_LIBS= ecpg 7.10 \
ecpg_compat 4.10 \
pgtypes 4.9 \
- pq 6.13
+ pq 6.14

HOMEPAGE= https://www.postgresql.org/

Index: postgresql/distinfo
===================================================================
RCS file: /cvs/ports/databases/postgresql/distinfo,v
retrieving revision 1.94
diff -u -p -r1.94 distinfo
--- postgresql/distinfo 15 Aug 2022 18:07:16 -0000 1.94
+++ postgresql/distinfo 13 Oct 2022 14:46:34 -0000
@@ -1,2 +1,2 @@
-SHA256 (postgresql-14.5.tar.gz) = kOrTk9vGVMsAdeqvDsIFjmuYZs7UeP7TzytopbwE6yQ=
-SIZE (postgresql-14.5.tar.gz) = 28988974
+SHA256 (postgresql-15.0.tar.gz) = +cfJvanZNZuxN+1RCsHPkOavofc5wGFrtrY3srwstgQ=
+SIZE (postgresql-15.0.tar.gz) = 29385837
Index: postgresql/patches/patch-src_backend_storage_ipc_dsm_impl_c
===================================================================
RCS file: postgresql/patches/patch-src_backend_storage_ipc_dsm_impl_c
diff -N postgresql/patches/patch-src_backend_storage_ipc_dsm_impl_c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ postgresql/patches/patch-src_backend_storage_ipc_dsm_impl_c 13 Jul 2022 19:14:13 -0000
@@ -0,0 +1,27 @@
+Use sysv shared memory instead of posix, even if posix specified.
+
+Without this change, with the default dynamic_shared_memory_type = posix,
+shared memory files would be created in /tmp via shm_open, and the
+database would stop working after a week as /etc/daily deletes files more
+than a week old.
+
+Previous versions of PostgreSQL on OpenBSD use dynamic_shared_memory_type = posix,
+but for some reason they don't have this issue. Since many users copy settings
+from previous postgresql.conf when upgrading, it's likely they will copy this
+setting, which will appear to work, until it fails after a week.
+
+This silently treats dynamic_shared_memory_type = posix as sysv, which doesn't
+have this issue as it does not use temporary files.
+
+Index: src/backend/storage/ipc/dsm_impl.c
+--- src/backend/storage/ipc/dsm_impl.c.orig
++++ src/backend/storage/ipc/dsm_impl.c
+@@ -170,8 +170,6 @@ dsm_impl_op(dsm_op op, dsm_handle handle, Size request
+ {
+ #ifdef USE_DSM_POSIX
+ case DSM_IMPL_POSIX:
+- return dsm_impl_posix(op, handle, request_size, impl_private,
+- mapped_address, mapped_size, elevel);
+

No comments:

Post a Comment