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
</listitem>
</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">
<term><varname>huge_pages_status</varname> (<type>enum</type>)
<indexterm>
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',
short_desc => 'Use direct I/O for file access.',
long_desc => 'An empty string disables direct I/O.',
#endif
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_string;
static char *recovery_target_xid_string;