Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1v9MJn-00Gd4J-Gn for pgsql-hackers@arkaria.postgresql.org; Thu, 16 Oct 2025 11:38:50 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1v9MJl-00CHu6-B7 for pgsql-hackers@arkaria.postgresql.org; Thu, 16 Oct 2025 11:38:48 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1v9MJl-00CHtx-1K for pgsql-hackers@lists.postgresql.org; Thu, 16 Oct 2025 11:38:48 +0000 Received: from mout-p-202.mailbox.org ([80.241.56.172]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1v9MJh-002W3s-1Q for pgsql-hackers@lists.postgresql.org; Thu, 16 Oct 2025 11:38:47 +0000 Received: from smtp102.mailbox.org (smtp102.mailbox.org [IPv6:2001:67c:2050:b231:465::102]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-202.mailbox.org (Postfix) with ESMTPS id 4cnQvK0JVfz9tVm; Thu, 16 Oct 2025 13:38:37 +0200 (CEST) Authentication-Results: outgoing_mbo_mout; dkim=none; spf=pass (outgoing_mbo_mout: domain of cb@df7cb.de designates 2001:67c:2050:b231:465::102 as permitted sender) smtp.mailfrom=cb@df7cb.de Date: Thu, 16 Oct 2025 13:38:35 +0200 From: Christoph Berg To: Tomas Vondra , Jakub Wartak Cc: pgsql-hackers@lists.postgresql.org Subject: failed NUMA pages inquiry status: Operation not permitted Message-ID: References: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="dtTMMoFAaZ2xgutH" Content-Disposition: inline In-Reply-To: X-Rspamd-Queue-Id: 4cnQvK0JVfz9tVm List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --dtTMMoFAaZ2xgutH Content-Type: text/plain; charset=us-ascii Content-Disposition: inline > src/test/regress/expected/numa.out | 13 +++ > src/test/regress/expected/numa_1.out | 5 + numa_1.out is catching this error: ERROR: libnuma initialization failed or NUMA is not supported on this platform This is what I'm getting when running PG18 in docker on Debian trixie (libnuma 2.0.19). However, on older distributions, the error is different: postgres =# select * from pg_shmem_allocations_numa; ERROR: XX000: failed NUMA pages inquiry status: Operation not permitted LOCATION: pg_get_shmem_allocations_numa, shmem.c:691 This makes the numa regression tests fail in Docker on Debian bookworm (libnuma 2.0.16) and older and all of the Ubuntu LTS releases. The attached patch makes it accept these errors, but perhaps it would be better to detect it in pg_numa_available(). Christoph --dtTMMoFAaZ2xgutH Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="0001-numa-Catch-Operation-not-permitted-error.patch" From bfa516b8c68203df8dccab168a729dc9823045dd Mon Sep 17 00:00:00 2001 From: Christoph Berg Date: Thu, 16 Oct 2025 13:24:56 +0200 Subject: [PATCH] numa: Catch "Operation not permitted" error On older (before 2.0.19) libnuma versions, the error thrown when the NUMA status cannot be inquired is different. --- .../expected/pg_buffercache_numa_2.out | 21 +++++++++++++++++++ src/test/regress/expected/numa_2.out | 9 ++++++++ 2 files changed, 30 insertions(+) create mode 100644 contrib/pg_buffercache/expected/pg_buffercache_numa_2.out create mode 100644 src/test/regress/expected/numa_2.out diff --git a/contrib/pg_buffercache/expected/pg_buffercache_numa_2.out b/contrib/pg_buffercache/expected/pg_buffercache_numa_2.out new file mode 100644 index 00000000000..b970dd2eaf9 --- /dev/null +++ b/contrib/pg_buffercache/expected/pg_buffercache_numa_2.out @@ -0,0 +1,21 @@ +SELECT NOT(pg_numa_available()) AS skip_test \gset +\if :skip_test +\quit +\endif +-- We expect at least one entry for each buffer +select count(*) >= (select setting::bigint + from pg_settings + where name = 'shared_buffers') +from pg_buffercache_numa; +ERROR: failed NUMA pages inquiry: Operation not permitted +-- Check that the functions / views can't be accessed by default. To avoid +-- having to create a dedicated user, use the pg_database_owner pseudo-role. +SET ROLE pg_database_owner; +SELECT count(*) > 0 FROM pg_buffercache_numa; +ERROR: permission denied for view pg_buffercache_numa +RESET role; +-- Check that pg_monitor is allowed to query view / function +SET ROLE pg_monitor; +SELECT count(*) > 0 FROM pg_buffercache_numa; +ERROR: failed NUMA pages inquiry: Operation not permitted +RESET role; diff --git a/src/test/regress/expected/numa_2.out b/src/test/regress/expected/numa_2.out new file mode 100644 index 00000000000..b4c19f01f59 --- /dev/null +++ b/src/test/regress/expected/numa_2.out @@ -0,0 +1,9 @@ +SELECT NOT(pg_numa_available()) AS skip_test \gset +\if :skip_test +SELECT COUNT(*) = 0 AS ok FROM pg_shmem_allocations_numa; +\quit +\endif +-- switch to superuser +\c - +SELECT COUNT(*) >= 0 AS ok FROM pg_shmem_allocations_numa; +ERROR: failed NUMA pages inquiry status: Operation not permitted -- 2.51.0 --dtTMMoFAaZ2xgutH--