Adding NetBSD and OpenBSD to Postgres CI
Hi,
NetBSD and OpenBSD Postgres CI images are generated [1]https://github.com/anarazel/pg-vm-images but their tasks are
not added to the upstream Postgres yet. The attached patch adds NetBSD and
OpenBSD tasks to the Postgres CI.
I made these tasks triggered manually like MinGW task to save CI credits
but a related line is commented out for now to trigger CFBot.
CPU: 2 and TEST_JOBS: 8 are chosen based on manual tests.
╔══════════════════════╦════════╦═════════╗
║ CI Run Tim ║ ║ ║
║ (Only Test Step) ║ NetBSD ║ OpenBSD ║
║ (in minutes:seconds) ║ ║ ║
╠══════════════════════╬════════╬═════════╣
║ CPU: 2, TJ: 4 ║ 13:18 ║ 17:07 ║
╠══════════════════════╬════════╬═════════╣
║ CPU: 2, TJ: 6 ║ 11:01 ║ 16:23 ║
╠══════════════════════╬════════╬═════════╣
║ CPU: 2, TJ: 8 ║ 10:14 ║ 15:41 ║
╠══════════════════════╬════════╬═════════╣
║ CPU: 4, TJ: 4 ║ 11:46 ║ 16:03 ║
╠══════════════════════╬════════╬═════════╣
║ CPU: 4, TJ: 6 ║ 09:56 ║ 14:59 ║
╠══════════════════════╬════════╬═════════╣
║ CPU: 4, TJ: 8 ║ 10:02 ║ 15:09 ║
╚══════════════════════╩════════╩═════════╝
Any kind of feedback would be appreciated.
[1]: https://github.com/anarazel/pg-vm-images
--
Regards,
Nazir Bilal Yavuz
Microsoft
Attachments:
v1-0001-Add-NetBSD-and-OpenBSD-tasks-to-the-Postgres-CI.patchtext/x-patch; charset=US-ASCII; name=v1-0001-Add-NetBSD-and-OpenBSD-tasks-to-the-Postgres-CI.patchDownload
From 18acef23ac64ec8906d05d19f47f097c96ef3b45 Mon Sep 17 00:00:00 2001
From: Nazir Bilal Yavuz <byavuz81@gmail.com>
Date: Fri, 1 Nov 2024 12:02:29 +0300
Subject: [PATCH v1] Add NetBSD and OpenBSD tasks to the Postgres CI
NetBSD and OpenBSD Postgres CI images are generated [1] but their tasks
are not added to the upstream Postgres yet. This patch adds them.
Note: These tasks will be triggered manually to save CI credits but a
related line is commented out for now to trigger CFBot.
[1] https://github.com/anarazel/pg-vm-images
---
.cirrus.tasks.yml | 82 +++++++++++++++++++++++++++++++++++++++++++++++
.cirrus.yml | 10 ++++++
2 files changed, 92 insertions(+)
diff --git a/.cirrus.tasks.yml b/.cirrus.tasks.yml
index 90cb95c8681..6c57584bdf9 100644
--- a/.cirrus.tasks.yml
+++ b/.cirrus.tasks.yml
@@ -214,6 +214,88 @@ task:
cores_script: src/tools/ci/cores_backtrace.sh freebsd /tmp/cores
+task:
+ depends_on: SanityCheck
+ # trigger_type: manual
+
+ env:
+ # Below are experimentally derived to be a decent choice.
+ CPUS: 2
+ BUILD_JOBS: 8
+ TEST_JOBS: 8
+
+ CIRRUS_WORKING_DIR: /home/postgres/postgres
+ CCACHE_DIR: /tmp/ccache_dir
+
+ PATH: /usr/sbin:$PATH
+
+ # Postgres interprets LANG as a 'en_US.UTF-8' but it is 'C', then
+ # Postgres tries to set 'LC_COLLATE' to 'en_US.UTF-8' but it is not
+ # changeable. Initdb fails because of that. So, LANG is forced to be 'C'.
+ LANG: "C"
+ LC_ALL: "C"
+
+ matrix:
+ - name: NetBSD - 10 - Meson
+ only_if: $CIRRUS_CHANGE_MESSAGE !=~ '.*\nci-os-only:.*' || $CIRRUS_CHANGE_MESSAGE =~ '.*\nci-os-only:[^\n]*netbsd.*'
+ env:
+ IMAGE_FAMILY: pg-ci-netbsd-postgres
+ INCLUDE_DIRS: -Dextra_lib_dirs=/usr/pkg/lib -Dextra_include_dirs=/usr/pkg/include
+ <<: *netbsd_task_template
+
+ - name: OpenBSD - 7 - Meson
+ only_if: $CIRRUS_CHANGE_MESSAGE !=~ '.*\nci-os-only:.*' || $CIRRUS_CHANGE_MESSAGE =~ '.*\nci-os-only:[^\n]*openbsd.*'
+ env:
+ IMAGE_FAMILY: pg-ci-openbsd-postgres
+ INCLUDE_DIRS: -Dextra_include_dirs=/usr/local/include -Dextra_lib_dirs=/usr/local/lib
+ UUID: -Duuid=e2fs
+ <<: *openbsd_task_template
+
+ sysinfo_script: |
+ locale
+ id
+ uname -a
+ ulimit -a -H && ulimit -a -S
+ env
+
+ ccache_cache:
+ folder: $CCACHE_DIR
+
+ create_user_script: |
+ useradd postgres
+ chown -R postgres:users /home/postgres
+ mkdir -p ${CCACHE_DIR}
+ chown -R postgres:users ${CCACHE_DIR}
+
+ # -Duuid=bsd is not set since 'bsd' uuid option
+ # is not working on NetBSD & OpenBSD. See
+ # https://www.postgresql.org/message-id/17358-89806e7420797025@postgresql.org
+ # And other uuid options are not available on NetBSD.
+ configure_script: |
+ su postgres <<-EOF
+ meson setup \
+ --buildtype debug \
+ -Dcassert=true -Dssl=openssl ${UUID} \
+ -DPG_TEST_EXTRA="$PG_TEST_EXTRA" \
+ ${INCLUDE_DIRS} \
+ build
+ EOF
+
+ build_script: su postgres -c 'ninja -C build -j${BUILD_JOBS}'
+ upload_caches: ccache
+
+ test_world_script: |
+ su postgres <<-EOF
+ ulimit -c unlimited
+ # Otherwise tests will fail on OpenBSD, due to the lack of enough processes.
+ ulimit -p 256
+ meson test $MTEST_ARGS --num-processes ${TEST_JOBS}
+ EOF
+
+ on_failure:
+ <<: *on_failure_meson
+
+
# configure feature flags, shared between the task running the linux tests and
# the CompilerWarnings task
LINUX_CONFIGURE_FEATURES: &LINUX_CONFIGURE_FEATURES >-
diff --git a/.cirrus.yml b/.cirrus.yml
index a83129ae46d..33c6e481d74 100644
--- a/.cirrus.yml
+++ b/.cirrus.yml
@@ -52,6 +52,16 @@ default_freebsd_task_template: &freebsd_task_template
PLATFORM: freebsd
<<: *cirrus_community_vm_template
+default_netbsd_task_template: &netbsd_task_template
+ env:
+ PLATFORM: netbsd
+ <<: *cirrus_community_vm_template
+
+default_openbsd_task_template: &openbsd_task_template
+ env:
+ PLATFORM: openbsd
+ <<: *cirrus_community_vm_template
+
default_windows_task_template: &windows_task_template
env:
--
2.45.2
On 01.11.24 10:17, Nazir Bilal Yavuz wrote:
NetBSD and OpenBSD Postgres CI images are generated [1] but their tasks
are not added to the upstream Postgres yet. The attached patch adds
NetBSD and OpenBSD tasks to the Postgres CI.I made these tasks triggered manually like MinGW task to save CI credits
but a related line is commented out for now to trigger CFBot.
This seems useful to me. It would add some more testability for
LibreSSL for example.
I noticed that neither the existing FreeBSD task nor the new OpenBSD one
find the bsd_auth.h header. I thought this would be good to get more
testing of that code. Do you know why that is?
Hi,
Thanks for the patch!
On 2024-11-01 12:17:00 +0300, Nazir Bilal Yavuz wrote:
I made these tasks triggered manually like MinGW task to save CI credits
but a related line is commented out for now to trigger CFBot.
Oh, I need to pick my patch which allows repo-level config of which tasks run
back up. Then we can enable these by default for cfbot, but not for individual
repos...
+task: + depends_on: SanityCheck + # trigger_type: manual + + env: + # Below are experimentally derived to be a decent choice. + CPUS: 2 + BUILD_JOBS: 8 + TEST_JOBS: 8 + + CIRRUS_WORKING_DIR: /home/postgres/postgres
Why do you need to set that?
+ CCACHE_DIR: /tmp/ccache_dir + + PATH: /usr/sbin:$PATH + + # Postgres interprets LANG as a 'en_US.UTF-8' but it is 'C', then
What does "Postgres interprets LANG as a 'en_US.UTF-8'" mean?
+ # Postgres tries to set 'LC_COLLATE' to 'en_US.UTF-8' but it is not + # changeable. Initdb fails because of that. So, LANG is forced to be 'C'. + LANG: "C" + LC_ALL: "C"
+ matrix: + - name: NetBSD - 10 - Meson + only_if: $CIRRUS_CHANGE_MESSAGE !=~ '.*\nci-os-only:.*' || $CIRRUS_CHANGE_MESSAGE =~ '.*\nci-os-only:[^\n]*netbsd.*' + env: + IMAGE_FAMILY: pg-ci-netbsd-postgres + INCLUDE_DIRS: -Dextra_lib_dirs=/usr/pkg/lib -Dextra_include_dirs=/usr/pkg/include + <<: *netbsd_task_template + + - name: OpenBSD - 7 - Meson + only_if: $CIRRUS_CHANGE_MESSAGE !=~ '.*\nci-os-only:.*' || $CIRRUS_CHANGE_MESSAGE =~ '.*\nci-os-only:[^\n]*openbsd.*' + env: + IMAGE_FAMILY: pg-ci-openbsd-postgres + INCLUDE_DIRS: -Dextra_include_dirs=/usr/local/include -Dextra_lib_dirs=/usr/local/lib + UUID: -Duuid=e2fs
Shouldn't something be added to PKG_CONFIG_PATH / --pkg-config-path?
For other OSs we have stanzas like
setup_additional_packages_script: |
#apt-get update
#DEBIAN_FRONTEND=noninteractive apt-get -y install ...
it'd be good to have something similar for openbsd/netbsd, given that most
won't be as familiar with that.
+ <<: *openbsd_task_template + sysinfo_script: | + locale + id + uname -a + ulimit -a -H && ulimit -a -S + env + + ccache_cache: + folder: $CCACHE_DIR + + create_user_script: | + useradd postgres + chown -R postgres:users /home/postgres + mkdir -p ${CCACHE_DIR} + chown -R postgres:users ${CCACHE_DIR} + + # -Duuid=bsd is not set since 'bsd' uuid option + # is not working on NetBSD & OpenBSD. See + # https://www.postgresql.org/message-id/17358-89806e7420797025@postgresql.org + # And other uuid options are not available on NetBSD. + configure_script: | + su postgres <<-EOF + meson setup \ + --buildtype debug \
I suspect it'd be good to either add -Og to cflags (as done in a bunch of
other tasks) or to use debugoptimized, given that the tests on these machines
are fairly slow.
+ -Dcassert=true -Dssl=openssl ${UUID} \ + -DPG_TEST_EXTRA="$PG_TEST_EXTRA" \ + ${INCLUDE_DIRS} \ + build + EOF
Should probably enable injection points.
+ build_script: su postgres -c 'ninja -C build -j${BUILD_JOBS}' + upload_caches: ccache + + test_world_script: | + su postgres <<-EOF + ulimit -c unlimited + # Otherwise tests will fail on OpenBSD, due to the lack of enough processes. + ulimit -p 256 + meson test $MTEST_ARGS --num-processes ${TEST_JOBS} + EOF + + on_failure: + <<: *on_failure_meson + +
Right now you don't seem to be collecting core files - but you're still
enabling them via ulimit -c unlimited. At least we shouldn't use ulimit -c
unlimited without collecting core files, but it'd probably be better to add
support for collecting core files. Shouldn't be too hard.
Greetings,
Andres Freund
On 1 Nov 2024, at 12:16, Peter Eisentraut <peter@eisentraut.org> wrote:
On 01.11.24 10:17, Nazir Bilal Yavuz wrote:
NetBSD and OpenBSD Postgres CI images are generated [1] but their tasks are not added to the upstream Postgres yet. The attached patch adds NetBSD and OpenBSD tasks to the Postgres CI.
I made these tasks triggered manually like MinGW task to save CI credits but a related line is commented out for now to trigger CFBot.This seems useful to me. It would add some more testability for LibreSSL for example.
Seconded, I very much look forward to having LibreSSL in CI.
--
Daniel Gustafsson
Hi,
Thanks for the feedback!
On Fri, 1 Nov 2024 at 14:16, Peter Eisentraut <peter@eisentraut.org> wrote:
On 01.11.24 10:17, Nazir Bilal Yavuz wrote:
NetBSD and OpenBSD Postgres CI images are generated [1] but their tasks
are not added to the upstream Postgres yet. The attached patch adds
NetBSD and OpenBSD tasks to the Postgres CI.I made these tasks triggered manually like MinGW task to save CI credits
but a related line is commented out for now to trigger CFBot.This seems useful to me. It would add some more testability for
LibreSSL for example.I noticed that neither the existing FreeBSD task nor the new OpenBSD one
find the bsd_auth.h header. I thought this would be good to get more
testing of that code. Do you know why that is?
The 'bsd_auth.h' file does not exist in FreeBSD.
For the OpenBSD, it exists but its compilation fails with:
'''
/usr/include/bsd_auth.h:93:1: error: unknown type name 'quad_t'
/usr/include/bsd_auth.h:94:1: error: unknown type name 'quad_t
'''
These 'quad_t' types are defined in the 'sys/types.h' file. If I apply
the changes below:
"""
if cc.check_header('bsd_auth.h', required: bsd_authopt,
- args: test_c_args, include_directories: postgres_inc)
+ args: test_c_args, prefix: '#include <sys/types.h>',
+ include_directories: postgres_inc)
cdata.set('USE_BSD_AUTH', 1)
bsd_auth = declare_dependency()
endif
"""
Then, meson is able to find "bsd_auth.h" in the OpenBSD task and CI
finishes successfully [1]https://cirrus-ci.com/task/6516032758611968. But I am not sure if this is enough. Do we
need additional changes for the BSD authentication?
[1]: https://cirrus-ci.com/task/6516032758611968
--
Regards,
Nazir Bilal Yavuz
Microsoft
On 07.11.24 14:40, Nazir Bilal Yavuz wrote:
I noticed that neither the existing FreeBSD task nor the new OpenBSD one
find the bsd_auth.h header. I thought this would be good to get more
testing of that code. Do you know why that is?The 'bsd_auth.h' file does not exist in FreeBSD.
For the OpenBSD, it exists but its compilation fails with:
'''
/usr/include/bsd_auth.h:93:1: error: unknown type name 'quad_t'
/usr/include/bsd_auth.h:94:1: error: unknown type name 'quad_t
'''These 'quad_t' types are defined in the 'sys/types.h' file.
Makes sense. The synopsis in https://man.openbsd.org/authenticate.3 is:
#include <sys/types.h>
#include <login_cap.h>
#include <bsd_auth.h>
Hi,
On 2024-11-07 16:05:43 +0100, Peter Eisentraut wrote:
On 07.11.24 14:40, Nazir Bilal Yavuz wrote:
I noticed that neither the existing FreeBSD task nor the new OpenBSD one
find the bsd_auth.h header. I thought this would be good to get more
testing of that code. Do you know why that is?The 'bsd_auth.h' file does not exist in FreeBSD.
For the OpenBSD, it exists but its compilation fails with:
'''
/usr/include/bsd_auth.h:93:1: error: unknown type name 'quad_t'
/usr/include/bsd_auth.h:94:1: error: unknown type name 'quad_t
'''These 'quad_t' types are defined in the 'sys/types.h' file.
Makes sense. The synopsis in https://man.openbsd.org/authenticate.3 is:
#include <sys/types.h>
#include <login_cap.h>
#include <bsd_auth.h>
It doesn't really make sense to me - it seems like a bug if system headers
aren't standalone. And the synopsys including a header doesn't seem to
obviously indicate that every user has to do so.
But anyway, we probably just have to deal with the world as it, rather than
how it should be :(
Greetings,
Andres Freund
Hi,
On Fri, 1 Nov 2024 at 21:44, Andres Freund <andres@anarazel.de> wrote:
Hi,
Thanks for the patch!
On 2024-11-01 12:17:00 +0300, Nazir Bilal Yavuz wrote:
I made these tasks triggered manually like MinGW task to save CI credits
but a related line is commented out for now to trigger CFBot.Oh, I need to pick my patch which allows repo-level config of which tasks run
back up. Then we can enable these by default for cfbot, but not for individual
repos...+task: + depends_on: SanityCheck + # trigger_type: manual + + env: + # Below are experimentally derived to be a decent choice. + CPUS: 2 + BUILD_JOBS: 8 + TEST_JOBS: 8 + + CIRRUS_WORKING_DIR: /home/postgres/postgresWhy do you need to set that?
Otherwise, it is set to /tmp path and the size of /tmp mount point is
1.2GB, which is not enough.
+ CCACHE_DIR: /tmp/ccache_dir + + PATH: /usr/sbin:$PATH + + # Postgres interprets LANG as a 'en_US.UTF-8' but it is 'C', thenWhat does "Postgres interprets LANG as a 'en_US.UTF-8'" mean?
It was because initdb was failing on NetBSD when the LANG and LC_ALL
is not set to C. I rephrased the comment and moved this under NetBSD
task.
+ # Postgres tries to set 'LC_COLLATE' to 'en_US.UTF-8' but it is not + # changeable. Initdb fails because of that. So, LANG is forced to be 'C'. + LANG: "C" + LC_ALL: "C"+ matrix: + - name: NetBSD - 10 - Meson + only_if: $CIRRUS_CHANGE_MESSAGE !=~ '.*\nci-os-only:.*' || $CIRRUS_CHANGE_MESSAGE =~ '.*\nci-os-only:[^\n]*netbsd.*' + env: + IMAGE_FAMILY: pg-ci-netbsd-postgres + INCLUDE_DIRS: -Dextra_lib_dirs=/usr/pkg/lib -Dextra_include_dirs=/usr/pkg/include + <<: *netbsd_task_template + + - name: OpenBSD - 7 - Meson + only_if: $CIRRUS_CHANGE_MESSAGE !=~ '.*\nci-os-only:.*' || $CIRRUS_CHANGE_MESSAGE =~ '.*\nci-os-only:[^\n]*openbsd.*' + env: + IMAGE_FAMILY: pg-ci-openbsd-postgres + INCLUDE_DIRS: -Dextra_include_dirs=/usr/local/include -Dextra_lib_dirs=/usr/local/lib + UUID: -Duuid=e2fsShouldn't something be added to PKG_CONFIG_PATH / --pkg-config-path?
I don't think so. Both OSes are able to find pkgconfig at
'/usr/pkg/bin/pkg-config'. Am I missing something?
For other OSs we have stanzas like
setup_additional_packages_script: |
#apt-get update
#DEBIAN_FRONTEND=noninteractive apt-get -y install ...it'd be good to have something similar for openbsd/netbsd, given that most
won't be as familiar with that.
Done.
+ <<: *openbsd_task_template + sysinfo_script: | + locale + id + uname -a + ulimit -a -H && ulimit -a -S + env + + ccache_cache: + folder: $CCACHE_DIR + + create_user_script: | + useradd postgres + chown -R postgres:users /home/postgres + mkdir -p ${CCACHE_DIR} + chown -R postgres:users ${CCACHE_DIR} + + # -Duuid=bsd is not set since 'bsd' uuid option + # is not working on NetBSD & OpenBSD. See + # https://www.postgresql.org/message-id/17358-89806e7420797025@postgresql.org + # And other uuid options are not available on NetBSD. + configure_script: | + su postgres <<-EOF + meson setup \ + --buildtype debug \I suspect it'd be good to either add -Og to cflags (as done in a bunch of
other tasks) or to use debugoptimized, given that the tests on these machines
are fairly slow.
Done.
+ -Dcassert=true -Dssl=openssl ${UUID} \ + -DPG_TEST_EXTRA="$PG_TEST_EXTRA" \ + ${INCLUDE_DIRS} \ + build + EOFShould probably enable injection points.
Done.
+ build_script: su postgres -c 'ninja -C build -j${BUILD_JOBS}' + upload_caches: ccache + + test_world_script: | + su postgres <<-EOF + ulimit -c unlimited + # Otherwise tests will fail on OpenBSD, due to the lack of enough processes. + ulimit -p 256 + meson test $MTEST_ARGS --num-processes ${TEST_JOBS} + EOF + + on_failure: + <<: *on_failure_meson + +Right now you don't seem to be collecting core files - but you're still
enabling them via ulimit -c unlimited. At least we shouldn't use ulimit -c
unlimited without collecting core files, but it'd probably be better to add
support for collecting core files. Shouldn't be too hard.
Done. I separated this patch to make review easier.
--
Regards,
Nazir Bilal Yavuz
Microsoft
Attachments:
v2-0001-Fix-meson-could-not-find-bsd_auth.h.patchtext/x-patch; charset=US-ASCII; name=v2-0001-Fix-meson-could-not-find-bsd_auth.h.patchDownload
From cbea598b11e85b5c7090ca8e9cc05c35f0359f54 Mon Sep 17 00:00:00 2001
From: Nazir Bilal Yavuz <byavuz81@gmail.com>
Date: Thu, 7 Nov 2024 15:48:31 +0300
Subject: [PATCH v2 1/3] Fix meson could not find bsd_auth.h
bsd_auth.h file needs to be compiled together with the 'sys/types.h' as
it has missing type definitions.
See synopsis at https://man.openbsd.org/authenticate.3
---
meson.build | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/meson.build b/meson.build
index 5b0510cef78..84107955d5d 100644
--- a/meson.build
+++ b/meson.build
@@ -551,7 +551,8 @@ test_c_args = cppflags + cflags
bsd_authopt = get_option('bsd_auth')
bsd_auth = not_found_dep
if cc.check_header('bsd_auth.h', required: bsd_authopt,
- args: test_c_args, include_directories: postgres_inc)
+ args: test_c_args, prefix: '#include <sys/types.h>',
+ include_directories: postgres_inc)
cdata.set('USE_BSD_AUTH', 1)
bsd_auth = declare_dependency()
endif
--
2.45.2
v2-0002-Add-NetBSD-and-OpenBSD-tasks-to-the-Postgres-CI.patchtext/x-patch; charset=US-ASCII; name=v2-0002-Add-NetBSD-and-OpenBSD-tasks-to-the-Postgres-CI.patchDownload
From cd5bb66a55e5226b543f5b7db9128cfa48e338e3 Mon Sep 17 00:00:00 2001
From: Nazir Bilal Yavuz <byavuz81@gmail.com>
Date: Mon, 11 Nov 2024 13:23:22 +0300
Subject: [PATCH v2 2/3] Add NetBSD and OpenBSD tasks to the Postgres CI
NetBSD and OpenBSD Postgres CI images are generated [1] but their tasks
are not added to the upstream Postgres yet. This patch adds them.
Note: These tasks will be triggered manually to save CI credits but a
related line is commented out for now to trigger CFBot.
Author: Nazir Bilal Yavuz <byavuz81@gmail.com>
[1] https://github.com/anarazel/pg-vm-images
---
.cirrus.tasks.yml | 84 +++++++++++++++++++++++++++++++++++++++++++++++
.cirrus.yml | 10 ++++++
2 files changed, 94 insertions(+)
diff --git a/.cirrus.tasks.yml b/.cirrus.tasks.yml
index fc413eb11ef..f338af902aa 100644
--- a/.cirrus.tasks.yml
+++ b/.cirrus.tasks.yml
@@ -213,6 +213,90 @@ task:
cores_script: src/tools/ci/cores_backtrace.sh freebsd /tmp/cores
+task:
+ depends_on: SanityCheck
+ # trigger_type: manual
+
+ env:
+ # Below are experimentally derived to be a decent choice.
+ CPUS: 2
+ BUILD_JOBS: 8
+ TEST_JOBS: 8
+
+ CIRRUS_WORKING_DIR: /home/postgres/postgres
+ CCACHE_DIR: /tmp/ccache_dir
+
+ PATH: /usr/sbin:$PATH
+
+ matrix:
+ - name: NetBSD - 10 - Meson
+ only_if: $CIRRUS_CHANGE_MESSAGE !=~ '.*\nci-os-only:.*' || $CIRRUS_CHANGE_MESSAGE =~ '.*\nci-os-only:[^\n]*netbsd.*'
+ env:
+ IMAGE_FAMILY: pg-ci-netbsd-postgres
+ INCLUDE_DIRS: -Dextra_include_dirs=/usr/pkg/include -Dextra_lib_dirs=/usr/pkg/lib
+ # initdb fails with: 'invalid locale settings' error on NetBSD.
+ # Force 'LANG' and 'LC_*' variables to be 'C'.
+ LANG: "C"
+ LC_ALL: "C"
+ setup_additional_packages_script: |
+ #pkgin -y install ...
+ <<: *netbsd_task_template
+
+ - name: OpenBSD - 7 - Meson
+ only_if: $CIRRUS_CHANGE_MESSAGE !=~ '.*\nci-os-only:.*' || $CIRRUS_CHANGE_MESSAGE =~ '.*\nci-os-only:[^\n]*openbsd.*'
+ env:
+ IMAGE_FAMILY: pg-ci-openbsd-postgres
+ INCLUDE_DIRS: -Dextra_include_dirs=/usr/local/include -Dextra_lib_dirs=/usr/local/lib
+ UUID: -Duuid=e2fs
+ setup_additional_packages_script: |
+ #pkg_add -I ...
+ <<: *openbsd_task_template
+
+ sysinfo_script: |
+ locale
+ id
+ uname -a
+ ulimit -a -H && ulimit -a -S
+ env
+
+ ccache_cache:
+ folder: $CCACHE_DIR
+
+ create_user_script: |
+ useradd postgres
+ chown -R postgres:users /home/postgres
+ mkdir -p ${CCACHE_DIR}
+ chown -R postgres:users ${CCACHE_DIR}
+
+ # -Duuid=bsd is not set since 'bsd' uuid option
+ # is not working on NetBSD & OpenBSD. See
+ # https://www.postgresql.org/message-id/17358-89806e7420797025@postgresql.org
+ # And other uuid options are not available on NetBSD.
+ configure_script: |
+ su postgres <<-EOF
+ meson setup \
+ --buildtype=debugoptimized \
+ -Dcassert=true -Dinjection_points=true \
+ -Dssl=openssl ${UUID} \
+ -DPG_TEST_EXTRA="$PG_TEST_EXTRA" \
+ ${INCLUDE_DIRS} \
+ build
+ EOF
+
+ build_script: su postgres -c 'ninja -C build -j${BUILD_JOBS}'
+ upload_caches: ccache
+
+ test_world_script: |
+ su postgres <<-EOF
+ # Otherwise tests will fail on OpenBSD, due to the lack of enough processes.
+ ulimit -p 256
+ meson test $MTEST_ARGS --num-processes ${TEST_JOBS}
+ EOF
+
+ on_failure:
+ <<: *on_failure_meson
+
+
# configure feature flags, shared between the task running the linux tests and
# the CompilerWarnings task
LINUX_CONFIGURE_FEATURES: &LINUX_CONFIGURE_FEATURES >-
diff --git a/.cirrus.yml b/.cirrus.yml
index a83129ae46d..33c6e481d74 100644
--- a/.cirrus.yml
+++ b/.cirrus.yml
@@ -52,6 +52,16 @@ default_freebsd_task_template: &freebsd_task_template
PLATFORM: freebsd
<<: *cirrus_community_vm_template
+default_netbsd_task_template: &netbsd_task_template
+ env:
+ PLATFORM: netbsd
+ <<: *cirrus_community_vm_template
+
+default_openbsd_task_template: &openbsd_task_template
+ env:
+ PLATFORM: openbsd
+ <<: *cirrus_community_vm_template
+
default_windows_task_template: &windows_task_template
env:
--
2.45.2
v2-0003-Collect-core-files-on-NetBSD-and-OpenBSD.patchtext/x-patch; charset=US-ASCII; name=v2-0003-Collect-core-files-on-NetBSD-and-OpenBSD.patchDownload
From 6f43797df839c189545d87b5c9ccbf45403cf631 Mon Sep 17 00:00:00 2001
From: Nazir Bilal Yavuz <byavuz81@gmail.com>
Date: Mon, 11 Nov 2024 17:27:08 +0300
Subject: [PATCH v2 3/3] Collect core files on NetBSD and OpenBSD
---
.cirrus.tasks.yml | 17 ++++++++++++++++-
src/tools/ci/cores_backtrace.sh | 6 ++++--
2 files changed, 20 insertions(+), 3 deletions(-)
diff --git a/.cirrus.tasks.yml b/.cirrus.tasks.yml
index f338af902aa..a1500b42e4c 100644
--- a/.cirrus.tasks.yml
+++ b/.cirrus.tasks.yml
@@ -210,7 +210,7 @@ task:
build/tmp_install/usr/local/pgsql/bin/pg_ctl -D build/runningcheck stop || true
EOF
<<: *on_failure_meson
- cores_script: src/tools/ci/cores_backtrace.sh freebsd /tmp/cores
+ cores_script: src/tools/ci/cores_backtrace.sh bsd /tmp/cores
task:
@@ -227,11 +227,13 @@ task:
CCACHE_DIR: /tmp/ccache_dir
PATH: /usr/sbin:$PATH
+ CORE_DUMP_DIR: /var/crash
matrix:
- name: NetBSD - 10 - Meson
only_if: $CIRRUS_CHANGE_MESSAGE !=~ '.*\nci-os-only:.*' || $CIRRUS_CHANGE_MESSAGE =~ '.*\nci-os-only:[^\n]*netbsd.*'
env:
+ OS_NAME: netbsd
IMAGE_FAMILY: pg-ci-netbsd-postgres
INCLUDE_DIRS: -Dextra_include_dirs=/usr/pkg/include -Dextra_lib_dirs=/usr/pkg/lib
# initdb fails with: 'invalid locale settings' error on NetBSD.
@@ -245,11 +247,14 @@ task:
- name: OpenBSD - 7 - Meson
only_if: $CIRRUS_CHANGE_MESSAGE !=~ '.*\nci-os-only:.*' || $CIRRUS_CHANGE_MESSAGE =~ '.*\nci-os-only:[^\n]*openbsd.*'
env:
+ OS_NAME: openbsd
IMAGE_FAMILY: pg-ci-openbsd-postgres
INCLUDE_DIRS: -Dextra_include_dirs=/usr/local/include -Dextra_lib_dirs=/usr/local/lib
UUID: -Duuid=e2fs
setup_additional_packages_script: |
#pkg_add -I ...
+ # Always core dump to ${CORE_DUMP_DIR}
+ set_core_dump_script: sysctl -w kern.nosuidcoredump=2
<<: *openbsd_task_template
sysinfo_script: |
@@ -267,6 +272,10 @@ task:
chown -R postgres:users /home/postgres
mkdir -p ${CCACHE_DIR}
chown -R postgres:users ${CCACHE_DIR}
+ setup_core_files_script: |
+ mkdir -p ${CORE_DUMP_DIR}
+ chmod -R 770 ${CORE_DUMP_DIR}
+ chown -R postgres:users ${CORE_DUMP_DIR}
# -Duuid=bsd is not set since 'bsd' uuid option
# is not working on NetBSD & OpenBSD. See
@@ -288,6 +297,7 @@ task:
test_world_script: |
su postgres <<-EOF
+ ulimit -c unlimited
# Otherwise tests will fail on OpenBSD, due to the lack of enough processes.
ulimit -p 256
meson test $MTEST_ARGS --num-processes ${TEST_JOBS}
@@ -295,6 +305,11 @@ task:
on_failure:
<<: *on_failure_meson
+ cores_script: |
+ # Although OSes are forced to core dump inside ${CORE_DUMP_DIR}, they may
+ # not obey this. So, move core files to the ${CORE_DUMP_DIR} directory.
+ find build/ -maxdepth 1 -type f -name '*.core' -exec mv '{}' ${CORE_DUMP_DIR} \;
+ src/tools/ci/cores_backtrace.sh ${OS_NAME} ${CORE_DUMP_DIR}
# configure feature flags, shared between the task running the linux tests and
diff --git a/src/tools/ci/cores_backtrace.sh b/src/tools/ci/cores_backtrace.sh
index 28d3cecfc67..4b174a5cf56 100755
--- a/src/tools/ci/cores_backtrace.sh
+++ b/src/tools/ci/cores_backtrace.sh
@@ -9,7 +9,7 @@ os=$1
directory=$2
case $os in
- freebsd|linux|macos)
+ freebsd|netbsd|openbsd|linux|macos)
;;
*)
echo "unsupported operating system ${os}"
@@ -26,7 +26,7 @@ for corefile in $(find "$directory" -type f) ; do
echo -e '\n\n'
fi
- if [ "$os" = 'macos' ]; then
+ if [ "$os" = 'macos' ] || [ "$os" = 'openbsd' ]; then
lldb -c $corefile --batch -o 'thread backtrace all' -o 'quit'
else
auxv=$(gdb --quiet --core ${corefile} --batch -ex 'info auxv' 2>/dev/null)
@@ -37,6 +37,8 @@ for corefile in $(find "$directory" -type f) ; do
if [ "$os" = 'freebsd' ]; then
binary=$(echo "$auxv" | grep AT_EXECPATH | perl -pe "s/^.*\"(.*)\"\$/\$1/g")
+ elif [ "$os" = 'netbsd' ]; then
+ binary=$(echo "$auxv" | grep AT_SUN_EXECNAME | perl -pe "s/^.*\"(.*)\"\$/\$1/g")
elif [ "$os" = 'linux' ]; then
binary=$(echo "$auxv" | grep AT_EXECFN | perl -pe "s/^.*\"(.*)\"\$/\$1/g")
else
--
2.45.2
Hi,
On 2024-11-12 11:38:11 +0300, Nazir Bilal Yavuz wrote:
On Fri, 1 Nov 2024 at 21:44, Andres Freund <andres@anarazel.de> wrote:
+ CCACHE_DIR: /tmp/ccache_dir + + PATH: /usr/sbin:$PATH + + # Postgres interprets LANG as a 'en_US.UTF-8' but it is 'C', thenWhat does "Postgres interprets LANG as a 'en_US.UTF-8'" mean?
It was because initdb was failing on NetBSD when the LANG and LC_ALL
is not set to C. I rephrased the comment and moved this under NetBSD
task.
Do you happen to have a reference to the failure? The environment variables +
the exact error message would be good. Kinda feels like that shouldn't
happen with a default netbsd install.
+ matrix: + - name: NetBSD - 10 - Meson + only_if: $CIRRUS_CHANGE_MESSAGE !=~ '.*\nci-os-only:.*' || $CIRRUS_CHANGE_MESSAGE =~ '.*\nci-os-only:[^\n]*netbsd.*' + env: + IMAGE_FAMILY: pg-ci-netbsd-postgres + INCLUDE_DIRS: -Dextra_lib_dirs=/usr/pkg/lib -Dextra_include_dirs=/usr/pkg/include + <<: *netbsd_task_template + + - name: OpenBSD - 7 - Meson + only_if: $CIRRUS_CHANGE_MESSAGE !=~ '.*\nci-os-only:.*' || $CIRRUS_CHANGE_MESSAGE =~ '.*\nci-os-only:[^\n]*openbsd.*' + env: + IMAGE_FAMILY: pg-ci-openbsd-postgres + INCLUDE_DIRS: -Dextra_include_dirs=/usr/local/include -Dextra_lib_dirs=/usr/local/lib + UUID: -Duuid=e2fsShouldn't something be added to PKG_CONFIG_PATH / --pkg-config-path?
I don't think so. Both OSes are able to find pkgconfig at
'/usr/pkg/bin/pkg-config'. Am I missing something?
--pkg-config-path is about the the path to pkg-config files, not the path to
the pkg-config binary. If set we shouldn't need the
extra_lib_dirs/extra_include_dirs, I think.
Right now you don't seem to be collecting core files - but you're still
enabling them via ulimit -c unlimited. At least we shouldn't use ulimit -c
unlimited without collecting core files, but it'd probably be better to add
support for collecting core files. Shouldn't be too hard.Done. I separated this patch to make review easier.
+1
From cbea598b11e85b5c7090ca8e9cc05c35f0359f54 Mon Sep 17 00:00:00 2001
From: Nazir Bilal Yavuz <byavuz81@gmail.com>
Date: Thu, 7 Nov 2024 15:48:31 +0300
Subject: [PATCH v2 1/3] Fix meson could not find bsd_auth.hbsd_auth.h file needs to be compiled together with the 'sys/types.h' as
it has missing type definitions.See synopsis at https://man.openbsd.org/authenticate.3
---
meson.build | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)diff --git a/meson.build b/meson.build index 5b0510cef78..84107955d5d 100644 --- a/meson.build +++ b/meson.build @@ -551,7 +551,8 @@ test_c_args = cppflags + cflags bsd_authopt = get_option('bsd_auth') bsd_auth = not_found_dep if cc.check_header('bsd_auth.h', required: bsd_authopt, - args: test_c_args, include_directories: postgres_inc) + args: test_c_args, prefix: '#include <sys/types.h>', + include_directories: postgres_inc) cdata.set('USE_BSD_AUTH', 1) bsd_auth = declare_dependency() endif --
Was about to apply that, but then started to wonder if we don't need the same
for configure? And it sure looks like that has the same problem?
Which also confuses me some, at some point this presumably worked?
From cd5bb66a55e5226b543f5b7db9128cfa48e338e3 Mon Sep 17 00:00:00 2001
From: Nazir Bilal Yavuz <byavuz81@gmail.com>
Date: Mon, 11 Nov 2024 13:23:22 +0300
Subject: [PATCH v2 2/3] Add NetBSD and OpenBSD tasks to the Postgres CINetBSD and OpenBSD Postgres CI images are generated [1] but their tasks
are not added to the upstream Postgres yet. This patch adds them.Note: These tasks will be triggered manually to save CI credits but a
related line is commented out for now to trigger CFBot.Author: Nazir Bilal Yavuz <byavuz81@gmail.com>
[1] https://github.com/anarazel/pg-vm-images
---
.cirrus.tasks.yml | 84 +++++++++++++++++++++++++++++++++++++++++++++++
.cirrus.yml | 10 ++++++
2 files changed, 94 insertions(+)diff --git a/.cirrus.tasks.yml b/.cirrus.tasks.yml index fc413eb11ef..f338af902aa 100644 --- a/.cirrus.tasks.yml +++ b/.cirrus.tasks.yml @@ -213,6 +213,90 @@ task: cores_script: src/tools/ci/cores_backtrace.sh freebsd /tmp/cores+task: + depends_on: SanityCheck + # trigger_type: manual + + env: + # Below are experimentally derived to be a decent choice. + CPUS: 2
For cfbot it turns out to be easier to just use 4 cpus for everything. What
time difference do you get from 2 vs 4 CPUs?
+ BUILD_JOBS: 8
+ TEST_JOBS: 8
8 build/test jobs for 2 cpus sounds unlikely to be close to optimal. A bit
higher makes sense, but 4x?
+ CIRRUS_WORKING_DIR: /home/postgres/postgres
I'd add a comment explaining why we're setting this.
+ CCACHE_DIR: /tmp/ccache_dir
And is it ok to put the ccache dir here, given the limited size of /tmp?
+ PATH: /usr/sbin:$PATH + + matrix: + - name: NetBSD - 10 - Meson
Given the image name doesn't include the version it seems we shouldn't include
it here either...
+ only_if: $CIRRUS_CHANGE_MESSAGE !=~ '.*\nci-os-only:.*' || $CIRRUS_CHANGE_MESSAGE =~ '.*\nci-os-only:[^\n]*netbsd.*' + env: + IMAGE_FAMILY: pg-ci-netbsd-postgres + INCLUDE_DIRS: -Dextra_include_dirs=/usr/pkg/include -Dextra_lib_dirs=/usr/pkg/lib + # initdb fails with: 'invalid locale settings' error on NetBSD. + # Force 'LANG' and 'LC_*' variables to be 'C'. + LANG: "C" + LC_ALL: "C" + setup_additional_packages_script: | + #pkgin -y install ... + <<: *netbsd_task_template + + - name: OpenBSD - 7 - Meson + only_if: $CIRRUS_CHANGE_MESSAGE !=~ '.*\nci-os-only:.*' || $CIRRUS_CHANGE_MESSAGE =~ '.*\nci-os-only:[^\n]*openbsd.*' + env: + IMAGE_FAMILY: pg-ci-openbsd-postgres + INCLUDE_DIRS: -Dextra_include_dirs=/usr/local/include -Dextra_lib_dirs=/usr/local/lib + UUID: -Duuid=e2fs
So for netbsd we're not using any uuid support? Ah, I see, it's documented
further down. Maybe reference that, or move the comment around?
+ # -Duuid=bsd is not set since 'bsd' uuid option + # is not working on NetBSD & OpenBSD. See + # https://www.postgresql.org/message-id/17358-89806e7420797025@postgresql.org + # And other uuid options are not available on NetBSD. + configure_script: | + su postgres <<-EOF + meson setup \ + --buildtype=debugoptimized \ + -Dcassert=true -Dinjection_points=true \ + -Dssl=openssl ${UUID} \ + -DPG_TEST_EXTRA="$PG_TEST_EXTRA" \ + ${INCLUDE_DIRS} \ + build + EOF
https://cirrus-ci.com/task/4879081273032704?logs=configure#L320
[14:48:50.729] Run-time dependency krb5-gssapi found: NO (tried pkgconfig and cmake)
[14:48:50.729] Library gssapi_krb5 found: NO
https://cirrus-ci.com/task/6286456156585984?logs=configure#L109
[14:49:28.049] Run-time dependency krb5-gssapi found: NO (tried pkgconfig and cmake)
[14:49:28.049] Library gssapi_krb5 found: NO
Is gss really not available / installed on either?
https://cirrus-ci.com/task/4879081273032704?logs=configure#L49-L51
[14:48:50.729] Run-time dependency tcl found: NO (tried pkgconfig and cmake)
[14:48:50.729] Library tcl found: NO
[14:48:50.729] Has header "tcl.h" with dependency -ltcl: NO
Is TCL not available on openbsd?
+ build_script: su postgres -c 'ninja -C build -j${BUILD_JOBS}' + upload_caches: ccache + + test_world_script: | + su postgres <<-EOF + # Otherwise tests will fail on OpenBSD, due to the lack of enough processes. + ulimit -p 256
Should we also increase the number of semaphores?
/messages/by-id/db2773a2-aca0-43d0-99c1-060efcd9954e@gmail.com
Perhaps it'd be better to update the system config earlier in the openbsd
specific portion of the test?
build/tmp_install/usr/local/pgsql/bin/pg_ctl -D build/runningcheck stop || true EOF <<: *on_failure_meson - cores_script: src/tools/ci/cores_backtrace.sh freebsd /tmp/cores + cores_script: src/tools/ci/cores_backtrace.sh bsd /tmp/cores
Hm, what's the deal with this change?
on_failure: <<: *on_failure_meson + cores_script: | + # Although OSes are forced to core dump inside ${CORE_DUMP_DIR}, they may + # not obey this. So, move core files to the ${CORE_DUMP_DIR} directory. + find build/ -maxdepth 1 -type f -name '*.core' -exec mv '{}' ${CORE_DUMP_DIR} \; + src/tools/ci/cores_backtrace.sh ${OS_NAME} ${CORE_DUMP_DIR}
s/OSs are forced/we try to configure the OS/
Is -maxdepth 1 really sufficient? The tests run in subdirectories, don't they?
Greetings,
Andres Freund
Hi,
Missed something until just after I hit send:
On 2024-11-12 11:38:11 +0300, Nazir Bilal Yavuz wrote:
+ matrix: + - name: NetBSD - 10 - Meson + only_if: $CIRRUS_CHANGE_MESSAGE !=~ '.*\nci-os-only:.*' || $CIRRUS_CHANGE_MESSAGE =~ '.*\nci-os-only:[^\n]*netbsd.*'
...
+ - name: OpenBSD - 7 - Meson + only_if: $CIRRUS_CHANGE_MESSAGE !=~ '.*\nci-os-only:.*' || $CIRRUS_CHANGE_MESSAGE =~ '.*\nci-os-only:[^\n]*openbsd.*'
Think these probably should be added to src/tools/ci/README
Greetings,
Andres Freund
Andres Freund <andres@anarazel.de> writes:
On 2024-11-12 11:38:11 +0300, Nazir Bilal Yavuz wrote:
It was because initdb was failing on NetBSD when the LANG and LC_ALL
is not set to C. I rephrased the comment and moved this under NetBSD
task.
Do you happen to have a reference to the failure? The environment variables +
the exact error message would be good. Kinda feels like that shouldn't
happen with a default netbsd install.
On mamba's host (pretty vanilla NetBSD 10.0):
$ env | grep ^L
LOGNAME=tgl
$ LANG=C initdb
... works fine ...
$ rm -rf $PGDATA
$ locale -a | grep en_US
en_US.ISO8859-1
en_US.ISO8859-15
en_US.US-ASCII
en_US.UTF-8
$ LANG=en_US.UTF-8 initdb
The files belonging to this database system will be owned by user "tgl".
This user must also own the server process.
initdb: error: invalid locale settings; check LANG and LC_* environment variables
I seem to recall noticing this when I was setting up mamba, but
I didn't feel like pursuing it so I just set the animal to test
only C locale.
Was about to apply that, but then started to wonder if we don't need the same
for configure? And it sure looks like that has the same problem?
Which also confuses me some, at some point this presumably worked?
The configure path does work on NetBSD 10, and has for some time.
I've never tested it with meson though.
regards, tom lane
I wrote:
Andres Freund <andres@anarazel.de> writes:
Was about to apply that, but then started to wonder if we don't need the same
for configure? And it sure looks like that has the same problem?
Which also confuses me some, at some point this presumably worked?
The configure path does work on NetBSD 10, and has for some time.
Ah, sorry, I'd forgotten that bsd_auth.h only exists on OpenBSD.
We correctly detect that the header is not there on NetBSD.
I tried it on OpenBSD 7.0, which is the only OpenBSD image I have
laying about at the moment, and configure correctly finds that the
"AC_CHECK_HEADER(bsd_auth.h, [], ...)" test succeeds. So it looks
to me like we should not need the sys/types.h include --- unless
they broke it in some more-recent release?
(It looks like none of our OpenBSD BF animals are testing
--with-bsd-auth, which is surely bad.)
regards, tom lane
Hi,
On 2024-12-17 12:44:46 -0500, Tom Lane wrote:
Andres Freund <andres@anarazel.de> writes:
On 2024-11-12 11:38:11 +0300, Nazir Bilal Yavuz wrote:
It was because initdb was failing on NetBSD when the LANG and LC_ALL
is not set to C. I rephrased the comment and moved this under NetBSD
task.Do you happen to have a reference to the failure? The environment variables +
the exact error message would be good. Kinda feels like that shouldn't
happen with a default netbsd install.On mamba's host (pretty vanilla NetBSD 10.0):
$ env | grep ^L
LOGNAME=tgl
$ LANG=C initdb
... works fine ...
$ rm -rf $PGDATA
$ locale -a | grep en_US
en_US.ISO8859-1
en_US.ISO8859-15
en_US.US-ASCII
en_US.UTF-8
$ LANG=en_US.UTF-8 initdb
The files belonging to this database system will be owned by user "tgl".
This user must also own the server process.initdb: error: invalid locale settings; check LANG and LC_* environment variables
I seem to recall noticing this when I was setting up mamba, but
I didn't feel like pursuing it so I just set the animal to test
only C locale.
Heh, I guess that's good enough for CI then too :)
It'd be helpful if the error message ought to at least include the category
being tested, perhaps it's just one category failing or such?
Greetings,
Andres Freund
Hi,
On 2024-12-17 13:09:49 -0500, Tom Lane wrote:
I wrote:
Andres Freund <andres@anarazel.de> writes:
Was about to apply that, but then started to wonder if we don't need the same
for configure? And it sure looks like that has the same problem?
Which also confuses me some, at some point this presumably worked?The configure path does work on NetBSD 10, and has for some time.
Ah, sorry, I'd forgotten that bsd_auth.h only exists on OpenBSD.
We correctly detect that the header is not there on NetBSD.I tried it on OpenBSD 7.0, which is the only OpenBSD image I have
laying about at the moment, and configure correctly finds that the
"AC_CHECK_HEADER(bsd_auth.h, [], ...)" test succeeds. So it looks
to me like we should not need the sys/types.h include --- unless
they broke it in some more-recent release?
It does look like it was recently broken:
/messages/by-id/CAN55FZ0czTmfnfF=WOHJUZ0iZRiMz6Yf3FSMbPh4=Z5a_TDjKw@mail.gmail.com
/usr/include/bsd_auth.h:93:1: error: unknown type name 'quad_t'
I'm pretty sure that it *did* work not too long ago with meson, because I had
tested the meson stuff on openbsd when I wrote it.
And as Peter noted:
The synopsis in https://man.openbsd.org/authenticate.3 is:
#include <sys/types.h>
#include <login_cap.h>
#include <bsd_auth.h>
Which does look a bit like they expect sys/types.h to be included first.
Looking at their git mirror, I do indeed not see anything that'd include
sys/types.h:
https://github.com/openbsd/src/blob/master/include/bsd_auth.h
first includes machine/_types.h, which I think maps to:
https://github.com/openbsd/src/blob/master/sys/arch/amd64/include/_types.h#L4
and then sys/cdefs.h:
https://github.com/openbsd/src/blob/master/sys/sys/cdefs.h
which I think in turn includes
https://github.com/openbsd/src/blob/master/sys/arch/amd64/include/cdefs.h
None of those define quad_t. But none seems to have changed in a relevant way
recently either.
I wonder if this is due to a newer compiler having different implicit includes
or something?
(It looks like none of our OpenBSD BF animals are testing
--with-bsd-auth, which is surely bad.)
Agreed.
Greetings,
Andres Freund
Hi,
On 2024-12-17 14:25:01 -0500, Andres Freund wrote:
On 2024-12-17 13:09:49 -0500, Tom Lane wrote:
I wrote:
Andres Freund <andres@anarazel.de> writes:
Was about to apply that, but then started to wonder if we don't need the same
for configure? And it sure looks like that has the same problem?
Which also confuses me some, at some point this presumably worked?The configure path does work on NetBSD 10, and has for some time.
Ah, sorry, I'd forgotten that bsd_auth.h only exists on OpenBSD.
We correctly detect that the header is not there on NetBSD.I tried it on OpenBSD 7.0, which is the only OpenBSD image I have
laying about at the moment, and configure correctly finds that the
"AC_CHECK_HEADER(bsd_auth.h, [], ...)" test succeeds. So it looks
to me like we should not need the sys/types.h include --- unless
they broke it in some more-recent release?It does look like it was recently broken:
/messages/by-id/CAN55FZ0czTmfnfF=WOHJUZ0iZRiMz6Yf3FSMbPh4=Z5a_TDjKw@mail.gmail.com
/usr/include/bsd_auth.h:93:1: error: unknown type name 'quad_t'I'm pretty sure that it *did* work not too long ago with meson, because I had
tested the meson stuff on openbsd when I wrote it.And as Peter noted:
The synopsis in https://man.openbsd.org/authenticate.3 is:
#include <sys/types.h>
#include <login_cap.h>
#include <bsd_auth.h>Which does look a bit like they expect sys/types.h to be included first.
Gah, configure does pass - because AC_CHECK_HEADER(), if includes is not passed
in, first includes what's defined in AC_INCLUDES_DEFAULT.
https://www.gnu.org/software/autoconf/manual/autoconf-2.69/html_node/Default-Includes.html#Default-Includes
Expand to include-directives if defined, otherwise to:
#include <stdio.h>
#ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
...
So maybe my memory is just faulty and the bsd_auth.h path never worked with
openbsd + meson. Anyway, it looks like Bilal's patch to just add this to meson
seems to suffice.
Greetings,
Andres Freund
Andres Freund <andres@anarazel.de> writes:
On 2024-12-17 12:44:46 -0500, Tom Lane wrote:
On mamba's host (pretty vanilla NetBSD 10.0):
initdb: error: invalid locale settings; check LANG and LC_* environment variables
It'd be helpful if the error message ought to at least include the category
being tested, perhaps it's just one category failing or such?
Yeah, I will poke into this a little harder to see what's going on.
(Good sleuthing on the bsd_auth.h question, BTW.)
regards, tom lane
I wrote:
Andres Freund <andres@anarazel.de> writes:
It'd be helpful if the error message ought to at least include the category
being tested, perhaps it's just one category failing or such?
Yeah, I will poke into this a little harder to see what's going on.
So after a little testing, setlocale(LC_COLLATE, ...) fails to set the
locale to (apparently) anything other than C, but it works for other
categories. The reason is explained by "man setlocale":
Currently, setlocale() returns NULL and fails to change the locale when
LC_COLLATE is modified independently of other values.
It seems that on current NetBSD you have to use setlocale(LC_ALL, ...)
if you want to set the collation category. That's quite annoying
from our perspective, but it's not something I'm excited about fixing.
Given other work going on, we might abandon all this logic soon
anyway.
regards, tom lane
Hi,
Thanks for the review!
On Tue, 17 Dec 2024 at 19:21, Andres Freund <andres@anarazel.de> wrote:
Hi,
On 2024-11-12 11:38:11 +0300, Nazir Bilal Yavuz wrote:
On Fri, 1 Nov 2024 at 21:44, Andres Freund <andres@anarazel.de> wrote:
+ CCACHE_DIR: /tmp/ccache_dir + + PATH: /usr/sbin:$PATH + + # Postgres interprets LANG as a 'en_US.UTF-8' but it is 'C', thenWhat does "Postgres interprets LANG as a 'en_US.UTF-8'" mean?
It was because initdb was failing on NetBSD when the LANG and LC_ALL
is not set to C. I rephrased the comment and moved this under NetBSD
task.Do you happen to have a reference to the failure? The environment variables +
the exact error message would be good. Kinda feels like that shouldn't
happen with a default netbsd install.
This was already discussed upthread. Would you like more information?
+ matrix: + - name: NetBSD - 10 - Meson + only_if: $CIRRUS_CHANGE_MESSAGE !=~ '.*\nci-os-only:.*' || $CIRRUS_CHANGE_MESSAGE =~ '.*\nci-os-only:[^\n]*netbsd.*' + env: + IMAGE_FAMILY: pg-ci-netbsd-postgres + INCLUDE_DIRS: -Dextra_lib_dirs=/usr/pkg/lib -Dextra_include_dirs=/usr/pkg/include + <<: *netbsd_task_template + + - name: OpenBSD - 7 - Meson + only_if: $CIRRUS_CHANGE_MESSAGE !=~ '.*\nci-os-only:.*' || $CIRRUS_CHANGE_MESSAGE =~ '.*\nci-os-only:[^\n]*openbsd.*' + env: + IMAGE_FAMILY: pg-ci-openbsd-postgres + INCLUDE_DIRS: -Dextra_include_dirs=/usr/local/include -Dextra_lib_dirs=/usr/local/lib + UUID: -Duuid=e2fsShouldn't something be added to PKG_CONFIG_PATH / --pkg-config-path?
I don't think so. Both OSes are able to find pkgconfig at
'/usr/pkg/bin/pkg-config'. Am I missing something?--pkg-config-path is about the the path to pkg-config files, not the path to
the pkg-config binary. If set we shouldn't need the
extra_lib_dirs/extra_include_dirs, I think.
Yes, my bad. Done.
Right now you don't seem to be collecting core files - but you're still
enabling them via ulimit -c unlimited. At least we shouldn't use ulimit -c
unlimited without collecting core files, but it'd probably be better to add
support for collecting core files. Shouldn't be too hard.Done. I separated this patch to make review easier.
+1
From cbea598b11e85b5c7090ca8e9cc05c35f0359f54 Mon Sep 17 00:00:00 2001
From: Nazir Bilal Yavuz <byavuz81@gmail.com>
Date: Thu, 7 Nov 2024 15:48:31 +0300
Subject: [PATCH v2 1/3] Fix meson could not find bsd_auth.hbsd_auth.h file needs to be compiled together with the 'sys/types.h' as
it has missing type definitions.See synopsis at https://man.openbsd.org/authenticate.3
---
meson.build | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)diff --git a/meson.build b/meson.build index 5b0510cef78..84107955d5d 100644 --- a/meson.build +++ b/meson.build @@ -551,7 +551,8 @@ test_c_args = cppflags + cflags bsd_authopt = get_option('bsd_auth') bsd_auth = not_found_dep if cc.check_header('bsd_auth.h', required: bsd_authopt, - args: test_c_args, include_directories: postgres_inc) + args: test_c_args, prefix: '#include <sys/types.h>', + include_directories: postgres_inc) cdata.set('USE_BSD_AUTH', 1) bsd_auth = declare_dependency() endif --Was about to apply that, but then started to wonder if we don't need the same
for configure? And it sure looks like that has the same problem?Which also confuses me some, at some point this presumably worked?
This too was discussed upthread. Please let me know if you need more
information.
From cd5bb66a55e5226b543f5b7db9128cfa48e338e3 Mon Sep 17 00:00:00 2001
From: Nazir Bilal Yavuz <byavuz81@gmail.com>
Date: Mon, 11 Nov 2024 13:23:22 +0300
Subject: [PATCH v2 2/3] Add NetBSD and OpenBSD tasks to the Postgres CINetBSD and OpenBSD Postgres CI images are generated [1] but their tasks
are not added to the upstream Postgres yet. This patch adds them.Note: These tasks will be triggered manually to save CI credits but a
related line is commented out for now to trigger CFBot.Author: Nazir Bilal Yavuz <byavuz81@gmail.com>
[1] https://github.com/anarazel/pg-vm-images
---
.cirrus.tasks.yml | 84 +++++++++++++++++++++++++++++++++++++++++++++++
.cirrus.yml | 10 ++++++
2 files changed, 94 insertions(+)diff --git a/.cirrus.tasks.yml b/.cirrus.tasks.yml index fc413eb11ef..f338af902aa 100644 --- a/.cirrus.tasks.yml +++ b/.cirrus.tasks.yml @@ -213,6 +213,90 @@ task: cores_script: src/tools/ci/cores_backtrace.sh freebsd /tmp/cores+task: + depends_on: SanityCheck + # trigger_type: manual + + env: + # Below are experimentally derived to be a decent choice. + CPUS: 2For cfbot it turns out to be easier to just use 4 cpus for everything. What
time difference do you get from 2 vs 4 CPUs?
I shared the timings at the first email of the thread [1]postgr.es/m/CAN55FZ0GXrojT2yUTrST5McJk8UWmYxUX8b696XjL01B1pKsxg%40mail.gmail.com. Copying the
timings from there:
╔══════════════════════╦════════╦═════════╗
║ CI Run Tim ║ ║ ║
║ (Only Test Step) ║ NetBSD ║ OpenBSD ║
║ (in minutes:seconds) ║ ║ ║
╠══════════════════════╬════════╬═════════╣
║ CPU: 2, TJ: 4 ║ 13:18 ║ 17:07 ║
╠══════════════════════╬════════╬═════════╣
║ CPU: 2, TJ: 6 ║ 11:01 ║ 16:23 ║
╠══════════════════════╬════════╬═════════╣
║ CPU: 2, TJ: 8 ║ 10:14 ║ 15:41 ║
╠══════════════════════╬════════╬═════════╣
║ CPU: 4, TJ: 4 ║ 11:46 ║ 16:03 ║
╠══════════════════════╬════════╬═════════╣
║ CPU: 4, TJ: 6 ║ 09:56 ║ 14:59 ║
╠══════════════════════╬════════╬═════════╣
║ CPU: 4, TJ: 8 ║ 10:02 ║ 15:09 ║
╚══════════════════════╩════════╩═════════╝
+ BUILD_JOBS: 8
+ TEST_JOBS: 88 build/test jobs for 2 cpus sounds unlikely to be close to optimal. A bit
higher makes sense, but 4x?
I updated them with CPUS: 4 and JOBS: 8.
+ CIRRUS_WORKING_DIR: /home/postgres/postgres
I'd add a comment explaining why we're setting this.
Done.
+ CCACHE_DIR: /tmp/ccache_dir
And is it ok to put the ccache dir here, given the limited size of /tmp?
Yes, you are right; moved it to /home/postgres/cache.
+ PATH: /usr/sbin:$PATH + + matrix: + - name: NetBSD - 10 - MesonGiven the image name doesn't include the version it seems we shouldn't include
it here either...
Done.
+ only_if: $CIRRUS_CHANGE_MESSAGE !=~ '.*\nci-os-only:.*' || $CIRRUS_CHANGE_MESSAGE =~ '.*\nci-os-only:[^\n]*netbsd.*' + env: + IMAGE_FAMILY: pg-ci-netbsd-postgres + INCLUDE_DIRS: -Dextra_include_dirs=/usr/pkg/include -Dextra_lib_dirs=/usr/pkg/lib + # initdb fails with: 'invalid locale settings' error on NetBSD. + # Force 'LANG' and 'LC_*' variables to be 'C'. + LANG: "C" + LC_ALL: "C" + setup_additional_packages_script: | + #pkgin -y install ... + <<: *netbsd_task_template + + - name: OpenBSD - 7 - Meson + only_if: $CIRRUS_CHANGE_MESSAGE !=~ '.*\nci-os-only:.*' || $CIRRUS_CHANGE_MESSAGE =~ '.*\nci-os-only:[^\n]*openbsd.*' + env: + IMAGE_FAMILY: pg-ci-openbsd-postgres + INCLUDE_DIRS: -Dextra_include_dirs=/usr/local/include -Dextra_lib_dirs=/usr/local/lib + UUID: -Duuid=e2fsSo for netbsd we're not using any uuid support? Ah, I see, it's documented
further down. Maybe reference that, or move the comment around?
Done.
+ # -Duuid=bsd is not set since 'bsd' uuid option + # is not working on NetBSD & OpenBSD. See + # https://www.postgresql.org/message-id/17358-89806e7420797025@postgresql.org + # And other uuid options are not available on NetBSD. + configure_script: | + su postgres <<-EOF + meson setup \ + --buildtype=debugoptimized \ + -Dcassert=true -Dinjection_points=true \ + -Dssl=openssl ${UUID} \ + -DPG_TEST_EXTRA="$PG_TEST_EXTRA" \ + ${INCLUDE_DIRS} \ + build + EOFhttps://cirrus-ci.com/task/4879081273032704?logs=configure#L320
[14:48:50.729] Run-time dependency krb5-gssapi found: NO (tried pkgconfig and cmake)
[14:48:50.729] Library gssapi_krb5 found: NOhttps://cirrus-ci.com/task/6286456156585984?logs=configure#L109
[14:49:28.049] Run-time dependency krb5-gssapi found: NO (tried pkgconfig and cmake)
[14:49:28.049] Library gssapi_krb5 found: NOIs gss really not available / installed on either?
NetBSD is fixed [2]https://github.com/anarazel/pg-vm-images/pull/108 but we require MIT Kerberos [3]f7431bca8b which requires a
gssapi_ext.h file. OpenBSD does not have MIT Kerberos nor gssapi_ext.h
file [4]postgr.es/m/3598083.1680976022%40sss.pgh.pa.us.
https://cirrus-ci.com/task/4879081273032704?logs=configure#L49-L51
[14:48:50.729] Run-time dependency tcl found: NO (tried pkgconfig and cmake)
[14:48:50.729] Library tcl found: NO
[14:48:50.729] Has header "tcl.h" with dependency -ltcl: NOIs TCL not available on openbsd?
Version option is added, it is working now.
+ build_script: su postgres -c 'ninja -C build -j${BUILD_JOBS}' + upload_caches: ccache + + test_world_script: | + su postgres <<-EOF + # Otherwise tests will fail on OpenBSD, due to the lack of enough processes. + ulimit -p 256Should we also increase the number of semaphores?
/messages/by-id/db2773a2-aca0-43d0-99c1-060efcd9954e@gmail.com
It is already increased while creating the bsd images [5]https://github.com/anarazel/pg-vm-images/blob/af8757bd5ed3f4055809bffde28334a8547dfced/scripts/bsd/netbsd-prep-postgres.sh#L30C1-L32C56 [6]https://github.com/anarazel/pg-vm-images/blob/af8757bd5ed3f4055809bffde28334a8547dfced/scripts/bsd/openbsd-prep-postgres.sh#L50C1-L53C63.
Perhaps it'd be better to update the system config earlier in the openbsd
specific portion of the test?
'ulimit -p' needs to be run as a postgres user, but postgres user is
created after the OpenBSD specific portion. I can put an if statement
to make it only work for OpenBSD. Does that sound good?
build/tmp_install/usr/local/pgsql/bin/pg_ctl -D build/runningcheck stop || true EOF <<: *on_failure_meson - cores_script: src/tools/ci/cores_backtrace.sh freebsd /tmp/cores + cores_script: src/tools/ci/cores_backtrace.sh bsd /tmp/coresHm, what's the deal with this change?
Removed, forgot to revert it before sending the patch.
on_failure: <<: *on_failure_meson + cores_script: | + # Although OSes are forced to core dump inside ${CORE_DUMP_DIR}, they may + # not obey this. So, move core files to the ${CORE_DUMP_DIR} directory. + find build/ -maxdepth 1 -type f -name '*.core' -exec mv '{}' ${CORE_DUMP_DIR} \; + src/tools/ci/cores_backtrace.sh ${OS_NAME} ${CORE_DUMP_DIR}s/OSs are forced/we try to configure the OS/
Is -maxdepth 1 really sufficient? The tests run in subdirectories, don't they?
You are right, maxdepth is removed now.
+ matrix: + - name: NetBSD - 10 - Meson + only_if: $CIRRUS_CHANGE_MESSAGE !=~ '.*\nci-os-only:.*' || $CIRRUS_CHANGE_MESSAGE =~ '.*\nci-os-only:[^\n]*netbsd.*'...
+ - name: OpenBSD - 7 - Meson + only_if: $CIRRUS_CHANGE_MESSAGE !=~ '.*\nci-os-only:.*' || $CIRRUS_CHANGE_MESSAGE =~ '.*\nci-os-only:[^\n]*openbsd.*'Think these probably should be added to src/tools/ci/README
Done.
[1]: postgr.es/m/CAN55FZ0GXrojT2yUTrST5McJk8UWmYxUX8b696XjL01B1pKsxg%40mail.gmail.com
[2]: https://github.com/anarazel/pg-vm-images/pull/108
[3]: f7431bca8b
[4]: postgr.es/m/3598083.1680976022%40sss.pgh.pa.us
[5]: https://github.com/anarazel/pg-vm-images/blob/af8757bd5ed3f4055809bffde28334a8547dfced/scripts/bsd/netbsd-prep-postgres.sh#L30C1-L32C56
[6]: https://github.com/anarazel/pg-vm-images/blob/af8757bd5ed3f4055809bffde28334a8547dfced/scripts/bsd/openbsd-prep-postgres.sh#L50C1-L53C63
--
Regards,
Nazir Bilal Yavuz
Microsoft
Attachments:
v3-0001-Fix-meson-could-not-find-bsd_auth.h.patchtext/x-patch; charset=US-ASCII; name=v3-0001-Fix-meson-could-not-find-bsd_auth.h.patchDownload
From 4388cb77794c94c329bfe2ac977a59f71b72f6d0 Mon Sep 17 00:00:00 2001
From: Nazir Bilal Yavuz <byavuz81@gmail.com>
Date: Thu, 7 Nov 2024 15:48:31 +0300
Subject: [PATCH v3 1/3] Fix meson could not find bsd_auth.h
bsd_auth.h file needs to be compiled together with the 'sys/types.h' as
it has missing type definitions.
See synopsis at https://man.openbsd.org/authenticate.3
---
meson.build | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/meson.build b/meson.build
index cfd654d2916..50731f47f7e 100644
--- a/meson.build
+++ b/meson.build
@@ -557,7 +557,8 @@ test_c_args = cppflags + cflags
bsd_authopt = get_option('bsd_auth')
bsd_auth = not_found_dep
if cc.check_header('bsd_auth.h', required: bsd_authopt,
- args: test_c_args, include_directories: postgres_inc)
+ args: test_c_args, prefix: '#include <sys/types.h>',
+ include_directories: postgres_inc)
cdata.set('USE_BSD_AUTH', 1)
bsd_auth = declare_dependency()
endif
--
2.47.1
v3-0002-Add-NetBSD-and-OpenBSD-tasks-to-the-Postgres-CI.patchtext/x-patch; charset=US-ASCII; name=v3-0002-Add-NetBSD-and-OpenBSD-tasks-to-the-Postgres-CI.patchDownload
From eb1d8e55d341b109a503759945f89ca530c6aafa Mon Sep 17 00:00:00 2001
From: Nazir Bilal Yavuz <byavuz81@gmail.com>
Date: Mon, 11 Nov 2024 13:23:22 +0300
Subject: [PATCH v3 2/3] Add NetBSD and OpenBSD tasks to the Postgres CI
NetBSD and OpenBSD Postgres CI images are generated [1] but their tasks
are not added to the upstream Postgres yet. This patch adds them.
Note: These tasks will be triggered manually to save CI credits but a
related line is commented out for now to trigger CFBot.
Author: Nazir Bilal Yavuz <byavuz81@gmail.com>
[1] https://github.com/anarazel/pg-vm-images
---
.cirrus.tasks.yml | 90 +++++++++++++++++++++++++++++++++++++++++++++
.cirrus.yml | 10 +++++
src/tools/ci/README | 2 +-
3 files changed, 101 insertions(+), 1 deletion(-)
diff --git a/.cirrus.tasks.yml b/.cirrus.tasks.yml
index 18e944ca89d..43cca1aeb58 100644
--- a/.cirrus.tasks.yml
+++ b/.cirrus.tasks.yml
@@ -213,6 +213,96 @@ task:
cores_script: src/tools/ci/cores_backtrace.sh freebsd /tmp/cores
+task:
+ depends_on: SanityCheck
+ # trigger_type: manual
+
+ env:
+ # Below are experimentally derived to be a decent choice.
+ CPUS: 4
+ BUILD_JOBS: 8
+ TEST_JOBS: 8
+
+ # Default working directory is /tmp but its total size (1.2 GB) is not
+ # enough, so different working and cache directory are set.
+ CIRRUS_WORKING_DIR: /home/postgres/postgres
+ CCACHE_DIR: /home/postgres/cache
+
+ PATH: /usr/sbin:$PATH
+
+ matrix:
+ - name: NetBSD - Meson
+ only_if: $CIRRUS_CHANGE_MESSAGE !=~ '.*\nci-os-only:.*' || $CIRRUS_CHANGE_MESSAGE =~ '.*\nci-os-only:[^\n]*netbsd.*'
+ env:
+ IMAGE_FAMILY: pg-ci-netbsd-postgres
+ PKGCONFIG_PATH: '/usr/lib/pkgconfig:/usr/pkg/lib/pkgconfig'
+ # initdb fails with: 'invalid locale settings' error on NetBSD.
+ # Force 'LANG' and 'LC_*' variables to be 'C'.
+ LANG: "C"
+ LC_ALL: "C"
+ # -Duuid is not set for the NetBSD, see the comment at the configure
+ # script for more information.
+ setup_additional_packages_script: |
+ #pkgin -y install ...
+ <<: *netbsd_task_template
+
+ - name: OpenBSD - Meson
+ only_if: $CIRRUS_CHANGE_MESSAGE !=~ '.*\nci-os-only:.*' || $CIRRUS_CHANGE_MESSAGE =~ '.*\nci-os-only:[^\n]*openbsd.*'
+ env:
+ IMAGE_FAMILY: pg-ci-openbsd-postgres
+ PKGCONFIG_PATH: '/usr/lib/pkgconfig:/usr/local/lib/pkgconfig'
+ UUID: -Duuid=e2fs
+ TCL: -Dtcl_version=tcl86
+ setup_additional_packages_script: |
+ #pkg_add -I ...
+ <<: *openbsd_task_template
+
+ sysinfo_script: |
+ locale
+ id
+ uname -a
+ ulimit -a -H && ulimit -a -S
+ env
+
+ ccache_cache:
+ folder: $CCACHE_DIR
+
+ create_user_script: |
+ useradd postgres
+ chown -R postgres:users /home/postgres
+ mkdir -p ${CCACHE_DIR}
+ chown -R postgres:users ${CCACHE_DIR}
+
+ # -Duuid=bsd is not set since 'bsd' uuid option
+ # is not working on NetBSD & OpenBSD. See
+ # https://www.postgresql.org/message-id/17358-89806e7420797025@postgresql.org
+ # And other uuid options are not available on NetBSD.
+ configure_script: |
+ su postgres <<-EOF
+ meson setup \
+ --buildtype=debugoptimized \
+ --pkg-config-path ${PKGCONFIG_PATH} \
+ -Dcassert=true -Dinjection_points=true \
+ -Dssl=openssl ${UUID} ${TCL} \
+ -DPG_TEST_EXTRA="$PG_TEST_EXTRA" \
+ build
+ EOF
+
+ build_script: su postgres -c 'ninja -C build -j${BUILD_JOBS}'
+ upload_caches: ccache
+
+ test_world_script: |
+ su postgres <<-EOF
+ ulimit -c unlimited
+ # Otherwise tests will fail on OpenBSD, due to the lack of enough processes.
+ ulimit -p 256
+ meson test $MTEST_ARGS --num-processes ${TEST_JOBS}
+ EOF
+
+ on_failure:
+ <<: *on_failure_meson
+
+
# configure feature flags, shared between the task running the linux tests and
# the CompilerWarnings task
LINUX_CONFIGURE_FEATURES: &LINUX_CONFIGURE_FEATURES >-
diff --git a/.cirrus.yml b/.cirrus.yml
index a83129ae46d..33c6e481d74 100644
--- a/.cirrus.yml
+++ b/.cirrus.yml
@@ -52,6 +52,16 @@ default_freebsd_task_template: &freebsd_task_template
PLATFORM: freebsd
<<: *cirrus_community_vm_template
+default_netbsd_task_template: &netbsd_task_template
+ env:
+ PLATFORM: netbsd
+ <<: *cirrus_community_vm_template
+
+default_openbsd_task_template: &openbsd_task_template
+ env:
+ PLATFORM: openbsd
+ <<: *cirrus_community_vm_template
+
default_windows_task_template: &windows_task_template
env:
diff --git a/src/tools/ci/README b/src/tools/ci/README
index 30ddd200c96..dd703272d3f 100644
--- a/src/tools/ci/README
+++ b/src/tools/ci/README
@@ -61,7 +61,7 @@ Controlling CI via commit messages
The behavior of CI can be controlled by special content in commit
messages. Currently the following controls are available:
-- ci-os-only: {(freebsd|linux|macos|windows|mingw)}
+- ci-os-only: {(freebsd|netbsd|openbsd|linux|macos|windows|mingw)}
Only runs CI on operating systems specified. This can be useful when
addressing portability issues affecting only a subset of platforms.
--
2.47.1
v3-0003-Collect-core-files-on-NetBSD-and-OpenBSD.patchtext/x-patch; charset=US-ASCII; name=v3-0003-Collect-core-files-on-NetBSD-and-OpenBSD.patchDownload
From 5ba96dd27488a5e8d484db3d46edf10c8a529660 Mon Sep 17 00:00:00 2001
From: Nazir Bilal Yavuz <byavuz81@gmail.com>
Date: Wed, 8 Jan 2025 10:56:23 +0300
Subject: [PATCH v3 3/3] Collect core files on NetBSD and OpenBSD
NetBSD and OpenBSD operating systems are added to the CI. Now, collect
core files on failure on these operating systems.
---
.cirrus.tasks.yml | 15 +++++++++++++++
src/tools/ci/cores_backtrace.sh | 6 ++++--
2 files changed, 19 insertions(+), 2 deletions(-)
diff --git a/.cirrus.tasks.yml b/.cirrus.tasks.yml
index 43cca1aeb58..a4aeabd097b 100644
--- a/.cirrus.tasks.yml
+++ b/.cirrus.tasks.yml
@@ -229,11 +229,13 @@ task:
CCACHE_DIR: /home/postgres/cache
PATH: /usr/sbin:$PATH
+ CORE_DUMP_DIR: /var/crash
matrix:
- name: NetBSD - Meson
only_if: $CIRRUS_CHANGE_MESSAGE !=~ '.*\nci-os-only:.*' || $CIRRUS_CHANGE_MESSAGE =~ '.*\nci-os-only:[^\n]*netbsd.*'
env:
+ OS_NAME: netbsd
IMAGE_FAMILY: pg-ci-netbsd-postgres
PKGCONFIG_PATH: '/usr/lib/pkgconfig:/usr/pkg/lib/pkgconfig'
# initdb fails with: 'invalid locale settings' error on NetBSD.
@@ -249,12 +251,15 @@ task:
- name: OpenBSD - Meson
only_if: $CIRRUS_CHANGE_MESSAGE !=~ '.*\nci-os-only:.*' || $CIRRUS_CHANGE_MESSAGE =~ '.*\nci-os-only:[^\n]*openbsd.*'
env:
+ OS_NAME: openbsd
IMAGE_FAMILY: pg-ci-openbsd-postgres
PKGCONFIG_PATH: '/usr/lib/pkgconfig:/usr/local/lib/pkgconfig'
UUID: -Duuid=e2fs
TCL: -Dtcl_version=tcl86
setup_additional_packages_script: |
#pkg_add -I ...
+ # Always core dump to ${CORE_DUMP_DIR}
+ set_core_dump_script: sysctl -w kern.nosuidcoredump=2
<<: *openbsd_task_template
sysinfo_script: |
@@ -272,6 +277,10 @@ task:
chown -R postgres:users /home/postgres
mkdir -p ${CCACHE_DIR}
chown -R postgres:users ${CCACHE_DIR}
+ setup_core_files_script: |
+ mkdir -p ${CORE_DUMP_DIR}
+ chmod -R 770 ${CORE_DUMP_DIR}
+ chown -R postgres:users ${CORE_DUMP_DIR}
# -Duuid=bsd is not set since 'bsd' uuid option
# is not working on NetBSD & OpenBSD. See
@@ -301,6 +310,12 @@ task:
on_failure:
<<: *on_failure_meson
+ cores_script: |
+ # Although we try to configure the OS to core dump inside
+ # ${CORE_DUMP_DIR}, they may not obey this. So, move core files to the
+ # ${CORE_DUMP_DIR} directory.
+ find build/ -type f -name '*.core' -exec mv '{}' ${CORE_DUMP_DIR} \;
+ src/tools/ci/cores_backtrace.sh ${OS_NAME} ${CORE_DUMP_DIR}
# configure feature flags, shared between the task running the linux tests and
diff --git a/src/tools/ci/cores_backtrace.sh b/src/tools/ci/cores_backtrace.sh
index 28d3cecfc67..4b174a5cf56 100755
--- a/src/tools/ci/cores_backtrace.sh
+++ b/src/tools/ci/cores_backtrace.sh
@@ -9,7 +9,7 @@ os=$1
directory=$2
case $os in
- freebsd|linux|macos)
+ freebsd|netbsd|openbsd|linux|macos)
;;
*)
echo "unsupported operating system ${os}"
@@ -26,7 +26,7 @@ for corefile in $(find "$directory" -type f) ; do
echo -e '\n\n'
fi
- if [ "$os" = 'macos' ]; then
+ if [ "$os" = 'macos' ] || [ "$os" = 'openbsd' ]; then
lldb -c $corefile --batch -o 'thread backtrace all' -o 'quit'
else
auxv=$(gdb --quiet --core ${corefile} --batch -ex 'info auxv' 2>/dev/null)
@@ -37,6 +37,8 @@ for corefile in $(find "$directory" -type f) ; do
if [ "$os" = 'freebsd' ]; then
binary=$(echo "$auxv" | grep AT_EXECPATH | perl -pe "s/^.*\"(.*)\"\$/\$1/g")
+ elif [ "$os" = 'netbsd' ]; then
+ binary=$(echo "$auxv" | grep AT_SUN_EXECNAME | perl -pe "s/^.*\"(.*)\"\$/\$1/g")
elif [ "$os" = 'linux' ]; then
binary=$(echo "$auxv" | grep AT_EXECFN | perl -pe "s/^.*\"(.*)\"\$/\$1/g")
else
--
2.47.1
Hi,
I finally pushed this. The meson fix backpatched to 16.
I did some very minor polishing, reordering the OS lists to stay alphabetical,
instead of adding netbsd/openbsd somewhere to the front of lists.
Thanks for the patches!
Obviously not your fault, but I do think it's pretty crazy that with the same
available resources, netbsd and openbsd take considerably longer than linux
and freebsd, which both do a lot more (linux tests 32 and 64 bit with ubsan
with autoconf and asan with meson, freebsd tests a bunch of debugging
options). I wonder what is going wrong. I suspect we might be waiting for
the filesystem a lot, according to cirrus-ci's CPU usage graph we're not CPU
bound during the test phase. Or maybe they just scale badly.
Any chance you're interested in rebasing and expanding
/messages/by-id/20240413021221.hg53rvqlvldqh57i@awork3.anarazel.de
It'd be nice if we could enable these tasks on cfbot, where we bring our own
compute, while leaving them on manual for everyone else.
Greetings,
Andres Freund
Hi,
On Wed, 12 Feb 2025 at 17:49, Andres Freund <andres@anarazel.de> wrote:
I finally pushed this. The meson fix backpatched to 16.
I did some very minor polishing, reordering the OS lists to stay alphabetical,
instead of adding netbsd/openbsd somewhere to the front of lists.
Thanks!
Obviously not your fault, but I do think it's pretty crazy that with the same
available resources, netbsd and openbsd take considerably longer than linux
and freebsd, which both do a lot more (linux tests 32 and 64 bit with ubsan
with autoconf and asan with meson, freebsd tests a bunch of debugging
options). I wonder what is going wrong. I suspect we might be waiting for
the filesystem a lot, according to cirrus-ci's CPU usage graph we're not CPU
bound during the test phase. Or maybe they just scale badly.
Yes, I could not find the reason why either.
Any chance you're interested in rebasing and expanding
/messages/by-id/20240413021221.hg53rvqlvldqh57i@awork3.anarazel.deIt'd be nice if we could enable these tasks on cfbot, where we bring our own
compute, while leaving them on manual for everyone else.
Sure, I will work on this. Thank you for mentioning it.
--
Regards,
Nazir Bilal Yavuz
Microsoft
On Fri, Feb 14, 2025 at 2:02 AM Nazir Bilal Yavuz <byavuz81@gmail.com> wrote:
On Wed, 12 Feb 2025 at 17:49, Andres Freund <andres@anarazel.de> wrote:
Obviously not your fault, but I do think it's pretty crazy that with the same
available resources, netbsd and openbsd take considerably longer than linux
and freebsd, which both do a lot more (linux tests 32 and 64 bit with ubsan
with autoconf and asan with meson, freebsd tests a bunch of debugging
options). I wonder what is going wrong. I suspect we might be waiting for
the filesystem a lot, according to cirrus-ci's CPU usage graph we're not CPU
bound during the test phase. Or maybe they just scale badly.Yes, I could not find the reason why either.
I don't know much about NetBSD and OpenBSD, but my guess would be that
its UFS is serialising on synchronous I/O for some file/directory
operations that we do a lot of. Perhaps something like commit
0265e5c1 could be ported to those guys too? I suspect that Windows
has the same problem, I just don't know how to script a RAM disk as
all the web instructions start with "open the blah GUI and click on
the ...". I think the Linux file systems are just much better at that
stuff due to journaling and deferring I/O, but these other systems
probably issue synchronous writes, possibly with drive cache flushes
in some cases that you might not be able to turn off*. As for macOS,
I don't know much except that it doesn't seem too interested in
flushing the write cache generally, and is currently our 2nd fastest
OS on CI anyway.
Maybe we could try this?
https://man.netbsd.org/mount_tmpfs.8
https://man.openbsd.org/mount_tmpfs.8
FreeBSD has the same thing too, but I haven't looked into how that
compares to mounting UFS on a RAM disk device as I did it. Linux has
a tmpfs too, but we know that it refuses O_DIRECT so I wouldn't
propose that, it's essential to test those code paths. OpenBSD is the
only system in our universe without O_DIRECT, and I don't know what
NetBSD's policy is on O_DIRECT on tmpfs and wouldn't worry about it
too much anyway. (This is like a Zen riddle: what does it mean to
skip the page cache if the filesystem is the page cache? Mu. The
Linux answer is: no, go away.)
Thanks for working on these! I'll have another go at my workaround
for the SysV IPC resource limits on those two OSes, which is relevant
to the I/O worker stuff.
*In my hobbyist OS hacking I had an on/off switch for that for
throwaway FreeBSD CI systems where you don't care about durability,
though I didn't go anywhere with it after the RAM disk did the trick.
On Tue, Feb 18, 2025 at 11:33 AM Thomas Munro <thomas.munro@gmail.com> wrote:
Maybe we could try this?
https://man.netbsd.org/mount_tmpfs.8
https://man.openbsd.org/mount_tmpfs.8
NetBSD's test_world: 10:30 -> 3:23
OpenBSD test_world: 15:45 - >9:10
I think NetBSD would finish around 2nd place if turned on by default
like that. The OpenBSD part needs more work though, see attached...
Attachments:
0001-ci-Use-a-RAM-disk-for-NetBSD-and-OpenBSD.patchtext/x-patch; charset=US-ASCII; name=0001-ci-Use-a-RAM-disk-for-NetBSD-and-OpenBSD.patchDownload
From f28ad02574090c4690bce639b47ee301a3d857cc Mon Sep 17 00:00:00 2001
From: Thomas Munro <thomas.munro@gmail.com>
Date: Fri, 28 Feb 2025 22:19:07 +1300
Subject: [PATCH 1/2] ci: Use a RAM disk for NetBSD and OpenBSD.
Run all the tests on a RAM disk, because it goes faster. Harmonize the
setup for all three BSD CI tasks into one script, replacing the old
FreeBSD-specific one from commit 0265e5c1.
XXX OpenBSD not good enough yet
ci-os-only: freebsd netbsd openbsd
---
.cirrus.tasks.yml | 4 +--
src/tools/ci/gcp_freebsd_repartition.sh | 26 ------------------
src/tools/ci/prepare_filesystem.sh | 36 +++++++++++++++++++++++++
3 files changed, 38 insertions(+), 28 deletions(-)
delete mode 100755 src/tools/ci/gcp_freebsd_repartition.sh
create mode 100755 src/tools/ci/prepare_filesystem.sh
diff --git a/.cirrus.tasks.yml b/.cirrus.tasks.yml
index 91b51142d2e..2858dc1194e 100644
--- a/.cirrus.tasks.yml
+++ b/.cirrus.tasks.yml
@@ -155,8 +155,7 @@ task:
ccache_cache:
folder: $CCACHE_DIR
- # Work around performance issues due to 32KB block size
- repartition_script: src/tools/ci/gcp_freebsd_repartition.sh
+ prepare_filesystem_script: src/tools/ci/prepare_filesystem.sh
create_user_script: |
pw useradd postgres
chown -R postgres:postgres .
@@ -277,6 +276,7 @@ task:
ccache_cache:
folder: $CCACHE_DIR
+ prepare_filesystem_script: src/tools/ci/prepare_filesystem.sh
create_user_script: |
useradd postgres
chown -R postgres:users /home/postgres
diff --git a/src/tools/ci/gcp_freebsd_repartition.sh b/src/tools/ci/gcp_freebsd_repartition.sh
deleted file mode 100755
index 3adb8fb88ec..00000000000
--- a/src/tools/ci/gcp_freebsd_repartition.sh
+++ /dev/null
@@ -1,26 +0,0 @@
-#!/bin/sh
-
-set -e
-set -x
-
-# fix backup partition table after resize
-gpart recover da0
-gpart show da0
-
-# delete and re-add swap partition with expanded size
-swapoff -a
-gpart delete -i 3 da0
-gpart add -t freebsd-swap -l swapfs -a 4096 da0
-gpart show da0
-swapon -a
-
-# create a file system on a memory disk backed by swap, to minimize I/O
-mdconfig -a -t swap -s20g -u md1
-newfs -b 8192 -U /dev/md1
-
-# migrate working directory
-du -hs $CIRRUS_WORKING_DIR
-mv $CIRRUS_WORKING_DIR $CIRRUS_WORKING_DIR.orig
-mkdir $CIRRUS_WORKING_DIR
-mount -o noatime /dev/md1 $CIRRUS_WORKING_DIR
-cp -a $CIRRUS_WORKING_DIR.orig/ $CIRRUS_WORKING_DIR/
diff --git a/src/tools/ci/prepare_filesystem.sh b/src/tools/ci/prepare_filesystem.sh
new file mode 100755
index 00000000000..dd203de4915
--- /dev/null
+++ b/src/tools/ci/prepare_filesystem.sh
@@ -0,0 +1,36 @@
+#!/bin/sh
+
+set -e
+set -x
+
+# migrate working directory to tmpfs
+du -hs $CIRRUS_WORKING_DIR
+mv $CIRRUS_WORKING_DIR $CIRRUS_WORKING_DIR.orig
+mkdir $CIRRUS_WORKING_DIR
+case "`uname`" in
+
+ FreeBSD|NetBSD)
+ mount -t tmpfs tmpfs $CIRRUS_WORKING_DIR
+ ;;
+
+ OpenBSD)
+ # tmpfs is broken on OpenBSD. mfs is similar but you need a size up front
+ # and that needs to be backed by swap, so we'll somehow need to add swap,
+ # either here or on the image.
+
+ #du -h
+ #umount /usr/obj # unused 5G on /dev/sd0j
+ #swapon /dev/sd0j # fails with ENXIO... what am I missing?
+
+ # XXX As a temporary hack, mount a 4GB file as swap.
+ dd if=/dev/zero of=/usr/obj/big.swap bs=1M count=4096
+ swapon /usr/obj/big.swap
+
+ mount -t mfs -o rw,noatime,nodev,-s=8000000 swap $CIRRUS_WORKING_DIR
+ ;;
+
+ *)
+ echo "I don't know how to create a RAM disk on this computer"
+ exit 1
+esac
+cp -a $CIRRUS_WORKING_DIR.orig/. $CIRRUS_WORKING_DIR/
--
2.48.1
Hi,
On Fri, 28 Feb 2025 at 19:26, Thomas Munro <thomas.munro@gmail.com> wrote:
On Tue, Feb 18, 2025 at 11:33 AM Thomas Munro <thomas.munro@gmail.com> wrote:
Maybe we could try this?
https://man.netbsd.org/mount_tmpfs.8
https://man.openbsd.org/mount_tmpfs.8NetBSD's test_world: 10:30 -> 3:23
OpenBSD test_world: 15:45 - >9:10
Thank you for working on this! These are very nice speedups.
I think NetBSD would finish around 2nd place if turned on by default
like that. The OpenBSD part needs more work though, see attached...
+ #umount /usr/obj # unused 5G on /dev/sd0j
+ #swapon /dev/sd0j # fails with ENXIO... what am I missing?
I think I found the problem, sd0j's fstype is not a swap. It worked like that:
$ disklabel -E sd0
$ umount /usr/obj
$ disklabel -E sd0 # prompts are: m -> j -> \n -> \n -> swap -> w -> q
$ disklabel -E sd0
$ swapon /dev/sd0j # runs successfully
--
Regards,
Nazir Bilal Yavuz
Microsoft
On Sat, Mar 1, 2025 at 6:24 AM Nazir Bilal Yavuz <byavuz81@gmail.com> wrote:
I think I found the problem, sd0j's fstype is not a swap. It worked like that:
$ disklabel -E sd0
$ umount /usr/obj
$ disklabel -E sd0 # prompts are: m -> j -> \n -> \n -> swap -> w -> q
$ disklabel -E sd0
$ swapon /dev/sd0j # runs successfully
Thanks! I just piped those characters in and it worked, shaving
another couple of minutes off. The script is probably now about as
short and sweet as it needs to be? And the times are pretty good.
Attachments:
v2-0001-ci-Use-a-RAM-disk-for-NetBSD-and-OpenBSD.patchtext/x-patch; charset=US-ASCII; name=v2-0001-ci-Use-a-RAM-disk-for-NetBSD-and-OpenBSD.patchDownload
From 68232b16632fcc9469017ec219308c798e0d5391 Mon Sep 17 00:00:00 2001
From: Thomas Munro <thomas.munro@gmail.com>
Date: Fri, 28 Feb 2025 22:19:07 +1300
Subject: [PATCH v2 1/2] ci: Use a RAM disk for NetBSD and OpenBSD.
Put the RAM disk setup for all three *BSD CI tasks into a common script,
replacing the old FreeBSD-specific one from commit 0265e5c1. This makes
them run 3 times and a bit over 2 times faster, respectively.
NetBSD and FreeBSD can use the same one-liner to mount tmpfs, but
OpenBSD needs a GCP-image specific recipe that knows where to steal a
disk partition to reserve swap space to mount mfs, because its tmpfs
is deprecated and currently broken. The configured size is enough for
our current tests but could potentially need future tweaks. Thanks to
Bilal for the disklabel incantation.
Reviewed-by: Nazir Bilal Yavuz <byavuz81@gmail.com>
Discussion: https://postgr.es/m/CA%2BhUKGJJ-XrPhN%2BQA4ZUfYAAXcwOSDty9t0vE9Z8__AdacKnQg%40mail.gmail.com
---
.cirrus.tasks.yml | 5 ++---
src/tools/ci/gcp_freebsd_repartition.sh | 26 -------------------------
src/tools/ci/gcp_ram_disk.sh | 22 +++++++++++++++++++++
3 files changed, 24 insertions(+), 29 deletions(-)
delete mode 100755 src/tools/ci/gcp_freebsd_repartition.sh
create mode 100755 src/tools/ci/gcp_ram_disk.sh
diff --git a/.cirrus.tasks.yml b/.cirrus.tasks.yml
index 91b51142d2e..c5e7b743bfb 100644
--- a/.cirrus.tasks.yml
+++ b/.cirrus.tasks.yml
@@ -155,8 +155,7 @@ task:
ccache_cache:
folder: $CCACHE_DIR
- # Work around performance issues due to 32KB block size
- repartition_script: src/tools/ci/gcp_freebsd_repartition.sh
+ setup_ram_disk_script: src/tools/ci/gcp_ram_disk.sh
create_user_script: |
pw useradd postgres
chown -R postgres:postgres .
@@ -276,7 +275,7 @@ task:
ccache_cache:
folder: $CCACHE_DIR
-
+ setup_ram_disk_script: src/tools/ci/gcp_ram_disk.sh
create_user_script: |
useradd postgres
chown -R postgres:users /home/postgres
diff --git a/src/tools/ci/gcp_freebsd_repartition.sh b/src/tools/ci/gcp_freebsd_repartition.sh
deleted file mode 100755
index 3adb8fb88ec..00000000000
--- a/src/tools/ci/gcp_freebsd_repartition.sh
+++ /dev/null
@@ -1,26 +0,0 @@
-#!/bin/sh
-
-set -e
-set -x
-
-# fix backup partition table after resize
-gpart recover da0
-gpart show da0
-
-# delete and re-add swap partition with expanded size
-swapoff -a
-gpart delete -i 3 da0
-gpart add -t freebsd-swap -l swapfs -a 4096 da0
-gpart show da0
-swapon -a
-
-# create a file system on a memory disk backed by swap, to minimize I/O
-mdconfig -a -t swap -s20g -u md1
-newfs -b 8192 -U /dev/md1
-
-# migrate working directory
-du -hs $CIRRUS_WORKING_DIR
-mv $CIRRUS_WORKING_DIR $CIRRUS_WORKING_DIR.orig
-mkdir $CIRRUS_WORKING_DIR
-mount -o noatime /dev/md1 $CIRRUS_WORKING_DIR
-cp -a $CIRRUS_WORKING_DIR.orig/ $CIRRUS_WORKING_DIR/
diff --git a/src/tools/ci/gcp_ram_disk.sh b/src/tools/ci/gcp_ram_disk.sh
new file mode 100755
index 00000000000..d48634512ac
--- /dev/null
+++ b/src/tools/ci/gcp_ram_disk.sh
@@ -0,0 +1,22 @@
+#!/bin/sh
+# Move working directory into a RAM disk for better performance.
+
+set -e
+set -x
+
+mv $CIRRUS_WORKING_DIR $CIRRUS_WORKING_DIR.orig
+mkdir $CIRRUS_WORKING_DIR
+
+case "`uname`" in
+ FreeBSD|NetBSD)
+ mount -t tmpfs tmpfs $CIRRUS_WORKING_DIR
+ ;;
+ OpenBSD)
+ umount /dev/sd0j # unused /usr/obj partition
+ printf "m j\n\n\nswap\nw\nq\n" | disklabel -E sd0
+ swapon /dev/sd0j
+ mount -t mfs -o rw,noatime,nodev,-s=8000000 swap $CIRRUS_WORKING_DIR
+ ;;
+esac
+
+cp -a $CIRRUS_WORKING_DIR.orig/. $CIRRUS_WORKING_DIR/
--
2.39.5
v2-0002-ci-Enable-NetBSD-and-OpenBSD-by-default.patchtext/x-patch; charset=US-ASCII; name=v2-0002-ci-Enable-NetBSD-and-OpenBSD-by-default.patchDownload
From cf2f8301f30537d7448190f9a2d0889845b4d168 Mon Sep 17 00:00:00 2001
From: Thomas Munro <thomas.munro@gmail.com>
Date: Sun, 2 Mar 2025 01:08:02 +1300
Subject: [PATCH v2 2/2] ci: Enable NetBSD and OpenBSD by default.
XXX Not saying we're quite ready to do this (are we?), but cfbot will
test them for this CF entry
---
.cirrus.tasks.yml | 1 -
1 file changed, 1 deletion(-)
diff --git a/.cirrus.tasks.yml b/.cirrus.tasks.yml
index c5e7b743bfb..2004610989d 100644
--- a/.cirrus.tasks.yml
+++ b/.cirrus.tasks.yml
@@ -218,7 +218,6 @@ task:
task:
depends_on: SanityCheck
- trigger_type: manual
env:
# Below are experimentally derived to be a decent choice.
--
2.39.5
On Sun, Mar 2, 2025 at 1:37 AM Thomas Munro <thomas.munro@gmail.com> wrote:
On Sat, Mar 1, 2025 at 6:24 AM Nazir Bilal Yavuz <byavuz81@gmail.com> wrote:
I think I found the problem, sd0j's fstype is not a swap. It worked like that:
$ disklabel -E sd0
$ umount /usr/obj
$ disklabel -E sd0 # prompts are: m -> j -> \n -> \n -> swap -> w -> q
$ disklabel -E sd0
$ swapon /dev/sd0j # runs successfullyThanks! I just piped those characters in and it worked, shaving
another couple of minutes off. The script is probably now about as
short and sweet as it needs to be? And the times are pretty good.
And pushed.
I propose to turn these on by default tomorrow, unless someone speaks
up with reasons why we shouldn't. One non-reason to hold off is a
one-off report[1]/messages/by-id/CAOYmi+kr-Eh7utEDZBFq8Mc9byLLRF3ZNc0TaHt78SKwB4T5KA@mail.gmail.com from Jacob about an unexplained failure of the oauth
tests on NetBSD, but I'd prefer to see it flap if it's going to so we
can collect clues and tackle it. Oauth test coverage is coming on in
the build farm slowly anyway, no reason to hide it from our first line
of defence...
[1]: /messages/by-id/CAOYmi+kr-Eh7utEDZBFq8Mc9byLLRF3ZNc0TaHt78SKwB4T5KA@mail.gmail.com
On Mon, Mar 3, 2025 at 2:36 PM Thomas Munro <thomas.munro@gmail.com> wrote:
One non-reason to hold off is a
one-off report[1] from Jacob about an unexplained failure of the oauth
tests on NetBSD, but I'd prefer to see it flap if it's going to so we
can collect clues and tackle it.
Agreed.
--Jacob
Hi,
On 2025-03-04 11:35:30 +1300, Thomas Munro wrote:
On Sun, Mar 2, 2025 at 1:37 AM Thomas Munro <thomas.munro@gmail.com> wrote:
On Sat, Mar 1, 2025 at 6:24 AM Nazir Bilal Yavuz <byavuz81@gmail.com> wrote:
I think I found the problem, sd0j's fstype is not a swap. It worked like that:
$ disklabel -E sd0
$ umount /usr/obj
$ disklabel -E sd0 # prompts are: m -> j -> \n -> \n -> swap -> w -> q
$ disklabel -E sd0
$ swapon /dev/sd0j # runs successfullyThanks! I just piped those characters in and it worked, shaving
another couple of minutes off. The script is probably now about as
short and sweet as it needs to be? And the times are pretty good.And pushed.
I propose to turn these on by default tomorrow, unless someone speaks
up with reasons why we shouldn't. One non-reason to hold off is a
one-off report[1] from Jacob about an unexplained failure of the oauth
tests on NetBSD, but I'd prefer to see it flap if it's going to so we
can collect clues and tackle it. Oauth test coverage is coming on in
the build farm slowly anyway, no reason to hide it from our first line
of defence...
I'm worried about enabling them by default eating up CI credits even
faster. Not for cfbot, where we bring our own compute resources, but for folks
own repos.
I quite evidently lost track of that patch, but I think we should instead pick
/messages/by-id/20240413021221.hg53rvqlvldqh57i@awork3.anarazel.de back
up, with that we could enable these tasks by default for cfbot, without
enabling them for everyone.
Greetings,
Andres Freund
On Tue, Mar 4, 2025 at 11:39 AM Andres Freund <andres@anarazel.de> wrote:
On 2025-03-04 11:35:30 +1300, Thomas Munro wrote:
I propose to turn these on by default tomorrow, unless someone speaks
up with reasons why we shouldn't.
I'm worried about enabling them by default eating up CI credits even
faster. Not for cfbot, where we bring our own compute resources, but for folks
own repos.
It would be nice to know what the expected cost in Cirrus credits is
for each task, and the per-month limit for personal repos. mingw must
be *vastly* more expensive than these little guys (licence cost +
run time).
I quite evidently lost track of that patch, but I think we should instead pick
/messages/by-id/20240413021221.hg53rvqlvldqh57i@awork3.anarazel.de back
up, with that we could enable these tasks by default for cfbot, without
enabling them for everyone.
WFM in the meantime until we can turbo-boost the TAP tests. I will respond
over there...
Hi,
On 2025-02-12 09:49:35 -0500, Andres Freund wrote:
I finally pushed this.
One thing I noticed is that occasionally the tests fail on openbsd after
exceeding the system wide number of files, not in postgres, but causing meson
test to fail. I could either put an increase of kern.maxfiles in the openbsd
image generation, or in the CI task, any opinions?
The soft nofiles limit is also rather ridiculously low, at 128. I'd not be
surprised if that hurts test performance slightly. OTOH, I guess it's good to
have some CI coverage of a low setting.
Greetings,
Andres Freund
Hi,
meson version is upgraded 1.7.0 in NetBSD and that causes ecpg tests
to fail with [1]https://cirrus-ci.com/task/5126123371102208?logs=test_world#L144:
'Could not open file
/home/postgres/postgres/build/src/interfaces/ecpg/test/compat_informix/dec_test.c
for reading'
This is already fixed on b2bdb972c0, attached patch just adds
$MBUILD_TARGET to the NetBSD and OpenBSD CI tasks.
[1]: https://cirrus-ci.com/task/5126123371102208?logs=test_world#L144
--
Regards,
Nazir Bilal Yavuz
Microsoft
Attachments:
ci-Add-MBUILD_TARGET-to-OpenBSD-NetBSD-meson-builds.patchtext/x-patch; charset=US-ASCII; name=ci-Add-MBUILD_TARGET-to-OpenBSD-NetBSD-meson-builds.patchDownload
From 0a265615e7bd9d6da2cbf1d7edfbe68a8bdf39f1 Mon Sep 17 00:00:00 2001
From: Nazir Bilal Yavuz <byavuz81@gmail.com>
Date: Tue, 8 Apr 2025 14:21:42 +0300
Subject: [PATCH] ci: Add MBUILD_TARGET to OpenBSD/NetBSD meson builds
Otherwise, these tasks don't build test dependencies.
---
.cirrus.tasks.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.cirrus.tasks.yml b/.cirrus.tasks.yml
index 6f4f5c674a1..98f3455eb72 100644
--- a/.cirrus.tasks.yml
+++ b/.cirrus.tasks.yml
@@ -322,7 +322,7 @@ task:
build
EOF
- build_script: su postgres -c 'ninja -C build -j${BUILD_JOBS}'
+ build_script: su postgres -c 'ninja -C build -j${BUILD_JOBS} ${MBUILD_TARGET}'
upload_caches: ccache
test_world_script: |
--
2.49.0
On 8 Apr 2025, at 13:40, Nazir Bilal Yavuz <byavuz81@gmail.com> wrote:
This is already fixed on b2bdb972c0, attached patch just adds
$MBUILD_TARGET to the NetBSD and OpenBSD CI tasks.
After review and testing, I applied this to master.
--
Daniel Gustafsson
Hi,
The openbsd/netbsd CI tasks are occasionally failing due to reaching the
process limit. See e.g.
https://cirrus-ci.com/task/5559228405907456
+psql: error: connection to server on socket "/tmp/pg_regress-nQ1wk1/.s.PGSQL.40056" failed: could not fork new process for connection: Resource temporarily unavailable
This is due to the ulimit -p 256 in .cirrus.tasks.yml not being high enough.
The ulimit on openbsd couldn't trivially be increased with ulimit, because of
hitting the hard limit. Instead of increasing the limit in the CI script, the
CI image generation now increases the limits:
https://github.com/anarazel/pg-vm-images/pull/129
I plan to push this patch soon.
Greetings,
Andres Freund
Attachments:
v1-0001-ci-Remove-ulimit-p-for-netbsd-openbsd.patchtext/x-diff; charset=us-asciiDownload
From ae6334f514403b60a23d31ab5adfa3ccd29c1a83 Mon Sep 17 00:00:00 2001
From: Andres Freund <andres@anarazel.de>
Date: Mon, 5 Jan 2026 13:09:03 -0500
Subject: [PATCH v1] ci: Remove ulimit -p for netbsd/openbsd
Previously the ulimit -p 256 was needed to increase the limit on
openbsd. However, sometimes the limit actually was too low, causing
"could not fork new process for connection: Resource temporarily unavailable"
errors. Most commonly on netbsd, but also on openbsd.
The ulimit on openbsd couldn't trivially be increased with ulimit, because of
hitting the hard limit.
Instead of increasing the limit in the CI script, the CI image generation now
increases the limits: https://github.com/anarazel/pg-vm-images/pull/129
Backpatch-through: 18
---
.cirrus.tasks.yml | 3 ---
1 file changed, 3 deletions(-)
diff --git a/.cirrus.tasks.yml b/.cirrus.tasks.yml
index 038d043d00e..745bd198b42 100644
--- a/.cirrus.tasks.yml
+++ b/.cirrus.tasks.yml
@@ -384,9 +384,6 @@ task:
su postgres <<-EOF
set -e
ulimit -c unlimited
- # Otherwise tests will fail on OpenBSD, due to inability to start enough
- # processes.
- ulimit -p 256
meson test $MTEST_ARGS --num-processes ${TEST_JOBS}
EOF
--
2.48.1.76.g4e746b1a31.dirty
On 2026-01-05 13:36:50 -0500, Andres Freund wrote:
The openbsd/netbsd CI tasks are occasionally failing due to reaching the
process limit. See e.g.
https://cirrus-ci.com/task/5559228405907456
+psql: error: connection to server on socket "/tmp/pg_regress-nQ1wk1/.s.PGSQL.40056" failed: could not fork new process for connection: Resource temporarily unavailableThis is due to the ulimit -p 256 in .cirrus.tasks.yml not being high enough.
The ulimit on openbsd couldn't trivially be increased with ulimit, because of
hitting the hard limit. Instead of increasing the limit in the CI script, the
CI image generation now increases the limits:
https://github.com/anarazel/pg-vm-images/pull/129I plan to push this patch soon.
And done.