summaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorMichael Paquier2023-07-06 05:42:36 +0000
committerMichael Paquier2023-07-06 05:42:36 +0000
commita14354cac0e32d5e169c1ea4225845f93922d483 (patch)
treee1ec55c639ec785b173fb24f2f457b3f2663a119 /src/test
parentcf05113eb0da0b65fdeaf79db0c6c27b82d3c869 (diff)
Add GUC parameter "huge_pages_status"
This is useful to show the allocation state of huge pages when setting up a server with "huge_pages = try", where allocating huge pages would be attempted but the server would continue its startup sequence even if the allocation fails. The effective status of huge pages is not easily visible without OS-level tools (or for instance, a lookup at /proc/N/smaps), and the environments where Postgres runs may not authorize that. Like the other GUCs related to huge pages, this works for Linux and Windows. This GUC can report as values: - "on", if huge pages were allocated. - "off", if huge pages were not allocated. - "unknown", a special state that could only be seen when using for example postgres -C because it is only possible to know if the shared memory allocation worked after we can check for the GUC values, even if checking a runtime-computed GUC. This value should never be seen when querying for the GUC on a running server. An assertion is added to check that. The discussion has also turned around having a new function to grab this status, but this would have required more tricks for -DEXEC_BACKEND, something that GUCs already handle. Noriyoshi Shinoda has initiated the thread that has led to the result of this commit. Author: Justin Pryzby Reviewed-by: Nathan Bossart, Kyotaro Horiguchi, Michael Paquier Discussion: https://postgr.es/m/TU4PR8401MB1152EBB0D271F827E2E37A01EECC9@TU4PR8401MB1152.NAMPRD84.PROD.OUTLOOK.COM
Diffstat (limited to 'src/test')
-rw-r--r--src/test/authentication/t/003_peer.pl6
-rw-r--r--src/test/authentication/t/005_sspi.pl4
2 files changed, 10 insertions, 0 deletions
diff --git a/src/test/authentication/t/003_peer.pl b/src/test/authentication/t/003_peer.pl
index d8e49760726..eacff2b52aa 100644
--- a/src/test/authentication/t/003_peer.pl
+++ b/src/test/authentication/t/003_peer.pl
@@ -100,6 +100,12 @@ my $system_user =
$node->safe_psql('postgres',
q(select (string_to_array(SYSTEM_USER, ':'))[2]));
+# While on it, check the status of huge pages, that can be either on
+# or off, but never unknown.
+my $huge_pages_status =
+ $node->safe_psql('postgres', q(SHOW huge_pages_status;));
+isnt($huge_pages_status, 'unknown', "check huge_pages_status");
+
# Tests without the user name map.
# Failure as connection is attempted with a database role not mapping
# to an authorized system user.
diff --git a/src/test/authentication/t/005_sspi.pl b/src/test/authentication/t/005_sspi.pl
index 05d81f34229..37fd5bc2437 100644
--- a/src/test/authentication/t/005_sspi.pl
+++ b/src/test/authentication/t/005_sspi.pl
@@ -21,6 +21,10 @@ $node->init;
$node->append_conf('postgresql.conf', "log_connections = on\n");
$node->start;
+my $huge_pages_status =
+ $node->safe_psql('postgres', q(SHOW huge_pages_status;));
+isnt($huge_pages_status, 'unknown', "check huge_pages_status");
+
# SSPI is set up by default. Make sure it interacts correctly with
# require_auth.
$node->connect_ok("require_auth=sspi",