public inbox for [email protected]
help / color / mirror / Atom feedFrom: Christoph Berg <[email protected]>
Subject: [PATCH] numa: Catch "Operation not permitted" error
Date: Thu, 16 Oct 2025 13:24:56 +0200
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--
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected]
Subject: Re: [PATCH] numa: Catch "Operation not permitted" error
In-Reply-To: <no-message-id-433@localhost>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox