Skip to content

Commit b3fe098

Browse files
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
1 parent 0f4f457 commit b3fe098

File tree

3 files changed

+31
-0
lines changed

3 files changed

+31
-0
lines changed

doc/src/sgml/config.sgml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11833,6 +11833,23 @@ dynamic_library_path = '/usr/local/lib/postgresql:$libdir'
1183311833
</listitem>
1183411834
</varlistentry>
1183511835

11836+
<varlistentry id="guc-debug-exec-backend" xreflabel="debug_exec_backend">
11837+
<term><varname>debug_exec_backend</varname> (<type>boolean</type>)
11838+
<indexterm>
11839+
<primary><varname>debug_exec_backend</varname> configuration parameter</primary>
11840+
</indexterm>
11841+
</term>
11842+
<listitem>
11843+
<para>
11844+
Reports whether <productname>PostgreSQL</productname> has been built
11845+
with <literal>EXEC_BACKEND</literal> enabled. That is the case on
11846+
<systemitem class="osname">Windows</systemitem> or if the
11847+
macro <symbol>EXEC_BACKEND</symbol> is defined
11848+
when <productname>PostgreSQL</productname> is built.
11849+
</para>
11850+
</listitem>
11851+
</varlistentry>
11852+
1183611853
<varlistentry id="guc-huge-pages-status" xreflabel="huge_pages_status">
1183711854
<term><varname>huge_pages_status</varname> (<type>enum</type>)
1183811855
<indexterm>

src/backend/utils/misc/guc_parameters.dat

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -617,6 +617,13 @@
617617
max => 'MAX_DEBUG_DISCARD_CACHES',
618618
},
619619

620+
{ name => 'debug_exec_backend', type => 'bool', context => 'PGC_INTERNAL', group => 'PRESET_OPTIONS',
621+
short_desc => 'Shows whether the running server is built with EXEC_BACKEND enabled.',
622+
flags => 'GUC_NOT_IN_SAMPLE | GUC_DISALLOW_IN_FILE',
623+
variable => 'exec_backend_enabled',
624+
boot_val => 'EXEC_BACKEND_ENABLED',
625+
},
626+
620627
{ name => 'debug_io_direct', type => 'string', context => 'PGC_POSTMASTER', group => 'DEVELOPER_OPTIONS',
621628
short_desc => 'Use direct I/O for file access.',
622629
long_desc => 'An empty string disables direct I/O.',

src/backend/utils/misc/guc_tables.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -627,6 +627,13 @@ static bool integer_datetimes;
627627
#endif
628628
static bool assert_enabled = DEFAULT_ASSERT_ENABLED;
629629

630+
#ifdef EXEC_BACKEND
631+
#define EXEC_BACKEND_ENABLED true
632+
#else
633+
#define EXEC_BACKEND_ENABLED false
634+
#endif
635+
static bool exec_backend_enabled = EXEC_BACKEND_ENABLED;
636+
630637
static char *recovery_target_timeline_string;
631638
static char *recovery_target_string;
632639
static char *recovery_target_xid_string;

0 commit comments

Comments
 (0)