1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-28 11:44:57 +03:00

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 <daniel@yesql.se>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Álvaro Herrera <alvherre@kurilemu.de>
Reviewed-by: Peter Eisentraut <peter@eisentraut.org>
Discussion: https://postgr.es/m/5F301096-921A-427D-8EC1-EBAEC2A35082@yesql.se
This commit is contained in:
Daniel Gustafsson
2025-11-26 14:24:27 +01:00
parent 0f4f45772c
commit b3fe098d33
3 changed files with 31 additions and 0 deletions

View File

@@ -11833,6 +11833,23 @@ dynamic_library_path = '/usr/local/lib/postgresql:$libdir'
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry id="guc-debug-exec-backend" xreflabel="debug_exec_backend">
<term><varname>debug_exec_backend</varname> (<type>boolean</type>)
<indexterm>
<primary><varname>debug_exec_backend</varname> configuration parameter</primary>
</indexterm>
</term>
<listitem>
<para>
Reports whether <productname>PostgreSQL</productname> has been built
with <literal>EXEC_BACKEND</literal> enabled. That is the case on
<systemitem class="osname">Windows</systemitem> or if the
macro <symbol>EXEC_BACKEND</symbol> is defined
when <productname>PostgreSQL</productname> is built.
</para>
</listitem>
</varlistentry>
<varlistentry id="guc-huge-pages-status" xreflabel="huge_pages_status"> <varlistentry id="guc-huge-pages-status" xreflabel="huge_pages_status">
<term><varname>huge_pages_status</varname> (<type>enum</type>) <term><varname>huge_pages_status</varname> (<type>enum</type>)
<indexterm> <indexterm>

View File

@@ -617,6 +617,13 @@
max => 'MAX_DEBUG_DISCARD_CACHES', 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 built with EXEC_BACKEND enabled.',
flags => 'GUC_NOT_IN_SAMPLE | GUC_DISALLOW_IN_FILE',
variable => 'exec_backend_enabled',
boot_val => 'EXEC_BACKEND_ENABLED',
},
{ name => 'debug_io_direct', type => 'string', context => 'PGC_POSTMASTER', group => 'DEVELOPER_OPTIONS', { name => 'debug_io_direct', type => 'string', context => 'PGC_POSTMASTER', group => 'DEVELOPER_OPTIONS',
short_desc => 'Use direct I/O for file access.', short_desc => 'Use direct I/O for file access.',
long_desc => 'An empty string disables direct I/O.', long_desc => 'An empty string disables direct I/O.',

View File

@@ -627,6 +627,13 @@ static bool integer_datetimes;
#endif #endif
static bool assert_enabled = DEFAULT_ASSERT_ENABLED; static bool assert_enabled = DEFAULT_ASSERT_ENABLED;
#ifdef EXEC_BACKEND
#define EXEC_BACKEND_ENABLED true
#else
#define EXEC_BACKEND_ENABLED false
#endif
static bool exec_backend_enabled = EXEC_BACKEND_ENABLED;
static char *recovery_target_timeline_string; static char *recovery_target_timeline_string;
static char *recovery_target_string; static char *recovery_target_string;
static char *recovery_target_xid_string; static char *recovery_target_xid_string;