From 652c117efa13d395225e73555fa761544829cf60 Mon Sep 17 00:00:00 2001 From: Daniel Gustafsson Date: Fri, 21 Nov 2025 13:47:00 +0100 Subject: [PATCH v2 1/3] Add GUC to show EXEC_BACKEND state There is no straightforward way to determine if a cluster is running in EXEC_BACKEND mode or not, which is useful for tests to know. This adds a GUC debug_exec_backend similar to debug_assertions which will be true when the server is running in EXEC_BACKEND mode. Author: Daniel Gustafsson Reviewed-by: ... Discussion: https://postgr.es/m/.. --- doc/src/sgml/config.sgml | 17 +++++++++++++++++ src/backend/utils/misc/guc_parameters.dat | 7 +++++++ src/backend/utils/misc/guc_tables.c | 7 +++++++ 3 files changed, 31 insertions(+) diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml index 023b3f03ba9..b8d6f43d5ff 100644 --- a/doc/src/sgml/config.sgml +++ b/doc/src/sgml/config.sgml @@ -11827,6 +11827,23 @@ dynamic_library_path = '/usr/local/lib/postgresql:$libdir' + + debug_exec_backend (boolean) + + debug_exec_backend configuration parameter + + + + + Reports whether PostgreSQL has been built + with EXEC_BACKEND enabled. That is the case on + Windows or if the + macro EXEC_BACKEND is defined + when PostgreSQL is built. + + + + huge_pages_status (enum) diff --git a/src/backend/utils/misc/guc_parameters.dat b/src/backend/utils/misc/guc_parameters.dat index 1128167c025..e6bb0ec8478 100644 --- a/src/backend/utils/misc/guc_parameters.dat +++ b/src/backend/utils/misc/guc_parameters.dat @@ -617,6 +617,13 @@ max => 'MAX_DEBUG_DISCARD_CACHES', }, +{ name => 'debug_exec_backend', type => 'bool', context => 'PGC_INTERNAL', group => 'PRESET_OPTIONS', + short_desc => 'Shows whether the running server is running in EXEC_BACKEND mode.', + flags => 'GUC_NOT_IN_SAMPLE | GUC_DISALLOW_IN_FILE', + variable => 'exec_backend_enabled', + boot_val => 'DEFAULT_EXEC_BACKEND_ENABLED', +}, + { name => 'debug_io_direct', type => 'string', context => 'PGC_POSTMASTER', group => 'DEVELOPER_OPTIONS', short_desc => 'Use direct I/O for file access.', long_desc => 'An empty string disables direct I/O.', diff --git a/src/backend/utils/misc/guc_tables.c b/src/backend/utils/misc/guc_tables.c index 0209b2067a2..b0b10890b55 100644 --- a/src/backend/utils/misc/guc_tables.c +++ b/src/backend/utils/misc/guc_tables.c @@ -627,6 +627,13 @@ static bool integer_datetimes; #endif static bool assert_enabled = DEFAULT_ASSERT_ENABLED; +#ifdef EXEC_BACKEND +#define DEFAULT_EXEC_BACKEND_ENABLED true +#else +#define DEFAULT_EXEC_BACKEND_ENABLED false +#endif +static bool exec_backend_enabled = DEFAULT_EXEC_BACKEND_ENABLED; + static char *recovery_target_timeline_string; static char *recovery_target_string; static char *recovery_target_xid_string; -- 2.39.3 (Apple Git-146)